updated comment layout from upstream; added grouped_by_event behaviour to comments_dropdown and helper

This commit is contained in:
raluka 2015-09-21 15:56:57 +02:00
parent 5790d99fac
commit f7c70ba55c
7 changed files with 78 additions and 77 deletions

View file

@ -1,13 +1,13 @@
html { html {
position: relative; position: relative;
min-height: 100%; min-height: 100%;
} }
body { body {
/* Margin bottom by 2 times the footer height */ /* Margin bottom by 2 times the footer height */
margin-bottom: 60px; margin-bottom: 60px;
/* Margin bottom by navbar height */ /* Margin bottom by navbar height */
padding-top: 60px; padding-top: 60px;
} }
#content { #content {
@ -15,23 +15,23 @@ body {
} }
#footer { #footer {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
/* Set the fixed height of the footer here */ /* Set the fixed height of the footer here */
height: 60px; height: 60px;
background-color: #f5f5f5; background-color: #f5f5f5;
.container { .container {
padding: 15px; padding: 15px;
} }
} }
.nav-tabs { .nav-tabs {
margin-bottom: 15px; margin-bottom: 15px;
} }
.img-center { .img-center {
margin: 0 auto; margin: 0 auto;
} }
/* centered columns styles */ /* centered columns styles */
@ -71,4 +71,14 @@ p.comment-body {
#account-already { #account-already {
font-size: 0.6em; font-size: 0.6em;
} }
/* comments views pane: use padding-bottom before next comment box */
.panel.panel-default .panel-body .box {
padding-bottom: 20px;
}
/* comments views pane: use padding-bottom after each comment */
.panel.panel-default .panel-body .box p {
padding-bottom: 20px;
}

View file

@ -280,6 +280,6 @@ module ApplicationHelper
end end
def unread_notifications(user) def unread_notifications(user)
Comment.accessible_by(current_ability).find_since_last_login(user).limit(5) Comment.accessible_by(current_ability).find_since_last_login(user)
end end
end end

View file

@ -1,16 +1,12 @@
- @comments.each do |conference, events| - @comments.each do |conference, events|
.well .panel.panel-default
%p.h4= conference.title .panel-heading
- events.each do |event, comments| %h4.title.panel-title= conference.title
%h3.title .panel-body
= link_to event.title, admin_conference_event_path(event.conference.short_title, event) - events.each do |event, comments|
%body .box
- comments.each do |comment| %h4.title= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
%hr %hr
%ul.list-unstyled - comments.each do |comment|
%ul.list-inline %h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at}
%li %p= comment.body
%h5.strong Posted by: #{comment.user.name}
%li
%h5.strong Created at: #{comment.created_at}
%li= comment.body

View file

@ -1,16 +1,12 @@
- @posted_comments.each do |conference, events| - @posted_comments.each do |conference, events|
.well .panel.panel-default
%p.h4= conference.title .panel-heading
- events.each do |event, comments| %h4.title.panel-title= conference.title
%h3.title .panel-body
= link_to event.title, admin_conference_event_path(event.conference.short_title, event) - events.each do |event, comments|
%body .box
- comments.each do |comment| %h4.title= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
%hr %hr
%ul.list-unstyled - comments.each do |comment|
%ul.list-inline %h5.strong Created at: #{comment.created_at}
%li %p= comment.body
%h5.strong Posted by: #{comment.user.name}
%li
%h5.strong Created at: #{comment.created_at}
%li= comment.body

View file

@ -1,16 +1,12 @@
- @unread_comments.each do |conference, events| - @unread_comments.each do |conference, events|
.well .panel.panel-default
%p.h4= conference.title .panel-heading
- events.each do |event, comments| %h4.title.panel-title= conference.title
%h3.title .panel-body
= link_to event.title, admin_conference_event_path(event.conference.short_title, event) - events.each do |event, comments|
%body .box
- comments.each do |comment| %h4.title= link_to event.title, admin_conference_event_path(event.conference.short_title, event)
%hr %hr
%ul.list-unstyled - comments.each do |comment|
%ul.list-inline %h5.strong Posted by: #{comment.user.name} | Created at: #{comment.created_at}
%li %p= comment.body
%h5.strong Posted by: #{comment.user.name}
%li
%h5.strong Created at: #{comment.created_at}
%li= comment.body

View file

@ -1,23 +1,24 @@
%h1 Comments %h1 Comments
%br
.row .row
.col-lg-12 .col-md-12
%ul.nav.nav-tabs#commentsTable %ul.nav.nav-tabs#commentsTable
%li.active %li.active
%a{:href=>"#unread_comments", "data-toggle"=>"tab"} %a{:href=>"#unread_comments", "data-toggle"=>"tab"}
%span.fa.fa-comment %span.fa.fa-comment
Unread comments Unread
%li
%a{:href=>"#all_comments", "data-toggle"=>"tab"}
%span.fa.fa-comments-o
Comments
%li %li
%a{:href=>"#posted_comments", "data-toggle"=>"tab"} %a{:href=>"#posted_comments", "data-toggle"=>"tab"}
%span.fa.fa-pencil %span.fa.fa-pencil
Posted Comments Posted
%li
%a{:href=>"#all_comments", "data-toggle"=>"tab"}
%span.fa.fa-comments-o
All
.tab-content .tab-content
.tab-pane.active#unread_comments .tab-pane.active#unread_comments
= render partial: 'unread_comments' = render partial: 'unread_comments'
.tab-pane#all_comments
= render partial: 'all_comments'
.tab-pane#posted_comments .tab-pane#posted_comments
= render partial: 'posted_comments' = render partial: 'posted_comments'
.tab-pane#all_comments
= render partial: 'all_comments'

View file

@ -28,17 +28,19 @@
- if can? :index, Comment - if can? :index, Comment
%ul.nav.navbar-nav.navbar-right %ul.nav.navbar-nav.navbar-right
%li.dropdown %li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "unread-comments-preview"} %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
- if unread_notifications(current_user) - if unread_notifications(current_user)
Notifications (#{unread_notifications(current_user).length}) Notifications (#{unread_notifications(current_user).length})
%span.fa.fa-comment
%b.caret %b.caret
%ul.dropdown-menu %ul.dropdown-menu
- unread_notifications(current_user).limit(5).each do |unread_comment| - if unread_notifications(current_user).length > 0
%li= link_to("New comment for: #{unread_comment.commentable.title}", admin_conference_event_path(unread_comment.commentable.conference.short_title, unread_comment.commentable_id)) %li.dropdown-header Last 5 Comments for:
%li.divider - unread_notifications(current_user).limit(5).group_by{ |comment| comment.commentable}.each do |event, comments|
%li= link_to 'See comments', admin_comments_path %li= link_to("#{event.title}(#{comments.count})", admin_conference_event_path(event.conference.short_title, event.id))
-else %li.divider
No Notifications %li= link_to "See all unread Comments (#{unread_notifications(current_user).length})", admin_comments_path
%li= link_to 'See all Comments', admin_comments_path(anchor: 'all_comments')
- else - else
%ul.nav.navbar-nav.navbar-right %ul.nav.navbar-nav.navbar-right
- if CONFIG['authentication']['ichain']['enabled'] - if CONFIG['authentication']['ichain']['enabled']