thecore_ui_rails_admin 2.1.8 → 2.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/rails_admin/ra.widgets.coffee +233 -0
  3. data/app/assets/javascripts/thecore_ui_rails_admin/thecore_rails_admin.js +3 -24
  4. data/app/assets/stylesheets/thecore_ui_rails_admin/apexcharts.scss +7 -0
  5. data/app/assets/stylesheets/thecore_ui_rails_admin/colors.scss +21 -0
  6. data/app/assets/stylesheets/thecore_ui_rails_admin/common.scss +14 -3
  7. data/app/assets/stylesheets/thecore_ui_rails_admin/devise.scss +19 -26
  8. data/app/assets/stylesheets/thecore_ui_rails_admin/flashing.scss +3 -3
  9. data/app/assets/stylesheets/thecore_ui_rails_admin/thecore.scss +19 -4
  10. data/app/assets/stylesheets/thecore_ui_rails_admin/thecore_rails_admin.scss +152 -43
  11. data/app/assets/stylesheets/thecore_ui_rails_admin/togglable-sidebar.scss +5 -2
  12. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +1 -1
  13. data/app/views/layouts/rails_admin/_user_navigation.html.haml +2 -2
  14. data/app/views/layouts/rails_admin/application.html.haml +2 -7
  15. data/app/views/layouts/rails_admin/pjax.html.haml +4 -1
  16. data/app/views/rails_admin/main/_card.html.haml +2 -1
  17. data/app/views/rails_admin/main/dashboard.html.haml +22 -11
  18. data/app/views/rails_admin/main/index.html.haml +19 -20
  19. data/config/initializers/rails_admin.rb +24 -4
  20. data/config/initializers/thecore_concern.rb +0 -1
  21. data/config/initializers/thecore_ui_rails_admin_app_configs.rb +4 -0
  22. data/config/locales/it.index_cards.custom.yml +1 -1
  23. data/config/locales/thecore_settings.en.yml +31 -0
  24. data/config/locales/thecore_settings.it.yml +0 -1
  25. data/lib/abilities/thecore_ui_rails_admin.rb +0 -1
  26. data/lib/concerns/thecore_ui_rails_admin_permission.rb +32 -0
  27. data/lib/concerns/thecore_ui_rails_admin_role.rb +36 -0
  28. data/lib/concerns/thecore_ui_rails_admin_user.rb +56 -59
  29. data/lib/thecore_ui_rails_admin.rb +3 -0
  30. data/lib/thecore_ui_rails_admin/engine.rb +0 -3
  31. data/lib/thecore_ui_rails_admin/version.rb +1 -1
  32. metadata +22 -3
  33. data/app/assets/javascripts/thecore_ui_rails_admin/thecore.js +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75369cb3f050b4996aafce1b1651216c51db2c3248195a46a5a9e42293372b6e
4
- data.tar.gz: 7f72b944c75a1a4a9a36a2633266c977d48638b34a15a6ea8915156b86adcc21
3
+ metadata.gz: 2ce53a008b9828ac3b44180fb1c36d09c930de58182da4eb97b12ddf97fb908d
4
+ data.tar.gz: 3bb46d92799f9f7b9d14e0224b5d558173fb59ec5e0c0b11451998da2eacac7e
5
5
  SHA512:
