lato_view 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +35 -0
  3. data/app/assets/fonts/lato-bold-webfont.eot +0 -0
  4. data/app/assets/fonts/lato-bold-webfont.svg +4551 -0
  5. data/app/assets/fonts/lato-bold-webfont.ttf +0 -0
  6. data/app/assets/fonts/lato-bold-webfont.woff +0 -0
  7. data/app/assets/fonts/lato-bold-webfont.woff2 +0 -0
  8. data/app/assets/fonts/lato-regular-webfont.eot +0 -0
  9. data/app/assets/fonts/lato-regular-webfont.svg +4241 -0
  10. data/app/assets/fonts/lato-regular-webfont.ttf +0 -0
  11. data/app/assets/fonts/lato-regular-webfont.woff +0 -0
  12. data/app/assets/fonts/lato-regular-webfont.woff2 +0 -0
  13. data/app/assets/images/lato_view/icons/_arrow-down.svg +1 -0
  14. data/app/assets/images/lato_view/icons/_arrow-left.svg +1 -0
  15. data/app/assets/images/lato_view/icons/_arrow-right.svg +1 -0
  16. data/app/assets/images/lato_view/icons/_arrow-up.svg +1 -0
  17. data/app/assets/images/lato_view/icons/_artist.svg +1 -0
  18. data/app/assets/images/lato_view/icons/_artwork.svg +1 -0
  19. data/app/assets/images/lato_view/icons/_attachment.svg +1 -0
  20. data/app/assets/images/lato_view/icons/_calendar.svg +1 -0
  21. data/app/assets/images/lato_view/icons/_clients.svg +1 -0
  22. data/app/assets/images/lato_view/icons/_close.svg +1 -0
  23. data/app/assets/images/lato_view/icons/_download.svg +1 -0
  24. data/app/assets/images/lato_view/icons/_file.svg +1 -0
  25. data/app/assets/images/lato_view/icons/_google-plus.svg +1 -0
  26. data/app/assets/images/lato_view/icons/_home.svg +1 -0
  27. data/app/assets/images/lato_view/icons/_info.svg +1 -0
  28. data/app/assets/images/lato_view/icons/_instagram.svg +1 -0
  29. data/app/assets/images/lato_view/icons/_lato-logo.svg +1 -0
  30. data/app/assets/images/lato_view/icons/_linkedin.svg +1 -0
  31. data/app/assets/images/lato_view/icons/_list.svg +1 -0
  32. data/app/assets/images/lato_view/icons/_magni-glass.svg +1 -0
  33. data/app/assets/images/lato_view/icons/_mail.svg +1 -0
  34. data/app/assets/images/lato_view/icons/_minus.svg +1 -0
  35. data/app/assets/images/lato_view/icons/_modify.svg +1 -0
  36. data/app/assets/images/lato_view/icons/_percentage.svg +1 -0
  37. data/app/assets/images/lato_view/icons/_plus.svg +1 -0
  38. data/app/assets/images/lato_view/icons/_power.svg +1 -0
  39. data/app/assets/images/lato_view/icons/_settings.svg +1 -0
  40. data/app/assets/images/lato_view/icons/_sweet.svg +1 -0
  41. data/app/assets/images/lato_view/icons/_trash.svg +1 -0
  42. data/app/assets/images/lato_view/icons/_twitter.svg +1 -0
  43. data/app/assets/images/lato_view/icons/_upload.svg +1 -0
  44. data/app/assets/images/lato_view/icons/_user.svg +1 -0
  45. data/app/assets/images/lato_view/icons/_users.svg +1 -0
  46. data/app/assets/images/lato_view/icons/_warning.svg +1 -0
  47. data/app/assets/images/lato_view/icons/_web.svg +1 -0
  48. data/app/assets/images/lato_view/vendor/trumbowyg_icons.svg +1 -0
  49. data/app/assets/images/lato_view/work-in-progress/da-scegliere.svg +225 -0
  50. data/app/assets/images/lato_view/work-in-progress/social.svg +76 -0
  51. data/app/assets/javascripts/lato_view/application.js +68 -0
  52. data/app/assets/javascripts/lato_view/build/ActionBar.js +65 -0
  53. data/app/assets/javascripts/lato_view/build/Dropdown.js +33 -0
  54. data/app/assets/javascripts/lato_view/build/Flash.js +23 -0
  55. data/app/assets/javascripts/lato_view/build/FormManager.js +159 -0
  56. data/app/assets/javascripts/lato_view/build/Navigation.js +79 -0
  57. data/app/assets/javascripts/lato_view/build/Util.js +91 -0
  58. data/app/assets/javascripts/lato_view/build/Validator.js +235 -0
  59. data/app/assets/javascripts/lato_view/vendor/dropzone.min.js +2 -0
  60. data/app/assets/javascripts/lato_view/vendor/jquery.email-autocomplete.min.js +9 -0
  61. data/app/assets/javascripts/lato_view/vendor/modernizr.js +3 -0
  62. data/app/assets/javascripts/lato_view/vendor/moment.min.js +7 -0
  63. data/app/assets/javascripts/lato_view/vendor/picker-it_IT.js +1 -0
  64. data/app/assets/javascripts/lato_view/vendor/picker.date.js +5 -0
  65. data/app/assets/javascripts/lato_view/vendor/picker.js +7 -0
  66. data/app/assets/javascripts/lato_view/vendor/picker.time.js +5 -0
  67. data/app/assets/javascripts/lato_view/vendor/trumbowyg.js +1522 -0
  68. data/app/assets/stylesheets/lato_view/application.scss.erb +32 -0
  69. data/app/assets/stylesheets/lato_view/base/_base.scss +53 -0
  70. data/app/assets/stylesheets/lato_view/base/_helpers.scss +491 -0
  71. data/app/assets/stylesheets/lato_view/base/_media.scss +32 -0
  72. data/app/assets/stylesheets/lato_view/base/_reset.scss +424 -0
  73. data/app/assets/stylesheets/lato_view/base/_typography.scss +138 -0
  74. data/app/assets/stylesheets/lato_view/config/_config.scss +143 -0
  75. data/app/assets/stylesheets/lato_view/config/templates/_base-template.scss +158 -0
  76. data/app/assets/stylesheets/lato_view/config/templates/_black-template.scss +158 -0
  77. data/app/assets/stylesheets/lato_view/modules/_action-bar.scss +62 -0
  78. data/app/assets/stylesheets/lato_view/modules/_arranger.scss +10 -0
  79. data/app/assets/stylesheets/lato_view/modules/_button-group.scss +70 -0
  80. data/app/assets/stylesheets/lato_view/modules/_buttons.scss +177 -0
  81. data/app/assets/stylesheets/lato_view/modules/_content-block.scss +33 -0
  82. data/app/assets/stylesheets/lato_view/modules/_datepicker.scss +580 -0
  83. data/app/assets/stylesheets/lato_view/modules/_dropdown.scss +166 -0
  84. data/app/assets/stylesheets/lato_view/modules/_flash.scss +55 -0
  85. data/app/assets/stylesheets/lato_view/modules/_form-controls.scss +83 -0
  86. data/app/assets/stylesheets/lato_view/modules/_form.scss +297 -0
  87. data/app/assets/stylesheets/lato_view/modules/_modules.scss +19 -0
  88. data/app/assets/stylesheets/lato_view/modules/_navbar.scss +262 -0
  89. data/app/assets/stylesheets/lato_view/modules/_pagination.scss +30 -0
  90. data/app/assets/stylesheets/lato_view/modules/_search-bar.scss +44 -0
  91. data/app/assets/stylesheets/lato_view/modules/_select.scss +313 -0
  92. data/app/assets/stylesheets/lato_view/modules/_sidebar.scss +211 -0
  93. data/app/assets/stylesheets/lato_view/modules/_status.scss +39 -0
  94. data/app/assets/stylesheets/lato_view/modules/_table.scss +94 -0
  95. data/app/assets/stylesheets/lato_view/modules/_upload.scss +371 -0
  96. data/app/assets/stylesheets/lato_view/modules/_wyswyg.scss +755 -0
  97. data/app/assets/stylesheets/lato_view/views/_admin.scss +30 -0
  98. data/app/assets/stylesheets/lato_view/views/_grid.scss +448 -0
  99. data/app/assets/stylesheets/lato_view/views/_login.scss +152 -0
  100. data/app/assets/stylesheets/lato_view/views/_print.scss +41 -0
  101. data/app/assets/stylesheets/lato_view/views/_views.scss +48 -0
  102. data/app/concepts/lato_view/actionbar/cell.rb +65 -0
  103. data/app/concepts/lato_view/actionbar/views/show.html.erb +21 -0
  104. data/app/concepts/lato_view/block/cell.rb +52 -0
  105. data/app/concepts/lato_view/buttongroup/cell.rb +50 -0
  106. data/app/concepts/lato_view/buttongroup/views/show.html.erb +7 -0
  107. data/app/concepts/lato_view/dropdown/cell.rb +46 -0
  108. data/app/concepts/lato_view/dropdown/views/show.html.erb +19 -0
  109. data/app/concepts/lato_view/index/cell.rb +112 -0
  110. data/app/concepts/lato_view/index/views/head.html.erb +12 -0
  111. data/app/concepts/lato_view/index/views/rows.html.erb +49 -0
  112. data/app/concepts/lato_view/input/cell.rb +148 -0
  113. data/app/concepts/lato_view/input/views/checkbox.html.erb +8 -0
  114. data/app/concepts/lato_view/input/views/date.html.erb +5 -0
  115. data/app/concepts/lato_view/input/views/editor.html.erb +7 -0
  116. data/app/concepts/lato_view/input/views/email.html.erb +5 -0
  117. data/app/concepts/lato_view/input/views/file.html.erb +17 -0
  118. data/app/concepts/lato_view/input/views/multiple-select.html.erb +12 -0
  119. data/app/concepts/lato_view/input/views/number.html.erb +5 -0
  120. data/app/concepts/lato_view/input/views/password.html.erb +8 -0
  121. data/app/concepts/lato_view/input/views/radio.html.erb +10 -0
  122. data/app/concepts/lato_view/input/views/select.html.erb +12 -0
  123. data/app/concepts/lato_view/input/views/text.html.erb +5 -0
  124. data/app/concepts/lato_view/input/views/textarea.html.erb +5 -0
  125. data/app/concepts/lato_view/input/views/time.html.erb +5 -0
  126. data/app/concepts/lato_view/searchbar/cell.rb +63 -0
  127. data/app/concepts/lato_view/searchbar/views/show.html.erb +6 -0
  128. data/app/concepts/lato_view/table/cell.rb +88 -0
  129. data/app/concepts/lato_view/table/views/head.html.erb +9 -0
  130. data/app/concepts/lato_view/table/views/row.html.erb +7 -0
  131. data/app/concepts/lato_view/table/views/rows.html.erb +5 -0
  132. data/app/controllers/lato_view/assets_controller.rb +18 -0
  133. data/app/controllers/lato_view/develop_controller.rb +18 -0
  134. data/app/helpers/lato_view/application_helper.rb +22 -0
  135. data/app/views/lato_view/develop/home.html.erb +281 -0
  136. data/app/views/lato_view/icons/_arrowdown.svg +1 -0
  137. data/app/views/lato_view/icons/_arrowleft.svg +1 -0
  138. data/app/views/lato_view/icons/_arrowright.svg +1 -0
  139. data/app/views/lato_view/icons/_arrowup.svg +1 -0
  140. data/app/views/lato_view/icons/_artist.svg +1 -0
  141. data/app/views/lato_view/icons/_artwork.svg +1 -0
  142. data/app/views/lato_view/icons/_attachment.svg +1 -0
  143. data/app/views/lato_view/icons/_calendar.svg +1 -0
  144. data/app/views/lato_view/icons/_clients.svg +1 -0
  145. data/app/views/lato_view/icons/_close.svg +1 -0
  146. data/app/views/lato_view/icons/_download.svg +1 -0
  147. data/app/views/lato_view/icons/_file.svg +1 -0
  148. data/app/views/lato_view/icons/_googleplus.svg +1 -0
  149. data/app/views/lato_view/icons/_home.svg +1 -0
  150. data/app/views/lato_view/icons/_info.svg +1 -0
  151. data/app/views/lato_view/icons/_instagram.svg +1 -0
  152. data/app/views/lato_view/icons/_latologo.svg +1 -0
  153. data/app/views/lato_view/icons/_linkedin.svg +1 -0
  154. data/app/views/lato_view/icons/_list.svg +1 -0
  155. data/app/views/lato_view/icons/_magni-glass.svg +1 -0
  156. data/app/views/lato_view/icons/_mail.svg +1 -0
  157. data/app/views/lato_view/icons/_minus.svg +1 -0
  158. data/app/views/lato_view/icons/_modify.svg +1 -0
  159. data/app/views/lato_view/icons/_percentage.svg +1 -0
  160. data/app/views/lato_view/icons/_plus.svg +1 -0
  161. data/app/views/lato_view/icons/_power.svg +1 -0
  162. data/app/views/lato_view/icons/_settings.svg +1 -0
  163. data/app/views/lato_view/icons/_sweet.svg +1 -0
  164. data/app/views/lato_view/icons/_trash.svg +1 -0
  165. data/app/views/lato_view/icons/_twitter.svg +1 -0
  166. data/app/views/lato_view/icons/_upload.svg +1 -0
  167. data/app/views/lato_view/icons/_user.svg +1 -0
  168. data/app/views/lato_view/icons/_users.svg +1 -0
  169. data/app/views/lato_view/icons/_warning.svg +1 -0
  170. data/app/views/lato_view/icons/_web.svg +1 -0
  171. data/app/views/lato_view/layout/_flash.html.erb +5 -0
  172. data/app/views/lato_view/layout/_header.html.erb +31 -0
  173. data/app/views/lato_view/layout/_sidebar.html.erb +28 -0
  174. data/app/views/lato_view/layout/_strings.html.erb +8 -0
  175. data/app/views/layouts/lato_layout.html.erb +81 -0
  176. data/config/example.yml +19 -0
  177. data/config/initializers/assets.rb +5 -0
  178. data/config/initializers/init.rb +5 -0
  179. data/config/initializers/lists.rb +34 -0
  180. data/config/initializers/ram.rb +23 -0
  181. data/config/routes.rb +9 -0
  182. data/lib/lato_view/concepts.rb +19 -0
  183. data/lib/lato_view/engine.rb +23 -0
  184. data/lib/lato_view/interface/assets.rb +90 -0
  185. data/lib/lato_view/interface/images.rb +69 -0
  186. data/lib/lato_view/interface/navigation.rb +17 -0
  187. data/lib/lato_view/interface/themes.rb +37 -0
  188. data/lib/lato_view/interface.rb +19 -0
  189. data/lib/lato_view.rb +20 -0
  190. data/lib/tasks/lato_starter_tasks.rake +11 -0
  191. data/test/controllers/lato_view/api/v1/api_controller_test.rb +9 -0
  192. data/test/controllers/lato_view/application_controller_test.rb +9 -0
  193. data/test/controllers/lato_view/back/back_controller_test.rb +9 -0
  194. data/test/dummy/README.rdoc +28 -0
  195. data/test/dummy/Rakefile +6 -0
  196. data/test/dummy/app/assets/javascripts/application.js +13 -0
  197. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  198. data/test/dummy/app/controllers/application_controller.rb +5 -0
  199. data/test/dummy/app/helpers/application_helper.rb +2 -0
  200. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  201. data/test/dummy/bin/bundle +3 -0
  202. data/test/dummy/bin/rails +4 -0
  203. data/test/dummy/bin/rake +4 -0
  204. data/test/dummy/bin/setup +29 -0
  205. data/test/dummy/config/application.rb +25 -0
  206. data/test/dummy/config/boot.rb +5 -0
  207. data/test/dummy/config/database.yml +25 -0
  208. data/test/dummy/config/environment.rb +5 -0
  209. data/test/dummy/config/environments/development.rb +41 -0
  210. data/test/dummy/config/environments/production.rb +79 -0
  211. data/test/dummy/config/environments/test.rb +42 -0
  212. data/test/dummy/config/initializers/assets.rb +11 -0
  213. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  214. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  215. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  216. data/test/dummy/config/initializers/inflections.rb +16 -0
  217. data/test/dummy/config/initializers/mime_types.rb +4 -0
  218. data/test/dummy/config/initializers/session_store.rb +3 -0
  219. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  220. data/test/dummy/config/locales/en.yml +23 -0
  221. data/test/dummy/config/routes.rb +3 -0
  222. data/test/dummy/config/secrets.yml +22 -0
  223. data/test/dummy/config.ru +4 -0
  224. data/test/dummy/public/404.html +67 -0
  225. data/test/dummy/public/422.html +67 -0
  226. data/test/dummy/public/500.html +66 -0
  227. data/test/dummy/public/favicon.ico +0 -0
  228. data/test/integration/navigation_test.rb +8 -0
  229. data/test/lato_view_test.rb +7 -0
  230. data/test/test_helper.rb +21 -0
  231. metadata +453 -0
