mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 05:34:55 +08:00
Code style improvements according to hound [SCI-442]
This commit is contained in:
parent
8907e54b49
commit
246dae4f46
4 changed files with 56 additions and 55 deletions
|
@ -2,6 +2,7 @@
|
||||||
@import "mixins";
|
@import "mixins";
|
||||||
|
|
||||||
.notifications-container {
|
.notifications-container {
|
||||||
|
margin-bottom: 20px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,52 +18,50 @@
|
||||||
padding: 8px;
|
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 {
|
.notification {
|
||||||
background-color: $color-white;
|
border-bottom: 1px solid $color-alto;
|
||||||
border: 1px solid $color-alto;
|
padding-bottom: 10px;
|
||||||
list-style: none;
|
padding-top: 10px;
|
||||||
margin-bottom: 0px;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
.notification {
|
&:hover {
|
||||||
border-bottom: 1px solid $color-alto;
|
background-color: #ECF5FC;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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 {
|
.notifications-footer {
|
||||||
|
|
||||||
background-color: $color-mystic;
|
background-color: $color-mystic;
|
||||||
|
@ -71,7 +70,7 @@
|
||||||
border-bottom: 1px solid $color-alto;
|
border-bottom: 1px solid $color-alto;
|
||||||
border-left: 1px solid $color-alto;
|
border-left: 1px solid $color-alto;
|
||||||
border-right: 1px solid $color-alto;
|
border-right: 1px solid $color-alto;
|
||||||
margin: 0px;
|
margin: 0;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
|
|
@ -10,33 +10,34 @@ class UserNotificationsController < ApplicationController
|
||||||
@last_notification_id,
|
@last_notification_id,
|
||||||
@per_page + 1)
|
@per_page + 1)
|
||||||
|
|
||||||
@more_notifications_url = ""
|
@more_notifications_url = ''
|
||||||
|
|
||||||
@overflown = @notifications.length > @per_page
|
@overflown = @notifications.length > @per_page
|
||||||
|
|
||||||
@notifications = UserNotification
|
@notifications =
|
||||||
.last_notifications(@current_user, @last_notification_id, @per_page)
|
UserNotification.last_notifications(@current_user,
|
||||||
|
@last_notification_id,
|
||||||
|
@per_page)
|
||||||
|
|
||||||
if @notifications.count > 0
|
if @notifications.count > 0
|
||||||
@more_notifications_url = url_for(
|
@more_notifications_url = url_for(
|
||||||
controller: 'user_notifications',
|
controller: 'user_notifications',
|
||||||
action: 'index',
|
action: 'index',
|
||||||
format: :json,
|
format: :json,
|
||||||
from: @notifications.last.id)
|
from: @notifications.last.id
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.json {
|
format.json do
|
||||||
render :json => {
|
render json: {
|
||||||
:per_page => @per_page,
|
per_page: @per_page,
|
||||||
:results_number => @notifications.length,
|
results_number: @notifications.length,
|
||||||
:more_notifications_url => @more_notifications_url,
|
more_notifications_url: @more_notifications_url,
|
||||||
:html => render_to_string({
|
html: render_to_string(partial: 'list.html.erb')
|
||||||
:partial => 'list.html.erb'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
mark_seen_notification @notifications
|
mark_seen_notification @notifications
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if notification.type_of == 'system_message' %>
|
<% if notification.type_of == 'system_message' %>
|
||||||
<div class="text-center">
|
<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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<% provide(:head_title, raw(t("notifications.title"))) %>
|
||||||
<div class="notifications-container">
|
<div class="notifications-container">
|
||||||
<div class="notifications-header">
|
<div class="notifications-header">
|
||||||
<span><%= t('notifications.title') %></span><span class="pull-right"><%= t('nav.user.settings') %></span>
|
<span><%= t('notifications.title') %></span><span class="pull-right"><%= t('nav.user.settings') %></span>
|
||||||
|
|
Loading…
Add table
Reference in a new issue