tramway-admin 1.26.1.1 → 1.26.1.2

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: 261075e424f3e32ae7e9fdcd8dee49effe2bceb4a180ca07276f238a9407df91
4
- data.tar.gz: a8dd65b6dee78514b51f9d2abbfd4243ef0097c928080abe7ca78a10edefb81e
3
+ metadata.gz: 7e74929c977533c46f0275270e00650c217553b733cc05f1fc42efb032a78e58
4
+ data.tar.gz: 1585d1a11659364ac3754bd30ac54fc98b81b1ac97dbf196c22a56e51337b1b6
5
5
  SHA512:
6
- metadata.gz: 84bd41cc6f2945dcc5e1df3f27ed2c8ab0696cfe16816d168b5797d975ee7e75f72d2fb88ebd7d7289952d0a7692c143981a8349efbb676206b996fb4483513c
7
- data.tar.gz: 1297688f9d6bfc72fff4cf04896de67ca411c1e1408bc2b4afe6fb6636313a5cef2a1d792c1bdc62a51999c457053e6b10963586dd45e97fd222f3d658a6fcab
6
+ metadata.gz: a3ae80b23d1c8876b1ad29633a3dc850e5b9acd4382895bbb760356ae99fea480fcd9205bd863423f21fd1d95540f3e61d47468113d6bd5ff58e0ee714300dbf
7
+ data.tar.gz: 1e2c46b96d3694ebcd5a667052929c2941cc2e1a409301fb637671406127f4299bbd3558d8d484afa82836a4ede2edab7181edf26f249b81ea040d64aad9be30
data/README.md CHANGED
@@ -12,6 +12,8 @@ Short description and motivation.
12
12
  ## Usage
13
13
  How to use my plugin.
14
14
 
15
+ #### 1. Add this gems to Gemfile
16
+
15
17
  *Gemfile*
16
18
  ```ruby
17
19
  gem 'tramway-admin'
@@ -24,7 +26,7 @@ gem 'haml-rails'
24
26
  gem 'selectize-rails'
25
27
  gem 'bootstrap'
26
28
  gem 'jquery-rails'
27
- gem 'copyright-mafa'
29
+ gem 'copyright_mafa'
28
30
  gem 'trap'
29
31
  gem 'kaminari'
30
32
  gem 'bootstrap-kaminari-views', github: 'kalashnikovisme/bootstrap-kaminari-views', branch: :master
@@ -34,7 +36,9 @@ gem 'ransack'
34
36
  gem 'smart_buttons'
35
37
  ```
36
38
 
37
- You should remove gem `turbolinks` from your application
39
+ #### 2. You should remove gem `turbolinks` from your application and from app/assets/javascripts/application.js
40
+
41
+ #### 3. Update your routes
38
42
 
39
43
  *config/routes.rb*
40
44
 
@@ -45,26 +49,33 @@ Rails.application.routes.draw do
45
49
  end
46
50
  ```
47
51
 
48
- Then make `tramway-core` installation. [How-to](https://github.com/ulmic/tramway-dev/blob/develop/tramway-core/README.md#installation)
52
+ #### 4. Then make `tramway-core` installation. [How-to](https://github.com/ulmic/tramway-dev/blob/develop/tramway-core/README.md#installation)
53
+
49
54
 
55
+ #### 5. And then execute:
50
56
 
51
- And then execute:
52
57
  ```bash
53
58
  $ bundle
54
59
  $ rails g tramway:user:install
55
60
  $ rails db:migrate
61
+ ```
56
62
 
57
- # Creating your first admin user
63
+ #### 6. Create your first admin user
58
64
 
65
+ ```bash
59
66
  $ rails c
60
67
  $> Tramway::User::User.create! email: 'your@email.com', password: '123456789', role: :admin
61
68
  ```
62
69
 
70
+ #### 7. Add models to your admin
71
+
63
72
  *app/config/initializers/tramway.rb*
64
73
 
65
74
  ```ruby
66
75
  # set available models for your admin
67
- ::Tramway::Admin.set_available_models list_of_models, project: #{project_name_which_you_used_in_application_name}
76
+ ::Tramway::Admin.set_available_models YourModel, AnotherYourModel, project: #{project_name_which_you_used_in_application_name}
77
+ # set singleton models for your admin
78
+ ::Tramway::Admin.set_singleton_models YourSingletonModel, AnotherYourSingletonModel, project: #{project_name_which_you_used_in_application_name}
68
79
  ::Tramway::Auth.root_path = '/admin' # you need it to redirect in the admin panel after admin signed_in
