rails_modular_admin 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +71 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/config/rails_modular_admin_manifest.js +2 -0
  6. data/app/assets/javascripts/index.js +87 -0
  7. data/app/assets/javascripts/rails_modular_admin.js +3 -0
  8. data/app/assets/javascripts/rails_modular_admin/_common/_helpers/code-helper.js +36 -0
  9. data/app/assets/javascripts/rails_modular_admin/_common/_helpers/for-helper.js +8 -0
  10. data/app/assets/javascripts/rails_modular_admin/_common/_helpers/is-helper.js +98 -0
  11. data/app/assets/javascripts/rails_modular_admin/_common/_helpers/times-helper.js +11 -0
  12. data/app/assets/javascripts/rails_modular_admin/_common/animations/animations.js +14 -0
  13. data/app/assets/javascripts/rails_modular_admin/_common/items-list/items-list.js +19 -0
  14. data/app/assets/javascripts/rails_modular_admin/_common/nprogress/nprogress.js +9 -0
  15. data/app/assets/javascripts/rails_modular_admin/_common/sameheight-items/sameheight-items.js +44 -0
  16. data/app/assets/javascripts/rails_modular_admin/app.js +1429 -0
  17. data/app/assets/javascripts/rails_modular_admin/app/_common/editor/editor-helper.js +10 -0
  18. data/app/assets/javascripts/rails_modular_admin/app/_common/editor/editor.js +34 -0
  19. data/app/assets/javascripts/rails_modular_admin/app/_common/header/nav/nav.js +14 -0
  20. data/app/assets/javascripts/rails_modular_admin/app/_common/modals/modal-media/modal-media.js +23 -0
  21. data/app/assets/javascripts/rails_modular_admin/app/_common/sidebar/customize/customize.js +155 -0
  22. data/app/assets/javascripts/rails_modular_admin/app/_common/sidebar/sidebar.js +38 -0
  23. data/app/assets/javascripts/rails_modular_admin/app/charts/charts-flot/charts-flot.js +329 -0
  24. data/app/assets/javascripts/rails_modular_admin/app/charts/charts-morris/charts-morris.js +125 -0
  25. data/app/assets/javascripts/rails_modular_admin/app/dashboard/history/history.js +145 -0
  26. data/app/assets/javascripts/rails_modular_admin/app/dashboard/items/items.js +41 -0
  27. data/app/assets/javascripts/rails_modular_admin/app/dashboard/sales-breakdown/sales-breakdown.js +37 -0
  28. data/app/assets/javascripts/rails_modular_admin/app/dashboard/sales-by-countries/sales-by-countries.js +50 -0
  29. data/app/assets/javascripts/rails_modular_admin/app/dashboard/tasks/tasks.js +13 -0
  30. data/app/assets/javascripts/rails_modular_admin/app/forms/input-groups/input-groups.js +14 -0
  31. data/app/assets/javascripts/rails_modular_admin/app/items/editor/item-editor.js +34 -0
  32. data/app/assets/javascripts/rails_modular_admin/app/items/list/items-list.js +44 -0
  33. data/app/assets/javascripts/rails_modular_admin/app/pages/error.js +18 -0
  34. data/app/assets/javascripts/rails_modular_admin/auth/login/login.js +35 -0
  35. data/app/assets/javascripts/rails_modular_admin/auth/reset/reset.js +31 -0
  36. data/app/assets/javascripts/rails_modular_admin/auth/signup/signup.js +88 -0
  37. data/app/assets/javascripts/rails_modular_admin/config.js +51 -0
  38. data/app/assets/javascripts/rails_modular_admin/main.js +16 -0
  39. data/app/assets/javascripts/rails_modular_admin/vendor.js +60485 -0
  40. data/app/assets/stylesheets/rails_modular_admin.scss +1 -0
  41. data/app/assets/stylesheets/rails_modular_admin/_common/_styles/_mixins.scss +103 -0
  42. data/app/assets/stylesheets/rails_modular_admin/_common/_styles/layout.scss +74 -0
  43. data/app/assets/stylesheets/rails_modular_admin/_common/_styles/misc.scss +115 -0
  44. data/app/assets/stylesheets/rails_modular_admin/_common/_styles/typography.scss +60 -0
  45. data/app/assets/stylesheets/rails_modular_admin/_common/alert/alert.scss +27 -0
  46. data/app/assets/stylesheets/rails_modular_admin/_common/animations/animations.scss +4 -0
  47. data/app/assets/stylesheets/rails_modular_admin/_common/button/button.scss +117 -0
  48. data/app/assets/stylesheets/rails_modular_admin/_common/card/card.scss +200 -0
  49. data/app/assets/stylesheets/rails_modular_admin/_common/chart/chart.scss +9 -0
  50. data/app/assets/stylesheets/rails_modular_admin/_common/dropdown/dropdown.scss +28 -0
  51. data/app/assets/stylesheets/rails_modular_admin/_common/flex/flex.scss +14 -0
  52. data/app/assets/stylesheets/rails_modular_admin/_common/form/form.scss +235 -0
  53. data/app/assets/stylesheets/rails_modular_admin/_common/images-container/images-container.scss +129 -0
  54. data/app/assets/stylesheets/rails_modular_admin/_common/items-list/items-list.scss +388 -0
  55. data/app/assets/stylesheets/rails_modular_admin/_common/logo/logo.scss +46 -0
  56. data/app/assets/stylesheets/rails_modular_admin/_common/modal/modal-tabs.scss +27 -0
  57. data/app/assets/stylesheets/rails_modular_admin/_common/navigation/navigation.scss +114 -0
  58. data/app/assets/stylesheets/rails_modular_admin/_common/nprogress/nprogress.scss +22 -0
  59. data/app/assets/stylesheets/rails_modular_admin/_common/pagination/pagination.scss +20 -0
  60. data/app/assets/stylesheets/rails_modular_admin/_common/sameheight-items/sameheight-items.scss +5 -0
  61. data/app/assets/stylesheets/rails_modular_admin/_common/scrollbar/scrollbar.scss +24 -0
  62. data/app/assets/stylesheets/rails_modular_admin/_common/table/table.scss +12 -0
  63. data/app/assets/stylesheets/rails_modular_admin/_main.scss +41 -0
  64. data/app/assets/stylesheets/rails_modular_admin/_themes/blue-theme.scss +1 -0
  65. data/app/assets/stylesheets/rails_modular_admin/_themes/custom-theme.scss +0 -0
  66. data/app/assets/stylesheets/rails_modular_admin/_themes/green-theme.scss +10 -0
  67. data/app/assets/stylesheets/rails_modular_admin/_themes/orange-theme.scss +12 -0
  68. data/app/assets/stylesheets/rails_modular_admin/_themes/purple-theme.scss +6 -0
  69. data/app/assets/stylesheets/rails_modular_admin/_themes/red-theme.scss +11 -0
  70. data/app/assets/stylesheets/rails_modular_admin/_themes/seagreen-theme.scss +9 -0
  71. data/app/assets/stylesheets/rails_modular_admin/_variables.scss +109 -0
  72. data/app/assets/stylesheets/rails_modular_admin/app/_common/editor/editor.scss +28 -0
  73. data/app/assets/stylesheets/rails_modular_admin/app/_common/footer/footer.scss +68 -0
  74. data/app/assets/stylesheets/rails_modular_admin/app/_common/header/buttons/buttons.scss +30 -0
  75. data/app/assets/stylesheets/rails_modular_admin/app/_common/header/collapse/collapse.scss +23 -0
  76. data/app/assets/stylesheets/rails_modular_admin/app/_common/header/header.scss +33 -0
  77. data/app/assets/stylesheets/rails_modular_admin/app/_common/header/nav/nav.scss +64 -0
  78. data/app/assets/stylesheets/rails_modular_admin/app/_common/header/nav/notifications/notifications.scss +126 -0
  79. data/app/assets/stylesheets/rails_modular_admin/app/_common/header/nav/profile/profile.scss +93 -0
  80. data/app/assets/stylesheets/rails_modular_admin/app/_common/header/search/search.scss +68 -0
  81. data/app/assets/stylesheets/rails_modular_admin/app/_common/modals/modal-media/modal-media.scss +56 -0
  82. data/app/assets/stylesheets/rails_modular_admin/app/_common/modals/modals.scss +19 -0
  83. data/app/assets/stylesheets/rails_modular_admin/app/_common/sidebar/customize/customize.scss +157 -0
  84. data/app/assets/stylesheets/rails_modular_admin/app/_common/sidebar/header/header.scss +14 -0
  85. data/app/assets/stylesheets/rails_modular_admin/app/_common/sidebar/sidebar.scss +240 -0
  86. data/app/assets/stylesheets/rails_modular_admin/app/app.scss +72 -0
  87. data/app/assets/stylesheets/rails_modular_admin/app/charts/charts-flot/charts-flot.scss +18 -0
  88. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/dashboard.scss +7 -0
  89. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/history/history.scss +6 -0
  90. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/items/items-header.scss +81 -0
  91. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/items/items-list.scss +102 -0
  92. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/sales-breakdown/sales-breakdown.scss +7 -0
  93. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/sales-by-countries/sales-by-countries.scss +14 -0
  94. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/stats/stats.scss +70 -0
  95. data/app/assets/stylesheets/rails_modular_admin/app/dashboard/tasks/tasks.scss +47 -0
  96. data/app/assets/stylesheets/rails_modular_admin/app/items/editor/item-editor.scss +3 -0
  97. data/app/assets/stylesheets/rails_modular_admin/app/items/list/items-list.scss +330 -0
  98. data/app/assets/stylesheets/rails_modular_admin/app/pages/error.scss +73 -0
  99. data/app/assets/stylesheets/rails_modular_admin/app/pages/screenful/screenful.scss +101 -0
  100. data/app/assets/stylesheets/rails_modular_admin/app/tables/responsive-tables/responsive-tables.scss +77 -0
  101. data/app/assets/stylesheets/rails_modular_admin/application.scss +26 -0
  102. data/app/assets/stylesheets/rails_modular_admin/auth/auth.scss +72 -0
  103. data/app/controllers/rails_modular_admin/application_controller.rb +5 -0
  104. data/app/helpers/rails_modular_admin/application_helper.rb +4 -0
  105. data/app/jobs/rails_modular_admin/application_job.rb +4 -0
  106. data/app/mailers/rails_modular_admin/application_mailer.rb +6 -0
  107. data/app/models/rails_modular_admin/application_record.rb +5 -0
  108. data/app/views/layouts/rails_modular_admin/application.html.erb +16 -0
  109. data/config/initializers/assets.rb +1 -0
  110. data/config/routes.rb +2 -0
  111. data/lib/generators/rails_modular_admin/USAGE +8 -0
  112. data/lib/generators/rails_modular_admin/install_generator.rb +12 -0
  113. data/lib/generators/rails_modular_admin/templates/custom-theme.scss +14 -0
  114. data/lib/rails_modular_admin.rb +11 -0
  115. data/lib/rails_modular_admin/engine.rb +5 -0
  116. data/lib/rails_modular_admin/version.rb +3 -0
  117. data/lib/tasks/rails_modular_admin_tasks.rake +47 -0
  118. metadata +205 -0
