diff --git a/app/assets/javascripts/app/views/notifications_view.js b/app/assets/javascripts/app/views/notifications_view.js index 69ac3cd01c244b36f6f5969db973347b5691fbea..08400742ec8d8e87921f8d1a281a2305cd0af1e8 100644 --- a/app/assets/javascripts/app/views/notifications_view.js +++ b/app/assets/javascripts/app/views/notifications_view.js @@ -20,7 +20,7 @@ app.views.Notifications = Backbone.View.extend({ else { this.setUnread(guid); } }, - getAllUnread: function(){ return $(".media.stream-element.unread"); }, + getAllUnread: function() { return $(".media.stream-element.unread"); }, setRead: function(guid) { this.setUnreadStatus(guid, false); }, diff --git a/app/assets/javascripts/app/views/stream/shortcuts.js b/app/assets/javascripts/app/views/stream/shortcuts.js index 0be50ca26b1a8bb37dd41e4521e7bff40320988b..56d9df05d7bf016da56335f5809c8b3a96f72919 100644 --- a/app/assets/javascripts/app/views/stream/shortcuts.js +++ b/app/assets/javascripts/app/views/stream/shortcuts.js @@ -90,23 +90,27 @@ app.views.StreamShortcuts = Backbone.View.extend({ }, commentSelected: function() { - $('a.focus_comment_textarea',this.$('div.stream-element.loaded.shortcut_selected')).click(); + this.shortcutSelected().find("a.focus_comment_textarea").click(); }, likeSelected: function() { - $('a.like:first',this.$('div.stream-element.loaded.shortcut_selected')).click(); + this.shortcutSelected().find("a.like:first").click(); }, reshareSelected: function() { - $('a.reshare:first',this.$('div.stream-element.loaded.shortcut_selected')).click(); + this.shortcutSelected().find("a.reshare:first").click(); }, expandSelected: function() { - $('div.expander:first',this.$('div.stream-element.loaded.shortcut_selected')).click(); + this.shortcutSelected().find("div.expander:first").click(); + }, + + shortcutSelected: function() { + return this.$("div.stream-element.loaded.shortcut_selected"); }, openFirstLinkSelected: function() { - var link = $('div.collapsible a[target="_blank"]:first',this.$('div.stream-element.loaded.shortcut_selected')); + var link = $("div.collapsible a[target='_blank']:first"); if(link.length > 0) { // click does only work with vanilla javascript link[0].click(); @@ -115,12 +119,11 @@ app.views.StreamShortcuts = Backbone.View.extend({ selectPost: function(element){ //remove the selection and selected-class from all posts - var selected=this.$('div.stream-element.loaded.shortcut_selected'); - selected.removeClass('shortcut_selected').removeClass('highlighted'); + this.shortcutSelected().removeClass("shortcut_selected").removeClass("highlighted"); //move to new post window.scrollTo(window.pageXOffset, Math.round($(element).offset().top - this._headerSize)); //add the selection and selected-class to new post element.className+=" shortcut_selected highlighted"; - }, + } }); // @license-end diff --git a/app/assets/javascripts/app/views/stream_post_views.js b/app/assets/javascripts/app/views/stream_post_views.js index 4e4f4f3071a66269bd25b44516f1184ba5403bb1..31746783c4c9ba316c634b07e43b24a52f1cd2da 100644 --- a/app/assets/javascripts/app/views/stream_post_views.js +++ b/app/assets/javascripts/app/views/stream_post_views.js @@ -2,7 +2,7 @@ app.views.StreamPost = app.views.Post.extend({ templateName: "stream-element", - className : "stream-element loaded", + className: "stream-element loaded", subviews : { ".feedback": "feedbackView", diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss index 87f6ca9bb49867e6f2ccc2ccf36e1adf3478d90a..588ce26b80c57215c404f4e5893c8f8a36f15ae7 100644 --- a/app/assets/stylesheets/mobile/mobile.scss +++ b/app/assets/stylesheets/mobile/mobile.scss @@ -108,14 +108,6 @@ textarea { resize: vertical; } width: 100%; } -.stream-element:not(.shield-active) .shield{ - display: none; -} - -.stream-element.shield-active .nsfw-hidden{ - display: none; -} - .login_error, .login_alert { color: #DF0101; @@ -195,6 +187,11 @@ footer { padding: 0; } margin-top: 0; } + + &.shield-active .nsfw-hidden, + &:not(.shield-active) .shield { + display: none; + } } .photo_attachments { diff --git a/app/views/notifications/_notification.haml b/app/views/notifications/_notification.haml index 5c9207d9c53879e034cd3f44b487dfd69f846e8d..8c537bdc0efb93af992248d881ac3dbe2dc62781 100644 --- a/app/views/notifications/_notification.haml +++ b/app/views/notifications/_notification.haml @@ -1,4 +1,5 @@ -.media.stream-element{:data=>{:guid => note.id, :type => (Notification.types.key(note.type) || '') }, :class => (note.unread ? 'unread' : 'read')} +.media.stream-element{data: {guid: note.id, type: (Notification.types.key(note.type) || "")}, + class: (note.unread ? "unread" : "read")} .unread-toggle.pull-right %i.entypo-eye{title: (note.unread ? t("notifications.index.mark_read") : t("notifications.index.mark_unread"))} - if note.type == "Notifications::StartedSharing" && (!defined?(no_aspect_dropdown) || !no_aspect_dropdown) diff --git a/app/views/notifications/index.mobile.haml b/app/views/notifications/index.mobile.haml index 6b6d67c3a5438bef2cfdc87d130bd9d02da7b7cb..d53a7db55233f9af772fecff3edece25003d3f87 100644 --- a/app/views/notifications/index.mobile.haml +++ b/app/views/notifications/index.mobile.haml @@ -14,7 +14,7 @@ = locale_date(date) %ul.notifications_for_day - notes.each do |note| - .stream-element{data: {guid: note.id}, class: "#{note.unread ? "unread" : "read"}"} + .stream-element{data: {guid: note.id}, class: (note.unread ? "unread" : "read")} .content.from .media .media-left diff --git a/app/views/people/_index.html.haml b/app/views/people/_index.html.haml index 813cebe527c9796ca17fa24aa2fb72113102dc45..3980b16d7e222883bacdc36bc36b7559741d4d94 100644 --- a/app/views/people/_index.html.haml +++ b/app/views/people/_index.html.haml @@ -1,6 +1,6 @@ #people_stream - people.each do |person| - .media.stream-element{:id => person.id} + .media.stream-element{id: person.id} .media-object.pull-left = person_image_link(person, :size => :thumb_small) .media-body diff --git a/app/views/photos/show.mobile.haml b/app/views/photos/show.mobile.haml index 0d5e3ec8c204161ac24fb1defcd277d86ca09365..69d2a96f96b84c3a26c61d291513fcaad4ca89c7 100644 --- a/app/views/photos/show.mobile.haml +++ b/app/views/photos/show.mobile.haml @@ -8,7 +8,7 @@ #show_content.photos .photo = image_tag photo.url(:scaled_full) - .stream-element{:class => "photo_mobile"} + .stream-element.photo_mobile .content .from.media .media-left diff --git a/app/views/shared/_post_info.mobile.haml b/app/views/shared/_post_info.mobile.haml index 03caf1beb45273b84e28c12bb3e1a86d43a0bcab..e5548d3a8bf958b7ada2140f963983b40086cbf6 100644 --- a/app/views/shared/_post_info.mobile.haml +++ b/app/views/shared/_post_info.mobile.haml @@ -21,7 +21,7 @@ = timeago(post.created_at) %span.via - if post.provider_display_name == "mobile" - = t('shared.stream-element.via_mobile', link: nil) + = t("shared.stream_element.via_mobile", link: nil) – %span.scope_scope - if post.public? diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 0c0e62b70c90580b4e6ca8fca059d06b8e9c8829..97a8e10350b01ec5bd765faaa47e366f40be7b79 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -204,7 +204,7 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)" end Then /^I should see (\d+) contacts$/ do |n_posts| - has_css?("#people_stream .stream-element", :count => n_posts.to_i).should be true + has_css?("#people_stream .stream-element", count: n_posts.to_i).should be true end And /^I scroll down$/ do @@ -245,11 +245,11 @@ When /^I resize my window to 800x600$/ do end Then 'I should see an image attached to the post' do - step %{I should see a "img" within ".stream-element div.photo_attachments"} + step %(I should see a "img" within ".stream-element div.photo_attachments") end Then 'I press the attached image' do - step %{I press the 1st "img" within ".stream-element div.photo_attachments"} + step %(I press the 1st "img" within ".stream-element div.photo_attachments") end And "I wait for the popovers to appear" do