thecore_ui_rails_admin 2.6.0 → 2.6.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: 3d9ea4f97bd820e0527837c48c1ca0a838f007cfa10041031f2324593995d86f
4
- data.tar.gz: c6d6a9646ebdb8ecf535b3d063d79e6ef4b013e5ba32a5379840cb4a87ef48f2
3
+ metadata.gz: 04736c5239fe4dcaa93fb9ef47d3dfee0655a5fd7d85c30af9c824bdd94544dd
4
+ data.tar.gz: 6295df358ee18ba3e0347ccef72c41e1839e3a4d44609cebb3121695acf981a8
5
5
  SHA512:
6
- metadata.gz: c0fea64c936129bdd45e995567956e8dc7aaaa5e956e859bca603ce0fe1c88a7fbbd4e10db79c7f28e35fd3a541e4df8e57923056a02cbf5e6ca16ce3435aa14
7
- data.tar.gz: 48d3f7282e701c1cf5ba01e2c7fb047efb0c33d7b0035533f0de12fa833ccbb48149a7c44bb76a4475f67bf912bbf0e2f090b6b4f7429ff9593617cb73f1a448
6
+ metadata.gz: 8e5b01857e292611c648f98034148379edef7ce579509c400fb63b8664b2872baa68b2fc2de7a314b803a39c9a2330ed7da773d5441076bb4ea8e8180b252a5e
7
+ data.tar.gz: 40cd1f2efc9ae07e9aa5f60b2205bd0755b8477e5e85eedf3fd2e286b852ecf5d36ae0067bc32198dea7df45bfa4c0a5c5a1c3d9f68ce98d7fd73cf087cea042
@@ -16,13 +16,18 @@ function hideBreadCrumbAndToolbar() {
16
16
 
17
17
  // console.log(actionName, isRoot)
18
18
 
19
- if($(".hide-breadcrumb").length) $(".breadcrumb").hide()
19
+ if ($(".hide-breadcrumb").length) $(".breadcrumb").hide()
20
20
  else $(".breadcrumb").show()
21
21
 
22
- if($(".hide-toolbar").length) $(".breadcrumb + .nav.nav-tabs").hide()
22
+ if ($(".hide-toolbar").length) $(".breadcrumb + .nav.nav-tabs").hide()
23
23
  else $(".breadcrumb + .nav.nav-tabs").show()
24
24
  }
25
25
 
26
+
27
+ function adjustIframe(obj) {
28
+ obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
29
+ }
30
+
26
31
  // Re evaluate at each iteraction
27
32
  $(document).off('ready pjax:success', hideBreadCrumbAndToolbar);
28
33
  $(document).on('ready pjax:success', hideBreadCrumbAndToolbar);
