thecore_ui_rails_admin 2.1.9 → 2.1.10

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: 1a6756ba49af59b55c1fa566eca295c98e52c7580f184e1d45ae0c25a7bd75f4
4
- data.tar.gz: ecbfb2985e40f30bb57c3c3a81469cc1d3147c9fdac68d999005dfc162899229
3
+ metadata.gz: 8cf64ac29415ff7be2ae88370d4bd3e533aeb86816a5f0b1966226b9982388e6
4
+ data.tar.gz: a496d1564532b858780c3bd388227398f4beebf46a596ec8ea5f27f980d673ef
5
5
  SHA512:
6
- metadata.gz: e638884d96e59d9d809885cd9a2a7e6a6ecb1cf4cef6a8bb93a17428f1492bd271e71b253a251b53b7c191aa128796fd602b67f7059b48432a832548e979ec97
7
- data.tar.gz: 2b248f371c27d01b9189f654351c15a2475383effa6ad47fc6c4c91a177c7c304bb2eb41c95479d25be66406bfa59fb1aab4bbab74b09145a94342fd549d2152
6
+ metadata.gz: 851c587fbdc7872d7cfe4cca5489792abb744643946e0f0e3bf4f497bafe291e6b39fb458fc5c9856c2d4cc19f0417134545504c77ec4b8f8d820280da5ea3b2
7
+ data.tar.gz: dd5d457e9827e2667551879ab4da61a3d05554d2b68fab7ccc10e53b765f0b320cd96a8cc69e563faadc7b09515e34d49527e31dcb49e4a21f39ada8369e62c4
@@ -0,0 +1,233 @@
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
23
+ $.fn.datetimepicker.defaults.icons =
24
+ time: 'fa fa-clock'
25
+ date: 'fa fa-calendar'
26
+ up: 'fa fa-chevron-up'
27
+ down: 'fa fa-chevron-down'
28
+ previous: 'fa fa-angle-double-left'
29
+ next: 'fa fa-angle-double-right'
30
+ today: 'fa fa-dot-circle'
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,5 +1,6 @@
1
- //= require timer
2
- //= require_tree .
1
+ //= require thecore_ui_commons/thecore
2
+ //= require rails_admin/rails_admin
3
+ //= require selectize
3
4
 
4
5
  $(document).on('ready pjax:success', function(e) {
5
6
  handleActiveBase();
@@ -0,0 +1,7 @@
1
+ .apexcharts-menu-item {
2
+ color: black
3
+ }
4
+ .apexcharts-tooltip {
5
+ background: #f3f3f3;
6
+ color: orange;
7
+ }
@@ -29,4 +29,8 @@ body {
29
29
  .fa-pencil:before,
30
30
  .icon-pencil:before {
31
31
  content: "\f044";
32
- }
32
+ }
33
+
34
+ #new_user div.actions input.btn.btn-warning {
35
+ width: 100%;
36
+ }
@@ -22,7 +22,4 @@
22
22
  @import 'devise';
23
23
  @import 'animate';
24
24
  @import 'mixins';
25
-
26
- #new_user div.actions input.btn.btn-warning {
27
- width: 100%;
28
- }
25
+ @import 'apexcharts';
@@ -11,7 +11,9 @@
11
11
  * file per style scope.
12
12
  *
13
13
  *= required _colors
14
-
14
+ *= require thecore_ui_commons/thecore
15
+ *= require rails_admin/rails_admin
16
+ *= require rails_admin_selectize/index
15
17
  *= require_self
16
18
  */
17
19
  @import 'thecore';
@@ -133,6 +135,9 @@ a.delete {
133
135
  &.bg-danger {
134
136
  background-color: $RAred;
135
137
  }
138
+ &.bg-clear {
139
+ background-color: rgb(204, 255, 204);
140
+ }
136
141
  }
137
142
 
138
143
  /* User sign in and sign forms. */
@@ -11,8 +11,6 @@
11
11
  div.sub-menu-container li.sub-menu a.pjax { padding-left: 0px }
12
12
  div#wrapper div#sidebar-wrapper { overflow: hidden }
13
13
 
14
- = stylesheet_link_tag "rails_admin/rails_admin.css", media: :all
15
- = javascript_include_tag "rails_admin/rails_admin.js"
16
14
  -# Getting all the assets needed by thecore_rails_admin from all the gems
17
15
  = get_asset_tags_for("thecore_rails_admin")
18
16
 
@@ -1,4 +1,22 @@
1
1
  = breadcrumb
2
+ - charts_high = []
3
+ - charts_medium = []
4
+ - self.methods.each do |m|
5
+ - charts_high << m if m.start_with? "charts_high_"
6
+ - charts_medium << m if m.start_with? "charts_medium_"
7
+
8
+ - charts_high.in_groups_of(2, false).each_with_index do |group, i|
9
+ .row
10
+ - group.each do |item|
11
+ .col-sm-6
12
+ .box.bg.bg-clear= self.send(item)
13
+
14
+ - charts_medium.in_groups_of(3, false).each_with_index do |group, i|
15
+ .row
16
+ - group.each do |item|
17
+ .col-sm-4
18
+ .box.bg.bg-clear= self.send(item)
19
+
2
20
  - @list_bg = ['info', 'success', 'danger', 'success', 'info', 'warning', 'danger', 'info', 'success']
3
21
  - if @abstract_models
4
22
  .row
@@ -1,9 +1,9 @@
1
1
  require 'rails_admin'
2
2
 
3
3
  RailsAdmin.config do |config|
4
- # config.main_app_name = Proc.new { |controller|
5
- # [(Settings.app_name rescue (ENV["APP_NAME"] || "TheCore App")), "#{controller.params[:action].try(:titleize)} (#{Time.zone.now.to_s(:time)})"]
6
- # }
4
+ # Link for background Job
5
+ (config.navigation_static_links ||= {}).merge! "Background Monitor" => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/app/sidekiq"
6
+
7
7
  ### Popular gems integration
8
8
  config.model "RoleUser" do
9
9
  visible false
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiRailsAdmin
2
- VERSION = '2.1.9'
2
+ VERSION = '2.1.10'
3
3
  end
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.1.9
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_ui_commons
@@ -190,9 +190,10 @@ files:
190
190
  - README.md
191
191
  - Rakefile
192
192
  - app/assets/config/thecore_ui_rails_admin_manifest.js
193
- - app/assets/javascripts/thecore_ui_rails_admin/thecore.js
193
+ - app/assets/javascripts/rails_admin/ra.widgets.coffee
194
194
  - app/assets/javascripts/thecore_ui_rails_admin/thecore_rails_admin.js
195
195
  - app/assets/stylesheets/thecore_ui_rails_admin/animate.css
196
+ - app/assets/stylesheets/thecore_ui_rails_admin/apexcharts.scss
196
197
  - app/assets/stylesheets/thecore_ui_rails_admin/common.scss
197
198
  - app/assets/stylesheets/thecore_ui_rails_admin/devise.scss
198
199
  - app/assets/stylesheets/thecore_ui_rails_admin/flashing.scss