From 3c6175041d6869aaebd9dbf8436e9200636c7884 Mon Sep 17 00:00:00 2001 From: Diaspora Europe Date: Tue, 13 Mar 2012 11:29:20 +0100 Subject: [PATCH 1/6] mobile notifications back again #1994 --- app/views/notifications/index.mobile.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/notifications/index.mobile.haml b/app/views/notifications/index.mobile.haml index 18ea33fef..4d3d25470 100644 --- a/app/views/notifications/index.mobile.haml +++ b/app/views/notifications/index.mobile.haml @@ -14,8 +14,7 @@ .content %span.from - %b= notification_people_link(note) - = object_link(note) + = notification_message_for(note) .time = time_ago_in_words(note.created_at) From f224cfe030bd250d17044dc037d964d67392c36a Mon Sep 17 00:00:00 2001 From: Diaspora Europe Date: Tue, 13 Mar 2012 16:34:37 +0100 Subject: [PATCH 2/6] added link to notifications mobile view in header --- app/views/layouts/application.mobile.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 4479d4b75..94c3343b5 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -50,6 +50,10 @@ .navbar-inner .container{:style => "position: relative;"} = link_to(image_tag('header-logo2x.png', :height => 40, :width => 40, :id => 'header_title'), stream_path) + #nav_badges + .badge{:id => "notification_badge"} + = link_to(image_tag('icons/notifications_grey.png', :height => 16, :width => 16, :id => 'notification-flag'), notifications_path) + .badge_count - if user_signed_in? .right From afd750536f5ddbe9f6a3ff25accf18bb56cc7e17 Mon Sep 17 00:00:00 2001 From: Diaspora Europe Date: Tue, 13 Mar 2012 16:46:04 +0100 Subject: [PATCH 3/6] added badges to mobile css --- public/stylesheets/sass/mobile.scss | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/public/stylesheets/sass/mobile.scss b/public/stylesheets/sass/mobile.scss index 4dd46de06..a01e2cce2 100644 --- a/public/stylesheets/sass/mobile.scss +++ b/public/stylesheets/sass/mobile.scss @@ -276,6 +276,24 @@ body { } } +#nav_badges { + display: inline-block; + margin-top: 2px; } + #nav_badges a:hover { + text-decoration: none; } + #nav_badges .badge { + position: relative; + top: 2px; + display: inline; + margin: 0 2px; + padding: 8px 3px; + padding-bottom: 9px; + font-weight: bold; + font-size: smaller; + width: 28px; } + #nav_badges .badge:hover .badge_count { + background-color: #bd0902; } + #header_title { position: relative; top: -3px; From c48e792c7559f5bfa90e6e2ac726b4e02e131f2a Mon Sep 17 00:00:00 2001 From: Diaspora Europe Date: Tue, 13 Mar 2012 17:27:40 +0100 Subject: [PATCH 4/6] added notification badge --- app/views/layouts/application.mobile.haml | 1 + public/stylesheets/sass/mobile.scss | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 94c3343b5..6b51993bc 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -54,6 +54,7 @@ .badge{:id => "notification_badge"} = link_to(image_tag('icons/notifications_grey.png', :height => 16, :width => 16, :id => 'notification-flag'), notifications_path) .badge_count + = current_user.unread_notifications.count - if user_signed_in? .right diff --git a/public/stylesheets/sass/mobile.scss b/public/stylesheets/sass/mobile.scss index a01e2cce2..a5a54d1ba 100644 --- a/public/stylesheets/sass/mobile.scss +++ b/public/stylesheets/sass/mobile.scss @@ -283,7 +283,7 @@ body { text-decoration: none; } #nav_badges .badge { position: relative; - top: 2px; + top: -15px; display: inline; margin: 0 2px; padding: 8px 3px; @@ -294,6 +294,20 @@ body { #nav_badges .badge:hover .badge_count { background-color: #bd0902; } +.badge_count { + -moz-border-radius: 2px 2px 2px 2px; + -webkit-border-radius: 2px 2px 2px 2px; + border-radius: 2px 2px 2px 2px; + z-index: 3; + position: absolute; + top: -2px; + left: 13px; + padding: 0 2px; + padding-bottom: 1px; + background-color: #a40802; + line-height: 12px; + color: white; } + #header_title { position: relative; top: -3px; From 82c9ccfbe0d55fc97cc5071cfc4ba22d380a30f1 Mon Sep 17 00:00:00 2001 From: Diaspora Europe Date: Tue, 13 Mar 2012 17:55:48 +0100 Subject: [PATCH 5/6] added read all button, hide count if zero --- app/views/layouts/application.mobile.haml | 5 +++-- app/views/notifications/index.mobile.haml | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 6b51993bc..8350693c5 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -53,8 +53,9 @@ #nav_badges .badge{:id => "notification_badge"} = link_to(image_tag('icons/notifications_grey.png', :height => 16, :width => 16, :id => 'notification-flag'), notifications_path) - .badge_count - = current_user.unread_notifications.count + - if current_user.unread_notifications.count > 0 + .badge_count + = current_user.unread_notifications.count - if user_signed_in? .right diff --git a/app/views/notifications/index.mobile.haml b/app/views/notifications/index.mobile.haml index 4d3d25470..6ea77428d 100644 --- a/app/views/notifications/index.mobile.haml +++ b/app/views/notifications/index.mobile.haml @@ -1,3 +1,6 @@ +.right + = link_to t('.mark_all_as_read'), notifications_read_all_path, :class => 'btn' + %h3 = t('.notifications') From 746a144dacdca86d12672552d3b831889e7338c5 Mon Sep 17 00:00:00 2001 From: Diaspora Europe Date: Tue, 13 Mar 2012 18:07:42 +0100 Subject: [PATCH 6/6] now redirect to stream --- app/controllers/notifications_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 3cafaecfa..7e0af8645 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -55,6 +55,7 @@ class NotificationsController < ApplicationController Notification.where(:recipient_id => current_user.id).update_all(:unread => false) respond_to do |format| format.html { redirect_to stream_path } + format.mobile{ redirect_to stream_path} format.xml { render :xml => {}.to_xml } format.json { render :json => {}.to_json } end