From eca37e1a28c2bc92a76dbaf947f8fb229dccc42e Mon Sep 17 00:00:00 2001
From: danielvincent <danielgrippi@gmail.com>
Date: Sun, 17 Oct 2010 21:55:03 -0700
Subject: [PATCH] small view cleanups

---
 app/views/albums/edit.html.haml           | 21 ++++++----------
 app/views/albums/index.html.haml          |  2 +-
 app/views/aspects/_new_aspect.haml        | 10 ++++----
 app/views/aspects/manage.html.haml        |  4 +--
 app/views/aspects/public.html.haml        | 22 -----------------
 app/views/comments/_new_comment.html.haml | 12 +++++----
 app/views/invitations/_new.haml           | 20 ++++++++-------
 app/views/people/new.html.haml            | 30 -----------------------
 app/views/people/show.html.haml           |  1 -
 app/views/photos/edit.html.haml           | 14 ++++-------
 app/views/photos/show.html.haml           |  6 ++---
 app/views/requests/_new_request.haml      | 12 ++++-----
 app/views/shared/_aspect_friends.haml     |  4 +--
 app/views/shared/_publisher.haml          | 16 ++++++------
 app/views/shared/_sub_header.haml         |  2 --
 public/stylesheets/sass/application.sass  |  3 +++
 16 files changed, 59 insertions(+), 120 deletions(-)
 delete mode 100644 app/views/aspects/public.html.haml
 delete mode 100644 app/views/people/new.html.haml

diff --git a/app/views/albums/edit.html.haml b/app/views/albums/edit.html.haml
index 4969227e4f..e979b1a77a 100644
--- a/app/views/albums/edit.html.haml
+++ b/app/views/albums/edit.html.haml
@@ -2,19 +2,15 @@
 -#   licensed under the Affero General Public License version 3 or later.  See
 -#   the COPYRIGHT file.
 
-.back= link_to "⇧ #{@album.name}", @album
-%h1.big_text
 
-  = "#{t('.editing')} #{@album.name}"
+%h2= "#{t('.editing')} #{@album.name}"
 
-.sub_header
-  ="#{t('.updated')} #{how_long_ago(@album)}"
+- form_for @album do |album|
+  = album.error_messages
 
-- form_for @album do |a|
-  = a.error_messages
-  %p
-    %b album name:
-    = a.text_field :name
+  %h4
+    Album name
+    = album.text_field :name
 
   - for photo in @album.photos
     .photo_edit_block= image_tag photo.url(:thumb_medium)
@@ -22,11 +18,8 @@
   .submit_block
     = link_to t('.cancel'), root_path
     or
-    = a.submit
+    = album.submit
 
 .button.delete
   = link_to t('.delete_album'), @album, :confirm => t('.are_you_sure'), :method => :delete
 
-#content_bottom
-  .back
-    = link_to "⇧ #{@album.name}", @album
diff --git a/app/views/albums/index.html.haml b/app/views/albums/index.html.haml
index 4b76d38e13..cd4f93ab32 100644
--- a/app/views/albums/index.html.haml
+++ b/app/views/albums/index.html.haml
@@ -17,7 +17,7 @@
   .right
     = link_to t('.new_album'), '#new_album_pane', {:class => "button", :id => "add_album_button"}
 
-.yo{:style => "display:none;" }
+.fancybox_content
   #new_album_pane
     = render "albums/new_album", :aspect => params[:aspect]
 
diff --git a/app/views/aspects/_new_aspect.haml b/app/views/aspects/_new_aspect.haml
index 8c3c45f4d1..151ab07d4f 100644
--- a/app/views/aspects/_new_aspect.haml
+++ b/app/views/aspects/_new_aspect.haml
@@ -3,9 +3,9 @@
 -#   the COPYRIGHT file.
 
 %h1=t('.add_a_new_aspect')
-= form_for Aspect.new do |f|
-  = f.error_messages
+= form_for Aspect.new do |aspect|
+  = aspect.error_messages
   %p
