Code style improvements according to hound [SCI-442]

This commit is contained in:
Oleksii Kriuchykhin 2016-10-04 14:16:18 +02:00
parent 8907e54b49
commit 246dae4f46
4 changed files with 56 additions and 55 deletions

View file

@ -2,6 +2,7 @@
@import "mixins";
.notifications-container {
margin-bottom: 20px;
margin-top: 20px;
}
@ -17,52 +18,50 @@
padding: 8px;
}
.notifications-body {
.notifications-list {
background-color: $color-white;
border: 1px solid $color-alto;
list-style: none;
margin-bottom: 0;
padding: 0;
.notifications-list {
background-color: $color-white;
border: 1px solid $color-alto;
list-style: none;
margin-bottom: 0px;
padding: 0;
.notification {
border-bottom: 1px solid $color-alto;
padding-bottom: 10px;
padding-top: 10px;
.notification {
border-bottom: 1px solid $color-alto;
padding-bottom: 10px;
padding-top: 10px;
&:hover {
background-color: #ECF5FC;
}
}
.unseen {
border-left: 4px solid $color-theme-primary;
}
.text-center {
margin-left: 10px;
padding-top: 10px;
}
.assignment {
background-color: $color-theme-primary;
border-radius: 50%;
color: $color-wild-sand;
font-size: 15px;
padding: 7px;
}
.system_message {
background-color: $color-theme-secondary;
border-radius: 50%;
color: $color-wild-sand;
font-size: 13px;
padding: 7px 10px;
&:hover {
background-color: #ECF5FC;
}
}
.unseen {
border-left: 4px solid $color-theme-primary;
}
.text-center {
margin-left: 10px;
padding-top: 10px;
}
.assignment {
background-color: $color-theme-primary;
border-radius: 50%;
color: $color-wild-sand;
font-size: 15px;
padding: 7px;
}
.system-message {
background-color: $color-theme-secondary;
border-radius: 50%;
color: $color-wild-sand;
font-size: 13px;
padding: 7px 10px;
}
}
.notifications-footer {
background-color: $color-mystic;
@ -71,7 +70,7 @@
border-bottom: 1px solid $color-alto;
border-left: 1px solid $color-alto;
border-right: 1px solid $color-alto;
margin: 0px;
margin: 0;
padding: 8px;
text-align: center;

View file

@ -10,33 +10,34 @@ class UserNotificationsController < ApplicationController
@last_notification_id,
@per_page + 1)
@more_notifications_url = ""
@more_notifications_url = ''
@overflown = @notifications.length > @per_page
@notifications = UserNotification
.last_notifications(@current_user, @last_notification_id, @per_page)
@notifications =
UserNotification.last_notifications(@current_user,
@last_notification_id,
@per_page)
if @notifications.count > 0
@more_notifications_url = url_for(
controller: 'user_notifications',
action: 'index',
format: :json,
from: @notifications.last.id)
from: @notifications.last.id
)
end
respond_to do |format|
format.html
format.json {
render :json => {
:per_page => @per_page,
:results_number => @notifications.length,
:more_notifications_url => @more_notifications_url,
:html => render_to_string({
:partial => 'list.html.erb'
})
format.json do
render json: {
per_page: @per_page,
results_number: @notifications.length,
more_notifications_url: @more_notifications_url,
html: render_to_string(partial: 'list.html.erb')
}
}
end
end
mark_seen_notification @notifications
end

View file

@ -14,7 +14,7 @@
<% end %>
<% if notification.type_of == 'system_message' %>
<div class="text-center">
<span class="system_message"><i class="glyphicon glyphicon-tower" aria-hidden="true"></i></span>
<span class="system-message"><i class="glyphicon glyphicon-tower" aria-hidden="true"></i></span>
</div>
<% end %>
</div>

View file

@ -1,3 +1,4 @@
<% provide(:head_title, raw(t("notifications.title"))) %>
<div class="notifications-container">
<div class="notifications-header">
<span><%= t('notifications.title') %></span><span class="pull-right"><%= t('nav.user.settings') %></span>