@@ -0,0 +1,3 @@
1
+ <iframe class="thecore-blazer-bi" src="/blazer" title="Business Intelligence" frameborder="0"
2
+ allow="accelerometer; clipboard-write; encrypted-media; gyroscope;" allowfullscreen style="width:100%; min-height:70vh"
3
+ scrolling="no" onload="adjustIframe(this)"></iframe>
@@ -0,0 +1,3 @@
1
+ <iframe class="sidekiq-monitor" src="/sidekiq" title="Background Processes Monitor" frameborder="0"
2
+ allow="accelerometer; clipboard-write; encrypted-media; gyroscope;" allowfullscreen style="width:100%;"
3
+ scrolling="no" onload="adjustIframe(this)"></iframe>
data/config/blazer.yml ADDED
@@ -0,0 +1,79 @@
1
+ # see https://github.com/ankane/blazer for more info
2
+
3
+ data_sources:
4
+ main:
5
+ url: <%= ENV["BLAZER_DATABASE_URL"] %>
6
+
7
+ # statement timeout, in seconds
8
+ # none by default
9
+ # timeout: 15
10
+
11
+ # caching settings
12
+ # can greatly improve speed
13
+ # off by default
14
+ # cache:
15
+ # mode: slow # or all
16
+ # expires_in: 60 # min
17
+ # slow_threshold: 15 # sec, only used in slow mode
18
+
19
+ # wrap queries in a transaction for safety
20
+ # not necessary if you use a read-only user
21
+ # true by default
22
+ # use_transaction: false
23
+
24
+ smart_variables:
25
+ # zone_id: "SELECT id, name FROM zones ORDER BY name ASC"
26
+ # period: ["day", "week", "month"]
27
+ # status: {0: "Active", 1: "Archived"}
28
+
29
+ linked_columns:
30
+ # user_id: "/admin/users/{value}"
31
+
32
+ smart_columns:
33
+ # user_id: "SELECT id, name FROM users WHERE id IN {value}"
34
+
35
+ # create audits
36
+ audit: true
37
+
38
+ # change the time zone
39
+ # time_zone: "Pacific Time (US & Canada)"
40
+
41
+ # class name of the user model
42
+ # user_class: User
43
+
44
+ # method name for the current user
45
+ # user_method: current_user
46
+
47
+ # method name for the display name
48
+ # user_name: name
49
+
50
+ # custom before_action to use for auth
51
+ # before_action_method: require_admin
52
+
53
+ # email to send checks from
54
+ # from_email: blazer@example.org
55
+
56
+ # webhook for Slack
57
+ # slack_webhook_url: <%= ENV["BLAZER_SLACK_WEBHOOK_URL"] %>
58
+
59
+ check_schedules:
60
+ - "1 day"
61
+ - "1 hour"
62
+ - "5 minutes"
63
+
64
+ # enable anomaly detection
65
+ # note: with trend, time series are sent to https://trendapi.org
66
+ # anomaly_checks: prophet / trend / anomaly_detection
67
+
68
+ # enable forecasting
69
+ # note: with trend, time series are sent to https://trendapi.org
70
+ # forecasting: prophet / trend
71
+
72
+ # enable map
73
+ # mapbox_access_token: <%= ENV["MAPBOX_ACCESS_TOKEN"] %>
74
+
75
+ # enable uploads
76
+ # uploads:
77
+ # url: <%= ENV["BLAZER_UPLOADS_URL"] %>
78
+ # schema: uploads
79
+ # data_source: main
@@ -0,0 +1,7 @@
1
+
2
+ RailsAdmin.config do |config|
3
+ config.actions do
4
+ thecore_sidekiq_monitor
5
+ thecore_blazer_bi
6
+ end
7
+ end
@@ -7,9 +7,25 @@ RailsAdmin.config do |config|
7
7
 
8
8
  config.main_app_name = Proc.new { |controller| [ ((ENV["APP_NAME"].presence || Settings.app_name.presence) rescue "Thecore"), "" ] }
9
9
  # Link for background Job
10
- (config.navigation_static_links ||= {}).merge! "Background Monitor" => "#{ENV["BACKEND_URL"].presence || "http://localhost:3000"}/sidekiq"
10
+ # (config.navigation_static_links ||= {}).merge! "Background Monitor" => "#{ENV["BACKEND_URL"].presence || "http://localhost:3000"}/sidekiq"
11
11
 
12
12
  ### Popular gems integration
13
+ config.model "Blazer::Audit" do
14
+ visible false
15
+ end
16
+ config.model "Blazer::Check" do
17
+ visible false
18
+ end
19
+ config.model "Blazer::Dashboard" do
20
+ visible false
21
+ end
22
+ config.model "Blazer::DashboardQuery" do
23
+ visible false
24
+ end
25
+ config.model "Blazer::Query" do
26
+ visible false
27
+ end
28
+
13
29
  config.model "RoleUser" do
14
30
  visible false
15
31
  end
@@ -15,4 +15,4 @@ Rails.application.configure do
15
15
  Role.send(:include, ThecoreUiRailsAdminRole)
16
16
  Permission.send(:include, ThecoreUiRailsAdminPermission)
17
17
  end
18
- end
18
+ end
@@ -19,6 +19,14 @@ it:
19
19
  object_not_found: "Impossibile trovare il modello %{model} con id '%{id}'"
20
20
  successful: "Azione eseguita con successo: %{action} (%{name})"
21
21
  actions:
22
+ thecore_sidekiq_monitor:
23
+ menu: Monitoraggio Attività
24
+ breadcrumb: Monitoraggio Attività
25
+ title: Monitoraggio Attività
26
+ thecore_blazer_bi:
27
+ menu: Business Intelligence
28
+ breadcrumb: Business Intelligence
29
+ title: Business Intelligence
22
30
  index:
23
31
  link: Mostra tutti gli Elementi
24
32
  label: "Impostazioni"
data/config/routes.rb CHANGED
@@ -9,4 +9,9 @@ Rails.application.routes.draw do
9
9
  devise_scope :user do
10
10
  root to: "devise/sessions#new"
11
11
  end
