From cd9be3904b3ae7afca10756cce2499567e1c95de Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Fri, 1 Jul 2011 09:03:18 -0700 Subject: [PATCH] publisher rework --- app/views/shared/_publisher.html.haml | 11 ++-- config/locales/diaspora/en.yml | 3 +- public/javascripts/publisher.js | 8 ++- public/stylesheets/sass/application.sass | 64 ++++++++++++++++-------- 4 files changed, 56 insertions(+), 30 deletions(-) diff --git a/app/views/shared/_publisher.html.haml b/app/views/shared/_publisher.html.haml index b322dd208..26f107960 100644 --- a/app/views/shared/_publisher.html.haml +++ b/app/views/shared/_publisher.html.haml @@ -9,7 +9,7 @@ $(".public_icon").tipsy({trigger: 'hover', gravity: 'n'}); }); -#publisher{:class => ((aspect == :profile)? 'mention_popup' : nil )} +#publisher.closed{:class => ((aspect == :profile)? 'mention_popup' : nil )} .content_creation = form_for(StatusMessage.new, :remote => true, :html => {"data-type" => "json"}) do |status| - if @selected_contacts @@ -18,18 +18,19 @@ %p %params #publisher_textarea_wrapper + = link_to( image_tag('deletelabel.png'), "#", :id => "hide_publisher", :title => t('.discard_post')) %ul#photodropzone = status.text_area :fake_text, :rows => 2, :value => h(params[:prefill]), :tabindex => 1, :placeholder => t('.whats_on_your_mind') = status.hidden_field :text, :value => '', :class => 'clear_on_submit' + #file-upload{:title => t('.upload_photos')} + = image_tag 'icons/camera.svg', :height => 14 + + - for aspect_id in aspect_ids = hidden_field_tag 'aspect_ids[]', aspect_id.to_s .options_and_submit - #file-upload - = image_tag 'icons/camera.svg', :height => 14 - = t('.add_photos') - - if aspect == :profile .mention_helper .badges diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 95f4c2238..21446a014 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -600,13 +600,14 @@ en: post_a_message_to: "Post a message to %{aspect}" make_public: "make public" all: "all" - add_photos: "add photos" + upload_photos: "Upload photos" all_contacts: "all contacts" share_with: "share with" whats_on_your_mind: "What's on your mind?" publishing_to: "publishing to: " public: "Public" click_to_share_with: "Click to share with: " + discard_post: "Discard post" add_contact: enter_a_diaspora_username: "Enter a Diaspora username:" your_diaspora_username_is: "Your Diaspora username is: %{diaspora_handle}" diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js index bcd2df09b..0fb01fd41 100644 --- a/public/javascripts/publisher.js +++ b/public/javascripts/publisher.js @@ -371,9 +371,13 @@ var Publisher = { Publisher.bindPublicIcon(); Publisher.bindAspectToggles(); - if ($("#status_message_fake_text").val() === "") { + /* close text area */ + Publisher.form().delegate("#hide_publisher", "click", function(){ + $.each(Publisher.form().find("textarea"), function(idx, element){ + $(element).val(""); + }); Publisher.close(); - } + }); Publisher.autocompletion.initialize(); Publisher.hiddenInput().val(Publisher.input().val()); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 366e6546f..f22455e65 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -892,8 +892,8 @@ label form textarea - :height 18px !important - :width 474px + :width 455px + :margin 0 &.mention_popup :padding 1px 12px @@ -905,23 +905,22 @@ label &.closed .options_and_submit :display none !important - #file-upload - :display none + + textarea + :height 18px !important .counter :display none + + &:not(.closed) + textarea + :margin + :bottom 30px + form :position relative :top 0 - input[type='text'], - textarea - :margin 0 - :width 395px - - textarea - :height 42px - label :font :size 14px @@ -961,24 +960,17 @@ label :top 1em #file-upload - :float left + :position absolute !important + :bottom 1px !important + :right 6px :z-index 10 :margin 0 - :top 2px :display inline-block :padding 0.3em :cursor pointer - :font - :weight bold - :size smaller - - :text - :align center - :shadow none - img @include opacity(0.4) @@ -1007,9 +999,32 @@ label @include opacity(0.5) #publisher_textarea_wrapper + #hide_publisher + @include opacity(0.3) + :padding 3px + :position absolute + :right 6px + :top 0 + + &:hover + @include opacity(1) + + @include border-radius(2px) + + :border 1px solid #ccc + :background #fff + :position relative + :padding + :right 10px + textarea :z-index 2 + :border none + + &:focus + :outline 0 + :background transparent &.with_attachments :padding @@ -1074,6 +1089,11 @@ label :width 82% :display inline +#publisher.closed + #publisher_textarea_wrapper + #hide_publisher + :display none + .dim @include opacity(0.3)