Clean up notifications layout

This commit is contained in:
Andreas Nedbal 2020-04-25 17:51:00 +02:00
parent 6e22e84081
commit 245c6493d3
5 changed files with 46 additions and 42 deletions

View File

@ -0,0 +1,10 @@
= render 'notifications/notification_nav'
.container.j2-page
.row
.col-md-3.col-xs-12.col-sm-4
= render 'tabs/notifications'
.col-md-9.col-xs-12.col-sm-8
= yield
- Notification.for(current_user).update_all(new: false)
- provide(:title, generate_title("Notifications"))

View File

@ -1,15 +0,0 @@
.col-md-3.col-xs-12.col-sm-4
.card.hidden-xs
.list-group
= list_group_item "New Notifications", notifications_path, badge: Notification.for(current_user).where(new: true).count
= list_group_item "All Notifications", notifications_path('all')
.card.hidden-xs
.card-header
Filter by Type
.list-group
= list_group_item t('views.notifications.tabs.answer'), notifications_path('answer'), badge: Notification.for(current_user).where(target_type: "Answer", new: true).count
= list_group_item t('views.notifications.tabs.smile'), notifications_path('smile'), badge: Notification.for(current_user).where(target_type: "Smile", new: true).count
= list_group_item t('views.notifications.tabs.comment'), notifications_path('comment'), badge: Notification.for(current_user).where(target_type: "Comment", new: true).count
= list_group_item t('views.notifications.tabs.commentsmile'), notifications_path('commentsmile'), badge: Notification.for(current_user).where(target_type: "CommentSmile", new: true).count
= list_group_item t('views.notifications.tabs.relationship'), notifications_path('relationship'), badge: Notification.for(current_user).where(target_type: "Relationship", new: true).count

View File

@ -0,0 +1,22 @@
.card
%ul#notifications.list-group
- if @notifications.count == 0
%li.list-group-item.text-center
.notifications--none
%i.fa.fa-bell-o.no-notifications
%p
- if params[:type] != "all"
No new notifications.
- else
No notifications.
- else
- @notifications.each do |notification|
= render 'notifications/notification', notification: notification
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type]
- if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @notifications_last_id }}
Load more
- parent_layout "notification"

View File

@ -1,27 +0,0 @@
- provide(:title, generate_title("Notifications"))
= render 'notifications/notification_nav'
.container.j2-page
.row
= render 'notification_tabs'
.col-md-9.col-xs-12.col-sm-8
.card
%ul#notifications.list-group
- if @notifications.count == 0
%li.list-group-item.text-center
.notifications--none
%i.fa.fa-bell-o.no-notifications
%p
- if params[:type] != "all"
No new notifications.
- else
No notifications.
- else
- @notifications.each do |notification|
= render 'notifications/notification', notification: notification
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type]
- if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @notifications_last_id }}
Load more
- Notification.for(current_user).update_all(new: false)

View File

@ -0,0 +1,14 @@
.card.hidden-xs
.list-group
= list_group_item "New Notifications", notifications_path, badge: Notification.for(current_user).where(new: true).count
= list_group_item "All Notifications", notifications_path('all')
.card.hidden-xs
.card-header
Filter by Type
.list-group
= list_group_item t('views.notifications.tabs.answer'), notifications_path('answer'), badge: Notification.for(current_user).where(target_type: "Answer", new: true).count
= list_group_item t('views.notifications.tabs.smile'), notifications_path('smile'), badge: Notification.for(current_user).where(target_type: "Smile", new: true).count
= list_group_item t('views.notifications.tabs.comment'), notifications_path('comment'), badge: Notification.for(current_user).where(target_type: "Comment", new: true).count
= list_group_item t('views.notifications.tabs.commentsmile'), notifications_path('commentsmile'), badge: Notification.for(current_user).where(target_type: "CommentSmile", new: true).count
= list_group_item t('views.notifications.tabs.relationship'), notifications_path('relationship'), badge: Notification.for(current_user).where(target_type: "Relationship", new: true).count