12
+
13
+ # Allow any authenticated User with admin capability
14
+ authenticate :user, lambda { |u| u.admin? } do
15
+ mount Blazer::Engine, at: "blazer"
16
+ end
12
17
  end
@@ -0,0 +1,47 @@
1
+ class InstallBlazer < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :blazer_queries do |t|
4
+ t.references :creator
5
+ t.string :name
6
+ t.text :description
7
+ t.text :statement
8
+ t.string :data_source
9
+ t.string :status
10
+ t.timestamps null: false
11
+ end
12
+
13
+ create_table :blazer_audits do |t|
14
+ t.references :user
15
+ t.references :query
16
+ t.text :statement
17
+ t.string :data_source
18
+ t.datetime :created_at
19
+ end
20
+
21
+ create_table :blazer_dashboards do |t|
22
+ t.references :creator
23
+ t.string :name
24
+ t.timestamps null: false
25
+ end
26
+
27
+ create_table :blazer_dashboard_queries do |t|
28
+ t.references :dashboard
29
+ t.references :query
30
+ t.integer :position
31
+ t.timestamps null: false
32
+ end
33
+
34
+ create_table :blazer_checks do |t|
35
+ t.references :creator
36
+ t.references :query
37
+ t.string :state
38
+ t.string :schedule
39
+ t.text :emails
40
+ t.text :slack_channels
41
+ t.string :check_type
42
+ t.text :message
43
+ t.datetime :last_run_at
44
+ t.timestamps null: false
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,59 @@
1
+ puts "Loading Sidekiq Monitor File"
2
+ require 'rails_admin/config/actions'
3
+
4
+ module RailsAdmin
5
+ module Config
6
+ module Actions
7
+ class ThecoreBlazerBi < Base
8
+ RailsAdmin::Config::Actions.register(self)
9
+ register_instance_option :object_level do
10
+ false
11
+ end
12
+ # This ensures the action only shows up for Users
13
+ register_instance_option :visible? do
14
+ # visible only if authorized and if the object has a defined method
15
+ authorized? #&& bindings[:abstract_model].model == ThecoreSpotItemsImporterXl && bindings[:abstract_model].model.column_names.include?('barcode')
16
+ end
17
+ # We want the action on members, not the Users collection
18
+ register_instance_option :member do
19
+ false
20
+ end
21
+
22
+ register_instance_option :collection do
23
+ false
24
+ end
25
+ register_instance_option :root? do
26
+ true
27
+ end
28
+
29
+ register_instance_option :breadcrumb_parent do
30
+ [nil]
31
+ end
32
+
33
+ register_instance_option :link_icon do
34
+ 'fa fa-line-chart'
35
+ end
36
+
37
+ register_instance_option :show_in_sidebar do
38
+ true
39
+ end
40
+
41
+ # You may or may not want pjax for your action
42
+ register_instance_option :pjax? do
43
+ true
44
+ end
45
+
46
+ register_instance_option :http_methods do
47
+ [:get]
48
+ end
49
+ # Adding the controller which is needed to compute calls from the ui
50
+ register_instance_option :controller do
51
+ proc do # This is needed because we need that this code is re-evaluated each time is called
52
+
53
+ puts "Loading Blazer BI Controller"
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,59 @@
1
+ puts "Loading Sidekiq Monitor File"
2
+ require 'rails_admin/config/actions'
3
+
4
+ module RailsAdmin
5
+ module Config
6
+ module Actions
7
+ class ThecoreSidekiqMonitor < Base
8
+ RailsAdmin::Config::Actions.register(self)
9
+ register_instance_option :object_level do
10
+ false
11
+ end
12
+ # This ensures the action only shows up for Users
13
+ register_instance_option :visible? do
14
+ # visible only if authorized and if the object has a defined method
15
+ authorized? #&& bindings[:abstract_model].model == ThecoreSpotItemsImporterXl && bindings[:abstract_model].model.column_names.include?('barcode')
16
+ end
17
+ # We want the action on members, not the Users collection
18
+ register_instance_option :member do
19
+ false
20
+ end
21
+
22
+ register_instance_option :collection do
23
+ false
24
+ end
25
+ register_instance_option :root? do
26
+ true
27
+ end
28
+
29
+ register_instance_option :breadcrumb_parent do
30
+ [nil]
31
+ end
32
+
33
+ register_instance_option :link_icon do
34
+ 'fa fa-caret-square-o-right'
35
+ end
36
+
37
+ register_instance_option :show_in_sidebar do
38
+ true
39
+ end
40
+
41
+ # You may or may not want pjax for your action
42
+ register_instance_option :pjax? do
43
+ true
44
+ end
45
+
46
+ register_instance_option :http_methods do
47
+ [:get]
48
+ end
49
+ # Adding the controller which is needed to compute calls from the ui
50
+ register_instance_option :controller do
51
+ proc do # This is needed because we need that this code is re-evaluated each time is called
52
+
53
+ puts "Loading Sidekiq Monitor Controller"
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -21,6 +21,8 @@ require 'concerns/thecore_ui_rails_admin_permission'
21
21
  require 'concerns/thecore_rails_admin_export_concern'
