Merge pull request #5141 from svbergerem/mark-read-link-notifications

Change mark read link on notifications page
This commit is contained in:
Jonne Haß 2014-08-24 13:32:32 +02:00
commit 52d5a1cd1a
5 changed files with 28 additions and 10 deletions

View file

@ -10,6 +10,7 @@
* Port settings pages (account, profile, privacy, services) to Bootstrap [#5039](https://github.com/diaspora/diaspora/pull/5039) * Port settings pages (account, profile, privacy, services) to Bootstrap [#5039](https://github.com/diaspora/diaspora/pull/5039)
* Port contacts and community spotlight pages to Bootstrap [#5118](https://github.com/diaspora/diaspora/pull/5118) * Port contacts and community spotlight pages to Bootstrap [#5118](https://github.com/diaspora/diaspora/pull/5118)
* Redesign login page [#5112](https://github.com/diaspora/diaspora/pull/5112) * Redesign login page [#5112](https://github.com/diaspora/diaspora/pull/5112)
* Change mark read link on notifications page [#5141](https://github.com/diaspora/diaspora/pull/5141)
## Bug fixes ## Bug fixes
* Fix hiding of poll publisher on close [#5029](https://github.com/diaspora/diaspora/issues/5029) * Fix hiding of poll publisher on close [#5029](https://github.com/diaspora/diaspora/issues/5029)

View file

@ -6,6 +6,7 @@ app.views.Notifications = Backbone.View.extend({
initialize: function() { initialize: function() {
Diaspora.page.header.notifications.setUpNotificationPage(this); Diaspora.page.header.notifications.setUpNotificationPage(this);
$(".unread-toggle .entypo").tooltip();
}, },
toggleUnread: function(evt) { toggleUnread: function(evt) {
@ -54,11 +55,19 @@ app.views.Notifications = Backbone.View.extend({
note = $('.stream_element[data-guid=' + guid + ']'); note = $('.stream_element[data-guid=' + guid + ']');
if(unread) { if(unread) {
note.removeClass("read").addClass("unread"); note.removeClass("read").addClass("unread");
$(".unread-toggle", note).text(Diaspora.I18n.t('notifications.mark_read')); $(".unread-toggle .entypo", note)
.tooltip('destroy')
.removeAttr("data-original-title")
.attr('title',Diaspora.I18n.t('notifications.mark_read'))
.tooltip();
} }
else { else {
note.removeClass("unread").addClass("read"); note.removeClass("unread").addClass("read");
$(".unread-toggle", note).text(Diaspora.I18n.t('notifications.mark_unread')); $(".unread-toggle .entypo", note)
.tooltip('destroy')
.removeAttr("data-original-title")
.attr('title',Diaspora.I18n.t('notifications.mark_unread'))
.tooltip();
} }
all_notes.text( function(i,text) { return parseInt(text) + change }); all_notes.text( function(i,text) { return parseInt(text) + change });

View file

@ -58,7 +58,10 @@
&.unread { &.unread {
background-color: $background-grey; background-color: $background-grey;
.unread-toggle { opacity: 1 !important; } .unread-toggle {
opacity: 1 !important;
.entypo { color: $black; }
}
} }
&:hover { &:hover {
@ -71,9 +74,14 @@
} }
.unread-toggle { .unread-toggle {
padding: 9px 5px;
.entypo {
cursor: pointer;
color: lighten($black,75%);
font-size: 17px;
line-height: 17px;
}
opacity: 0; opacity: 0;
margin-top: 4px;
float: right;
} }
.btn-group.aspect_membership_dropdown { margin: 5px 0; } .btn-group.aspect_membership_dropdown { margin: 5px 0; }

View file

@ -1,6 +1,6 @@
.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')}
%button.btn.btn-link.btn-small.unread-toggle .unread-toggle.pull-right
= note.unread ? t('notifications.index.mark_read') : t('notifications.index.mark_unread') %i.entypo.eye{ :title => (note.unread ? t('notifications.index.mark_read') : t('notifications.index.mark_unread')) }
- if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note.effective_target) - if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note.effective_target)
.pull-right .pull-right
= aspect_membership_dropdown(contact, note.effective_target, 'left') = aspect_membership_dropdown(contact, note.effective_target, 'left')

View file

@ -61,16 +61,16 @@ describe("app.views.Notifications", function(){
expect(parseInt(badge.text())).toBe(count); expect(parseInt(badge.text())).toBe(count);
}); });
it('toggles the unread class and changes the link text', function() { it('toggles the unread class and changes the title', function() {
this.view.updateView(this.readN.data('guid'), this.readN.data('type'), true); this.view.updateView(this.readN.data('guid'), this.readN.data('type'), true);
expect(this.readN.hasClass('unread')).toBeTruethy; expect(this.readN.hasClass('unread')).toBeTruethy;
expect(this.readN.hasClass('read')).toBeFalsy; expect(this.readN.hasClass('read')).toBeFalsy;
expect(this.readN.find('.unread-toggle').text()).toContain(Diaspora.I18n.t('notifications.mark_read')); expect(this.readN.find('.unread-toggle .entypo').data('original-title')).toBe(Diaspora.I18n.t('notifications.mark_read'));
this.view.updateView(this.readN.data('guid'), this.readN.data('type'), false); this.view.updateView(this.readN.data('guid'), this.readN.data('type'), false);
expect(this.readN.hasClass('read')).toBeTruethy; expect(this.readN.hasClass('read')).toBeTruethy;
expect(this.readN.hasClass('unread')).toBeFalsy; expect(this.readN.hasClass('unread')).toBeFalsy;
expect(this.readN.find('.unread-toggle').text()).toContain(Diaspora.I18n.t('notifications.mark_unread')); expect(this.readN.find('.unread-toggle .entypo').data('original-title')).toBe(Diaspora.I18n.t('notifications.mark_unread'));
}); });
}); });
}); });