tramway-admin 2.0.0.4 → 2.1

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: 632e5dd43c0a3314fabad57036952dc28b1076c332f9d34c88469db3615a70dc
4
- data.tar.gz: 9efd54aee213e9bed5d867f2b64eec6ed049702b26d3aacb36208a329d7a881b
3
+ metadata.gz: cf44b11818abdaef1bd6f416f95ad023990a56a11ab06d89e49a85f0402b2a01
4
+ data.tar.gz: 9699cc4c0adb5f5c3430f4fe39545b889924a60d0cd6ffa353598fb9da50458d
5
5
  SHA512:
6
- metadata.gz: f4ffb4e002ea169573c72e5b14719323e9366d232c68282ab40354fda312109bc9cb7cb042ed5caafeabb39340cc5553e6021b1a3bbe23f45f4bdc1a7487ddb9
7
- data.tar.gz: 223ab421a92f7cd80cc83728736e918440d64fa77e6c902bf77a5e1cc38c6702b882412ca9ad5109457c75104e1d1e8a4719e6f2eb11928a5add7826b4ad2b9d
6
+ metadata.gz: 3a817f9f4833e315496dfaa1fc52e59618aa75d4b44c27a3ae97114b7374501ec5bcf6d8f6e49954b46233f029cd14e169f7adb68cbd0689dc295c785da7b63d
7
+ data.tar.gz: 2c103a0d7de7e31964dc124a0eee8f0620f566ac7e0b0075b309114381cd219c9c0ce8dfaf6a5169956c36ec07d980a56b3d1a9ecddaafefa5349ecf8b5bebc9
@@ -1,17 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway::Admin::AdditionalButtonsBuilder
4
- def build_buttons(additional_buttons)
5
- additional_buttons = additional_buttons.is_a?(Hash) ? [additional_buttons] : additional_buttons
6
- additional_buttons.each do |button|
7
- options = button[:options] || {}
8
- concat(
9
- link_to(
10
- button[:url], method: button[:method], class: "btn btn-#{button[:color]} btn-xs", **options
11
- ) do
12
- button[:text]
13
- end
14
- )
15
- end
4
+ def build_button(button)
5
+ options = button[:options] || {}
6
+ concat(link_to(button[:url], method: button[:method], class: "btn btn-#{button[:color]} btn-xs", **options) do
7
+ button[:inner].call
8
+ end)
16
9
  end
17
10
  end
@@ -1,11 +1,6 @@
1
1
  - default_page_title ||= nil; on_site_link ||= nil
2
2
  - current_title = default_page_title || "#{object.name} | #{model_class.model_name.human.pluralize(:ru)}"
3
3
  - title current_title
4
- -#= content_for :sidebar do
5
- -# - buttons = ::Tramway::Admin.additional_buttons(record: object.model.class, view: :show, project: @application.name)
6
- -# .btn-group-vertical
7
- -# - buttons.each do |button|
8
- -# - build_buttons button.call object
9
4
  .page-header
10
5
  .row
11
6
  .col-md-12
@@ -15,9 +10,9 @@
15
10
  = link_to fa_icon('pencil-alt'), edit_path, class: 'btn btn-warning btn-xs'
16
11
  - if public_path(object)
17
12
  = link_to fa_icon(:share), public_path(object), class: 'btn btn-primary btn-xs'
18
- - buttons = ::Tramway::Admin.additional_buttons(record: object.model.class, view: :show, project: @application.name)
13
+ - buttons = object.additional_buttons[:show]
19
14
  - buttons&.each do |button|
20
- - build_buttons button.call object
15
+ - build_button button
21
16
  %hr
22
17
  .row
23
18
  %table.table.table-striped.table-bordered
data/lib/tramway/admin.rb CHANGED
@@ -5,7 +5,6 @@ require 'tramway/admin/engine'
5
5
  require 'tramway/admin/singleton_models'
6
6
  require 'tramway/admin/records_models'
7
7
  require 'tramway/admin/forms'
8
- require 'tramway/admin/additional_buttons'
9
8
  require 'tramway/admin/notifications'
10
9
  require 'tramway/admin/welcome_page_actions'
11
10
  require 'tramway/admin/navbar'
@@ -20,7 +19,6 @@ module Tramway
20
19
  class << self
21
20
  include ::Tramway::Admin::RecordsModels
22
21
  include ::Tramway::Admin::SingletonModels
23
- include ::Tramway::Admin::AdditionalButtons
24
22
  include ::Tramway::Admin::Forms
25
23
  include ::Tramway::Admin::Notifications
26
24
  include ::Tramway::Admin::WelcomePageActions
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '2.0.0.4'
5
+ VERSION = '2.1'
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: 2.0.0.4
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-07 00:00:00.000000000 Z
11
+ date: 2021-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tramway-core
@@ -296,7 +296,6 @@ files:
296
296
  - config/routes.rb
297
297
  - lib/tasks/tramway/admin_tasks.rake
298
298
  - lib/tramway/admin.rb
299
- - lib/tramway/admin/additional_buttons.rb
300
299
  - lib/tramway/admin/engine.rb
301
300
  - lib/tramway/admin/forms.rb
302
301
  - lib/tramway/admin/generators/install_generator.rb
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tramway::Admin::AdditionalButtons
4
- def set_additional_buttons(buttons, project:)
5
- @additional_buttons ||= {}
6
- @additional_buttons[project] ||= {}
7
- @additional_buttons[project].merge! buttons
8
- end
9
-
10
- def additional_buttons(view: nil, record: nil, project: nil)
11
- @additional_buttons&.with_indifferent_access&.dig project, record, view
12
- end
13
- end