tramway-admin 1.18.4.4 → 1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/tramway/admin/application.sass +9 -0
- data/app/controllers/tramway/admin/application_controller.rb +13 -0
- data/app/views/layouts/tramway/admin/shared/_navbar.html.haml +10 -0
- data/lib/tramway/admin.rb +11 -0
- data/lib/tramway/admin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1d2be1680ef4d50822e106f3835cb14224f26ae8e1825864c1ee012fca4bd22
|
4
|
+
data.tar.gz: 71c3ff71e401be1e9bad883ab0d98bcc1887aa18943d8eb4bcc8b7c69fa4b770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227b88443bfeb1a0e3923e96424d8b9e245cd319b4ff77b0939f6c99fb30fe560425325148cdbd20e4c1ab4791e4efac073c8d13fcce01f6b6d6f678158d6782
|
7
|
+
data.tar.gz: cb4a7ba86f128fa09790e224cacfb1ea448d043ca4d631f6cfcfcea30b55f7f57d7b6924efeb2ebb8cfbb582cd866c522736549b23b3d6051b6a39eedea03d26
|
@@ -12,6 +12,8 @@ module Tramway
|
|
12
12
|
before_action :collections_counts, if: :model_given?
|
13
13
|
before_action :check_available_scope!, if: :model_given?, only: :index
|
14
14
|
before_action :application
|
15
|
+
before_action :notifications
|
16
|
+
before_action :notifications_count
|
15
17
|
|
16
18
|
protect_from_forgery with: :exception
|
17
19
|
|
@@ -39,6 +41,17 @@ module Tramway
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
44
|
+
def notifications
|
45
|
+
@notifications ||= Tramway::Admin.notifications
|
46
|
+
@notifications
|
47
|
+
end
|
48
|
+
|
49
|
+
def notifications_count
|
50
|
+
@notifications_count = notifications.reduce(0) do |count, notification|
|
51
|
+
count += notification[1].count
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
42
55
|
if Rails.env.production?
|
43
56
|
rescue_from StandardError do |exception|
|
44
57
|
Rails.logger.warn "ERROR MESSAGE: #{exception.message}"
|
@@ -15,6 +15,16 @@
|
|
15
15
|
= model_menu_item model: model, route: ::Tramway::Admin::Engine.routes.url_helpers.records_path(model: model, scope: decorator_class(model).collections.first)
|
16
16
|
%ul.nav.navbar-nav.ml-auto
|
17
17
|
- if signed_in?
|
18
|
+
%li.nav-item.dropdown.notifications
|
19
|
+
= link_to '#', class: 'nav-link icon-in-navbar dropdown-toggle', id: :notifications_dropdown, role: :button, aria: { haspopup: true, expanded: false }, data: { toggle: :dropdown } do
|
20
|
+
%span.badge.badge-light
|
21
|
+
= @notifications_count
|
22
|
+
.dropdown-menu.dropdown-menu-right{ aria: { labelledby: :notifications_dropdown } }
|
23
|
+
- @notifications.each_with_index do |collection, index|
|
24
|
+
- collection[1].each do |item|
|
25
|
+
= link_to decorator_class(item.class).decorate(item).title, record_path(item, model: item.class), class: 'dropdown-item'
|
26
|
+
- if index < @notifications.count - 1
|
27
|
+
.dropdown-divider
|
18
28
|
%li.nav-item
|
19
29
|
= link_to Tramway::Auth::Engine.routes.url_helpers.session_path, method: :delete, class: 'nav-link' do
|
20
30
|
= fa_icon 'sign-out-alt'
|
data/lib/tramway/admin.rb
CHANGED
@@ -86,6 +86,17 @@ module Tramway
|
|
86
86
|
def get_models_by_key(checked_models, project)
|
87
87
|
checked_models && checked_models != [] && checked_models[project.to_sym] || []
|
88
88
|
end
|
89
|
+
|
90
|
+
def set_notificable_queries(**queries)
|
91
|
+
@notificable_queries ||= {}
|
92
|
+
@notificable_queries.merge! queries
|
93
|
+
end
|
94
|
+
|
95
|
+
def notifications
|
96
|
+
@notificable_queries.reduce({}) do |hash, notification|
|
97
|
+
hash.merge! notification[0] => notification[1].call
|
98
|
+
end
|
99
|
+
end
|
89
100
|
end
|
90
101
|
end
|
91
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.19'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap-kaminari-views
|