diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index f55613f5b..6ed450384 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -5,7 +5,8 @@ - content_for :head do :javascript $(document).ready( function(){ - $("#edit_photo_toggle").bind('click', function() { + $("#edit_photo_toggle").bind('click', function(evt) { + evt.preventDefault(); $("#photo_edit_options").toggle(); $(".edit_photo input[type='text']").first().focus(); }); @@ -38,12 +39,11 @@ #show_photo -if @ownership = image_tag 'ajax-loader.gif', :id => "photo_spinner", :class => "hidden" - .edit_pane - .controls{:data=>{:actor=>"#{@photo.person.owner.id}",:actor_person=>"#{@photo.person.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}} - = link_to t('.make_profile_photo'), '#', :class => "make_profile_photo" - | - = link_to 'edit', '#', :id => "edit_photo_toggle" - = image_tag @photo.url(:scaled_full) + = image_tag @photo.url(:scaled_full) + .photo_options{:data=>{:actor=>"#{@photo.person.owner.id}",:actor_person=>"#{@photo.person.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}} + = link_to t('.make_profile_photo'), '#', :class => 'make_profile_photo' + | + = link_to 'edit', '#', :id => "edit_photo_toggle" -else = image_tag @photo.url(:scaled_full) diff --git a/app/views/status_messages/_status_message.haml b/app/views/status_messages/_status_message.haml index e559598db..c467cbea6 100644 --- a/app/views/status_messages/_status_message.haml +++ b/app/views/status_messages/_status_message.haml @@ -2,7 +2,7 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -%h3= markdownify(post.message) += markdownify(post.message) %br - for photo in post.photos = link_to (image_tag photo.url(:thumb_medium)), object_path(photo) diff --git a/public/javascripts/view.js b/public/javascripts/view.js index b11da0a45..15d5fd1ff 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -138,19 +138,27 @@ function openVideo(type, videoid, link) { link.onclick = function() { $container.slideToggle('fast', function() { } ); } } -$(".make_profile_photo").live("click", function(){ +$(".make_profile_photo").live("click", function(evt){ + + evt.preventDefault(); + var $this = $(this), - $controls = $this.closest(".controls"), + $controls = $this.closest(".photo_options"), user_id = $controls.attr('data-actor'); person_id = $controls.attr('data-actor_person'); photo_url = $controls.attr('data-image_url'); + $("img[data-person_id='"+ person_id +"']").each( function() { + $(this).fadeTo(200,0.3); + }); + $.ajax({ type: "PUT", url: '/people/'+user_id, data: {"person":{"profile":{ "image_url": photo_url }}}, success: function(){ $("img[data-person_id='"+ person_id +"']").each( function() { + $(this).fadeTo(200,1); this.src = photo_url; }); } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index a3dcd1f1c..b849fe409 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -665,6 +665,7 @@ li.message .from .right :margin-right 1em #show_photo + :position relative :display inline-block :background :color #fff @@ -680,6 +681,8 @@ li.message .from .right :border-radius 3px img + :z-index 2 + :position relative :max-width 100% :margin :bottom 10px @@ -687,6 +690,7 @@ li.message .from .right :bottom 1px solid #ddd #photo_spinner + :z-index 1 :position absolute :height 100px :width 100px @@ -1351,32 +1355,13 @@ input[type="search"] :border-radius 5px -.edit_pane +.photo_options :display inline - :position relative + :position absolute + :bottom 5px + :right 13px - .controls - :display none - :background - :color rgba(51,51,51,0.9) - :padding 10px - :position absolute - :right 1px - :margin - :top 1px - - a - :font - :weight bold - :color #eee - :text-shadow 0 1px #000 - - &:hover - :color #fff - - &:hover - .controls - :display inline + :color #999 ul#breadcrumb :list