22
22
  require 'concerns/thecore_rails_admin_bulk_delete_concern'
23
23
 
24
+ require 'blazer'
25
+
24
26
  require "thecore_ui_rails_admin/engine"
25
27
 
26
28
  module ThecoreUiRailsAdmin
@@ -28,3 +30,7 @@ module ThecoreUiRailsAdmin
28
30
  SafeYAML::OPTIONS[:default_mode] = :safe
29
31
  SafeYAML::OPTIONS[:deserialize_symbols] = false
30
32
  end
33
+
34
+ puts "Loading Root Monitor Libraries"
35
+ require 'iframes/sidekiq_monitor'
36
+ require 'iframes/blazer_bi'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_rails_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-20 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_ui_commons
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '2.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: blazer
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: Holds all base dependencies and configurations to have a thecore integrated
126
140
  with Rails Admin.
127
141
  email:
@@ -141,7 +155,6 @@ files:
141
155
  - app/assets/javascripts/rails_admin/custom/thecore-custom-5.js
142
156
  - app/assets/javascripts/rails_admin/custom/thecore.js
143
157
  - app/assets/javascripts/rails_admin/custom/ui.js
144
- - app/assets/javascripts/rails_admin/ra.widgets.coffee.older
145
158
  - app/assets/javascripts/thecore_ui_rails_admin/thecore_rails_admin.js
146
159
  - app/assets/stylesheets/rails_admin/custom/theming-custom-1.scss
147
160
  - app/assets/stylesheets/rails_admin/custom/theming-custom-2.scss
@@ -162,15 +175,11 @@ files:
162
175
  - app/controllers/pages_controller.rb
163
176
  - app/helpers/devise_bootstrap_errors_helper.rb
164
177
  - app/helpers/thecore_helper.rb
165
- - app/views/layouts.old/rails_admin/_navigation.html.haml
166
- - app/views/layouts.old/rails_admin/_secondary_navigation.html.haml
167
- - app/views/layouts.old/rails_admin/_sidebar_navigation.html.haml
168
- - app/views/layouts.old/rails_admin/_style_common.html.haml
169
- - app/views/layouts.old/rails_admin/_style_override.html.haml
170
- - app/views/layouts.old/rails_admin/_user_navigation.html.haml
171
- - app/views/layouts.old/rails_admin/application.html.haml
172
- - app/views/layouts.old/rails_admin/pjax.html.haml
178
+ - app/views/rails_admin/main/thecore_blazer_bi.html.erb
179
+ - app/views/rails_admin/main/thecore_sidekiq_monitor.html.erb
173
180
  - app/views/shared/_flash.html.erb
181
+ - config/blazer.yml
182
+ - config/initializers/load_root_actions_for_thecore_ui_rails_admin.rb
174
183
  - config/initializers/rails_admin.rb
175
184
  - config/initializers/thecore_concern.rb
176
185
  - config/initializers/thecore_ui_rails_admin_app_configs.rb
@@ -183,6 +192,7 @@ files:
183
192
  - config/locales/it.rails_admin.yml
184
193
  - config/locales/it.rollincode.yml
185
194
  - config/routes.rb
195
+ - db/migrate/20220124113739_install_blazer.rb
186
196
  - db/seeds.rb
187
197
  - lib/abilities/thecore_ui_rails_admin.rb
188
198
  - lib/concerns/rails_admin_requirements.rb
@@ -192,6 +202,8 @@ files:
192
202
  - lib/concerns/thecore_ui_rails_admin_role.rb
193
203
  - lib/concerns/thecore_ui_rails_admin_used_token.rb
194
204
  - lib/concerns/thecore_ui_rails_admin_user.rb
205
+ - lib/iframes/blazer_bi.rb
206
+ - lib/iframes/sidekiq_monitor.rb
195
207
  - lib/tasks/thecore_ui_rails_admin_tasks.rake