6
- metadata.gz: b81368ff53b4f4362f2318a0949b5be0a673161899c5c4a85433895683f13fbee00dae9bb3cc2137dee5fc56698b7e4983ccd763128eab3d8b7a9b1d4f0c681b
7
- data.tar.gz: 72557529214aef7ed4f464309c10846ff0ad57a1f594ed1ecc328a3a940a79eaf37b965e7a40eccf22e14fcfcdf76eed89ab9f5a902f1ec413cfbd7a0146f7fc
6
+ metadata.gz: 90f4c1caac4cdcb8117ce1a20c3a05e1c3bc8714159253e4b735f2f3bfbea6f8f496125515a10ce984e6d77c1c76ebc7290d52932f53f2f4566002c066f26755
7
+ data.tar.gz: 1efa607575ebfef6c0895a25a40a46199a1cacd0bed7608422abfe11bc3e48cdd67c223e4195d6cdc00ae25c1a8120c6225a338f5eac46df22ceddab4f599e67
@@ -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();
@@ -19,18 +20,6 @@ $(document).on('ready pjax:success', function(e) {
19
20
  } else {
20
21
  $('.page-header, .content').removeClass('dashboard');
21
22
  }
22
-
23
- // $(document).ready(function () {
24
- // Hide and show the sidebar
25
- // Make the sidebar button shine a bit
26
- // setTimeout(function() {
27
- // $('#sidebar-collapse').addClass("flash");
28
- // }, 500);
29
- // setTimeout(function() {
30
- // if (!$('#wrapper').hasClass('toggled'))
31
- // $('#wrapper').addClass('toggled');
32
- // }, 1200);
33
- // });
34
23
  });
35
24
 
36
25
  $(function() {
@@ -86,14 +75,4 @@ $(document).ready(function () {
86
75
  $('#wrapper').toggleClass('toggled');
87
76
  });
88
77
 
89
- $('textarea[data-richtext="froala-wysiwyg"').froalaEditor();
90
- // // Hide and show the sidebar
91
- // // Make the sidebar button shine a bit
92
- // setTimeout(function() {
93
- // $('#sidebar-collapse').addClass("flash");
94
- // }, 500);
95
- // setTimeout(function() {
96
- // if (!$('#wrapper').hasClass('toggled'))
97
- // $('#wrapper').addClass('toggled');
98
- // }, 1200);
99
78
  });
@@ -0,0 +1,7 @@
1
+ .apexcharts-menu-item {
2
+ color: black
3
+ }
4
+ .apexcharts-tooltip {
5
+ background: #f3f3f3;
6
+ color: orange;
7
+ }
@@ -0,0 +1,21 @@
1
+ $primary: #1f4068 !default;
2
+
3
+ $background: lighten($primary, 51%) !default;
4
+ $shadows: darken($primary, 10%) !default;
5
+
6
+ $text: $primary !default;
7
+ $text-highlight: lighten($text, 35%) !default;
8
+
9
+ $link: $text !default;
10
+ $link-highlight: lighten($link, 10%) !default;
11
+
12
+ $element: $primary !default;
13
+ $element-text: lighten($element, 40%) !default;
14
+ $element-text-highlight: lighten($element-text, 10%) !default;
15
+ $element-border: darken($element, 10%) !default;
16
+
17
+ $neutral: #706f6f !default;
18
+ $success: #37BC9B !default;
19
+ $info: #3BAFDA !default;
20
+ $danger: #E9573F !default;
21
+ $warning: #F6BB42 !default;
@@ -1,11 +1,12 @@
1
1
  body {
2
2
  height: 100vh;
3
3
  // background: linear-gradient(-20deg, #09b7b9 30%, #1c51a4 100%);
4
- background-color: rgb(59, 78, 89);
4
+ background-color: $background;
5
5
  }
6
6
 
7
7
  .jumbotron {
8
- background-color: rgb(59, 78, 89);
8
+ background-color: $background;
9
+ color: $text;
9
10
  }
10
11
 
11
12
  .vertical-center {
@@ -29,4 +30,14 @@ body {
29
30
  .fa-pencil:before,
30
31
  .icon-pencil:before {
31
32
  content: "\f044";
32
- }
33
+ }
34
+
35
+ #new_user div.checkbox:hover {
36
+ color: $text-highlight
37
+ }
38
+
39
+ #new_user div.actions input.btn {
40
+ width: 100%;
41
+ background-color: $element;
42
+ border-color: $element-border;
43
+ }
@@ -1,10 +1,3 @@
1
- $primary: #1c2c41;
2
- $secondary: #304158;
3
- $light: #47566c;
4
- $blue: #0C457D;
5
- $grey: #706f6f;
6
- $tertiary: #81C784;
7
-
8
1
  .devise {
9
2
  font-family: 'Raleway', sans-serif;
10
3
  height: 100vh;
@@ -19,11 +12,11 @@
19
12
  }
