tramway-admin 1.7.2 → 1.7.3

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: 02a617fd538e8d5e62201e5a2901fcf1fef771ebb537168665d737d3d4d68b02
4
- data.tar.gz: 4f6a7d837cf6d6532e872f5b2d8917100a399cf2ee2946a9c815b761b80c121b
3
+ metadata.gz: 5899ca92fe25d67fdd38a4251429d84649d95e4543722771b346845591b64795
4
+ data.tar.gz: de3e2c0d2d1eaadd6eccd41f62eb9928fd626ee18f97d48998dd74b0d878ab54
5
5
  SHA512:
6
- metadata.gz: a7c2d2925c1ea4fd96b7a25d12d807b186325be81d7d21ac2c59665a72cb2f0cbbb7eae33fccff6b367cf5e7c3321cb401b3f507e475a68a6408f2de4d420ba7
7
- data.tar.gz: faad01a28f5b1c7fae432fda57306979df7fe4d7bd3f74c076a36c838966b20019245ff993f62ac2801351b96fd52c53b61e78e33c6ad84202847dd8530cd74e
6
+ metadata.gz: 9dcf04eb6d8e290c1178dedc9c0bacd15e59b03d79b3eac57d6d18b0d2d3b0ab0d91b7ff32a40d47dbedc816fab6234d018ef00fe4ac4b12f2ccc4c46d0fe6b4
7
+ data.tar.gz: 0e0472063b7ec27ef0aa0a00887dbc89bd35a49ebfe64305096653dbd4e2e4fd7cc7119527edeaa56ffd0d082fa2968171647c40d4abdadcdde52bf61e9fde53
@@ -0,0 +1,4 @@
1
+ $ ->
2
+ url = new URL(window.location.href)
3
+ focusElementSelector = url.searchParams.get('focus')
4
+ $(window).scrollTop $(focusElementSelector).offset().top
@@ -9,6 +9,7 @@ module Tramway
9
9
  include ::Tramway::Admin::SingletonHelper
10
10
  include ::Tramway::Admin::NavbarHelper
11
11
  include ::Tramway::Admin::InputsHelper
12
+ include ::Tramway::Admin::FocusGeneratorHelper
12
13
  include ::Tramway::Collections::Helper
13
14
  end
14
15
  end
@@ -0,0 +1,6 @@
1
+ module ::Tramway::Admin::FocusGeneratorHelper
2
+ #FIXME create independent focus generator
3
+ def focus_selector(index)
4
+ "table:nth-child(2)>tbody>tr:nth-child(#{index - 1})"
5
+ end
6
+ end
@@ -8,7 +8,7 @@
8
8
  %th= model_class.human_attribute_name attribute
9
9
  %th= t 'helpers.links.actions'
10
10
  %tbody
11
- - @records.each do |record|
11
+ - @records.each_with_index do |record, index|
12
12
  %tr
13
13
  %td
14
14
  = link_to record.id, current_model_record_path(record.id)
@@ -21,7 +21,7 @@
21
21
  .btn-group{ data: { toggle: :buttons } }
22
22
  - record.model.class.state_machines.keys.each do |state_method|
23
23
  - unless state_method == :state
24
- = state_events_buttons record, state_method: state_method, model_param_name: :record, route_method: :current_model_record_path, parameters: { redirect: current_model_records_path(page: params[:page], scope: params[:scope]) }
24
+ = state_events_buttons record, state_method: state_method, model_param_name: :record, route_method: :current_model_record_path, parameters: { redirect: current_model_records_path(page: params[:page], scope: params[:scope], focus: focus_selector(index)) }
25
25
  = link_to fa_icon(:pencil), edit_current_model_record_path(record.id), class: 'btn btn-warning btn-xs'
26
26
  = link_to fa_icon(:remove), current_model_record_path(record.id), method: :delete, class: 'btn btn-xs btn-danger'
27
27
  = paginate @records, theme: 'twitter-bootstrap-4'
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Admin
3
- VERSION = '1.7.2'
3
+ VERSION = '1.7.3'
4
4
  end
5
5
  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.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-02 00:00:00.000000000 Z
11
+ date: 2018-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-kaminari-views
@@ -205,6 +205,7 @@ files:
205
205
  - app/assets/javascripts/ckeditor/plugins/image/lang/zh.js
206
206
  - app/assets/javascripts/ckeditor/plugins/image/plugin.js
207
207
  - app/assets/javascripts/tramway/admin/application.js.coffee
208
+ - app/assets/javascripts/tramway/admin/focus.js.coffee
208
209
  - app/assets/stylesheets/tramway/admin/application.sass
209
210
  - app/controllers/tramway/admin/application_controller.rb
210
211
  - app/controllers/tramway/admin/records_controller.rb
@@ -212,6 +213,7 @@ files:
212
213
  - app/controllers/tramway/admin/welcome_controller.rb
213
214
  - app/helpers/tramway/admin/additional_buttons_builder.rb
214
215
  - app/helpers/tramway/admin/application_helper.rb
216
+ - app/helpers/tramway/admin/focus_generator_helper.rb
215
217
  - app/helpers/tramway/admin/inputs_helper.rb
216
218
  - app/helpers/tramway/admin/navbar_helper.rb
217
219
  - app/helpers/tramway/admin/records_helper.rb