-    = f.label :name
-    = f.text_field :name
-    = f.submit t('.create'), :class => 'button'
+    = aspect.label :name
+    = aspect.text_field :name
+    = aspect.submit t('.create'), :class => 'button'
diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml
index 58222fa410..73b2bac29c 100644
--- a/app/views/aspects/manage.html.haml
+++ b/app/views/aspects/manage.html.haml
@@ -42,7 +42,6 @@
 
         %ul.tools
           %li= link_to t('.add_a_new_friend'), "#add_request_pane_#{aspect.id}", :class => 'add_request_button'
-          /%li= link_to t('.show'), aspect_path(aspect)
           %li!= remove_link(aspect)
 
       %ul.dropzone{:id => aspect.id}
@@ -57,7 +56,8 @@
               = person_image_tag(person)
               .name
                 = link_to person.real_name, person
-        .yo{:style => 'display:none'}
+
+        .fancybox_content
           %div{:id => "add_request_pane_#{aspect.id}"}
             = render "requests/new_request", :aspect => aspect
 
diff --git a/app/views/aspects/public.html.haml b/app/views/aspects/public.html.haml
deleted file mode 100644
index 95c185761b..0000000000
--- a/app/views/aspects/public.html.haml
+++ /dev/null
@@ -1,22 +0,0 @@
--#   Copyright (c) 2010, Diaspora Inc.  This file is
--#   licensed under the Affero General Public License version 3 or later.  See
--#   the COPYRIGHT file.
-
-
-- content_for :page_title do
-  = link_to "photos", albums_path(:aspect => @aspect)
-
-- content_for :left_pane do
-  = render "shared/aspect_friends"
-
-- content_for :publish do
-  - if
-    = render "shared/publisher", :aspect_ids => :all
-
-%ul#stream
-  - for post in @posts
-    = render type_partial(post), :post => post unless post.class == Album
-
-#pagination
-  = will_paginate @posts
-
diff --git a/app/views/comments/_new_comment.html.haml b/app/views/comments/_new_comment.html.haml
index 2c95d4385d..bb8719ee7c 100644
--- a/app/views/comments/_new_comment.html.haml
+++ b/app/views/comments/_new_comment.html.haml
@@ -2,10 +2,12 @@
 -#   licensed under the Affero General Public License version 3 or later.  See
 -#   the COPYRIGHT file.
 
-= form_for Comment.new, :remote => true do |f|
+= form_for Comment.new, :remote => true do |comment|
   %p
-    %label{:for => "comment_text_on_#{post.id}"} Comment
-    = f.text_area :text, :rows => 1, :id => "comment_text_on_#{post.id}", :class => "comment_box"
-  = f.hidden_field :post_id, :value => post.id
+    = label_tag "comment_text_on_#{post.id}", "Comment"
+    = comment.text_area :text, :rows => 1, :id => "comment_text_on_#{post.id}", :class => "comment_box"
+
+  = comment.hidden_field :post_id, :value => post.id
+
   %p{:style => "text-align:right;"}
-    = f.submit t('.comment'), :class => "comment_submit button"
+    = comment.submit t('.comment'), :class => "comment_submit button"
diff --git a/app/views/invitations/_new.haml b/app/views/invitations/_new.haml
index 36b0dacaca..9cd41f05f4 100644
--- a/app/views/invitations/_new.haml
+++ b/app/views/invitations/_new.haml
@@ -1,11 +1,13 @@
 %h2 Send invitation
-= form_for User.new, :url => invitation_path(User) do |f|
+= form_for User.new, :url => invitation_path(User) do |invite|
   %p