69
80
  ```
70
81
 
@@ -100,8 +111,8 @@ You can set conditions for functions which are available for any role:
100
111
 
101
112
  Here docs about changing roles of `Tramway::User::User` model [Readme](https://github.com/ulmic/tramway-dev/tree/develop/tramway#if-you-want-to-edit-roles-to-the-tramwayuseruser-class)
102
113
 
103
- Run server `rails s`
104
- Launch `localhost:3000/admin`
114
+ #### 8. Run server `rails s`
115
+ #### 9. Launch `localhost:3000/admin`
105
116
 
106
117
  ## Date Picker locale
107
118
 
@@ -0,0 +1,8 @@
1
+ //= require tramway/core/application
2
+ //= require jquery
3
+ //= require jquery_ujs
4
+ //= require popper
5
+ //= require bootstrap-sprockets
6
+ //= require ckeditor/init
7
+ //= require selectize
8
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ $(document).ready(function() {
2
+ const url = new URL(window.location.href);
3
+ const focusElementSelector = url.searchParams.get('focus');
4
+ if (!$(focusElementSelector).offset() == undefined) {
5
+ $(window).scrollTop($(focusElementSelector).offset().top);
6
+ }
7
+ });
@@ -51,7 +51,7 @@ module Tramway
51
51
  end
52
52
 
53
53
  def notifications_count
54
- @notifications_count = notifications.reduce(0) do |count, notification|
54
+ @notifications_count = notifications&.reduce(0) do |count, notification|
55
55
  count += notification[1].count
56
56
  end
57
57
  end
@@ -32,22 +32,23 @@
32
32
 
33
33
  %ul.nav.navbar-nav.ml-auto
34
34
  - if signed_in?
35
- - if @notifications_count > 0
36
- %li.nav-item.dropdown.notifications
37
- = link_to '#', class: 'nav-link icon-in-navbar dropdown-toggle', id: :notifications_dropdown, role: :button, aria: { haspopup: true, expanded: false }, data: { toggle: :dropdown } do
38
- %span.badge.badge-light
39
- = @notifications_count
40
- .dropdown-menu.dropdown-menu-right{ aria: { labelledby: :notifications_dropdown } }
41
- - @notifications.each_with_index do |collection, index|
42
- - collection[1].each do |item|
43
- = link_to decorator_class(item.class).decorate(item).title, record_path(item, model: item.class), class: 'dropdown-item'
44
- - if index < @notifications.count - 1
45
- .dropdown-divider
46
- - else
47
- %li.nav-item.notifications
48
- = link_to '#', class: 'nav-link icon-in-navbar' do
49
- %span.badge.badge-light
50
- = @notifications_count
35
+ - if @notifications_count.present?
36
+ - if @notifications_count > 0
37
+ %li.nav-item.dropdown.notifications
38
+ = link_to '#', class: 'nav-link icon-in-navbar dropdown-toggle', id: :notifications_dropdown, role: :button, aria: { haspopup: true, expanded: false }, data: { toggle: :dropdown } do
39
+ %span.badge.badge-light
40
+ = @notifications_count
41
+ .dropdown-menu.dropdown-menu-right{ aria: { labelledby: :notifications_dropdown } }
42
+ - @notifications.each_with_index do |collection, index|
43
+ - collection[1].each do |item|
44
+ = link_to decorator_class(item.class).decorate(item).title, record_path(item, model: item.class), class: 'dropdown-item'
45
+ - if index < @notifications.count - 1
46
+ .dropdown-divider
47
+ - else
48
+ %li.nav-item.notifications
49
+ = link_to '#', class: 'nav-link icon-in-navbar' do
50
+ %span.badge.badge-light
51
+ = @notifications_count
51
52
  %li.nav-item
52
53
  = link_to Tramway::Auth::Engine.routes.url_helpers.session_path, method: :delete, class: 'nav-link' do
53
54
  = fa_icon 'sign-out-alt'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '1.26.1.1'
5
+ VERSION = '1.26.1.2'
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.26.1.1
4
+ version: 1.26.1.2
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-03-03 00:00:00.000000000 Z
11
+ date: 2020-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-kaminari-views
@@ -28,20 +28,20 @@ dependencies:
28
28
  name: copyright_mafa
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.1.2
34
- - - "~>"
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: 0.1.2
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ">="
41
+ - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.1.2
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 0.1.2
47
47
  - !ruby/object:Gem::Dependency
@@ -68,20 +68,20 @@ dependencies:
68
68
  name: kaminari
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - ">="
71
+ - - "~>"
72
72
  - !ruby/object:Gem::Version
73
73
  version: 1.1.1
74
- - - "~>"
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: 1.1.1
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: 1.1.1
84
- - - "~>"
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: 1.1.1
87
87
  - !ruby/object:Gem::Dependency
@@ -177,8 +177,8 @@ files:
177
177
  - app/assets/javascripts/ckeditor/plugins/youtube/lang/en.js
178
178
  - app/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js
179
179
  - app/assets/javascripts/ckeditor/plugins/youtube/plugin.js
180
- - app/assets/javascripts/tramway/admin/application.js.coffee
181
- - app/assets/javascripts/tramway/admin/focus.js.coffee
180
+ - app/assets/javascripts/tramway/admin/application.js
181
+ - app/assets/javascripts/tramway/admin/focus.js
182
182
  - app/assets/stylesheets/tramway/admin/application.sass
183
183
  - app/controllers/tramway/admin/application_controller.rb
184
184
  - app/controllers/tramway/admin/records_controller.rb
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
257
  requirements: []
258
- rubygems_version: 3.0.3
258
+ rubygems_version: 3.1.2
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: Engine for admin
@@ -1,8 +0,0 @@
1
- #= require tramway/core/application
2
- #= require jquery
3
- #= require jquery_ujs
4
- #= require popper
5
- #= require bootstrap-sprockets
6
- #= require ckeditor/init
7
- #= require selectize
8
- #= require_tree .
@@ -1,5 +0,0 @@
1
- $ ->
2
- url = new URL(window.location.href)
3
- focusElementSelector = url.searchParams.get('focus')
4
- unless $(focusElementSelector).offset() == undefined
5
- $(window).scrollTop $(focusElementSelector).offset().top