@@ -0,0 +1,68 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery2
14
+ //= require jquery_ujs
15
+ //= require lato_view/vendor/modernizr
16
+ //= require selectize
17
+ //= require lato_view/vendor/moment.min
18
+ //= require lato_view/vendor/picker
19
+ //= require lato_view/vendor/picker.date
20
+ //= require lato_view/vendor/picker.time
21
+ //= require lato_view/vendor/picker-it_IT
22
+ //= require lato_view/vendor/dropzone.min
23
+ //= require lato_view/vendor/jquery.email-autocomplete.min
24
+ //= require lato_view/vendor/trumbowyg
25
+ //= require lato_view/build/Util
26
+ //= require lato_view/build/Validator
27
+ //= require lato_view/build/FormManager
28
+ //= require lato_view/build/Dropdown
29
+ //= require lato_view/build/Navigation
30
+ //= require lato_view/build/ActionBar
31
+ //= require lato_view/build/Flash
32
+
33
+ var Application = (function($) {
34
+
35
+ var onResize = function() {
36
+ $(window).on('resize', function() {
37
+ Navigation.manageSidebarDropdown();
38
+ });
39
+ };
40
+
41
+ var init = function() {
42
+ $(document).on('ready', function() {
43
+
44
+ // Active js functionalities
45
+ document.documentElement.className = 'js';
46
+
47
+ // Init our modules
48
+ Dropdown.init();
49
+ Navigation.init();
50
+ //ActionBar.init();
51
+ Flash.init();
52
+ FormManager.init();
53
+ $('.editor').trumbowyg({
54
+ svgPath: '/ui/icons.svg'
55
+ });
56
+
57
+ // Functions executed on resize
58
+ onResize();
59
+ });
60
+ };
61
+
62
+ return {
63
+ init: init,
64
+ };
65
+
66
+ })(jQuery);
67
+
68
+ Application.init();
@@ -0,0 +1,65 @@
1
+ var ActionBar = (function($) {
2
+ 'use strict';
3
+
4
+ /*
5
+ * Manage responsive Action Bar component - moves the unnecessary elements to a separate menu.
6
+ * @params: -
7
+ * @return: undefined
8
+ */
9
+ var _responsiveActionBar = function() {
10
+ var resizing = false;
11
+ var $actionBar = $('.action-bar');
12
+ var $actionRemove = $actionBar.find('.action-remove');
13
+
14
+ function _detachElements(elements) {
15
+ $(elements).detach();
16
+ }
17
+
18
+ var moveActionBarElement = Util.debounce(function() {
19
+
20
+ if($actionRemove.length) {
21
+ $actionBar.each(function(index, el) {
22
+ var $elToRemove = $(el).find('.action-remove');
23
+ var $actionHolder = $(el).find('.action-nav-menu');
24
+ var $header = $('.main-navigation-header');
25
+
26
+ var dataAttrs = [];
27
+ $elToRemove.each(function(index, el) {
28
+ dataAttrs.push($(el).data('position'));
29
+ });
30
+
31
+ if ( Modernizr.mq("only screen and (max-width: 1070px)")) {
32
+ _detachElements($elToRemove);
33
+ $elToRemove.appendTo($actionHolder);
34
+ } else if ( Modernizr.mq("only screen and (min-width: 1071px)") ) {
35
+ _detachElements($elToRemove);
36
+ $elToRemove.each(function(index, el) {
37
+ $(el).appendTo($elToRemove.eq(0));
38
+ });
39
+ $header.find('.nav-logo').after($elToRemove);
40
+ }
41
+ });
42
+
43
+ resizing = false;
44
+ }
45
+
46
+ }, 200);
47
+
48
+ moveActionBarElement();
49
+ $(window).on('resize', function() {
50
+ if( !resizing ) {
51
+ window.requestAnimationFrame(moveActionBarElement);
52
+ resizing = true;
53
+ }
54
+ });
55
+ };
56
+
57
+ var init = function() {
58
+ _responsiveActionBar();
59
+ };
60
+
61
+ return {
62
+ init: init
63
+ };
64
+
65
+ })(jQuery);
@@ -0,0 +1,33 @@
1
+ var Dropdown = (function($) {
2
+ 'use strict';
3
+
4
+ var _manageDropdown = function() {
5
+
6
+ $(document).on('click', '.active-voice', function(event) {
7
+ event.stopPropagation();
8
+ $(this).parent('.dropdown').toggleClass('is-arranger-open');
9
+ });
10
+
11
+ $(document).on('click', '.nav-account-area', function(event) {
12
+ event.stopPropagation();
13
+ $('body').toggleClass('is-dropdown-open');
14
+ });
15
+
16
+ // FIXME - da rivedere il click fuori dall'area dropdown
17
+ $('html').on('click', function(event) {
18
+ if($('body').hasClass('is-dropdown-open')) {
19
+ //$('body').removeClass('is-dropdown-open');
20
+ }
21
+ });
22
+
23
+ };
24
+
25
+ var init = function() {
26
+ _manageDropdown();
27
+ };
28
+
29
+ return {
30
+ init: init
31
+ };
32
+
33
+ })(jQuery);
@@ -0,0 +1,23 @@
1
+ var Flash = (function($) {
2
+
3
+ var flashTimeout = 4000;
4
+
5
+ var _showFlashes = function() {
6
+ var $flash = $('.flashes-container');
7
+
8
+ if($flash.length) {
9
+ setTimeout(function() {
10
+ $flash.addClass('is-remove');
11
+ }, flashTimeout);
12
+ }
13
+ };
14
+
15
+ var init = function() {
16
+ _showFlashes();
17
+ };
18
+
19
+ return {
20
+ init: init
21
+ };
22
+
23
+ })(jQuery);
@@ -0,0 +1,159 @@
1
+ var FormManager = (function($) {
2
+ 'use strict';
3
+
4
+ // Activate selectize.js module
5
+ var _manageSelect = function() {
6
+ $('.select').selectize({
7
+ hideSelected: 'true' // for multiple-select working
8
+ });
9
+ };
10
+
11
+ // Activate pikaday.js module
12
+ var _manageDatePicker = function() {
13
+ var $datepicker = $('.date-picker').pickadate({
14
+ firstDay: 1,
15
+ min: new Date(1900, 0, 1),
16
+ max: new Date(3000, 12, 31),
17
+ format: 'dd/mm/yyyy'
18
+ });
19
+ };
20
+
21
+ var _manageTimePicker = function() {
22
+ var $timePicker = $('.time-picker').pickatime();
23
+ };
24
+
25
+ var _manageFileUploader = function() {
26
+ var $dropZone = $('.drop-zone');
27
+ var parentForm = $dropZone.parent('.lato-form');
28
+
29
+ $dropZone.dropzone({ url: parentForm.attr('action') });
30
+ };
31
+
32
+ // Manage input type="file" component.
33
+ // Replaces the label text depending on the uploaded files.
34
+ var _manageInputFile = function() {
35
+ if($('.input-file').length) {
36
+ $('.input-file').each( function() {
37
+ var $input = $(this);
38
+ var $label = $input.next('label');
39
+ var labelVal = $label.html();
40
+
41
+ $input.on('change', function(event) {
42
+ var fileName = '';
43
+
44
+ if(this.files && this.files.length > 1) {
45
+ fileName = (this.getAttribute('data-multiple-caption') || '' ).replace( '{count}', this.files.length );
46
+ } else if(event.target.value) {
47
+ fileName = event.target.value.split('\\').pop();
48
+ }
49
+
50
+ if(fileName) {
51
+ $label.find('span').html(fileName);
52
+ } else {
53
+ $label.html(labelVal);
54
+ }
55
+
56
+ });
57
+
58
+ // Firefox bug fix
59
+ $input
60
+ .on('focus', function(){ $input.addClass( 'has-focus' ); })
61
+ .on('blur', function(){ $input.removeClass( 'has-focus' ); });
62
+ });
63
+ }
64
+ };
65
+
66
+ // Manage password-reveal sub-module.
67
+ // Transforms the input type.
68
+ var _manageInputPassword = function() {
69
+ $(document).on('click', '.password-reveal', function(event) {
70
+ event.preventDefault();
71
+ var $input = $(this).prev('.input');
72
+
73
+ $(this).toggleClass('is-text');
74
+ $input.attr('type') === 'password' ? $input.attr('type', 'text') : $input.attr('type', 'password');
75
+ });
76
+ };
77
+
78
+ // Activate email data-list autocomplete
79
+ var _insertSuggestions = function() {
80
+ if($('.email-suggestion').length) {
81
+ var domains = ['yahoo.com', 'gmail.com', 'google.com', 'hotmail.com', 'me.com', 'libero.it', 'live.it', 'live.com'];
82
+
83
+ $('.email-suggestion').emailautocomplete({
84
+ domains: domains
85
+ });
86
+ }
87
+ };
88
+
89
+ /*
90
+ * Manage form submission/validation
91
+ * @return: undefined or boolean
92
+ */
93
+ var _manageFormSubmit = function() {
94
+ $('.lato-form').on('submit', function(event) {
95
+
96
+ var tests = {
97
+ "number": Validator.controlNumber('.input-number'),
98
+ "required": Validator.controlRequired('data-input="required"'),
99
+ "email": Validator.controlEmail('.input-email'),
100
+ "password": Validator.controlPasswordEquality('.input-password', '.confirm-password'),
101
+ "length": Validator.controlInputLength('.input-length'),
102
+ "radiobox": Validator.controlRadiobox('data-input="radio"')
103
+ };
104
+
105
+ // Basta che uno dei test fallisca per generare un errore
106
+ $.each(tests, function(index, val) {
107
+ if(val === false) {
108
+ event.preventDefault();
109
+ return false;
110
+ }
111
+ });
112
+
113
+ });
114
+ }
115
+
116
+ // Manage form validation in semi-real-time.
117
+ var _manageBlurValidation = function() {
118
+ $('.lato-form').on('blur', '.input', function(event) {
119
+ var type = $(this).parent('.form-control').data('input');
120
+ var controlType = $(this).parent('.form-control').data('control');
121
+
122
+ // Email suggestion case
123
+ if($('.eac-input-wrap').length) {
124
+ Validator.controlEmail('.input-email');
125
+ }
126
+
127
+ // Get input desired className.
128
+ var tester = '.' + $(this).attr('class').split(' ')[1];
129
+
130
+ // Manage data-control type
131
+ switch(controlType) {
132
+ case 'number':
133
+ Validator.controlNumber(tester);
134
+ break;
135
+ case 'email':
136
+ Validator.controlEmail(tester);
137
+ break;
138
+ }
139
+
140
+ });
141
+ };
142
+
143
+ var init = function() {
144
+ _manageSelect();
145
+ _manageDatePicker();
146
+ _manageTimePicker();
147
+ // _manageFileUploader();
148
+ _manageInputFile();
149
+ _manageInputPassword();
150
+ _insertSuggestions();
151
+ _manageFormSubmit();
152
+ _manageBlurValidation();
153
+ };
154
+
155
+ return {
156
+ init: init
157
+ };
158
+
159
+ })(jQuery);
@@ -0,0 +1,79 @@
1
+ var Navigation = (function($) {
2
+ 'use strict';
3
+
4
+ /*
5
+ * Debounced function which manages the click handler for the dropdown's list-item.
6
+ * @params: -
7
+ * @return: undefined
8
+ */
9
+ var sidebarDropdown = Util.debounce(function() {
10
+ var $sidebarListItem = $('.sidebar-list-item');
11
+
12
+ if(Modernizr.mq("only screen and (max-width: 1023px)")) {
13
+ $(document).on('click', '.sidebar-main-link', function(event) {
14
+ if($(this).parent('.sidebar-list-item').hasClass('has-child')) {
15
+ event.preventDefault();
16
+ $(this).next('ul').toggleClass('is-drop-open');
17
+ }
18
+ });
19
+ } else {
20
+ $(document).off('click', '.sidebar-main-link');
21
+ $sidebarListItem.find('ul').removeClass('is-drop-open');
22
+ }
23
+ }, 200);
24
+
25
+ /*
26
+ * Manage responsive menu - moves the admin dropdown to the sidebar.
27
+ * @params: -
28
+ * @return: undefined
29
+ */
30
+ var responsiveMenu = function() {
31
+ var resizing = false;
32
+ var $topNavigation = $('.nav-account-area');
33
+ var $sidebar = $('.main-navigation-sidebar');
34
+ var $header = $('.main-navigation-header');
35
+
36
+ function _detachElements() {
37
+ $topNavigation.detach();
38
+ }
39
+
40
+ var moveNavigation = Util.debounce(function() {
41
+ if ( Modernizr.mq("only screen and (max-width: 766px)")) {
42
+ _detachElements();
43
+ $topNavigation.appendTo($sidebar);
44
+ } else if ( Modernizr.mq("only screen and (min-width: 767px)") ) {
45
+ _detachElements();
46
+ $header.find('.nav-logo').after($topNavigation);
47
+ }
48
+ resizing = false;
49
+ }, 200);
50
+
51
+ moveNavigation();
52
+ $(window).on('resize', function() {
53
+ if( !resizing ) {
54
+ window.requestAnimationFrame(moveNavigation);
55
+ resizing = true;
56
+ }
57
+ });
58
+ };
59
+
60
+ var _openMobileMenu = function() {
61
+ var $sidebar = $('.main-navigation-sidebar');
62
+ $(document).on('click', '.menu-toggle', function() {
63
+ $(this).toggleClass('is-mobile-menu-open');
64
+ $sidebar.toggleClass('is-mobile-menu-open');
65
+ });
66
+ }
67
+
68
+ var init = function() {
69
+ sidebarDropdown();
70
+ responsiveMenu();
71
+ _openMobileMenu();
72
+ };
73
+
74
+ return {
75
+ init: init,
76
+ manageSidebarDropdown: sidebarDropdown
77
+ };
78
+
79
+ })(jQuery);
@@ -0,0 +1,91 @@
1
+ var Util = (function($) {
2
+ 'use strict';
3
+
4
+ /*
5
+ * Debounce any function
6
+ * @params:
7
+ * func: function to test.
8
+ * wait: the time interval for the next function execution.
9
+ * immediate: triggers the function on the leading edge, instead of the trailing.
10
+ * @return: a function, that, as long as it continues to be invoked, will not be triggered.
11
+ */
12
+ var debounce = function(func, wait, immediate) {
13
+ var timeout;
14
+ return function() {
15
+ var context = this, args = arguments;
16
+ var later = function() {
17
+ timeout = null;
18
+ if (!immediate) func.apply(context, args);
19
+ };
20
+ var callNow = immediate && !timeout;
21
+ clearTimeout(timeout);
22
+ timeout = setTimeout(later, wait);
23
+ if (callNow) func.apply(context, args);
24
+ };
25
+ };
26
+
27
+ /*
28
+ * Check if the value given is a number.
29
+ * @params:
30
+ * value: value to test
31
+ * @return: boolean
32
+ */
33
+ var isNumber = function(value) {
34
+ return !Number(value);
35
+ };
36
+
37
+ /*
38
+ * Check if two strings have the same value.
39
+ * @params:
40
+ * firstValue: value to test.
41
+ * secondValue: value to compare to.
42
+ * @return: boolean
43
+ */
44
+ var isEqual = function(firstValue, secondValue) {
45
+ return firstValue === secondValue ? true : false;
46
+ };
47
+
48
+ /*
49
+ * Check if a string is empty
50
+ * @params:
51
+ * value: value to test
52
+ * @return: boolean
53
+ */
54
+ var isEmptyString = function(value) {
55
+ return value === '';
56
+ };
57
+
58
+ /*
59
+ * Check if the lenght of a given value respects the limit given.
60
+ * @params:
61
+ * el: element to test
62
+ * limit: limit to give. Ex: max, min, between
63
+ * minValue: minimum value to respect
64
+ * maxValue: maximum value to respect
65
+ * @return: boolean
66
+ */
67
+ var checkLength = function(el, limit, minValue, maxValue) {
68
+ var $length = $(el).val().length;
69
+ minValue = minValue || 1;
70
+ maxValue = maxValue || 0;
71
+
72
+ if (limit === 'max') {
73
+ return $length <= maxValue;
74
+ } else if (limit === 'min') {
75
+ return $length >= minValue;
76
+ } else if (limit === 'between') {
77
+ return $length >= minValue && $length <= maxValue;
78
+ } else {
79
+ return false;
80
+ }
81
+ };
82
+
83
+ return {
84
+ debounce: debounce,
85
+ isNumber: isNumber,
86
+ isEqual: isEqual,
87
+ isEmptyString: isEmptyString,
88
+ checkLength: checkLength
89
+ };
90
+
91
+ })(jQuery);