diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 1cb5fd64d..d6a34ee07 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -45,8 +45,9 @@ %body %header - = link_to(image_tag('icons/compose_mobile2.png', :height => 28, :width => 28), new_status_message_path, :class => 'compose_icon') = link_to(image_tag('white@2x.png', :height => 20, :width => 127, :id => 'header_title'), aspects_path) + - if user_signed_in? + = link_to(image_tag('icons/compose_mobile2.png', :height => 28, :width => 28), new_status_message_path, :class => 'compose_icon') - if flash.present? %p diff --git a/app/views/reshares/_reshare.mobile.haml b/app/views/reshares/_reshare.mobile.haml index 22d620165..abac28dd1 100644 --- a/app/views/reshares/_reshare.mobile.haml +++ b/app/views/reshares/_reshare.mobile.haml @@ -7,16 +7,11 @@ - if post .content .from - = person_link(post.author, :class => "hovercardable") + = person_link(post.author) - if post.activity_streams? = link_to image_tag(post.image_url, 'data-small-photo' => post.image_url, 'data-full-photo' => post.image_url, :class => 'stream-photo'), post.object_url, :class => "stream-photo-link" - else = render 'status_messages/status_message', :post => post, :photos => post.photos - - if defined?(current_user) && current_user && (post.author_id != current_user.person.id) && (post.public?) && !reshare?(post) - .reshare_action - = reshare_link(post) - = link_to t(".show_original"), post_path(post) - - else = t('.deleted') diff --git a/app/views/shared/_publisher.mobile.haml b/app/views/shared/_publisher.mobile.haml index ffffa05a9..9aeb27166 100644 --- a/app/views/shared/_publisher.mobile.haml +++ b/app/views/shared/_publisher.mobile.haml @@ -2,7 +2,7 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -= form_for StatusMessage.new, {:data => {:ajax => false}} do |status| += form_for StatusMessage.new, {:data => {:ajax => false}} do |status| = status.text_area :text, :placeholder => t('.whats_on_your_mind'), :style => "width:300px", :rows => 4 - for aspect_id in aspect_ids diff --git a/config/assets.yml b/config/assets.yml index cb510dfaf..e8a4368e0 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -49,8 +49,9 @@ javascripts: #- public/javascripts/diaspora.js #- public/javascripts/helpers/i18n.js #- public/javascripts/widgets/infinite-scroll.js - #- public/javascripts/rails.js + - public/javascripts/rails.js - public/javascripts/vendor/mbp-helper.js + - public/javascripts/mobile.js mailchimp: - public/javascripts/vendor/mailchimp/jquery.form.js diff --git a/public/images/mobile-spinner.gif b/public/images/mobile-spinner.gif new file mode 100644 index 000000000..901564c3f Binary files /dev/null and b/public/images/mobile-spinner.gif differ diff --git a/public/javascripts/mobile.js b/public/javascripts/mobile.js new file mode 100644 index 000000000..2632c33aa --- /dev/null +++ b/public/javascripts/mobile.js @@ -0,0 +1,46 @@ +$(document).ready(function(){ + $(".like_action.inactive").live('tap click', function(evt){ + evt.preventDefault(); + var target = $(this), + postId = target.data('post-id'); + + $.ajax({ + url: '/posts/'+postId+'/likes.json', + type: 'POST', + beforeSend: function(){ + target.removeClass('inactive') + .addClass('loading'); + }, + complete: function(data){ + target.removeClass('loading') + .removeClass('inactive') + .addClass('active') + .data('post-id', postId); + } + }); + }); + + $(".like_action.active").live('tap click', function(evt){ + evt.preventDefault(); + var target = $(this), + postId = $(this).data('post-id'), + likeId = $(this).data('like-id'); + + + $.ajax({ + url: '/posts/'+postId+'/likes/'+likeId+'.json', + type: 'DELETE', + beforeSend: function(){ + target.removeClass('active') + .addClass('loading') + .fadeIn(50); + }, + complete: function(data){ + target.removeClass('loading') + .removeClass('active') + .addClass('inactive') + .data('like-id', ''); + } + }); + }); +}); diff --git a/public/stylesheets/sass/mobile.scss b/public/stylesheets/sass/mobile.scss index 3fa89d1d8..301f53c54 100644 --- a/public/stylesheets/sass/mobile.scss +++ b/public/stylesheets/sass/mobile.scss @@ -40,6 +40,16 @@ body { left: 2px; }; } +#main { + text-align: center; +} + +.stream { + text-align: left; + max-width: 700px; +} + + .stream_element, .comments { overflow: auto; @@ -106,12 +116,9 @@ body { @include border-radius(3px); @include box-shadow(0, 1px, 5px, rgba(0, 0, 0, 1)); background: { - color: white; }; + color: #fff; }; border: { - top: 1px solid black; bottom: 1px solid black; }; - - max-width: 700px; } .photo_attachments { @@ -129,12 +136,8 @@ body { padding: { left: 15px; top: 10px; }; - .from { - font: { - style: italic; }; } } - .reshare_action { - font: { - size: 0.8em; }; } } + } +} #main_stream { font: { @@ -310,9 +313,17 @@ footer { left: 5px; }; } .like_action { - background-image: url("/images/icons/heart_mobile_grey.png"); + &.inactive{ + background-image: url("/images/icons/heart_mobile_grey.png"); + } &.active { - background-image: url("/images/icons/heart_mobile_red.png"); } } + background-image: url("/images/icons/heart_mobile_red.png"); + } + + &.loading { + background-image: url("/images/mobile-spinner.gif"); + } +} .comment_action { background-image: url("/images/icons/pencil_mobile_grey.png"); } @@ -329,3 +340,15 @@ form { top: 6px; right: 15px; } + +#new_status_message { + position: absolute; + left: 0; + top: 45px; + width:100%; + + textarea { + @include border-radius(0); + left: 0; + } +}