rails_material_admin 0.1.5 → 0.1.9

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -20
  3. data/app/helpers/admin_helper.rb +34 -0
  4. data/app/views/admin/sessions/new.html.slim +27 -24
  5. data/app/views/layouts/admin.html.slim +16 -5
  6. data/app/views/shared/_error_messages.html.slim +12 -7
  7. data/app/views/shared/_flash_messages.html.slim +14 -0
  8. data/app/views/shared/_header.html.slim +17 -13
  9. data/app/views/shared/_sidebar.html.slim +9 -8
  10. data/config/webpack/environment.js +5 -1
  11. data/lib/generators/crud/crud_generator.rb +4 -4
  12. data/lib/generators/material_admin/material_admin_generator.rb +16 -9
  13. data/lib/material_admin/version.rb +1 -1
  14. data/vendor/javascript/packs/admin.js +18 -12
  15. data/vendor/javascript/packs/admin_style.js +5 -3
  16. data/vendor/javascript/src/stylesheets/admin/shared/common.scss +39 -2
  17. data/vendor/javascript/src/stylesheets/admin/shared/override.scss +62 -0
  18. data/vendor/javascript/src/stylesheets/shared/override.scss +0 -4
  19. data/vendor/rails_material_admin/css/plugins/bootstrap.min.scss +6 -6
  20. data/vendor/rails_material_admin/css/style.scss +33462 -8272
  21. data/vendor/rails_material_admin/js/app.js +404 -0
  22. data/vendor/rails_material_admin/js/bootstrap.min.js +4 -4
  23. data/vendor/rails_material_admin/js/dashboard.js +15 -16
  24. data/vendor/rails_material_admin/js/perfect-scrollbar.jquery.min.js +1569 -0
  25. data/vendor/rails_material_admin/js/sidebarmenu.js +52 -337
  26. data/vendor/rails_material_admin/js/sweetalert2.min.js +2 -0
  27. data/vendor/rails_material_admin/material_admin.js +8 -7
  28. metadata +8 -6
  29. data/package.json +0 -23
  30. data/vendor/rails_material_admin/js/custom.js +0 -113