196
208
  - lib/thecore_ui_rails_admin.rb
197
209
  - lib/thecore_ui_rails_admin/engine.rb
@@ -1,233 +0,0 @@
1
- $(document).on 'rails_admin.dom_ready', (e, content) ->
2
- content = if content then content else $('form')
3
-
4
- if content.length # don't waste time otherwise
5
-
6
- # colorpicker
7
-
8
- content.find('[data-color]').each ->
9
- that = this
10
- $(this).ColorPicker
11
- color: $(that).val()
12
- onShow: (el) ->
13
- $(el).fadeIn(500)
14
- false
15
- onHide: (el) ->
16
- $(el).fadeOut(500)
17
- false
18
- onChange: (hsb, hex, rgb) ->
19
- $(that).val(hex)
20
- $(that).css('backgroundColor', '#' + hex)
21
-
22
- # datetime picker datepicker timepicker datetimepicker
23
- $.fn.datetimepicker.defaults.icons =
24
- time: 'fa fa-clock-o'
25
- date: 'fa fa-calendar'
26
- up: 'fa fa-chevron-up'
27
- down: 'fa fa-chevron-down'
28
- previous: 'fa fa-chevron-left'
29
- next: 'fa fa-chevron-right'
30
- today: 'fa fa-calendar-check-o'
31
- clear: 'fa fa-trash'
32
- close: 'fa fa-times'
33
-
34
- content.find('[data-datetimepicker]').each ->
35
- options = $(this).data('options')
36
- $.extend(options, {locale: RailsAdmin.I18n.locale})
37
- $(this).datetimepicker options
38
-
39
- # enumeration
40
-
41
- content.find('[data-enumeration]').each ->
42
- if $(this).is('[multiple]')
43
- $(this).filteringMultiselect $(this).data('options')
44
- else
45
- $(this).filteringSelect $(this).data('options')
46
-
47
- # fileupload
48
-
49
- content.find('[data-fileupload]').each ->
50
- input = this
51
- $(this).on 'click', ".delete input[type='checkbox']", ->
52
- $(input).children('.toggle').toggle('slow')
53
-
54
- # fileupload-preview
55
-
56
- content.find('[data-fileupload]').change ->
57
- input = this
58
- image_container = $("#" + input.id).parent().children(".preview")
59
- unless image_container.length
60
- image_container = $("#" + input.id).parent().prepend($('<img />').addClass('preview').addClass('img-thumbnail')).find('img.preview')
61
- image_container.parent().find('img:not(.preview)').hide()
62
- ext = $("#" + input.id).val().split('.').pop().toLowerCase()
63
- if input.files and input.files[0] and $.inArray(ext, ['gif', 'png', 'jpg', 'jpeg', 'bmp']) != -1
64
- reader = new FileReader()
65
- reader.onload = (e) ->
66
- image_container.attr "src", e.target.result
67
- reader.readAsDataURL input.files[0]
68
- image_container.show()
69
- else
70
- image_container.hide()
71
-
72
- # filtering-multiselect
73
-
74
- content.find('[data-filteringmultiselect]').each ->
75
- $(this).filteringMultiselect $(this).data('options')
76
- if $(this).parents("#modal").length # hide link if we already are inside a dialog (endless issues on nested dialogs with JS)
77
- $(this).siblings('.btn').remove()
78
- else
79
- $(this).parents('.control-group').first().remoteForm()
80
-
81
- # filtering-select
82
-
83
- content.find('[data-filteringselect]').each ->
84
- $(this).filteringSelect $(this).data('options')
85
- if $(this).parents("#modal").length # hide link if we already are inside a dialog (endless issues on nested dialogs with JS)
86
- $(this).siblings('.btn').remove()
87
- else
88
- $(this).parents('.control-group').first().remoteForm()
89
-
90
- # nested-many
91
-
92
- content.find('[data-nestedmany]').each ->
93
- field = $(this).parents('.control-group').first()
94
- nav = field.find('> .controls > .nav')
95
- tab_content = field.find('> .tab-content')
96
- toggler = field.find('> .controls > .btn-group > .toggler')
97
- # add each nested field to a tab-pane and reference it in the nav
98
- tab_content.children('.fields:not(.tab-pane)').addClass('tab-pane').each ->
99
- $(this).attr('id', 'unique-id-' + (new Date().getTime()) + Math.floor(Math.random() * 100000)) # some elements are created on the same ms
100
- nav.append('<li><a data-toggle="tab" href="#' + this.id + '">' + $(this).children('.object-infos').data('object-label') + '</a></li>')
101
- # only if no tab is set to active
102
- if nav.find("> li.active").length == 0
103
- # init first tab, toggler and tab_content/tabs visibility
104
- nav.find("> li > a[data-toggle='tab']:first").tab('show')
105
- if nav.children().length == 0
106
- nav.hide()
107
- tab_content.hide()
108
- toggler.addClass('disabled').removeClass('active').children('i').addClass('icon-chevron-right')
109
- else
110
- if toggler.hasClass('active')
111
- nav.show()
112
- tab_content.show()
113
- toggler.children('i').addClass('icon-chevron-down')
114
- else
115
- nav.hide()
116
- tab_content.hide()
117
- toggler.children('i').addClass('icon-chevron-right')
118
-
119
- # nested-one
120
-
121
- content.find('[data-nestedone]').each ->
122
- field = $(this).parents('.control-group').first()
123
- nav = field.find("> .controls > .nav")
124
- tab_content = field.find("> .tab-content")
125
- toggler = field.find('> .controls > .btn-group > .toggler')
126
- tab_content.children(".fields:not(.tab-pane)").addClass('tab-pane active').each ->
127
- # Convert the "add nested field" button to just showing the title of the new model
128
- field.find('> .controls .add_nested_fields').removeClass('add_nested_fields').html($(this).children('.object-infos').data('object-label'))
129
- nav.append('<li><a data-toggle="tab" href="#' + this.id + '">' + $(this).children('.object-infos').data('object-label') + '</a></li>')
130
- first_tab = nav.find("> li > a[data-toggle='tab']:first")
131
- first_tab.tab('show')
132
- field.find("> .controls > [data-target]:first").html('<i class="icon-white"></i> ' + first_tab.html())
133
- nav.hide()
134
- if nav.children().length == 0
135
- nav.hide()
136
- tab_content.hide()
137
- toggler.addClass('disabled').removeClass('active').children('i').addClass('icon-chevron-right')
138
- else
139
- if toggler.hasClass('active')
140
- toggler.children('i').addClass('icon-chevron-down')
141
- tab_content.show()
142
- else
143
- toggler.children('i').addClass('icon-chevron-right')
144
- tab_content.hide()
145
-
146
- # polymorphic-association
147
-
148
- content.find('[data-polymorphic]').each ->
149
- type_select = $(this)
150
- field = type_select.parents('.control-group').first()
151
- object_select = field.find('select').last()
152
- urls = type_select.data('urls')
153
- type_select.on 'change', (e) ->
154
- if $(this).val() is ''
155
- object_select.html('<option value=""></option>')
156
- else
157
- $.ajax
158
- url: urls[type_select.val()]
159
- data:
160
- compact: true
161
- all: true
162
- beforeSend: (xhr) ->
163
- xhr.setRequestHeader("Accept", "application/json")
164
- success: (data, status, xhr) ->
165
- html = $('<option></option>')
166
- $(data).each (i, el) ->
167
- option = $('<option></option>')
168
- option.attr('value', el.id)
169
- option.text(el.label)
170
- html = html.add(option)
171
- object_select.html(html)
172
-
173
- # ckeditor
174
-
175
- goCkeditors = ->
176
- content.find('[data-richtext=ckeditor]').not('.ckeditored').each (index, domEle) ->
177
- try
178
- if instance = window.CKEDITOR.instances[this.id]
179
- instance.destroy(true)
180
- window.CKEDITOR.replace(this, $(this).data('options'))
181
- $(this).addClass('ckeditored')
182
-
183
- $editors = content.find('[data-richtext=ckeditor]').not('.ckeditored')
184
- if $editors.length
185
- if not window.CKEDITOR
186
- options = $editors.first().data('options')
187
- window.CKEDITOR_BASEPATH = options['base_location']
188
- $.getScript options['jspath'], (script, textStatus, jqXHR) =>
189
- goCkeditors()
190
- else
191
- goCkeditors()
192
-
193
- #codemirror
194
-
195
- goCodeMirrors = (array) =>
196
- array.each (index, domEle) ->
197
- options = $(this).data('options')
198
- textarea = this
199
- $.getScript options['locations']['mode'], (script, textStatus, jqXHR) ->
200
- $('head').append('<link href="' + options['locations']['theme'] + '" rel="stylesheet" media="all" type="text\/css">')
201
- CodeMirror.fromTextArea(textarea, options['options'])
202
- $(textarea).addClass('codemirrored')
203
-
204
- array = content.find('[data-richtext=codemirror]').not('.codemirrored')
205
- if array.length
206
- @array = array
207
- if not window.CodeMirror
208
- options = $(array[0]).data('options')
209
- $('head').append('<link href="' + options['csspath'] + '" rel="stylesheet" media="all" type="text\/css">')
210
- $.getScript options['jspath'], (script, textStatus, jqXHR) =>
211
- goCodeMirrors(@array)
212
- else
213
- goCodeMirrors(@array)
214
-
215
- # bootstrap_wysihtml5
216
-
217
- goBootstrapWysihtml5s = (array, config_options) =>
218
- array.each ->
219
- $(@).addClass('bootstrap-wysihtml5ed')
220
- $(@).closest('.controls').addClass('well')
221
- $(@).wysihtml5(config_options)
222
-
223
- array = content.find('[data-richtext=bootstrap-wysihtml5]').not('.bootstrap-wysihtml5ed')
224
- if array.length
225
- @array = array
226
- options = $(array[0]).data('options')
227
- config_options = $.parseJSON(options['config_options'])
228
- if not window.wysihtml5
229
- $('head').append('<link href="' + options['csspath'] + '" rel="stylesheet" media="all" type="text\/css">')
230
- $.getScript options['jspath'], (script, textStatus, jqXHR) =>
231
- goBootstrapWysihtml5s(@array, config_options)
232
- else
233
- goBootstrapWysihtml5s(@array, config_options)
@@ -1,13 +0,0 @@
1
- -# .container-fluid
2
- -# .navbar-header
3
- -# %button.navbar-toggle.collapsed{ type: 'button', data: { toggle: 'collapse', target: '#secondary-navigation' }, aria: {expanded: 'false', controls: 'navbar'} }
4
- -# %span.sr-only= t('admin.toggle_navigation')
5
- -# %span.icon-bar
6
- -# %span.icon-bar
7
- -# %span.icon-bar
8
- -# - # Added support for app name setting (falling back if not existing to standard rails_admin behaviour)
9
- -# %a.navbar-brand.pjax{href: dashboard_path}
10
- -# = Settings.app_name rescue (_get_plugin_name[0] || 'Rails')
11
- -# %small= _get_plugin_name[1] || 'Admin'
12
- -# .navbar-collapse.collapse#secondary-navigation
13
- -# = render partial: 'layouts/rails_admin/secondary_navigation'
@@ -1,3 +0,0 @@
1
- -# %ul.sidebar-nav
2
- - actions(:root).each do |action|
3
- %li= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: action.pjax? ? "pjax" : "", style: "padding-left: 0px;text-indent:20px"
@@ -1,4 +0,0 @@
1
- -# %ul.sidebar-nav
2
- = main_navigation
3
- -# %ul.sidebar-nav
4
- = static_navigation
@@ -1,4 +0,0 @@
1
- %style{media: "screen"}
2
- div#sidebar-wrapper div.sidebar-nav li.dropdown-header {padding-left: 0px}
3
- div.sub-menu-container li.sub-menu a.pjax {padding-left: 0px}
4
- div#wrapper div#sidebar-wrapper {overflow: hidden}
@@ -1 +0,0 @@
1
- -# Placeholder to be overridden for special CSS needs, like using interpolation
@@ -1,7 +0,0 @@
1
- - if _current_user
2
- -# %ul.sidebar-nav
3
- %li.dropdown-header=t :current_user
4
- - if user_link = edit_user_link
5
- %li.edit_user_root_link= link_to content_tag('i', "", class: 'fa fa-user', style: 'text-indent: 0') + _current_user.email, show_path(:user, _current_user.id)
6
- - if logout_path.present?
7
- %li=link_to content_tag('i', "", class: 'fa fa-unlink', style: 'text-indent: 0') + t('admin.misc.log_out'), logout_path, method: logout_method
@@ -1,59 +0,0 @@
1
- !!! 5
2
- %html{lang: I18n.locale}
3
- %head
4
- %title= Settings.app_name rescue "Thecore"
5
-
6
- = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'reload'
7
- = javascript_pack_tag 'application', 'data-turbolinks-track' => 'reload'
8
-
9
- = render "layouts/rails_admin/head"
10
-
11
- = render "layouts/rails_admin/style_common"
12
- = render "layouts/rails_admin/style_override"
13
-
14
- / Getting all the assets needed by thecore_ui_rails_admin from all the gems and the application level
15
- = get_asset_tags_for("thecore_rails_admin")
16
-
17
- = favicon_link_tag 'apple-touch-icon.png', rel: 'apple-touch-icon', sizes: "180x180"
18
- = favicon_link_tag 'favicon-32x32.png', rel: 'icon', sizes: "32x32"
19
- = favicon_link_tag 'favicon-16x16.png', rel: 'icon', sizes: "16x16"
20
- = favicon_link_tag 'safari-pinned-tab.svg', rel: 'mask-icon', color: "#5bbad5"
21
- %body.rails_admin
22
- #admin-js{:'data-i18n-options' => I18n.t("admin.js").to_json}
23
- -# Initialize JS simple i18n
24
- -# :javascript
25
- -# RailsAdmin.I18n.init('#{I18n.locale}', document.getElementById("admin-js").dataset.i18nOptions);
26
- #loading.label.label-warning{style: 'display:none; position:fixed; right:20px; bottom:20px; z-index:100000'}= t('admin.loading')
27
- -# %nav.navbar.navbar-default.navbar-fixed-top
28
- -# = render "layouts/rails_admin/navigation"
29
- #wrapper
30
- #sidebar-wrapper
31
- .sidebar-nav
32
- = render "layouts/rails_admin/secondary_navigation"
33
- = render "layouts/rails_admin/sidebar_navigation"
34
- = render "layouts/rails_admin/user_navigation"
35
- #page-content-wrapper
36
- .container-fluid
37
- .row
38
- .col-lg-12
39
- %button#sidebar-collapse{href: "#menu-toggle"}
40
- %i.fa.fa-bars.fa-2x
41
- -# %a#app-name.pjax{href: dashboard_path}
42
- %span#app-name
43
- = Settings.app_name rescue "Thecore"
44
- .content{:'data-pjax-container' => true}
45
- = render template: 'layouts/rails_admin/pjax'
46
- = render "rails_admin/main/modal_interaction"
47
- -# -# Initialize JS simple i18n
48
- -# :javascript
49
- -# RailsAdmin.I18n.init('#{I18n.locale}', JSON.parse("#{j I18n.t("admin.js").to_json}"))
50
- -# %body.rails_admin
51
- -# #loading.label.label-warning{style: 'display:none; position:fixed; right:20px; bottom:20px; z-index:100000'}= t('admin.loading')
52
- -# %nav.navbar.navbar-default.navbar-fixed-top
53
- -# = render "layouts/rails_admin/navigation"
54
- -# .container-fluid
55
- -# .row
56
- -# .col-sm-3.col-md-2.sidebar-nav
57
- -# = render "layouts/rails_admin/sidebar_navigation"
58
- -# .col-sm-9.col-sm-offset-3.col-md-10.col-md-offset-2
59
- -# .content{:'data-pjax-container' => true}= render template: 'layouts/rails_admin/pjax'
@@ -1,30 +0,0 @@
1
- :javascript
2
- $('.nav.nav-pills li.active').removeClass('active');
3
- $('.nav.nav-pills li[data-model="#{@abstract_model.to_param}"]').addClass('active');
4
- $(window).off('keydown');
5
-
6
- - # Integration of the thecore_settings gem, if not available, it rescues to the normal naming
7
- %title= "#{(@abstract_model.try(:pretty_name) || @page_name)} | #{Settings.app_name rescue ([_get_plugin_name[0] || 'Rails', _get_plugin_name[1] || 'Admin'].join(' '))}"
8
- .page-header
9
- %h1= @page_name
10
- - flash && flash.each do |key, value|
11
- .alert.alert-dismissible{class: flash_alert_class(key)}
12
- %button.close{type: 'button', :'data-dismiss' => "alert"} &times;
13
- = value
14
- - # if it's and abstract model, then is not a root model for sure (like the dashboard)
15
- - # these actions (root ones) are the actions listed at the same level as the dashboard (not related to a model)
16
- - if @abstract_model
17
- = breadcrumb
18
- .well.well-sm
19
- %ul.nav.nav-pills#action-menu
20
- = content_for :search_form
21
- = content_for :action_links
22
- = content_for :contextual_tabs
23
-
24
- .well.well-sm
25
- = yield
26
- - else
27
- = yield
28
-
29
- %script
30
- $('.dropdown-toggle').dropdown()