tramway-admin 1.32.1.3 → 1.32.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dff80b796cc083c3bd26c9985b3369045d3ea8f983e978dfee3880fc550a443c
4
- data.tar.gz: 15f65fae673edaff024ae501e3bbbbd864536f73cda32f4c79421ea2cbbee1af
3
+ metadata.gz: 12f18ece55fa0e66275d0ace0972d67490dc5396d7003f0ea0f24ab89d3e1be8
4
+ data.tar.gz: 4288cb1d7368b94747ddb238ece0024fca1e6f306a45aaf7c38a8e097b37ecf2
5
5
  SHA512:
6
- metadata.gz: 2f49d2bbc8a8962a5bd8f99ba38715ee78f37c478a7b025adfabb922afaad03b41c8384f1bb3440a7cfa2a486f2d8a4c1f91b7965f49c11b73d853f2c2c03236
7
- data.tar.gz: 2ba60b25129fd4ec52e9d27044fa7f94bf42abd45bd22469f173f8ef30755794bfe6e3d285cbc00428b138939b8764dd54af21d38a404152719eb0a2d284d82f
6
+ metadata.gz: 65a7acba188612cc40301ff7949a4ecd5087154e7ecab8e4d8c9f366a56d2e9d043f3ad17d6e1cb9ac252e60615975a5c71b68f146bdf62edd9ef742d329baf1
7
+ data.tar.gz: 4cd7656172be3b226933b5fc81bb995aef736ba49488398f9680723ebe905954b73bd185765b40b0151cfce42817faac6e8c81f7a03d878e27761fdf9f26ea2f
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Tramway::Admin
1
+ # ![tramway-ico](https://raw.githubusercontent.com/kalashnikovisme/kalashnikovisme/master/%D1%82%D1%80%D1%8D%D0%BC%D0%B2%D1%8D%D0%B9%D0%B1%D0%B5%D0%B7%D1%84%D0%BE%D0%BD%D0%B0-min.png) Tramway::Admin
2
2
 
3
3
  Create admin panel for your application FAST!
4
4
 
@@ -255,6 +255,35 @@ Here docs about changing roles of `Tramway::User::User` model [Readme](https://g
255
255
 
256
256
  ## Associations management
257
257
 
258
+ ### has_many
259
+
260
+ We have models Game and Packs.
261
+
262
+ *app/models/game.rb*
263
+ ```ruby
264
+ class Game < Tramway::Core::ApplicationRecord
265
+ has_many :packs
266
+ end
267
+ ```
268
+
269
+ *app/models/pack.rb*
270
+ ```ruby
271
+ class Pack < Tramway::Core::ApplicationRecord
272
+ belongs_to :game
273
+ end
274
+ ```
275
+
276
+ **You want to manage packs in the Game show admin page**
277
+
278
+ #### 1. Add association to PackDecorator
279
+
280
+ *app/decorators/pack_decorator.rb*
281
+ ```ruby
282
+ class GameDecorator < Tramway::Core::ApplicationDecorator
283
+ decorate_association :packs, as: :game # we recommend you to add association name in Pack model. You need it if association name of Game in Pack is not `game`
284
+ end
285
+ ```
286
+
258
287
  ### has_and_belongs_to_many
259
288
 
260
289
  We have models Game and Packs.
@@ -47,7 +47,7 @@ module Tramway
47
47
  end
48
48
  end
49
49
  end
50
- hash.merge! collection => records.count
50
+ hash.merge! collection => records.send("#{current_admin.role}_scope", current_admin.id).count
51
51
  end
52
52
  end
53
53
 
@@ -14,3 +14,6 @@
14
14
  = hidden_field_tag :redirect, params[:redirect]
15
15
  = f.button :submit, t('helpers.links.save'), class: 'btn-success'
16
16
  = link_to t('helpers.links.back'), current_model_records_path, class: 'btn btn-secondary'
17
+
18
+ -# NOTES
19
+ -# * value_from_params helper is in tramway-core gem app/helpers/inputs_helpers.rb
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '1.32.1.3'
5
+ VERSION = '1.32.1.4'
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.32.1.3
4
+ version: 1.32.1.4
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-10-06 00:00:00.000000000 Z
11
+ date: 2020-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tramway-core