@@ -0,0 +1,404 @@
1
+ 'use strict'
2
+
3
+ function msg_receive(a) {
4
+ var e = new Date()
5
+ return (
6
+ "<li class='msg_receive'><div class='chat-content'><div class='box bg-light-info'>" +
7
+ a +
8
+ "</div></div><div class='chat-time'>" +
9
+ e.getHours() +
10
+ ':' +
11
+ e.getMinutes() +
12
+ '</div></li>'
13
+ )
14
+ }
15
+
16
+ function msg_sent(a) {
17
+ var e = new Date()
18
+ return (
19
+ "<li class='odd msg_sent'><div class='chat-content'><div class='box bg-light-info'>" +
20
+ a +
21
+ "</div><br></div><div class='chat-time'>" +
22
+ e.getHours() +
23
+ ':' +
24
+ e.getMinutes() +
25
+ '</div></li>'
26
+ )
27
+ }
28
+
29
+ $.fn.AdminSettings = function (t) {
30
+ var miniSidebarToggled = localStorage.getItem('miniSidebarToggled')
31
+
32
+ var i = this.attr('id'),
33
+ a =
34
+ ((t = $.extend(
35
+ {},
36
+ {
37
+ Theme: !0,
38
+ Layout: 'vertical',
39
+ LogoBg: 'skin1',
40
+ NavbarBg: 'skin6',
41
+ SidebarType: 'full',
42
+ SidebarColor: 'skin1',
43
+ SidebarPosition: !1,
44
+ HeaderPosition: !1,
45
+ BoxedLayout: !1
46
+ },
47
+ t
48
+ )),
49
+ {
50
+ AdminSettingsInit: function () {
51
+ a.ManageTheme(),
52
+ a.ManageThemeLayout(),
53
+ a.ManageThemeBackground(),
54
+ a.ManageSidebarType(),
55
+ a.ManageSidebarColor(),
56
+ a.ManageSidebarPosition(),
57
+ a.ManageBoxedLayout()
58
+ },
59
+ ManageTheme: function () {
60
+ var a = t.Theme
61
+ switch (t.Layout) {
62
+ case 'vertical':
63
+ 1 == a
64
+ ? ($('body').attr('data-theme', 'dark'), $('#theme-view').prop('checked', !0))
65
+ : ($('#' + i).attr('data-theme', 'light'), $('body').prop('checked', !1))
66
+ }
67
+ },
68
+ ManageThemeLayout: function () {
69
+ switch (t.Layout) {
70
+ case 'horizontal':
71
+ $('#' + i).attr('data-layout', 'horizontal')
72
+ var a = function () {
73
+ ;(0 < window.innerWidth ? window.innerWidth : this.screen.width) < 768
74
+ ? $('.scroll-sidebar').perfectScrollbar({})
75
+ : $('.scroll-sidebar').perfectScrollbar('destroy')
76
+ }
77
+ $(window).ready(a), $(window).on('resize', a)
78
+ break
79
+ case 'vertical':
80
+ $('#' + i).attr('data-layout', 'vertical'), $('.scroll-sidebar').perfectScrollbar({})
81
+ }
82
+ },
83
+ ManageThemeBackground: function () {
84
+ var a, e
85
+ null != (a = t.LogoBg) && '' != a
86
+ ? $('#' + i + ' .topbar .top-navbar .navbar-header').attr('data-logobg', a)
87
+ : $('#' + i + ' .topbar .top-navbar .navbar-header').attr('data-logobg', 'skin1'),
88
+ null != (e = t.NavbarBg) && '' != e
89
+ ? ($('#' + i + ' .topbar .navbar-collapse').attr('data-navbarbg', e),
90
+ $('#' + i + ' .topbar').attr('data-navbarbg', e),
91
+ $('#' + i).attr('data-navbarbg', e))
92
+ : ($('#' + i + ' .topbar .navbar-collapse').attr('data-navbarbg', 'skin1'),
93
+ $('#' + i + ' .topbar').attr('data-navbarbg', 'skin1'),
94
+ $('#' + i).attr('data-navbarbg', 'skin1'))
95
+ },
96
+ ManageSidebarType: function () {
97
+ switch (t.SidebarType) {
98
+ case 'full':
99
+ $('#' + i).attr('data-sidebartype', 'full')
100
+
101
+ if (!miniSidebarToggled || miniSidebarToggled === 'false') {
102
+ $('#main-wrapper').attr('data-sidebartype', 'mini-sidebar')
103
+ $('#main-wrapper').addClass('mini-sidebar')
104
+ } else {
105
+ $('#main-wrapper').attr('data-sidebartype', 'full')
106
+ $('#main-wrapper').removeClass('mini-sidebar')
107
+ }
108
+
109
+ $('.sidebartoggler').on('click', function () {
110
+ if (!miniSidebarToggled || miniSidebarToggled === 'false') {
111
+ localStorage.setItem('miniSidebarToggled', 'true')
112
+ } else {
113
+ localStorage.setItem('miniSidebarToggled', 'false')
114
+ }
115
+
116
+ $('#main-wrapper').toggleClass('mini-sidebar'),
117
+ $('#main-wrapper').hasClass('mini-sidebar')
118
+ ? ($('.sidebartoggler').prop('checked', !0),
119
+ $('#main-wrapper').attr('data-sidebartype', 'mini-sidebar'))
120
+ : ($('.sidebartoggler').prop('checked', !1), $('#main-wrapper').attr('data-sidebartype', 'full'))
121
+ })
122
+ break
123
+ case 'mini-sidebar':
124
+ $('#' + i).attr('data-sidebartype', 'mini-sidebar'),
125
+ $('.sidebartoggler').on('click', function () {
126
+ $('#main-wrapper').toggleClass('mini-sidebar'),
127
+ $('#main-wrapper').hasClass('mini-sidebar')
128
+ ? ($('.sidebartoggler').prop('checked', !0), $('#main-wrapper').attr('data-sidebartype', 'full'))
129
+ : ($('.sidebartoggler').prop('checked', !1),
130
+ $('#main-wrapper').attr('data-sidebartype', 'mini-sidebar'))
131
+ })
132
+ break
133
+ case 'iconbar':
134
+ $('#' + i).attr('data-sidebartype', 'iconbar')
135
+ a = function () {
136
+ ;(0 < window.innerWidth ? window.innerWidth : this.screen.width) < 1170
137
+ ? ($('#main-wrapper').attr('data-sidebartype', 'mini-sidebar'),
138
+ $('#main-wrapper').addClass('mini-sidebar'))
139
+ : ($('#main-wrapper').attr('data-sidebartype', 'iconbar'),
140
+ $('#main-wrapper').removeClass('mini-sidebar'))
141
+ }
142
+ $(window).ready(a),
143
+ $(window).on('resize', a),
144
+ $('.sidebartoggler').on('click', function () {
145
+ $('#main-wrapper').toggleClass('mini-sidebar'),
146
+ $('#main-wrapper').hasClass('mini-sidebar')
147
+ ? ($('.sidebartoggler').prop('checked', !0),
148
+ $('#main-wrapper').attr('data-sidebartype', 'mini-sidebar'))
149
+ : ($('.sidebartoggler').prop('checked', !1),
150
+ $('#main-wrapper').attr('data-sidebartype', 'iconbar'))
151
+ })
152
+ break
153
+ case 'overlay':
154
+ $('#' + i).attr('data-sidebartype', 'overlay')
155
+ a = function () {
156
+ ;(0 < window.innerWidth ? window.innerWidth : this.screen.width) < 767
157
+ ? ($('#main-wrapper').attr('data-sidebartype', 'mini-sidebar'),
158
+ $('#main-wrapper').addClass('mini-sidebar'))
159
+ : ($('#main-wrapper').attr('data-sidebartype', 'overlay'),
160
+ $('#main-wrapper').removeClass('mini-sidebar'))
161
+ }
162
+ $(window).ready(a),
163
+ $(window).on('resize', a),
164
+ $('.sidebartoggler').on('click', function () {
165
+ $('#main-wrapper').toggleClass('show-sidebar'), $('#main-wrapper').hasClass('show-sidebar')
166
+ })
167
+ }
168
+ },
169
+ ManageSidebarColor: function () {
170
+ var a
171
+ null != (a = t.SidebarColor) && '' != a
172
+ ? $('#' + i + ' .left-sidebar').attr('data-sidebarbg', a)
173
+ : $('#' + i + ' .left-sidebar').attr('data-sidebarbg', 'skin1')
174
+ },
175
+ ManageSidebarPosition: function () {
176
+ var a = t.SidebarPosition,
177
+ e = t.HeaderPosition
178
+ switch (t.Layout) {
179
+ case 'vertical':
180
+ case 'horizontal':
181
+ 1 == a
182
+ ? ($('#' + i).attr('data-sidebar-position', 'fixed'), $('#sidebar-position').prop('checked', !0))
183
+ : ($('#' + i).attr('data-sidebar-position', 'absolute'), $('#sidebar-position').prop('checked', !1)),
184
+ 1 == e
185
+ ? ($('#' + i).attr('data-header-position', 'fixed'), $('#header-position').prop('checked', !0))
186
+ : ($('#' + i).attr('data-header-position', 'relative'), $('#header-position').prop('checked', !1))
187
+ }
188
+ },
189
+ ManageBoxedLayout: function () {
190
+ var a = t.BoxedLayout
191
+ switch (t.Layout) {
192
+ case 'vertical':
193
+ case 'horizontal':
194
+ 1 == a
195
+ ? ($('#' + i).attr('data-boxed-layout', 'boxed'), $('#boxed-layout').prop('checked', !0))
196
+ : ($('#' + i).attr('data-boxed-layout', 'full'), $('#boxed-layout').prop('checked', !1))
197
+ }
198
+ }
199
+ })
200
+ a.AdminSettingsInit()
201
+ }
202
+
203
+ $(document).on('turbolinks:load', function () {
204
+ $('#chat')
205
+ $('#chat .message-center a').on('click', function () {
206
+ var a = $(this).find('.mail-contnet h5').text(),
207
+ e = $(this).find('.user-img img').attr('src'),
208
+ t = $(this).attr('data-user-id'),
209
+ i = $(this).find('.profile-status').attr('data-status')
210
+ if ($(this).hasClass('active')) $(this).toggleClass('active'), $('.chat-windows #user-chat' + t).hide()
211
+ else if (($(this).toggleClass('active'), $('.chat-windows #user-chat' + t).length))
212
+ $('.chat-windows #user-chat' + t)
213
+ .removeClass('mini-chat')
214
+ .show()
215
+ else {
216
+ var r = msg_receive('I watched the storm, so beautiful yet terrific.'),
217
+ s = "<div class='user-chat' id='user-chat" + t + "' data-user-id='" + t + "'>"
218
+ ;(s +=
219
+ "<div class='chat-head'><img src='" +
220
+ e +
221
+ "' data-user-id='" +
222
+ t +
223
+ "'><span class='status " +
224
+ i +
225
+ "'></span><span class='name'>" +
226
+ a +
227
+ "</span><span class='opts'><i class='ti-close closeit' data-user-id='" +
228
+ t +
229
+ "'></i><i class='ti-minus mini-chat' data-user-id='" +
230
+ t +
231
+ "'></i></span></div>"),
232
+ (s +=
233
+ "<div class='chat-body'><ul class='chat-list'>" +
234
+ (r += msg_sent('That is very deep indeed!')) +
235
+ '</ul></div>'),
236
+ (s +=
237
+ "<div class='chat-footer'><input type='text' data-user-id='" +
238
+ t +
239
+ "' placeholder='Type & Enter' class='form-control'></div>"),
240
+ (s += '</div>'),
241
+ $('.chat-windows').append(s)
242
+ }
243
+ }),
244
+ $(document).on('click', '.chat-windows .user-chat .chat-head .closeit', function (a) {
245
+ var e = $(this).attr('data-user-id')
246
+ $('.chat-windows #user-chat' + e).hide(),
247
+ $('#chat .message-center .user-info#chat_user_' + e).removeClass('active')
248
+ }),
249
+ $(document).on(
250
+ 'click',
251
+ '.chat-windows .user-chat .chat-head img, .chat-windows .user-chat .chat-head .mini-chat',
252
+ function (a) {
253
+ var e = $(this).attr('data-user-id')
254
+ $('.chat-windows #user-chat' + e).hasClass('mini-chat')
255
+ ? $('.chat-windows #user-chat' + e).removeClass('mini-chat')
256
+ : $('.chat-windows #user-chat' + e).addClass('mini-chat')
257
+ }
258
+ ),
259
+ $(document).on('keypress', '.chat-windows .user-chat .chat-footer input', function (a) {
260
+ if (13 == a.keyCode) {
261
+ var e = $(this).attr('data-user-id'),
262
+ t = $(this).val()
263
+ ;(t = msg_sent(t)),
264
+ $('.chat-windows #user-chat' + e + ' .chat-body .chat-list').append(t),
265
+ $(this).val(''),
266
+ $(this).focus()
267
+ }
268
+ $('.chat-windows #user-chat' + e + ' .chat-body').perfectScrollbar({
269
+ suppressScrollX: !0
270
+ })
271
+ }),
272
+ $('.page-wrapper').on('click', function (a) {
273
+ $('.chat-windows').addClass('hide-chat'), $('.chat-windows').removeClass('show-chat')
274
+ }),
275
+ $('.service-panel-toggle').on('click', function (a) {
276
+ $('.chat-windows').addClass('show-chat'), $('.chat-windows').removeClass('hide-chat')
277
+ })
278
+ })
279
+
280
+ $(document).on('turbolinks:load', function () {
281
+ $('#main-wrapper').AdminSettings({
282
+ Theme: false, // this can be true or false ( true means dark and false means light ),
283
+ Layout: 'vertical',
284
+ LogoBg: 'skin1', // You can change the Value to be skin1/skin2/skin3/skin4/skin5/skin6
285
+ NavbarBg: 'skin1', // You can change the Value to be skin1/skin2/skin3/skin4/skin5/skin6
286
+ SidebarType: 'full', // You can change it full / mini-sidebar / iconbar / overlay
287
+ SidebarColor: 'skin6', // You can change the Value to be skin1/skin2/skin3/skin4/skin5/skin6
288
+ SidebarPosition: true, // it can be true / false ( true means Fixed and false means absolute )
289
+ HeaderPosition: true, // it can be true / false ( true means Fixed and false means absolute )
290
+ BoxedLayout: false // it can be true / false ( true means Boxed and false means Fluid )
291
+ })
292
+ })
293
+
294
+ $(document).on('turbolinks:load', function () {
295
+ //****************************
296
+ /* Left header Theme Change function Start */
297
+ //****************************
298
+ function handlelogobg() {
299
+ $('.theme-color .theme-item .theme-link').on('click', function () {
300
+ var logobgskin = $(this).attr('data-logobg')
301
+ $('.topbar .top-navbar .navbar-header').attr('data-logobg', logobgskin)
302
+ })
303
+ }
304
+ handlelogobg()
305
+ //****************************
306
+ /* Top navbar Theme Change function Start */
307
+ //****************************
308
+ function handlenavbarbg() {
309
+ if ($('#main-wrapper').attr('data-navbarbg') == 'skin6') {
310
+ // do this
311
+ $('.topbar .navbar').addClass('navbar-light')
312
+ $('.topbar .navbar').removeClass('navbar-dark')
313
+ } else {
314
+ // do that
315
+ }
316
+ $('.theme-color .theme-item .theme-link').on('click', function () {
317
+ var navbarbgskin = $(this).attr('data-navbarbg')
318
+ $('#main-wrapper').attr('data-navbarbg', navbarbgskin)
319
+ $('.topbar .navbar-collapse').attr('data-navbarbg', navbarbgskin)
320
+ if ($('#main-wrapper').attr('data-navbarbg') == 'skin6') {
321
+ // do this
322
+ $('.topbar .navbar').addClass('navbar-light')
323
+ $('.topbar .navbar').removeClass('navbar-dark')
324
+ } else {
325
+ // do that
326
+ $('.topbar .navbar').removeClass('navbar-light')
327
+ $('.topbar .navbar').addClass('navbar-dark')
328
+ }
329
+ })
330
+ }
331
+
332
+ handlenavbarbg()
333
+
334
+ //****************************
335
+ // ManageSidebar Type
336
+ //****************************
337
+ function handlesidebartype() {}
338
+ handlesidebartype()
339
+
340
+ //****************************
341
+ /* Manage sidebar bg color */
342
+ //****************************
343
+ function handlesidebarbg() {
344
+ $('.theme-color .theme-item .theme-link').on('click', function () {
345
+ var sidebarbgskin = $(this).attr('data-sidebarbg')
346
+ $('.left-sidebar').attr('data-sidebarbg', sidebarbgskin)
347
+ })
348
+ }
349
+ handlesidebarbg()
350
+ //****************************
351
+ /* sidebar position */
352
+ //****************************
353
+ function handlesidebarposition() {
354
+ $('#sidebar-position').change(function () {
355
+ if ($(this).is(':checked')) {
356
+ $('#main-wrapper').attr('data-sidebar-position', 'fixed')
357
+ $('.topbar .top-navbar .navbar-header').attr('data-navheader', 'fixed')
358
+ } else {
359
+ $('#main-wrapper').attr('data-sidebar-position', 'absolute')
360
+ $('.topbar .top-navbar .navbar-header').attr('data-navheader', 'relative')
361
+ }
362
+ })
363
+ }
364
+ handlesidebarposition()
365
+ //****************************
366
+ /* Header position */
367
+ //****************************
368
+ function handleheaderposition() {
369
+ $('#header-position').change(function () {
370
+ if ($(this).is(':checked')) {
371
+ $('#main-wrapper').attr('data-header-position', 'fixed')
372
+ } else {
373
+ $('#main-wrapper').attr('data-header-position', 'relative')
374
+ }
375
+ })
376
+ }
377
+ handleheaderposition()
378
+ //****************************
379
+ /* sidebar position */
380
+ //****************************
381
+ function handleboxedlayout() {
382
+ $('#boxed-layout').change(function () {
383
+ if ($(this).is(':checked')) {
384
+ $('#main-wrapper').attr('data-boxed-layout', 'boxed')
385
+ } else {
386
+ $('#main-wrapper').attr('data-boxed-layout', 'full')
387
+ }
388
+ })
389
+ }
390
+ handleboxedlayout()
391
+ //****************************
392
+ /* Header position */
393
+ //****************************
394
+ function handlethemeview() {
395
+ $('#theme-view').change(function () {
396
+ if ($(this).is(':checked')) {
397
+ $('body').attr('data-theme', 'dark')
398
+ } else {
399
+ $('body').attr('data-theme', 'light')
400
+ }
401
+ })
402
+ }
403
+ handlethemeview()
404
+ })