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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48d4bf4069b1910328bf0e8ff72a9853d3e184a1f193a930c4cf4da5a2777207
4
- data.tar.gz: 7b14ef5370479d150e45101de344e7d750226b0210966bcd9d48674db119782b
3
+ metadata.gz: a1d2be1680ef4d50822e106f3835cb14224f26ae8e1825864c1ee012fca4bd22
4
+ data.tar.gz: 71c3ff71e401be1e9bad883ab0d98bcc1887aa18943d8eb4bcc8b7c69fa4b770
5
5
  SHA512:
6
- metadata.gz: d26e2eb93eec1aef81e012308297e1b2a4a2ae0f73fd1fe99e3d9bd6c8e011468fd54731933d58e9c6d1651d335f3c394df42a2006c42364c7409126bc4d6de7
7
- data.tar.gz: 0c7c824a83a3040f9ceec345bd97c21456700efb439bae0ce0380a2e03a0e5a2bfbdbd7c8c0aceb3a23ef54ea1501b3e571559c8eff80c1d75b9f2253f1815d2
6
+ metadata.gz: 227b88443bfeb1a0e3923e96424d8b9e245cd319b4ff77b0939f6c99fb30fe560425325148cdbd20e4c1ab4791e4efac073c8d13fcce01f6b6d6f678158d6782
7
+ data.tar.gz: cb4a7ba86f128fa09790e224cacfb1ea448d043ca4d631f6cfcfcea30b55f7f57d7b6924efeb2ebb8cfbb582cd866c522736549b23b3d6051b6a39eedea03d26
@@ -13,3 +13,12 @@
13
13
 
14
14
  td.actions
15
15
  width: 8rem
16
+
17
+ .icon-in-navbar
18
+ font-size: 15pt
19
+
20
+ .notifications
21
+ a
22
+ margin-right: 25px
23
+ span.badge:hover
24
+ filter: brightness(90%)
@@ -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'
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '1.18.4.4'
5
+ VERSION = '1.19'
6
6
  end
7
7
  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.18.4.4
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-13 00:00:00.000000000 Z
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