-    = f.label :email
-    = f.text_field :email
-    To
-    - if @aspect == :all
-      = f.select(:aspects, @aspects_dropdown_array)
-    - else 
-      = f.select(:aspects, @aspects_dropdown_array, :selected => [@aspect.to_s, @aspect_id])
-  %p= f.submit "Send an invitation"
+    = invite.label :email
+    = invite.text_field :email
+  To
+  - if @aspect == :all
+    = invite.select(:aspects, @aspects_dropdown_array)
+  - else 
+    = invite.select(:aspects, @aspects_dropdown_array, :selected => @aspect.id)
+
+  %p= invite.submit "Send an invitation"
+
diff --git a/app/views/people/new.html.haml b/app/views/people/new.html.haml
deleted file mode 100644
index 7685a8933c..0000000000
--- a/app/views/people/new.html.haml
+++ /dev/null
@@ -1,30 +0,0 @@
--#   Copyright (c) 2010, Diaspora Inc.  This file is
--#   licensed under the Affero General Public License version 3 or later.  See
--#   the COPYRIGHT file.
-
-- title=t('.new_person')
-
-= form_for @person do |f|
-  = f.error_messages
-  %p
-    = f.label :diaspora_handle
-    %br
-    = f.text_field :diaspora_handle
-  %p
-    = f.label :url
-    %br
-    = f.text_field :url
-
-    =f.fields_for :profile do |p|
-      %p
-        = p.label :first_name
-        %br
-        = p.text_field :first_name
-
-      %p
-        = p.label :last_name
-        %br
-        = p.text_field :last_name
-    = f.submit
-
-%p= link_to t('.back_to_list'), people_path
diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml
index 3e1fc31e63..1038d7d94f 100644
--- a/app/views/people/show.html.haml
+++ b/app/views/people/show.html.haml
@@ -27,7 +27,6 @@
       = link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button"
 
 .span-20.last
-
   .span-19.last
     - if @posts
       %ul#stream
diff --git a/app/views/photos/edit.html.haml b/app/views/photos/edit.html.haml
index 78186d2481..08e6dae0ad 100644
--- a/app/views/photos/edit.html.haml
+++ b/app/views/photos/edit.html.haml
@@ -2,20 +2,16 @@
 -#   licensed under the Affero General Public License version 3 or later.  See
 -#   the COPYRIGHT file.
 
-%h1.big_text
-  .back
-    = link_to "⇧ #{@album.name}", album_path(@album)
-  = "#{t('.editing')} #{@photo.image}"
+%h2= "#{t('.editing')} #{@photo.image}"
 
 %div{:id => @photo.id}
-
   #show_photo
     = linked_scaled_photo @photo, @album
 
-  = form_for @photo do |p|
-    = p.label :caption
-    = p.text_field :caption, :value => @photo.caption
-    = p.submit
+  = form_for @photo do |photo|
+    = photo.label :caption
+    = photo.text_field :caption, :value => @photo.caption
+    = photo.submit
   %div{:class => 'clear'}
 
   #content_bottom
diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml
index 035839772a..8d0e664719 100644
--- a/app/views/photos/show.html.haml
+++ b/app/views/photos/show.html.haml
@@ -30,7 +30,6 @@
     //show form to add description
     $(".edit-desc").click(function(){
       $(".edit_photo").toggle(); 
-      //$(".caption").toggle();
     });
 
     //Add a description with ajax request
@@ -40,7 +39,6 @@
       var url = $(".edit_photo").attr("action");
       var data = $(".edit_photo").serialize();
       $(".description").text($("#photo_caption").val());