@@ -0,0 +1,1429 @@
1
+ var config = window.config = {};
2
+
3
+ // Config reference element
4
+ var $ref = $("#ref");
5
+
6
+ // Configure responsive bootstrap toolkit
7
+ config.ResponsiveBootstrapToolkitVisibilityDivs = {
8
+ 'xs': $('<div class="device-xs hidden-sm-up"></div>'),
9
+ 'sm': $('<div class="device-sm hidden-xs-down hidden-md-up"></div>'),
10
+ 'md': $('<div class="device-md hidden-sm-down hidden-lg-up"></div>'),
11
+ 'lg': $('<div class="device-lg hidden-md-down hidden-xl-up"></div>'),
12
+ 'xl': $('<div class="device-xl hidden-lg-down "></div>'),
13
+ };
14
+
15
+ ResponsiveBootstrapToolkit.use('Custom', config.ResponsiveBootstrapToolkitVisibilityDivs);
16
+
17
+ //validation configuration
18
+ config.validations = {
19
+ debug: true,
20
+ errorClass:'has-error',
21
+ validClass:'success',
22
+ errorElement:"span",
23
+
24
+ // add error class
25
+ highlight: function(element, errorClass, validClass) {
26
+ $(element).parents("div.form-group")
27
+ .addClass(errorClass)
28
+ .removeClass(validClass);
29
+ },
30
+
31
+ // add error class
32
+ unhighlight: function(element, errorClass, validClass) {
33
+ $(element).parents(".has-error")
34
+ .removeClass(errorClass)
35
+ .addClass(validClass);
36
+ },
37
+
38
+ // submit handler
39
+ submitHandler: function(form) {
40
+ form.submit();
41
+ }
42
+ }
43
+
44
+ //delay time configuration
45
+ config.delayTime = 50;
46
+
47
+ // chart configurations
48
+ config.chart = {};
49
+
50
+ config.chart.colorPrimary = tinycolor($ref.find(".chart .color-primary").css("color"));
51
+ config.chart.colorSecondary = tinycolor($ref.find(".chart .color-secondary").css("color"));
52
+ //LoginForm validation
53
+ $(function() {
54
+ if (!$('#login-form').length) {
55
+ return false;
56
+ }
57
+
58
+ var loginValidationSettings = {
59
+ rules: {
60
+ username: {
61
+ required: true,
62
+ email: true
63
+ },
64
+ password: "required",
65
+ agree: "required"
66
+ },
67
+ messages: {
68
+ username: {
69
+ required: "Please enter username",
70
+ email: "Please enter a valid email address"
71
+ },
72
+ password: "Please enter password",
73
+ agree: "Please accept our policy"
74
+ },
75
+ invalidHandler: function() {
76
+ animate({
77
+ name: 'shake',
78
+ selector: '.auth-container > .card'
79
+ });
80
+ }
81
+ }
82
+
83
+ $.extend(loginValidationSettings, config.validations);
84
+
85
+ $('#login-form').validate(loginValidationSettings);
86
+ })
87
+ //ResetForm validation
88
+ $(function() {
89
+ if (!$('#reset-form').length) {
90
+ return false;
91
+ }
92
+
93
+ var resetValidationSettings = {
94
+ rules: {
95
+ email1: {
96
+ required: true,
97
+ email: true
98
+ }
99
+ },
100
+ messages: {
101
+ email1: {
102
+ required: "Please enter email address",
103
+ email: "Please enter a valid email address"
104
+ }
105
+ },
106
+ invalidHandler: function() {
107
+ animate({
108
+ name: 'shake',
109
+ selector: '.auth-container > .card'
110
+ });
111
+ }
112
+ }
113
+
114
+ $.extend(resetValidationSettings, config.validations);
115
+
116
+ $('#reset-form').validate(resetValidationSettings);
117
+ })
118
+ /***********************************************
119
+ * Animation Settings
120
+ ***********************************************/
121
+ function animate(options) {
122
+ var animationName = "animated " + options.name;
123
+ var animationEnd = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
124
+ $(options.selector)
125
+ .addClass(animationName)
126
+ .one(animationEnd,
127
+ function(){
128
+ $(this).removeClass(animationName);
129
+ }
130
+ );
131
+ }
132
+
133
+ //SignupForm validation
134
+ $(function() {
135
+ if (!$('#signup-form').length) {
136
+ return false;
137
+ }
138
+
139
+ var signupValidationSettings = {
140
+ rules: {
141
+ firstname: {
142
+ required: true,
143
+ },
144
+ lastname: {
145
+ required: true,
146
+ },
147
+ email: {
148
+ required: true,
149
+ email: true
150
+ },
151
+ password: {
152
+ required: true,
153
+ minlength: 8
154
+ },
155
+ retype_password: {
156
+ required: true,
157
+ minlength: 8,
158
+ equalTo: "#password"
159
+ },
160
+ agree: {
161
+ required: true,
162
+ }
163
+ },
164
+ groups: {
165
+ name: "firstname lastname",
166
+ pass: "password retype_password",
167
+ },
168
+ errorPlacement: function(error, element) {
169
+ if (
170
+ element.attr("name") == "firstname" ||
171
+ element.attr("name") == "lastname"
172
+ ) {
173
+ error.insertAfter($("#lastname").closest('.row'));
174
+ element.parents("div.form-group")
175
+ .addClass('has-error');
176
+ }
177
+ else if (
178
+ element.attr("name") == "password" ||
179
+ element.attr("name") == "retype_password"
180
+ ) {
181
+ error.insertAfter($("#retype_password").closest('.row'));
182
+ element.parents("div.form-group")
183
+ .addClass('has-error');
184
+ }
185
+ else if (element.attr("name") == "agree") {
186
+ error.insertAfter("#agree-text");
187
+ }
188
+ else {
189
+ error.insertAfter(element);
190
+ }
191
+ },
192
+ messages: {
193
+ firstname: "Please enter firstname and lastname",
194
+ lastname: "Please enter firstname and lastname",
195
+ email: {
196
+ required: "Please enter email",
197
+ email: "Please enter a valid email address"
198
+ },
199
+ password: {
200
+ required: "Please enter password fields.",
201
+ minlength: "Passwords should be at least 8 characters."
202
+ },
203
+ retype_password: {
204
+ required: "Please enter password fields.",
205
+ minlength: "Passwords should be at least 8 characters."
206
+ },
207
+ agree: "Please accept our policy"
208
+ },
209
+ invalidHandler: function() {
210
+ animate({
211
+ name: 'shake',
212
+ selector: '.auth-container > .card'
213
+ });
214
+ }
215
+ }
216
+
217
+ $.extend(signupValidationSettings, config.validations);
218
+
219
+ $('#signup-form').validate(signupValidationSettings);
220
+ });
221
+ $(function() {
222
+ var $itemActions = $(".item-actions-dropdown");
223
+
224
+ $(document).on('click',function(e) {
225
+ if (!$(e.target).closest('.item-actions-dropdown').length) {
226
+ $itemActions.removeClass('active');
227
+ }
228
+ });
229
+
230
+ $('.item-actions-toggle-btn').on('click',function(e){
231
+ e.preventDefault();
232
+
233
+ var $thisActionList = $(this).closest('.item-actions-dropdown');
234
+
235
+ $itemActions.not($thisActionList).removeClass('active');
236
+
237
+ $thisActionList.toggleClass('active');
238
+ });
239
+ });
240
+
241
+ /***********************************************
242
+ * NProgress Settings
243
+ ***********************************************/
244
+ var npSettings = {
245
+ easing: 'ease',
246
+ speed: 500
247
+ }
248
+
249
+ NProgress.configure(npSettings);
250
+ $(function() {
251
+ animate({
252
+ name: 'flipInY',
253
+ selector: '.error-card > .error-title-block'
254
+ });
255
+
256
+
257
+ setTimeout(function(){
258
+ var $el = $('.error-card > .error-container');
259
+
260
+ animate({
261
+ name: 'fadeInUp',
262
+ selector: $el
263
+ });
264
+
265
+ $el.addClass('visible');
266
+ }, 1000);
267
+ })
268
+ $(function() {
269
+ setSameHeights();
270
+
271
+ var resizeTimer;
272
+
273
+ $(window).resize(function() {
274
+ clearTimeout(resizeTimer);
275
+ resizeTimer = setTimeout(setSameHeights, 150);
276
+ });
277
+ });
278
+
279
+
280
+ function setSameHeights($container) {
281
+
282
+ $container = $container || $('.sameheight-container');
283
+
284
+ var viewport = ResponsiveBootstrapToolkit.current();
285
+
286
+ $container.each(function() {
287
+
288
+ var $items = $(this).find(".sameheight-item");
289
+
290
+ // Get max height of items in container
291
+ var maxHeight = 0;
292
+
293
+ $items.each(function() {
294
+ $(this).css({height: 'auto'});
295
+ maxHeight = Math.max(maxHeight, $(this).innerHeight());
296
+ });
297
+
298
+
299
+ // Set heights of items
300
+ $items.each(function() {
301
+ // Ignored viewports for item
302
+ var excludedStr = $(this).data('exclude') || '';
303
+ var excluded = excludedStr.split(',');
304
+
305
+ // Set height of element if it's not excluded on
306
+ if (excluded.indexOf(viewport) === -1) {
307
+ $(this).innerHeight(maxHeight);
308
+ }
309
+ });
310
+ });
311
+ }
312
+
313
+ $(function() {
314
+
315
+ $(".wyswyg").each(function() {
316
+
317
+ var $editor = $(this).find(".editor");
318
+ var $toolbar = $(this).find(".toolbar");
319
+
320
+ var editor = new Quill($editor.get(0), {
321
+ theme: 'snow',
322
+ // modules: {
323
+ // toolbar: toolbarOptions
324
+ // }
325
+ modules: {
326
+ toolbar: $toolbar.get(0)
327
+ }
328
+ });
329
+
330
+ // var $toolbar = $(this).find(".toolbar");
331
+ // var $editor = $(this).find(".editor");
332
+
333
+
334
+ // var editor = new Quill($editor.get(0), {
335
+ // theme: 'snow'
336
+ // });
337
+
338
+ // editor.addModule('toolbar', {
339
+ // container: $toolbar.get(0) // Selector for toolbar container
340
+ // });
341
+
342
+
343
+
344
+ });
345
+
346
+ });
347
+
348
+ $(function() {
349
+
350
+ if (!$('#morris-one-line-chart').length) {
351
+ return false;
352
+ }
353
+
354
+ function drawMorrisCharts() {
355
+
356
+ $('#morris-one-line-chart').empty();
357
+
358
+ Morris.Line({
359
+ element: 'morris-one-line-chart',
360
+ data: [
361
+ { year: '2008', value: 5 },
362
+ { year: '2009', value: 10 },
363
+ { year: '2010', value: 8 },
364
+ { year: '2011', value: 22 },
365
+ { year: '2012', value: 8 },
366
+ { year: '2014', value: 10 },
367
+ { year: '2015', value: 5 }
368
+ ],
369
+ xkey: 'year',
370
+ ykeys: ['value'],
371
+ resize: true,
372
+ lineWidth:4,
373
+ labels: ['Value'],
374
+ lineColors: [config.chart.colorPrimary.toString()],
375
+ pointSize:5,
376
+ });
377
+
378
+ $('#morris-area-chart').empty();
379
+
380
+ Morris.Area({
381
+ element: 'morris-area-chart',
382
+ data: [{ period: '2010 Q1', iphone: 2666, ipad: null, itouch: 2647 },
383
+ { period: '2010 Q2', iphone: 2778, ipad: 2294, itouch: 2441 },
384
+ { period: '2010 Q3', iphone: 4912, ipad: 1969, itouch: 2501 },
385
+ { period: '2010 Q4', iphone: 3767, ipad: 3597, itouch: 5689 },
386
+ { period: '2011 Q1', iphone: 6810, ipad: 1914, itouch: 2293 },
387
+ { period: '2011 Q2', iphone: 5670, ipad: 4293, itouch: 1881 },
388
+ { period: '2011 Q3', iphone: 4820, ipad: 3795, itouch: 1588 },
389
+ { period: '2011 Q4', iphone: 15073, ipad: 5967, itouch: 5175 },
390
+ { period: '2012 Q1', iphone: 10687, ipad: 4460, itouch: 2028 },
391
+ { period: '2012 Q2', iphone: 8432, ipad: 5713, itouch: 1791 } ],
392
+ xkey: 'period',
393
+ ykeys: ['iphone', 'ipad', 'itouch'],
394
+ labels: ['iPhone', 'iPad', 'iPod Touch'],
395
+ pointSize: 2,
396
+ hideHover: 'auto',
397
+ resize: true,
398
+ lineColors: [
399
+ tinycolor(config.chart.colorPrimary.toString()).lighten(10).toString(),
400
+ tinycolor(config.chart.colorPrimary.toString()).darken(10).toString(),
401
+ config.chart.colorPrimary.toString()
402
+ ],
403
+ lineWidth:2,
404
+ pointSize:1,
405
+ });
406
+
407
+ $('#morris-donut-chart').empty();
408
+
409
+ Morris.Donut({
410
+ element: 'morris-donut-chart',
411
+ data: [{ label: "Download Sales", value: 12 },
412
+ { label: "In-Store Sales", value: 30 },
413
+ { label: "Mail-Order Sales", value: 20 } ],
414
+ resize: true,
415
+ colors: [
416
+ tinycolor(config.chart.colorPrimary.toString()).lighten(10).toString(),
417
+ tinycolor(config.chart.colorPrimary.toString()).darken(10).toString(),
418
+ config.chart.colorPrimary.toString()
419
+ ],
420
+ });
421
+
422
+ $('#morris-bar-chart').empty();
423
+
424
+ Morris.Bar({
425
+ element: 'morris-bar-chart',
426
+ data: [{ y: '2006', a: 60, b: 50 },
427
+ { y: '2007', a: 75, b: 65 },
428
+ { y: '2008', a: 50, b: 40 },
429
+ { y: '2009', a: 75, b: 65 },
430
+ { y: '2010', a: 50, b: 40 },
431
+ { y: '2011', a: 75, b: 65 },
432
+ { y: '2012', a: 100, b: 90 } ],
433
+ xkey: 'y',
434
+ ykeys: ['a', 'b'],
435
+ labels: ['Series A', 'Series B'],
436
+ hideHover: 'auto',
437
+ resize: true,
438
+ barColors: [
439
+ config.chart.colorPrimary.toString(),
440
+ tinycolor(config.chart.colorPrimary.toString()).darken(10).toString()
441
+ ],
442
+ });
443
+
444
+ $('#morris-line-chart').empty();
445
+
446
+ Morris.Line({
447
+ element: 'morris-line-chart',
448
+ data: [{ y: '2006', a: 100, b: 90 },
449
+ { y: '2007', a: 75, b: 65 },
450
+ { y: '2008', a: 50, b: 40 },
451
+ { y: '2009', a: 75, b: 65 },
452
+ { y: '2010', a: 50, b: 40 },
453
+ { y: '2011', a: 75, b: 65 },
454
+ { y: '2012', a: 100, b: 90 } ],
455
+ xkey: 'y',
456
+ ykeys: ['a', 'b'],
457
+ labels: ['Series A', 'Series B'],
458
+ hideHover: 'auto',
459
+ resize: true,
460
+ lineColors: [
461
+ config.chart.colorPrimary.toString(),
462
+ tinycolor(config.chart.colorPrimary.toString()).darken(10).toString()
463
+ ],
464
+ });
465
+ }
466
+
467
+ drawMorrisCharts();
468
+
469
+ $(document).on("themechange", function(){
470
+ drawMorrisCharts();
471
+ });
472
+ });
473
+ //Flot Bar Chart
474
+ $(function() {
475
+
476
+ if (!$('#flot-bar-chart').length) {
477
+ return false;
478
+ }
479
+
480
+ function drawFlotCharts() {
481
+
482
+ var barOptions = {
483
+ series: {
484
+ bars: {
485
+ show: true,
486
+ barWidth: 0.6,
487
+ fill: true,
488
+ fillColor: {
489
+ colors: [{
490
+ opacity: 0.8
491
+ }, {
492
+ opacity: 0.8
493
+ }]
494
+ }
495
+ }
496
+ },
497
+ xaxis: {
498
+ tickDecimals: 0
499
+ },
500
+ colors: [config.chart.colorPrimary],
501
+ grid: {
502
+ color: "#999999",
503
+ hoverable: true,
504
+ clickable: true,
505
+ tickColor: "#D4D4D4",
506
+ borderWidth:0
507
+ },
508
+ legend: {
509
+ show: false
510
+ },
511
+ tooltip: true,
512
+ tooltipOpts: {
513
+ content: "x: %x, y: %y"
514
+ }
515
+ };
516
+ var barData = {
517
+ label: "bar",
518
+ data: [
519
+ [1, 34],
520
+ [2, 25],
521
+ [3, 19],
522
+ [4, 34],
523
+ [5, 32],
524
+ [6, 44]
525
+ ]
526
+ };
527
+ $.plot($("#flot-bar-chart"), [barData], barOptions);
528
+
529
+
530
+ // Flot line chart
531
+ var lineOptions = {
532
+ series: {
533
+ lines: {
534
+ show: true,
535
+ lineWidth: 2,
536
+ fill: true,
537
+ fillColor: {
538
+ colors: [{
539
+ opacity: 0.0
540
+ }, {
541
+ opacity: 0.0
542
+ }]
543
+ }
544
+ }
545
+ },
546
+ xaxis: {
547
+ tickDecimals: 0
548
+ },
549
+ colors: [config.chart.colorPrimary],
550
+ grid: {
551
+ color: "#999999",
552
+ hoverable: true,
553
+ clickable: true,
554
+ tickColor: "#D4D4D4",
555
+ borderWidth:0
556
+ },
557
+ legend: {
558
+ show: false
559
+ },
560
+ tooltip: true,
561
+ tooltipOpts: {
562
+ content: "x: %x, y: %y"
563
+ }
564
+ };
565
+ var barData = {
566
+ label: "bar",
567
+ data: [
568
+ [1, 34],
569
+ [2, 25],
570
+ [3, 19],
571
+ [4, 34],
572
+ [5, 32],
573
+ [6, 44]
574
+ ]
575
+ };
576
+ $.plot($("#flot-line-chart"), [barData], lineOptions);
577
+
578
+ //Flot Pie Chart
579
+ var data = [{
580
+ label: "Sales 1",
581
+ data: 21,
582
+ color: tinycolor(config.chart.colorPrimary.toString()).lighten(20),
583
+ }, {
584
+ label: "Sales 2",
585
+ data: 15,
586
+ color: tinycolor(config.chart.colorPrimary.toString()).lighten(10),
587
+ }, {
588
+ label: "Sales 3",
589
+ data: 7,
590
+ color: tinycolor(config.chart.colorPrimary.toString()),
591
+ }, {
592
+ label: "Sales 4",
593
+ data: 52,
594
+ color: tinycolor(config.chart.colorPrimary.toString()).darken(10),
595
+ }];
596
+
597
+ var plotObj = $.plot($("#flot-pie-chart"), data, {
598
+ series: {
599
+ pie: {
600
+ show: true
601
+ }
602
+ },
603
+ grid: {
604
+ hoverable: true
605
+ },
606
+ tooltip: true,
607
+ tooltipOpts: {
608
+ content: "%p.0%, %s", // show percentages, rounding to 2 decimal places
609
+ shifts: {
610
+ x: 20,
611
+ y: 0
612
+ },
613
+ defaultTheme: false
614
+ }
615
+ });
616
+
617
+
618
+ //live chart example
619
+ var container = $("#flot-line-chart-moving");
620
+ container.empty();
621
+ // Determine how many data points to keep based on the placeholder's initial size;
622
+ // this gives us a nice high-res plot while avoiding more than one point per pixel.
623
+
624
+ var maximum = container.outerWidth() / 10 || 100;
625
+
626
+ //
627
+
628
+ var data = [];
629
+
630
+ function getRandomData() {
631
+
632
+ if (data.length) {
633
+ data = data.slice(1);
634
+ }
635
+
636
+ while (data.length < maximum) {
637
+ var previous = data.length ? data[data.length - 1] : 50;
638
+ var y = previous + Math.random() * 10 - 5;
639
+ data.push(y < 0 ? 0 : y > 100 ? 100 : y);
640
+ }
641
+
642
+ // zip the generated y values with the x values
643
+
644
+ var res = [];
645
+ for (var i = 0; i < data.length; ++i) {
646
+ res.push([i, data[i]])
647
+ }
648
+
649
+ return res;
650
+ }
651
+
652
+ series = [{
653
+ data: getRandomData(),
654
+ lines: {
655
+ fill: true
656
+ }
657
+ }];
658
+
659
+
660
+ var plot = $.plot(container, series, {
661
+ grid: {
662
+
663
+ color: "#999999",
664
+ tickColor: "#D4D4D4",
665
+ borderWidth:0,
666
+ minBorderMargin: 20,
667
+ labelMargin: 10,
668
+ backgroundColor: {
669
+ colors: ["#ffffff", "#ffffff"]
670
+ },
671
+ margin: {
672
+ top: 8,
673
+ bottom: 20,
674
+ left: 20
675
+ },
676
+ markings: function(axes) {
677
+ var markings = [];
678
+ var xaxis = axes.xaxis;
679
+ for (var x = Math.floor(xaxis.min); x < xaxis.max; x += xaxis.tickSize * 2) {
680
+ markings.push({
681
+ xaxis: {
682
+ from: x,
683
+ to: x + xaxis.tickSize
684
+ },
685
+ color: "#fff"
686
+ });
687
+ }
688
+ return markings;
689
+ }
690
+ },
691
+ colors: [config.chart.colorPrimary.toString()],
692
+ xaxis: {
693
+ tickFormatter: function() {
694
+ return "";
695
+ }
696
+ },
697
+ yaxis: {
698
+ min: 0,
699
+ max: 110
700
+ },
701
+ legend: {
702
+ show: true
703
+ }
704
+ });
705
+
706
+ // Update the random dataset at 25FPS for a smoothly-animating chart
707
+
708
+ setInterval(function updateRandom() {
709
+ series[0].data = getRandomData();
710
+ plot.setData(series);
711
+ plot.draw();
712
+ }, 40);
713
+
714
+
715
+ //Flot Multiple Axes Line Chart
716
+ var oilpricesFull = [ [1167692400000, 61.05], [1167778800000, 58.32], [1167865200000, 57.35], [1167951600000, 56.31], [1168210800000, 55.55], [1168297200000, 55.64], [1168383600000, 54.02], [1168470000000, 51.88], [1168556400000, 52.99], [1168815600000, 52.99], [1168902000000, 51.21], [1168988400000, 52.24], [1169074800000, 50.48], [1169161200000, 51.99], [1169420400000, 51.13], [1169506800000, 55.04], [1169593200000, 55.37], [1169679600000, 54.23], [1169766000000, 55.42], [1170025200000, 54.01], [1170111600000, 56.97], [1170198000000, 58.14], [1170284400000, 58.14], [1170370800000, 59.02], [1170630000000, 58.74], [1170716400000, 58.88], [1170802800000, 57.71], [1170889200000, 59.71], [1170975600000, 59.89], [1171234800000, 57.81], [1171321200000, 59.06], [1171407600000, 58.00], [1171494000000, 57.99], [1171580400000, 59.39], [1171839600000, 59.39], [1171926000000, 58.07], [1172012400000, 60.07], [1172098800000, 61.14], [1172444400000, 61.39], [1172530800000, 61.46], [1172617200000, 61.79], [1172703600000, 62.00], [1172790000000, 60.07], [1173135600000, 60.69], [1173222000000, 61.82], [1173308400000, 60.05], [1173654000000, 58.91], [1173740400000, 57.93], [1173826800000, 58.16], [1173913200000, 57.55], [1173999600000, 57.11], [1174258800000, 56.59], [1174345200000, 59.61], [1174518000000, 61.69], [1174604400000, 62.28], [1174860000000, 62.91], [1174946400000, 62.93], [1175032800000, 64.03], [1175119200000, 66.03], [1175205600000, 65.87], [1175464800000, 64.64], [1175637600000, 64.38], [1175724000000, 64.28], [1175810400000, 64.28], [1176069600000, 61.51], [1176156000000, 61.89], [1176242400000, 62.01], [1176328800000, 63.85], [1176415200000, 63.63], [1176674400000, 63.61], [1176760800000, 63.10], [1176847200000, 63.13], [1176933600000, 61.83], [1177020000000, 63.38], [1177279200000, 64.58], [1177452000000, 65.84], [1177538400000, 65.06], [1177624800000, 66.46], [1177884000000, 64.40], [1178056800000, 63.68], [1178143200000, 63.19], [1178229600000, 61.93], [1178488800000, 61.47], [1178575200000, 61.55], [1178748000000, 61.81], [1178834400000, 62.37], [1179093600000, 62.46], [1179180000000, 63.17], [1179266400000, 62.55], [1179352800000, 64.94], [1179698400000, 66.27], [1179784800000, 65.50], [1179871200000, 65.77], [1179957600000, 64.18], [1180044000000, 65.20], [1180389600000, 63.15], [1180476000000, 63.49], [1180562400000, 65.08], [1180908000000, 66.30], [1180994400000, 65.96], [1181167200000, 66.93], [1181253600000, 65.98], [1181599200000, 65.35], [1181685600000, 66.26], [1181858400000, 68.00], [1182117600000, 69.09], [1182204000000, 69.10], [1182290400000, 68.19], [1182376800000, 68.19], [1182463200000, 69.14], [1182722400000, 68.19], [1182808800000, 67.77], [1182895200000, 68.97], [1182981600000, 69.57], [1183068000000, 70.68], [1183327200000, 71.09], [1183413600000, 70.92], [1183586400000, 71.81], [1183672800000, 72.81], [1183932000000, 72.19], [1184018400000, 72.56], [1184191200000, 72.50], [1184277600000, 74.15], [1184623200000, 75.05], [1184796000000, 75.92], [1184882400000, 75.57], [1185141600000, 74.89], [1185228000000, 73.56], [1185314400000, 75.57], [1185400800000, 74.95], [1185487200000, 76.83], [1185832800000, 78.21], [1185919200000, 76.53], [1186005600000, 76.86], [1186092000000, 76.00], [1186437600000, 71.59], [1186696800000, 71.47], [1186956000000, 71.62], [1187042400000, 71.00], [1187301600000, 71.98], [1187560800000, 71.12], [1187647200000, 69.47], [1187733600000, 69.26], [1187820000000, 69.83], [1187906400000, 71.09], [1188165600000, 71.73], [1188338400000, 73.36], [1188511200000, 74.04], [1188856800000, 76.30], [1189116000000, 77.49], [1189461600000, 78.23], [1189548000000, 79.91], [1189634400000, 80.09], [1189720800000, 79.10], [1189980000000, 80.57], [1190066400000, 81.93], [1190239200000, 83.32], [1190325600000, 81.62], [1190584800000, 80.95], [1190671200000, 79.53], [1190757600000, 80.30], [1190844000000, 82.88], [1190930400000, 81.66], [1191189600000, 80.24], [1191276000000, 80.05], [1191362400000, 79.94], [1191448800000, 81.44], [1191535200000, 81.22], [1191794400000, 79.02], [1191880800000, 80.26], [1191967200000, 80.30], [1192053600000, 83.08], [1192140000000, 83.69], [1192399200000, 86.13], [1192485600000, 87.61], [1192572000000, 87.40], [1192658400000, 89.47], [1192744800000, 88.60], [1193004000000, 87.56], [1193090400000, 87.56], [1193176800000, 87.10], [1193263200000, 91.86], [1193612400000, 93.53], [1193698800000, 94.53], [1193871600000, 95.93], [1194217200000, 93.98], [1194303600000, 96.37], [1194476400000, 95.46], [1194562800000, 96.32], [1195081200000, 93.43], [1195167600000, 95.10], [1195426800000, 94.64], [1195513200000, 95.10], [1196031600000, 97.70], [1196118000000, 94.42], [1196204400000, 90.62], [1196290800000, 91.01], [1196377200000, 88.71], [1196636400000, 88.32], [1196809200000, 90.23], [1196982000000, 88.28], [1197241200000, 87.86], [1197327600000, 90.02], [1197414000000, 92.25], [1197586800000, 90.63], [1197846000000, 90.63], [1197932400000, 90.49], [1198018800000, 91.24], [1198105200000, 91.06], [1198191600000, 90.49], [1198710000000, 96.62], [1198796400000, 96.00], [1199142000000, 99.62], [1199314800000, 99.18], [1199401200000, 95.09], [1199660400000, 96.33], [1199833200000, 95.67], [1200351600000, 91.90], [1200438000000, 90.84], [1200524400000, 90.13], [1200610800000, 90.57], [1200956400000, 89.21], [1201042800000, 86.99], [1201129200000, 89.85], [1201474800000, 90.99], [1201561200000, 91.64], [1201647600000, 92.33], [1201734000000, 91.75], [1202079600000, 90.02], [1202166000000, 88.41], [1202252400000, 87.14], [1202338800000, 88.11], [1202425200000, 91.77], [1202770800000, 92.78], [1202857200000, 93.27], [1202943600000, 95.46], [1203030000000, 95.46], [1203289200000, 101.74], [1203462000000, 98.81], [1203894000000, 100.88], [1204066800000, 99.64], [1204153200000, 102.59], [1204239600000, 101.84], [1204498800000, 99.52], [1204585200000, 99.52], [1204671600000, 104.52], [1204758000000, 105.47], [1204844400000, 105.15], [1205103600000, 108.75], [1205276400000, 109.92], [1205362800000, 110.33], [1205449200000, 110.21], [1205708400000, 105.68], [1205967600000, 101.84], [1206313200000, 100.86], [1206399600000, 101.22], [1206486000000, 105.90], [1206572400000, 107.58], [1206658800000, 105.62], [1206914400000, 101.58], [1207000800000, 100.98], [1207173600000, 103.83], [1207260000000, 106.23], [1207605600000, 108.50], [1207778400000, 110.11], [1207864800000, 110.14], [1208210400000, 113.79], [1208296800000, 114.93], [1208383200000, 114.86], [1208728800000, 117.48], [1208815200000, 118.30], [1208988000000, 116.06], [1209074400000, 118.52], [1209333600000, 118.75], [1209420000000, 113.46], [1209592800000, 112.52], [1210024800000, 121.84], [1210111200000, 123.53], [1210197600000, 123.69], [1210543200000, 124.23], [1210629600000, 125.80], [1210716000000, 126.29], [1211148000000, 127.05], [1211320800000, 129.07], [1211493600000, 132.19], [1211839200000, 128.85], [1212357600000, 127.76], [1212703200000, 138.54], [1212962400000, 136.80], [1213135200000, 136.38], [1213308000000, 134.86], [1213653600000, 134.01], [1213740000000, 136.68], [1213912800000, 135.65], [1214172000000, 134.62], [1214258400000, 134.62], [1214344800000, 134.62], [1214431200000, 139.64], [1214517600000, 140.21], [1214776800000, 140.00], [1214863200000, 140.97], [1214949600000, 143.57], [1215036000000, 145.29], [1215381600000, 141.37], [1215468000000, 136.04], [1215727200000, 146.40], [1215986400000, 145.18], [1216072800000, 138.74], [1216159200000, 134.60], [1216245600000, 129.29], [1216332000000, 130.65], [1216677600000, 127.95], [1216850400000, 127.95], [1217282400000, 122.19], [1217455200000, 124.08], [1217541600000, 125.10], [1217800800000, 121.41], [1217887200000, 119.17], [1217973600000, 118.58], [1218060000000, 120.02], [1218405600000, 114.45], [1218492000000, 113.01], [1218578400000, 116.00], [1218751200000, 113.77], [1219010400000, 112.87], [1219096800000, 114.53], [1219269600000, 114.98], [1219356000000, 114.98], [1219701600000, 116.27], [1219788000000, 118.15], [1219874400000, 115.59], [1219960800000, 115.46], [1220306400000, 109.71], [1220392800000, 109.35], [1220565600000, 106.23], [1220824800000, 106.34] ];
717
+ var exchangeratesFull = [ [1167606000000, 0.7580], [1167692400000, 0.7580], [1167778800000, 0.75470], [1167865200000, 0.75490], [1167951600000, 0.76130], [1168038000000, 0.76550], [1168124400000, 0.76930], [1168210800000, 0.76940], [1168297200000, 0.76880], [1168383600000, 0.76780], [1168470000000, 0.77080], [1168556400000, 0.77270], [1168642800000, 0.77490], [1168729200000, 0.77410], [1168815600000, 0.77410], [1168902000000, 0.77320], [1168988400000, 0.77270], [1169074800000, 0.77370], [1169161200000, 0.77240], [1169247600000, 0.77120], [1169334000000, 0.7720], [1169420400000, 0.77210], [1169506800000, 0.77170], [1169593200000, 0.77040], [1169679600000, 0.7690], [1169766000000, 0.77110], [1169852400000, 0.7740], [1169938800000, 0.77450], [1170025200000, 0.77450], [1170111600000, 0.7740], [1170198000000, 0.77160], [1170284400000, 0.77130], [1170370800000, 0.76780], [1170457200000, 0.76880], [1170543600000, 0.77180], [1170630000000, 0.77180], [1170716400000, 0.77280], [1170802800000, 0.77290], [1170889200000, 0.76980], [1170975600000, 0.76850], [1171062000000, 0.76810], [1171148400000, 0.7690], [1171234800000, 0.7690], [1171321200000, 0.76980], [1171407600000, 0.76990], [1171494000000, 0.76510], [1171580400000, 0.76130], [1171666800000, 0.76160], [1171753200000, 0.76140], [1171839600000, 0.76140], [1171926000000, 0.76070], [1172012400000, 0.76020], [1172098800000, 0.76110], [1172185200000, 0.76220], [1172271600000, 0.76150], [1172358000000, 0.75980], [1172444400000, 0.75980], [1172530800000, 0.75920], [1172617200000, 0.75730], [1172703600000, 0.75660], [1172790000000, 0.75670], [1172876400000, 0.75910], [1172962800000, 0.75820], [1173049200000, 0.75850], [1173135600000, 0.76130], [1173222000000, 0.76310], [1173308400000, 0.76150], [1173394800000, 0.760], [1173481200000, 0.76130], [1173567600000, 0.76270], [1173654000000, 0.76270], [1173740400000, 0.76080], [1173826800000, 0.75830], [1173913200000, 0.75750], [1173999600000, 0.75620], [1174086000000, 0.7520], [1174172400000, 0.75120], [1174258800000, 0.75120], [1174345200000, 0.75170], [1174431600000, 0.7520], [1174518000000, 0.75110], [1174604400000, 0.7480], [1174690800000, 0.75090], [1174777200000, 0.75310], [1174860000000, 0.75310], [1174946400000, 0.75270], [1175032800000, 0.74980], [1175119200000, 0.74930], [1175205600000, 0.75040], [1175292000000, 0.750], [1175378400000, 0.74910], [1175464800000, 0.74910], [1175551200000, 0.74850], [1175637600000, 0.74840], [1175724000000, 0.74920], [1175810400000, 0.74710], [1175896800000, 0.74590], [1175983200000, 0.74770], [1176069600000, 0.74770], [1176156000000, 0.74830], [1176242400000, 0.74580], [1176328800000, 0.74480], [1176415200000, 0.7430], [1176501600000, 0.73990], [1176588000000, 0.73950], [1176674400000, 0.73950], [1176760800000, 0.73780], [1176847200000, 0.73820], [1176933600000, 0.73620], [1177020000000, 0.73550], [1177106400000, 0.73480], [1177192800000, 0.73610], [1177279200000, 0.73610], [1177365600000, 0.73650], [1177452000000, 0.73620], [1177538400000, 0.73310], [1177624800000, 0.73390], [1177711200000, 0.73440], [1177797600000, 0.73270], [1177884000000, 0.73270], [1177970400000, 0.73360], [1178056800000, 0.73330], [1178143200000, 0.73590], [1178229600000, 0.73590], [1178316000000, 0.73720], [1178402400000, 0.7360], [1178488800000, 0.7360], [1178575200000, 0.7350], [1178661600000, 0.73650], [1178748000000, 0.73840], [1178834400000, 0.73950], [1178920800000, 0.74130], [1179007200000, 0.73970], [1179093600000, 0.73960], [1179180000000, 0.73850], [1179266400000, 0.73780], [1179352800000, 0.73660], [1179439200000, 0.740], [1179525600000, 0.74110], [1179612000000, 0.74060], [1179698400000, 0.74050], [1179784800000, 0.74140], [1179871200000, 0.74310], [1179957600000, 0.74310], [1180044000000, 0.74380], [1180130400000, 0.74430], [1180216800000, 0.74430], [1180303200000, 0.74430], [1180389600000, 0.74340], [1180476000000, 0.74290], [1180562400000, 0.74420], [1180648800000, 0.7440], [1180735200000, 0.74390], [1180821600000, 0.74370], [1180908000000, 0.74370], [1180994400000, 0.74290], [1181080800000, 0.74030], [1181167200000, 0.73990], [1181253600000, 0.74180], [1181340000000, 0.74680], [1181426400000, 0.7480], [1181512800000, 0.7480], [1181599200000, 0.7490], [1181685600000, 0.74940], [1181772000000, 0.75220], [1181858400000, 0.75150], [1181944800000, 0.75020], [1182031200000, 0.74720], [1182117600000, 0.74720], [1182204000000, 0.74620], [1182290400000, 0.74550], [1182376800000, 0.74490], [1182463200000, 0.74670], [1182549600000, 0.74580], [1182636000000, 0.74270], [1182722400000, 0.74270], [1182808800000, 0.7430], [1182895200000, 0.74290], [1182981600000, 0.7440], [1183068000000, 0.7430], [1183154400000, 0.74220], [1183240800000, 0.73880], [1183327200000, 0.73880], [1183413600000, 0.73690], [1183500000000, 0.73450], [1183586400000, 0.73450], [1183672800000, 0.73450], [1183759200000, 0.73520], [1183845600000, 0.73410], [1183932000000, 0.73410], [1184018400000, 0.7340], [1184104800000, 0.73240], [1184191200000, 0.72720], [1184277600000, 0.72640], [1184364000000, 0.72550], [1184450400000, 0.72580], [1184536800000, 0.72580], [1184623200000, 0.72560], [1184709600000, 0.72570], [1184796000000, 0.72470], [1184882400000, 0.72430], [1184968800000, 0.72440], [1185055200000, 0.72350], [1185141600000, 0.72350], [1185228000000, 0.72350], [1185314400000, 0.72350], [1185400800000, 0.72620], [1185487200000, 0.72880], [1185573600000, 0.73010], [1185660000000, 0.73370], [1185746400000, 0.73370], [1185832800000, 0.73240], [1185919200000, 0.72970], [1186005600000, 0.73170], [1186092000000, 0.73150], [1186178400000, 0.72880], [1186264800000, 0.72630], [1186351200000, 0.72630], [1186437600000, 0.72420], [1186524000000, 0.72530], [1186610400000, 0.72640], [1186696800000, 0.7270], [1186783200000, 0.73120], [1186869600000, 0.73050], [1186956000000, 0.73050], [1187042400000, 0.73180], [1187128800000, 0.73580], [1187215200000, 0.74090], [1187301600000, 0.74540], [1187388000000, 0.74370], [1187474400000, 0.74240], [1187560800000, 0.74240], [1187647200000, 0.74150], [1187733600000, 0.74190], [1187820000000, 0.74140], [1187906400000, 0.73770], [1187992800000, 0.73550], [1188079200000, 0.73150], [1188165600000, 0.73150], [1188252000000, 0.7320], [1188338400000, 0.73320], [1188424800000, 0.73460], [1188511200000, 0.73280], [1188597600000, 0.73230], [1188684000000, 0.7340], [1188770400000, 0.7340], [1188856800000, 0.73360], [1188943200000, 0.73510], [1189029600000, 0.73460], [1189116000000, 0.73210], [1189202400000, 0.72940], [1189288800000, 0.72660], [1189375200000, 0.72660], [1189461600000, 0.72540], [1189548000000, 0.72420], [1189634400000, 0.72130], [1189720800000, 0.71970], [1189807200000, 0.72090], [1189893600000, 0.7210], [1189980000000, 0.7210], [1190066400000, 0.7210], [1190152800000, 0.72090], [1190239200000, 0.71590], [1190325600000, 0.71330], [1190412000000, 0.71050], [1190498400000, 0.70990], [1190584800000, 0.70990], [1190671200000, 0.70930], [1190757600000, 0.70930], [1190844000000, 0.70760], [1190930400000, 0.7070], [1191016800000, 0.70490], [1191103200000, 0.70120], [1191189600000, 0.70110], [1191276000000, 0.70190], [1191362400000, 0.70460], [1191448800000, 0.70630], [1191535200000, 0.70890], [1191621600000, 0.70770], [1191708000000, 0.70770], [1191794400000, 0.70770], [1191880800000, 0.70910], [1191967200000, 0.71180], [1192053600000, 0.70790], [1192140000000, 0.70530], [1192226400000, 0.7050], [1192312800000, 0.70550], [1192399200000, 0.70550], [1192485600000, 0.70450], [1192572000000, 0.70510], [1192658400000, 0.70510], [1192744800000, 0.70170], [1192831200000, 0.70], [1192917600000, 0.69950], [1193004000000, 0.69940], [1193090400000, 0.70140], [1193176800000, 0.70360], [1193263200000, 0.70210], [1193349600000, 0.70020], [1193436000000, 0.69670], [1193522400000, 0.6950], [1193612400000, 0.6950], [1193698800000, 0.69390], [1193785200000, 0.6940], [1193871600000, 0.69220], [1193958000000, 0.69190], [1194044400000, 0.69140], [1194130800000, 0.68940], [1194217200000, 0.68910], [1194303600000, 0.69040], [1194390000000, 0.6890], [1194476400000, 0.68340], [1194562800000, 0.68230], [1194649200000, 0.68070], [1194735600000, 0.68150], [1194822000000, 0.68150], [1194908400000, 0.68470], [1194994800000, 0.68590], [1195081200000, 0.68220], [1195167600000, 0.68270], [1195254000000, 0.68370], [1195340400000, 0.68230], [1195426800000, 0.68220], [1195513200000, 0.68220], [1195599600000, 0.67920], [1195686000000, 0.67460], [1195772400000, 0.67350], [1195858800000, 0.67310], [1195945200000, 0.67420], [1196031600000, 0.67440], [1196118000000, 0.67390], [1196204400000, 0.67310], [1196290800000, 0.67610], [1196377200000, 0.67610], [1196463600000, 0.67850], [1196550000000, 0.68180], [1196636400000, 0.68360], [1196722800000, 0.68230], [1196809200000, 0.68050], [1196895600000, 0.67930], [1196982000000, 0.68490], [1197068400000, 0.68330], [1197154800000, 0.68250], [1197241200000, 0.68250], [1197327600000, 0.68160], [1197414000000, 0.67990], [1197500400000, 0.68130], [1197586800000, 0.68090], [1197673200000, 0.68680], [1197759600000, 0.69330], [1197846000000, 0.69330], [1197932400000, 0.69450], [1198018800000, 0.69440], [1198105200000, 0.69460], [1198191600000, 0.69640], [1198278000000, 0.69650], [1198364400000, 0.69560], [1198450800000, 0.69560], [1198537200000, 0.6950], [1198623600000, 0.69480], [1198710000000, 0.69280], [1198796400000, 0.68870], [1198882800000, 0.68240], [1198969200000, 0.67940], [1199055600000, 0.67940], [1199142000000, 0.68030], [1199228400000, 0.68550], [1199314800000, 0.68240], [1199401200000, 0.67910], [1199487600000, 0.67830], [1199574000000, 0.67850], [1199660400000, 0.67850], [1199746800000, 0.67970], [1199833200000, 0.680], [1199919600000, 0.68030], [1200006000000, 0.68050], [1200092400000, 0.6760], [1200178800000, 0.6770], [1200265200000, 0.6770], [1200351600000, 0.67360], [1200438000000, 0.67260], [1200524400000, 0.67640], [1200610800000, 0.68210], [1200697200000, 0.68310], [1200783600000, 0.68420], [1200870000000, 0.68420], [1200956400000, 0.68870], [1201042800000, 0.69030], [1201129200000, 0.68480], [1201215600000, 0.68240], [1201302000000, 0.67880], [1201388400000, 0.68140], [1201474800000, 0.68140], [1201561200000, 0.67970], [1201647600000, 0.67690], [1201734000000, 0.67650], [1201820400000, 0.67330], [1201906800000, 0.67290], [1201993200000, 0.67580], [1202079600000, 0.67580], [1202166000000, 0.6750], [1202252400000, 0.6780], [1202338800000, 0.68330], [1202425200000, 0.68560], [1202511600000, 0.69030], [1202598000000, 0.68960], [1202684400000, 0.68960], [1202770800000, 0.68820], [1202857200000, 0.68790], [1202943600000, 0.68620], [1203030000000, 0.68520], [1203116400000, 0.68230], [1203202800000, 0.68130], [1203289200000, 0.68130], [1203375600000, 0.68220], [1203462000000, 0.68020], [1203548400000, 0.68020], [1203634800000, 0.67840], [1203721200000, 0.67480], [1203807600000, 0.67470], [1203894000000, 0.67470], [1203980400000, 0.67480], [1204066800000, 0.67330], [1204153200000, 0.6650], [1204239600000, 0.66110], [1204326000000, 0.65830], [1204412400000, 0.6590], [1204498800000, 0.6590], [1204585200000, 0.65810], [1204671600000, 0.65780], [1204758000000, 0.65740], [1204844400000, 0.65320], [1204930800000, 0.65020], [1205017200000, 0.65140], [1205103600000, 0.65140], [1205190000000, 0.65070], [1205276400000, 0.6510], [1205362800000, 0.64890], [1205449200000, 0.64240], [1205535600000, 0.64060], [1205622000000, 0.63820], [1205708400000, 0.63820], [1205794800000, 0.63410], [1205881200000, 0.63440], [1205967600000, 0.63780], [1206054000000, 0.64390], [1206140400000, 0.64780], [1206226800000, 0.64810], [1206313200000, 0.64810], [1206399600000, 0.64940], [1206486000000, 0.64380], [1206572400000, 0.63770], [1206658800000, 0.63290], [1206745200000, 0.63360], [1206831600000, 0.63330], [1206914400000, 0.63330], [1207000800000, 0.6330], [1207087200000, 0.63710], [1207173600000, 0.64030], [1207260000000, 0.63960], [1207346400000, 0.63640], [1207432800000, 0.63560], [1207519200000, 0.63560], [1207605600000, 0.63680], [1207692000000, 0.63570], [1207778400000, 0.63540], [1207864800000, 0.6320], [1207951200000, 0.63320], [1208037600000, 0.63280], [1208124000000, 0.63310], [1208210400000, 0.63420], [1208296800000, 0.63210], [1208383200000, 0.63020], [1208469600000, 0.62780], [1208556000000, 0.63080], [1208642400000, 0.63240], [1208728800000, 0.63240], [1208815200000, 0.63070], [1208901600000, 0.62770], [1208988000000, 0.62690], [1209074400000, 0.63350], [1209160800000, 0.63920], [1209247200000, 0.640], [1209333600000, 0.64010], [1209420000000, 0.63960], [1209506400000, 0.64070], [1209592800000, 0.64230], [1209679200000, 0.64290], [1209765600000, 0.64720], [1209852000000, 0.64850], [1209938400000, 0.64860], [1210024800000, 0.64670], [1210111200000, 0.64440], [1210197600000, 0.64670], [1210284000000, 0.65090], [1210370400000, 0.64780], [1210456800000, 0.64610], [1210543200000, 0.64610], [1210629600000, 0.64680], [1210716000000, 0.64490], [1210802400000, 0.6470], [1210888800000, 0.64610], [1210975200000, 0.64520], [1211061600000, 0.64220], [1211148000000, 0.64220], [1211234400000, 0.64250], [1211320800000, 0.64140], [1211407200000, 0.63660], [1211493600000, 0.63460], [1211580000000, 0.6350], [1211666400000, 0.63460], [1211752800000, 0.63460], [1211839200000, 0.63430], [1211925600000, 0.63460], [1212012000000, 0.63790], [1212098400000, 0.64160], [1212184800000, 0.64420], [1212271200000, 0.64310], [1212357600000, 0.64310], [1212444000000, 0.64350], [1212530400000, 0.6440], [1212616800000, 0.64730], [1212703200000, 0.64690], [1212789600000, 0.63860], [1212876000000, 0.63560], [1212962400000, 0.6340], [1213048800000, 0.63460], [1213135200000, 0.6430], [1213221600000, 0.64520], [1213308000000, 0.64670], [1213394400000, 0.65060], [1213480800000, 0.65040], [1213567200000, 0.65030], [1213653600000, 0.64810], [1213740000000, 0.64510], [1213826400000, 0.6450], [1213912800000, 0.64410], [1213999200000, 0.64140], [1214085600000, 0.64090], [1214172000000, 0.64090], [1214258400000, 0.64280], [1214344800000, 0.64310], [1214431200000, 0.64180], [1214517600000, 0.63710], [1214604000000, 0.63490], [1214690400000, 0.63330], [1214776800000, 0.63340], [1214863200000, 0.63380], [1214949600000, 0.63420], [1215036000000, 0.6320], [1215122400000, 0.63180], [1215208800000, 0.6370], [1215295200000, 0.63680], [1215381600000, 0.63680], [1215468000000, 0.63830], [1215554400000, 0.63710], [1215640800000, 0.63710], [1215727200000, 0.63550], [1215813600000, 0.6320], [1215900000000, 0.62770], [1215986400000, 0.62760], [1216072800000, 0.62910], [1216159200000, 0.62740], [1216245600000, 0.62930], [1216332000000, 0.63110], [1216418400000, 0.6310], [1216504800000, 0.63120], [1216591200000, 0.63120], [1216677600000, 0.63040], [1216764000000, 0.62940], [1216850400000, 0.63480], [1216936800000, 0.63780], [1217023200000, 0.63680], [1217109600000, 0.63680], [1217196000000, 0.63680], [1217282400000, 0.6360], [1217368800000, 0.6370], [1217455200000, 0.64180], [1217541600000, 0.64110], [1217628000000, 0.64350], [1217714400000, 0.64270], [1217800800000, 0.64270], [1217887200000, 0.64190], [1217973600000, 0.64460], [1218060000000, 0.64680], [1218146400000, 0.64870], [1218232800000, 0.65940], [1218319200000, 0.66660], [1218405600000, 0.66660], [1218492000000, 0.66780], [1218578400000, 0.67120], [1218664800000, 0.67050], [1218751200000, 0.67180], [1218837600000, 0.67840], [1218924000000, 0.68110], [1219010400000, 0.68110], [1219096800000, 0.67940], [1219183200000, 0.68040], [1219269600000, 0.67810], [1219356000000, 0.67560], [1219442400000, 0.67350], [1219528800000, 0.67630], [1219615200000, 0.67620], [1219701600000, 0.67770], [1219788000000, 0.68150], [1219874400000, 0.68020], [1219960800000, 0.6780], [1220047200000, 0.67960], [1220133600000, 0.68170], [1220220000000, 0.68170], [1220306400000, 0.68320], [1220392800000, 0.68770], [1220479200000, 0.69120], [1220565600000, 0.69140], [1220652000000, 0.70090], [1220738400000, 0.70120], [1220824800000, 0.7010], [1220911200000, 0.70050]
718
+ ];
719
+
720
+ oilprices = [];
721
+ exchangerates = [];
722
+
723
+
724
+ oilpricesFull.map(function(item, index) {
725
+ if (index % 8 === 0) {
726
+ oilprices.push(item);
727
+ }
728
+ });
729
+
730
+ exchangeratesFull.map(function(item, index) {
731
+ if (index % 8 === 0) {
732
+ exchangerates.push(item);
733
+ }
734
+ });
735
+
736
+
737
+
738
+ function euroFormatter(v, axis) {
739
+ return v.toFixed(axis.tickDecimals) + "€";
740
+ }
741
+
742
+ function doPlot(position) {
743
+ $.plot($("#flot-line-chart-multi"), [{
744
+ data: oilprices,
745
+ label: "Oil price ($)"
746
+ }, {
747
+ data: exchangerates,
748
+ label: "USD/EUR exchange rate",
749
+ yaxis: 2
750
+ }], {
751
+ xaxes: [{
752
+ mode: 'time'
753
+ }],
754
+ yaxes: [{
755
+ min: 0
756
+ }, {
757
+ // align if we are to the right
758
+ alignTicksWithAxis: position == "right" ? 1 : null,
759
+ position: position,
760
+ tickFormatter: euroFormatter
761
+ }],
762
+ legend: {
763
+ position: 'sw'
764
+ },
765
+ colors: [config.chart.colorPrimary.toString()],
766
+ grid: {
767
+ color: "#999999",
768
+ hoverable: true,
769
+ clickable: true,
770
+ tickColor: "#D4D4D4",
771
+ borderWidth:0,
772
+ hoverable: true //IMPORTANT! this is needed for tooltip to work,
773
+
774
+ },
775
+ tooltip: {
776
+ show: true,
777
+ content: "%s for %x was %y",
778
+ xDateFormat: "%y-%m-%d",
779
+ onHover: function(flotItem, $tooltipEl) {
780
+ // console.log(flotItem, $tooltipEl);
781
+ }
782
+ }
783
+
784
+ });
785
+ }
786
+
787
+ doPlot("right");
788
+
789
+ $("button").click(function() {
790
+ doPlot($(this).text());
791
+ });
792
+
793
+ }
794
+
795
+ drawFlotCharts();
796
+
797
+ $(document).on("themechange", function(){
798
+ drawFlotCharts();
799
+ });
800
+
801
+ });
802
+
803
+ $(function() {
804
+
805
+ if (!$('#dashboard-visits-chart').length) {
806
+ return false;
807
+ }
808
+
809
+ // drawing visits chart
810
+ drawVisitsChart();
811
+
812
+ var el = null;
813
+ var item = 'visits';
814
+
815
+ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
816
+
817
+ el = e.target;
818
+ item = $(el).attr('href').replace('#', '');
819
+ switchHistoryCharts(item);
820
+
821
+ });
822
+
823
+ $(document).on("themechange", function(){
824
+ switchHistoryCharts(item);
825
+ });
826
+
827
+ function switchHistoryCharts(item){
828
+ var chartSelector = "#dashboard-" + item + "-chart";
829
+
830
+ if ($(chartSelector).has('svg').length) {
831
+ $(chartSelector).empty();
832
+ }
833
+
834
+ switch(item){
835
+ case 'visits':
836
+ drawVisitsChart();
837
+ break;
838
+ case 'downloads':
839
+ drawDownloadsChart();
840
+ break;
841
+ }
842
+ }
843
+
844
+ function drawVisitsChart(){
845
+ var dataVisits = [
846
+ { x: '2015-09-01', y: 70},
847
+ { x: '2015-09-02', y: 75 },
848
+ { x: '2015-09-03', y: 50},
849
+ { x: '2015-09-04', y: 75 },
850
+ { x: '2015-09-05', y: 50 },
851
+ { x: '2015-09-06', y: 75 },
852
+ { x: '2015-09-07', y: 86 }
853
+ ];
854
+
855
+
856
+ Morris.Line({
857
+ element: 'dashboard-visits-chart',
858
+ data: dataVisits,
859
+ xkey: 'x',
860
+ ykeys: ['y'],
861
+ ymin: 'auto 40',
862
+ labels: ['Visits'],
863
+ xLabels: "day",
864
+ hideHover: 'auto',
865
+ yLabelFormat: function (y) {
866
+ // Only integers
867
+ if (y === parseInt(y, 10)) {
868
+ return y;
869
+ }
870
+ else {
871
+ return '';
872
+ }
873
+ },
874
+ resize: true,
875
+ lineColors: [
876
+ config.chart.colorSecondary.toString(),
877
+ ],
878
+ pointFillColors: [
879
+ config.chart.colorPrimary.toString(),
880
+ ]
881
+ });
882
+ }
883
+
884
+ function drawDownloadsChart(){
885
+
886
+ var dataDownloads = [
887
+ {
888
+ year: '2006',
889
+ downloads: 1300
890
+ },
891
+ {
892
+ year: '2007',
893
+ downloads: 1526
894
+ },
895
+ {
896
+ year: '2008',
897
+ downloads: 2000
898
+ },
899
+ {
900
+ year: '2009',
901
+ downloads: 1800
902
+ },
903
+ {
904
+ year: '2010',
905
+ downloads: 1650
906
+ },
907
+ {
908
+ year: '2011',
909
+ downloads: 620
910
+ },
911
+ {
912
+ year: '2012',
913
+ downloads: 1000
914
+ },
915
+ {
916
+ year: '2013',
917
+ downloads: 1896
918
+ },
919
+ {
920
+ year: '2014',
921
+ downloads: 850
922
+ },
923
+ {
924
+ year: '2015',
925
+ downloads: 1500
926
+ }
927
+ ];
928
+
929
+
930
+ Morris.Bar({
931
+ element: 'dashboard-downloads-chart',
932
+ data: dataDownloads,
933
+ xkey: 'year',
934
+ ykeys: ['downloads'],
935
+ labels: ['Downloads'],
936
+ hideHover: 'auto',
937
+ resize: true,
938
+ barColors: [
939
+ config.chart.colorPrimary.toString(),
940
+ tinycolor(config.chart.colorPrimary.toString()).darken(10).toString()
941
+ ],
942
+ });
943
+ }
944
+ });
945
+
946
+
947
+
948
+
949
+ $(function() {
950
+
951
+
952
+ function drawDashboardItemsListSparklines(){
953
+ $(".dashboard-page .items .sparkline").each(function() {
954
+ var type = $(this).data('type');
955
+
956
+ // There is predefined data
957
+ if ($(this).data('data')) {
958
+ var data = $(this).data('data').split(',').map(function(item) {
959
+ if (item.indexOf(":") > 0) {
960
+ return item.split(":");
961
+ }
962
+ else {
963
+ return item;
964
+ }
965
+ });
966
+ }
967
+ // Generate random data
968
+ else {
969
+ var data = [];
970
+ for (var i = 0; i < 17; i++) {
971
+ data.push(Math.round(100 * Math.random()));
972
+ }
973
+ }
974
+
975
+
976
+ $(this).sparkline(data, {
977
+ barColor: config.chart.colorPrimary.toString(),
978
+ height: $(this).height(),
979
+ type: type
980
+ });
981
+ });
982
+ }
983
+
984
+ drawDashboardItemsListSparklines();
985
+
986
+ $(document).on("themechange", function(){
987
+ drawDashboardItemsListSparklines();
988
+ });
989
+ });
990
+ $(function() {
991
+
992
+ var $dashboardSalesBreakdownChart = $('#dashboard-sales-breakdown-chart');
993
+
994
+ if (!$dashboardSalesBreakdownChart.length) {
995
+ return false;
996
+ }
997
+
998
+ function drawSalesChart(){
999
+
1000
+ $dashboardSalesBreakdownChart.empty();
1001
+
1002
+ Morris.Donut({
1003
+ element: 'dashboard-sales-breakdown-chart',
1004
+ data: [{ label: "Download Sales", value: 12 },
1005
+ { label: "In-Store Sales", value: 30 },
1006
+ { label: "Mail-Order Sales", value: 20 } ],
1007
+ resize: true,
1008
+ colors: [
1009
+ tinycolor(config.chart.colorPrimary.toString()).lighten(10).toString(),
1010
+ tinycolor(config.chart.colorPrimary.toString()).darken(8).toString(),
1011
+ config.chart.colorPrimary.toString()
1012
+ ],
1013
+ });
1014
+
1015
+ var $sameheightContainer = $dashboardSalesBreakdownChart.closest(".sameheight-container");
1016
+
1017
+ setSameHeights($sameheightContainer);
1018
+ }
1019
+
1020
+ drawSalesChart();
1021
+
1022
+ $(document).on("themechange", function(){
1023
+ drawSalesChart();
1024
+ });
1025
+
1026
+ })
1027
+ $(function() {
1028
+
1029
+ var $dashboardSalesMap = $('#dashboard-sales-map');
1030
+
1031
+ if (!$dashboardSalesMap.length) {
1032
+ return false;
1033
+ }
1034
+
1035
+ function drawSalesMap() {
1036
+
1037
+ $dashboardSalesMap.empty();
1038
+
1039
+ var color = config.chart.colorPrimary.toHexString();
1040
+ var darkColor = tinycolor(config.chart.colorPrimary.toString()).darken(40).toHexString();
1041
+ var selectedColor = tinycolor(config.chart.colorPrimary.toString()).darken(10).toHexString();
1042
+
1043
+ var sales_data = {
1044
+ us: 2000,
1045
+ ru: 2000,
1046
+ gb: 10000,
1047
+ fr: 10000,
1048
+ de: 10000,
1049
+ cn: 10000,
1050
+ in: 10000,
1051
+ sa: 10000,
1052
+ ca: 10000,
1053
+ br: 5000,
1054
+ au: 5000
1055
+ };
1056
+
1057
+ $dashboardSalesMap.vectorMap({
1058
+ map: 'world_en',
1059
+ backgroundColor: 'transparent',
1060
+ color: '#E5E3E5',
1061
+ hoverOpacity: 0.7,
1062
+ selectedColor: selectedColor,
1063
+ enableZoom: true,
1064
+ showTooltip: true,
1065
+ values: sales_data,
1066
+ scaleColors: [ color, darkColor],
1067
+ normalizeFunction: 'linear'
1068
+ });
1069
+ }
1070
+
1071
+ drawSalesMap();
1072
+
1073
+ $(document).on("themechange", function(){
1074
+ drawSalesMap();
1075
+ });
1076
+ });
1077
+ $(function() {
1078
+
1079
+ $('.actions-list > li').on('click', '.check', function(e){
1080
+ e.preventDefault();
1081
+
1082
+ $(this).parents('.tasks-item')
1083
+ .find('.checkbox')
1084
+ .prop("checked", true);
1085
+
1086
+ removeActionList();
1087
+ });
1088
+
1089
+ });
1090
+ $(function(){
1091
+
1092
+ // set sortable options
1093
+ var sortable = new Sortable($('.images-container').get(0), {
1094
+ animation: 150,
1095
+ handle: ".control-btn.move",
1096
+ draggable: ".image-container",
1097
+ onMove: function (evt) {
1098
+ var $relatedElem = $(evt.related);
1099
+
1100
+ if ($relatedElem.hasClass('add-image')) {
1101
+ return false;
1102
+ }
1103
+ }
1104
+ });
1105
+
1106
+
1107
+ $controlsButtons = $('.controls');
1108
+
1109
+ $controlsButtonsStar = $controlsButtons.find('.star');
1110
+ $controlsButtonsRemove = $controlsButtons.find('.remove');
1111
+
1112
+ $controlsButtonsStar.on('click',function(e){
1113
+ e.preventDefault();
1114
+
1115
+ $controlsButtonsStar.removeClass('active');
1116
+ $controlsButtonsStar.parents('.image-container').removeClass('main');
1117
+
1118
+ $(this).addClass('active');
1119
+
1120
+ $(this).parents('.image-container').addClass('main');
1121
+ })
1122
+
1123
+ })
1124
+
1125
+ $(function() {
1126
+
1127
+ if (!$('#select-all-items').length) {
1128
+ return false;
1129
+ }
1130
+
1131
+
1132
+ $('#select-all-items').on('change', function() {
1133
+ var $this = $(this).children(':checkbox').get(0);
1134
+
1135
+ $(this).parents('li')
1136
+ .siblings()
1137
+ .find(':checkbox')
1138
+ .prop('checked', $this.checked)
1139
+ .val($this.checked)
1140
+ .change();
1141
+ });
1142
+
1143
+
1144
+ function drawItemsListSparklines(){
1145
+ $(".items-list-page .sparkline").each(function() {
1146
+ var type = $(this).data('type');
1147
+
1148
+ // Generate random data
1149
+ var data = [];
1150
+ for (var i = 0; i < 17; i++) {
1151
+ data.push(Math.round(100 * Math.random()));
1152
+ }
1153
+
1154
+ $(this).sparkline(data, {
1155
+ barColor: config.chart.colorPrimary.toString(),
1156
+ height: $(this).height(),
1157
+ type: type
1158
+ });
1159
+ });
1160
+ }
1161
+
1162
+ drawItemsListSparklines();
1163
+
1164
+ $(document).on("themechange", function(){
1165
+ drawItemsListSparklines();
1166
+ });
1167
+
1168
+ });
1169
+ //LoginForm validation
1170
+ $(function() {
1171
+ if (!$('.form-control').length) {
1172
+ return false;
1173
+ }
1174
+
1175
+ $('.form-control').focus(function() {
1176
+ $(this).siblings('.input-group-addon').addClass('focus');
1177
+ });
1178
+
1179
+ $('.form-control').blur(function() {
1180
+ $(this).siblings('.input-group-addon').removeClass('focus');
1181
+ });
1182
+ });
1183
+ $(function () {
1184
+
1185
+ $('#sidebar-menu, #customize-menu').metisMenu({
1186
+ activeClass: 'open'
1187
+ });
1188
+
1189
+
1190
+ $('#sidebar-collapse-btn').on('click', function(event){
1191
+ event.preventDefault();
1192
+
1193
+ $("#app").toggleClass("sidebar-open");
1194
+ });
1195
+
1196
+ $("#sidebar-overlay").on('click', function() {
1197
+ $("#app").removeClass("sidebar-open");
1198
+ });
1199
+
1200
+ if ($.browser.mobile) {
1201
+ var $appContainer = $('#app ');
1202
+ var $mobileHandle = $('#sidebar-mobile-menu-handle ');
1203
+
1204
+ $mobileHandle.swipe({
1205
+ swipeLeft: function() {
1206
+ if($appContainer.hasClass("sidebar-open")) {
1207
+ $appContainer.removeClass("sidebar-open");
1208
+ }
1209
+ },
1210
+ swipeRight: function() {
1211
+ if(!$appContainer.hasClass("sidebar-open")) {
1212
+ $appContainer.addClass("sidebar-open");
1213
+ }
1214
+ },
1215
+ // excludedElements: "button, input, select, textarea, .noSwipe, table",
1216
+ triggerOnTouchEnd: false
1217
+ });
1218
+ }
1219
+
1220
+ });
1221
+ var modalMedia = {
1222
+ $el: $("#modal-media"),
1223
+ result: {},
1224
+ options: {},
1225
+ open: function(options) {
1226
+ options = options || {};
1227
+ this.options = options;
1228
+
1229
+
1230
+ this.$el.modal('show');
1231
+ },
1232
+ close: function() {
1233
+ if ($.isFunction(this.options.beforeClose)) {
1234
+ this.options.beforeClose(this.result);
1235
+ }
1236
+
1237
+ this.$el.modal('hide');
1238
+
1239
+ if ($.isFunction(this.options.afterClose)) {
1240
+ this.options.beforeClose(this.result);
1241
+ }
1242
+ }
1243
+ };
1244
+ // Animating dropdowns is temporary disabled
1245
+ // Please feel free to send a pull request :)
1246
+
1247
+ // $(function() {
1248
+ // $('.nav-profile > li > a').on('click', function() {
1249
+ // var $el = $(this).next();
1250
+
1251
+
1252
+ // animate({
1253
+ // name: 'flipInX',
1254
+ // selector: $el
1255
+ // });
1256
+ // });
1257
+ // })
1258
+
1259
+ $(function () {
1260
+
1261
+ // Local storage settings
1262
+ var themeSettings = getThemeSettings();
1263
+
1264
+ // Elements
1265
+
1266
+ var $app = $('#app');
1267
+ var $styleLink = $('#theme-style');
1268
+ var $customizeMenu = $('#customize-menu');
1269
+
1270
+ // Color switcher
1271
+ var $customizeMenuColorBtns = $customizeMenu.find('.color-item');
1272
+
1273
+ // Position switchers
1274
+ var $customizeMenuRadioBtns = $customizeMenu.find('.radio');
1275
+
1276
+
1277
+ // /////////////////////////////////////////////////
1278
+
1279
+ // Initial state
1280
+
1281
+ // On setting event, set corresponding options
1282
+
1283
+ // Update customize view based on options
1284
+
1285
+ // Update theme based on options
1286
+
1287
+ /************************************************
1288
+ * Initial State
1289
+ *************************************************/
1290
+
1291
+ setThemeSettings();
1292
+
1293
+ /************************************************
1294
+ * Events
1295
+ *************************************************/
1296
+
1297
+ // set theme type
1298
+ $customizeMenuColorBtns.on('click', function() {
1299
+ themeSettings.themeName = $(this).data('theme');
1300
+
1301
+ setThemeSettings();
1302
+ });
1303
+
1304
+
1305
+ $customizeMenuRadioBtns.on('click', function() {
1306
+
1307
+ var optionName = $(this).prop('name');
1308
+ var value = $(this).val();
1309
+
1310
+ themeSettings[optionName] = value;
1311
+
1312
+ setThemeSettings();
1313
+ });
1314
+
1315
+ function setThemeSettings() {
1316
+ setThemeState()
1317
+ .delay(config.delayTime)
1318
+ .queue(function (next) {
1319
+
1320
+ setThemeColor();
1321
+ setThemeControlsState();
1322
+ saveThemeSettings();
1323
+
1324
+ $(document).trigger("themechange");
1325
+
1326
+ next();
1327
+ });
1328
+ }
1329
+
1330
+ /************************************************
1331
+ * Update theme based on options
1332
+ *************************************************/
1333
+
1334
+ function setThemeState() {
1335
+ // set theme type
1336
+ if (themeSettings.themeName) {
1337
+ $styleLink.attr('href', 'css/app-' + themeSettings.themeName + '.css');
1338
+ }
1339
+ else {
1340
+ $styleLink.attr('href', 'css/app.css');
1341
+ }
1342
+
1343
+ // App classes
1344
+ $app.removeClass('header-fixed footer-fixed sidebar-fixed');
1345
+
1346
+ // set header
1347
+ $app.addClass(themeSettings.headerPosition);
1348
+
1349
+ // set footer
1350
+ $app.addClass(themeSettings.footerPosition);
1351
+
1352
+ // set footer
1353
+ $app.addClass(themeSettings.sidebarPosition);
1354
+
1355
+ return $app;
1356
+ }
1357
+
1358
+ /************************************************
1359
+ * Update theme controls based on options
1360
+ *************************************************/
1361
+
1362
+ function setThemeControlsState() {
1363
+ // set color switcher
1364
+ $customizeMenuColorBtns.each(function() {
1365
+ if($(this).data('theme') === themeSettings.themeName) {
1366
+ $(this).addClass('active');
1367
+ }
1368
+ else {
1369
+ $(this).removeClass('active');
1370
+ }
1371
+ });
1372
+
1373
+ // set radio buttons
1374
+ $customizeMenuRadioBtns.each(function() {
1375
+ var name = $(this).prop('name');
1376
+ var value = $(this).val();
1377
+
1378
+ if (themeSettings[name] === value) {
1379
+ $(this).prop("checked", true );
1380
+ }
1381
+ else {
1382
+ $(this).prop("checked", false );
1383
+ }
1384
+ });
1385
+ }
1386
+
1387
+ /************************************************
1388
+ * Update theme color
1389
+ *************************************************/
1390
+ function setThemeColor(){
1391
+ config.chart.colorPrimary = tinycolor($ref.find(".chart .color-primary").css("color"));
1392
+ config.chart.colorSecondary = tinycolor($ref.find(".chart .color-secondary").css("color"));
1393
+ }
1394
+
1395
+ /************************************************
1396
+ * Storage Functions
1397
+ *************************************************/
1398
+
1399
+ function getThemeSettings() {
1400
+ var settings = (localStorage.getItem('themeSettings')) ? JSON.parse(localStorage.getItem('themeSettings')) : {};
1401
+
1402
+ settings.headerPosition = settings.headerPosition || '';
1403
+ settings.sidebarPosition = settings.sidebarPosition || '';
1404
+ settings.footerPosition = settings.footerPosition || '';
1405
+
1406
+ return settings;
1407
+ }
1408
+
1409
+ function saveThemeSettings() {
1410
+ localStorage.setItem('themeSettings', JSON.stringify(themeSettings));
1411
+ }
1412
+
1413
+ });
1414
+ $(function() {
1415
+
1416
+ $("body").addClass("loaded");
1417
+
1418
+ });
1419
+
1420
+
1421
+ /***********************************************
1422
+ * NProgress Settings
1423
+ ***********************************************/
1424
+
1425
+ // start load bar
1426
+ NProgress.start();
1427
+
1428
+ // end loading bar
1429
+ NProgress.done();