20
13
 
21
14
  .bckg-dark {
22
- // background: linear-gradient(-20deg, #09b7b9 30%, #1c51a4 100%);
23
- background-color: rgb(59, 78, 89);
15
+ background-color:$background;
24
16
  }
25
17
 
26
18
  .bckg-login {
19
+ background-color:$background;
27
20
  }
28
21
 
29
22
  .logo {
@@ -38,11 +31,11 @@
38
31
  }
39
32
 
40
33
  .bckg-dark-light {
41
- background: $secondary;
34
+ background: $text;
42
35
  }
43
36
 
44
37
  .bckg-blue {
45
- background: $blue;
38
+ background: $info;
46
39
  }
47
40
 
48
41
  .centered {
@@ -54,7 +47,7 @@
54
47
 
55
48
  .login-form-user {
56
49
  width: 25%;
57
- color: #fff;
50
+ color: $text-highlight;
58
51
  margin: 0 auto;
59
52
  margin-bottom: 25px;
60
53
 
@@ -65,7 +58,7 @@
65
58
  }
66
59
 
67
60
  .lost_id {
68
- color: #fff;
61
+ color: $text-highlight;
69
62
  margin-bottom: 15px;
70
63
  display: block;
71
64
  font-size: .9em;
@@ -111,16 +104,16 @@
111
104
  border: 0;
112
105
  }
113
106
  input[type="submit"] {
114
- background: $grey;
107
+ background: $neutral;
115
108
  border: 0;
116
109
  border-radius: 0;
117
110
  cursor: pointer;
118
111
  float: right;
119
- color: white;
112
+ color:$text-highlight;
120
113
  width:100%;
121
114
  }
122
115
  h2 {
123
- background: $grey;
116
+ background: $neutral;
124
117
  display: block;
125
118
  padding: 10px 15px;
126
119
  text-align: left;
@@ -129,15 +122,15 @@
129
122
  }
130
123
 
131
124
  .login-form {
132
- color: #fff;
125
+ color:$text-highlight;
133
126
  width: 30%;
134
127
 
135
128
  .links-form {
136
129
  a {
137
- color: $light;
130
+ color:$text-highlight;
138
131
  text-decoration: none;
139
132
  &:hover {
140
- color: $light;
133
+ color: $text-highlight;
141
134
  }
142
135
  }
143
136
  }
@@ -174,8 +167,8 @@
174
167
 
175
168
  input[type="submit"] {
176
169
  cursor: pointer;
177
- background: $tertiary;
178
- color: #fff;
170
+ background: $element-border;
171
+ color:$text-highlight;
179
172
  border-radius: 3px;
180
173
  border: 0;
181
174
  display: block;
@@ -184,15 +177,15 @@
184
177
  margin-top: 55px;
185
178
  width: 100%;
186
179
  &:hover {
187
- background: darken($tertiary, 5%);
180
+ background: darken($element-border, 5%);
188
181
  }
189
182
  }
190
183
 
191
184
  input[type="text"], input[type="email"], input[type="password"] {
192
185
  background-color: transparent;
193
186
  border: 0;
194
- border-bottom: 1px solid $light;
195
- color: #fff;
187
+ border-bottom: 1px solid $text-highlight;
188
+ color:$text-highlight;
196
189
  margin-top: 15px;
197
190
  padding-bottom: 15px;
198
191
  }
@@ -200,8 +193,8 @@
200
193
  .input-group-addon {
201
194
  background-color: transparent;
202
195
  border: 0;
203
- border-bottom: 1px solid $light;
204
- color: #fff;
196
+ border-bottom: 1px solid $text-highlight;
197
+ color:$text-highlight;
205
198
  margin-top: 15px;
206
199
  padding-bottom: 15px;
207
200
  padding-top: 12px;