-      //$(".caption").toggle();
       $(".edit_photo").toggle();
 
         $.ajax({  
@@ -80,13 +78,13 @@
   #show_photo
     = linked_scaled_photo @photo, @album
     .caption
-      -if current_user.owns? @album
+      -if current_user.owns? @photo
         -if @photo.caption and @photo.caption != ""
           = link_to 'Edit','javascript:void(0)', :id => "edit-desc", :class => "edit-desc"
       .description
         = @photo.caption
 
-    -if current_user.owns? @album
+    -if current_user.owns? @photo
       %div{:class => 'clear'}
       -if !@photo.caption or @photo.caption == ""
         = link_to 'Add a description','javascript:void(0)', :id => "add-description", :class => "edit-desc"
diff --git a/app/views/requests/_new_request.haml b/app/views/requests/_new_request.haml
index ced50fd545..68ee5922e2 100644
--- a/app/views/requests/_new_request.haml
+++ b/app/views/requests/_new_request.haml
@@ -6,16 +6,16 @@
   =t('.add_a_new_friend_to')
   %i= aspect.name
 
-= form_for Request.new do |f|
-  = f.error_messages
+= form_for Request.new do |fr_request|
+  = fr_request.error_messages
 
   =t('.enter_a_diaspora_username')
   %br
   %i= t '.your_diaspora_username_is', :diaspora_handle  => current_user.diaspora_handle
 
   %p
-    = f.label :destination_url, t(".friends_username")
-    = f.text_field :destination_url
-  = f.hidden_field :aspect_id, :value => aspect.id
-  = f.submit
+    = fr_request.label :destination_url, t(".friends_username")
+    = fr_request.text_field :destination_url
+  = fr_request.hidden_field :aspect_id, :value => aspect.id
+  = fr_request.submit
 
diff --git a/app/views/shared/_aspect_friends.haml b/app/views/shared/_aspect_friends.haml
index 6ca3a29af0..d50a369d3f 100644
--- a/app/views/shared/_aspect_friends.haml
+++ b/app/views/shared/_aspect_friends.haml
@@ -13,10 +13,10 @@
       - @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends")
       - @fb_friends[:data].each do |friend|
         = image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" )
-    -unless (@aspect == :all) || (@aspect == :public)
+    -unless (@aspect == :all)
       = link_to (image_tag('add_friend_button.png', :height => "50px", :width => "50px")), "#add_request_pane", :id => 'add_request_button'
 
-      .yo{:style => 'display:none'}
+      .fancybox_content
         #add_request_pane
           = render "requests/new_request", :aspect => @aspect
     -else
diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml
index e44c281573..5400d15d1a 100644
--- a/app/views/shared/_publisher.haml
+++ b/app/views/shared/_publisher.haml
@@ -12,17 +12,17 @@
 #publisher
   = owner_image_tag
 
-  = form_for StatusMessage.new, :remote => true do |f|
-    = f.error_messages
+  = form_for StatusMessage.new, :remote => true do |status|
+    = status.error_messages
     %p
-      = f.label :message, "Post a message to #{@aspect}"
-      = f.text_area :message, :rows => 2, :value => params[:prefill]
+      = status.label :message, "Post a message to #{@aspect}"
+      = status.text_area :message, :rows => 2, :value => params[:prefill]
 
-    = f.hidden_field :to, :value => (@aspect == :all ? @aspect : @aspect.id)
+    = status.hidden_field :to, :value => (@aspect == :all ? @aspect : @aspect.id)
   
     - if @aspect == :all
       .public_toggle
-        = f.check_box( :public, :value => false )
+        = status.check_box( :public, :value => false )
         make public
         = link_to '(?)', "#question_mark_pane", :class => 'question_mark'
 
@@ -31,7 +31,7 @@
             = render 'shared/public_explain'
 
     - if @aspect == :all
-      = f.submit t('.share'), :title => "Share with all aspects"
+      = status.submit t('.share'), :title => "Share with all aspects"
     - else
-      = f.submit t('.share'), :title => "Share with #{@aspect.name}"
+      = status.submit t('.share'), :title => "Share with #{@aspect}"
 
diff --git a/app/views/shared/_sub_header.haml b/app/views/shared/_sub_header.haml
index 781b38629e..50c80da532 100644
--- a/app/views/shared/_sub_header.haml
+++ b/app/views/shared/_sub_header.haml
@@ -8,8 +8,6 @@
         %h2
           - if @aspect == :all
             = link_to "Everyone", root_path
-          - elsif @aspect == :public
-            = "Public"
           - elsif @aspect == :manage
             = link_to t('.manage_aspects'), root_path
           - else
diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass
index 7eab8e3fdf..6db368b34d 100644
--- a/public/stylesheets/sass/application.sass
+++ b/public/stylesheets/sass/application.sass
@@ -1054,3 +1054,6 @@ header
 
 .fancybox_content
   :display none
+
+.edit_photo
+  :display none
-- 
GitLab