diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index b4bc9fe948e61221231b2ce798074cd6596314e6..bbae0fbf8deaac9625bde3290b25e3aa9151e6c3 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -9,15 +9,11 @@ class StatusMessagesController < ApplicationController respond_to :json, :only => :show def create - params[:status_message][:to] = params[:aspect_ids] - data = clean_hash params[:status_message] - if logged_into_fb? && params[:status_message][:public] == '1' id = 'me' type = 'feed' - Rails.logger.info("Sending a message: #{params[:status_message][:message]} to Facebook") EventMachine::HttpRequest.new("https://graph.facebook.com/me/feed?message=#{params[:status_message][:message]}&access_token=#{@access_token}").post end diff --git a/app/views/albums/edit.html.haml b/app/views/albums/edit.html.haml index 4969227e4f2cfa8b1187f9e03a9f8d623923ec10..e979b1a77ad812ca1986cc199f71444ae4e35a11 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 4b76d38e13954793c7cc430995ae12862e7b9001..cd4f93ab321331ea3b28a7c7c23d64204a9ee1ab 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 8c3c45f4d19e0d2a58d5b2db94b9cf97ca0bbc52..151ab07d4f092800fad066b51e526eb9bbab79bf 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 a188787af0537c5fdca596a5c986d729620439d6..73b2bac29c46d65145648ff8b6c07c32cc00564a 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,8 +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 -#content_bottom diff --git a/app/views/aspects/public.html.haml b/app/views/aspects/public.html.haml deleted file mode 100644 index 95c185761bb98595939976934b65e45f329b29b6..0000000000000000000000000000000000000000 --- 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 2c95d4385d5f8116fadef4313f67845235c1fb80..bb8719ee7ceb028eacf9523854affe60a961180d 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 36b0dacacac5faa131dfcf3016cee1b0f0e197fa..9cd41f05f445c0f237cb88005841e4aa3b99d246 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 7685a8933c3f554ed7204054b7d7abc173abe27b..0000000000000000000000000000000000000000 --- 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 3e1fc31e63e9e44d4b7a48123e03c84660f1b3ce..1038d7d94f9c63699dde9822008e04683e786905 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 78186d2481150faa0e15a537c54fe363bfac6fe2..08e6dae0ada4ae20c7ce5c1118990ff5f715e7b7 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 58c363240f338c52d34a0f4c1379bbc334ceaae8..8d0e664719972f0a7310c3082fc23f48deadd976 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({ @@ -66,11 +64,11 @@ %h1 = @photo.image - = link_to "<< #{t('.prev')}", url_to_prev(@photo, @album) + = link_to "<< #{t('.prev')}", url_to_prev(@photo, @album), :rel => 'prefetch' | = link_to "#{t('.full_size')}", @photo.url | - = link_to "#{t('.next')} >>", url_to_next(@photo, @album) + = link_to "#{t('.next')} >>", url_to_next(@photo, @album), :rel => 'prefetch' .right -if current_user.owns? @album @@ -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 ced50fd5456f3c3d9642f5d516a2840641ba3cd8..68ee5922e2d742ce260d73e439e5fc935d2c4fba 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 6ca3a29af042de405785c2a454c75e991e204af9..d50a369d3fc0407a9e420c74e822f56ade199a59 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 a6f1bd92cefcb21e56732fca12a2c8a7bccae53d..5400d15d1a5e44b2523ef3cedcbf3a4a79c06d7e 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -3,7 +3,6 @@ -# the COPYRIGHT file. :javascript - $("div.public_toggle input").live("click", function(evt){ if("#{@logged_in}" == "false" && $(this).attr('checked') == true){ $(".question_mark").click(); @@ -13,31 +12,26 @@ #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 - %label{:for => "status_message_message"} Message - = f.text_area :message, :rows => 2, :value => params[:prefill] - - %ul.aspect_selector{ :style => "display:none;"} - going to... - - for aspect in @aspects - %li - = check_box_tag("aspect_ids[]", aspect.id, @aspect == :all || current_aspect?(aspect) ) - = aspect.name + = status.label :message, "Post a message to #{@aspect}" + = status.text_area :message, :rows => 2, :value => params[:prefill] + = 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' - .yo{:style => "display:none;"} + + .fancybox_content #question_mark_pane = render 'shared/public_explain' - .buttons - - if @aspect == :all - = f.submit t('.share'), :title => "Share with all aspects" - - else - = f.submit t('.share'), :title => "Share with #{@aspect.name}" + + - if @aspect == :all + = status.submit t('.share'), :title => "Share with all aspects" + - else + = 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 781b38629eef1966a82d05641864d492fa1359e1..50c80da532ad498cd5da69ea43cb8fb9898294fc 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/javascripts/view.js b/public/javascripts/view.js index 6c7783371ec4b7ea64e2595535304558f0bc273f..11fac862dc37e8668b05cd664e4937f3d2d486df 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -47,9 +47,9 @@ $(document).ready(function(){ } ); - $("#publisher textarea").keydown( function(e) { + $("#publisher textarea, .comment textarea").keydown( function(e) { if (e.keyCode == 13) { - $("#publisher form").submit(); + $(this).closest("form").submit(); } }); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 91bbf60f33237e45cfd7007c0525999e40bbbfb0..6db368b34dee053e8f8f64bdc1392901c25529ca 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -115,7 +115,6 @@ header a :color #CCC - :text-shadow 0 1px 0 #444 &:hover :background none @@ -130,6 +129,9 @@ header :color #fff ul#user_menu + a + :text-shadow 0 1px 0 #444 + :z-index 10 :font :size 14px @@ -246,7 +248,6 @@ li.message :background #eee .content - :max-width 610px :margin :top -4px :padding @@ -448,16 +449,13 @@ ul.comment_set :top 1em :padding 0 :list-style none - :max-width 610px + :background + :color rgba(10,81,109,0.05) textarea :width 100% li.comment - :margin - :bottom 0.5em - :background - :color rgba(10,81,109,0.05) :padding 0.6em :border :bottom 1px solid #ddd @@ -466,8 +464,10 @@ ul.comment_set :color #777 :margin :top -2px + :bottom -2px :padding :left 45px + :right 20px .from a :color #444 @@ -475,7 +475,7 @@ ul.comment_set :size 12px :line - :height 18px + :height 16px div.time :color #bbb @@ -629,20 +629,14 @@ label :display inline input[type='submit'] - :display block + :float right :margin :right 20px - :width 100% textarea :width 570px :height 42px - :margin - :top 0 - :bottom 0 - - .buttons - :float right + :margin 0 .public_toggle :position absolute @@ -1057,3 +1051,9 @@ input[type="search"] header input[type="search"] :width 200px + +.fancybox_content + :display none + +.edit_photo + :display none diff --git a/spec/controllers/status_message_controller_spec.rb b/spec/controllers/status_message_controller_spec.rb index 8df112285c8bd95cadd89df9fa1f862253ca23fe..9c84fe3e8c366ad395e9119698def79a7b21a1ff 100644 --- a/spec/controllers/status_message_controller_spec.rb +++ b/spec/controllers/status_message_controller_spec.rb @@ -5,16 +5,17 @@ require 'spec_helper' describe StatusMessagesController do - render_views + render_views + + let!(:user) { Factory(:user) } + let!(:aspect) { user.aspect(:name => "lame-os") } + before do - @user = Factory.create(:user) - @aspect = @user.aspect(:name => "lame-os") - @album = @user.post :album, :to => @aspect.id, :name => 'things on fire' - sign_in :user, @user + sign_in :user, user end describe '#create' do - let(:status_message_hash) {{"aspect_ids" =>"#{@aspect.id.to_s}", "status_message"=>{"public"=>"1", "message"=>"facebook, is that you?"}}} + let(:status_message_hash) {{"status_message"=>{"public"=>"1", "message"=>"facebook, is that you?", "to" =>"#{aspect.id}"}}} before do @controller.stub!(:logged_into_fb?).and_return(true)