para 0.11.4 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/para/admin/main.scss +31 -0
  3. data/app/assets/stylesheets/para/admin/src/_affix.scss +7 -0
  4. data/app/assets/stylesheets/para/admin/src/_alert.scss +35 -0
  5. data/app/assets/stylesheets/para/admin/src/_base.scss +63 -0
  6. data/app/assets/stylesheets/para/admin/src/_bootstrap-variables.scss +766 -379
  7. data/app/assets/stylesheets/para/admin/src/_breadcrumb.scss +37 -0
  8. data/app/assets/stylesheets/para/admin/src/_buttons.scss +128 -0
  9. data/app/assets/stylesheets/para/admin/src/_checkable.scss +106 -0
  10. data/app/assets/stylesheets/para/admin/src/_common.scss +250 -0
  11. data/app/assets/stylesheets/para/admin/src/_dropdown.scss +52 -0
  12. data/app/assets/stylesheets/para/admin/src/_form.scss +359 -0
  13. data/app/assets/stylesheets/para/admin/src/_list.scss +96 -0
  14. data/app/assets/stylesheets/para/admin/src/_mixins.scss +109 -0
  15. data/app/assets/stylesheets/para/admin/src/_multi-select.scss +110 -0
  16. data/app/assets/stylesheets/para/admin/src/_navigation.scss +210 -0
  17. data/app/assets/stylesheets/para/admin/src/_navtabs.scss +68 -0
  18. data/app/assets/stylesheets/para/admin/src/_nested-many.scss +87 -0
  19. data/app/assets/stylesheets/para/admin/src/_nested_one.scss +26 -0
  20. data/app/assets/stylesheets/para/admin/src/_orderable.scss +48 -0
  21. data/app/assets/stylesheets/para/admin/src/_page-loading.scss +40 -0
  22. data/app/assets/stylesheets/para/admin/src/_pagination.scss +39 -0
  23. data/app/assets/stylesheets/para/admin/src/_panel.scss +61 -0
  24. data/app/assets/stylesheets/para/admin/src/_responsive.scss +133 -0
  25. data/app/assets/stylesheets/para/admin/src/_sorting.scss +43 -0
  26. data/app/assets/stylesheets/para/admin/src/_statcard.scss +46 -0
  27. data/app/assets/stylesheets/para/admin/src/_table.scss +36 -0
  28. data/app/assets/stylesheets/para/admin/src/_tree.scss +60 -0
  29. data/app/assets/stylesheets/para/admin/src/{_variables.sass → _variables.scss} +7 -7
  30. data/app/assets/stylesheets/para/admin/src/{_well.sass → _well.scss} +5 -4
  31. data/app/assets/stylesheets/para/admin.scss +15 -0
  32. data/app/assets/stylesheets/para/index.scss +1 -0
  33. data/app/assets/stylesheets/para/lib/datetimepicker.scss +15 -0
  34. data/app/assets/stylesheets/para/lib/fuelux.scss +46 -0
  35. data/app/assets/stylesheets/para/lib/jasny-bootstrap.scss +100 -0
  36. data/app/assets/stylesheets/para/lib/selectize.scss +129 -0
  37. data/app/assets/stylesheets/para/lib/slider.scss +14 -0
  38. data/app/controllers/para/admin/crud_resources_controller.rb +16 -9
  39. data/app/controllers/para/admin/imports_controller.rb +9 -9
  40. data/app/controllers/para/admin/jobs_controller.rb +7 -1
  41. data/app/controllers/para/admin/resources_controller.rb +17 -18
  42. data/app/controllers/para/admin/settings_component_controller.rb +2 -2
  43. data/app/helpers/para/admin/base_helper.rb +36 -25
  44. data/app/helpers/para/admin/page_helper.rb +8 -9
  45. data/app/helpers/para/flash_helper.rb +7 -28
  46. data/app/helpers/para/model_helper.rb +5 -8
  47. data/app/helpers/para/tree_helper.rb +4 -4
  48. data/app/javascripts/para/admin/async-progress.js +58 -0
  49. data/app/javascripts/para/admin/filters-form.js +12 -0
  50. data/app/javascripts/para/admin/job-tracker.js +33 -0
  51. data/app/javascripts/para/admin/table.js +58 -0
  52. data/app/javascripts/para/admin/tabs.js +110 -0
  53. data/app/javascripts/para/admin/theme_actions.js +39 -0
  54. data/app/javascripts/para/admin/tree.js +124 -0
  55. data/app/javascripts/para/application.js +2 -0
  56. data/app/javascripts/para/controllers/application.js +17 -0
  57. data/app/javascripts/para/controllers/index.js +10 -0
  58. data/app/javascripts/para/controllers/para_admin_flash_message_controller.js +48 -0
  59. data/app/javascripts/para/controllers/para_admin_modal_controller.js +43 -0
  60. data/app/javascripts/para/controllers/selectize_field_controller.js +142 -0
  61. data/app/javascripts/para/index.js +31 -0
  62. data/app/javascripts/para/inputs/material-input.js +7 -0
  63. data/app/javascripts/para/inputs/multi-select-input.js +343 -0
  64. data/app/javascripts/para/inputs/nested_many.js +151 -0
  65. data/app/javascripts/para/lib/fetch.js +41 -0
  66. data/app/javascripts/para/lib/page-loading.js +42 -0
  67. data/app/javascripts/para/simple_form_extension/colorpicker.js +30 -0
  68. data/app/javascripts/para/simple_form_extension/datetimepicker.js +115 -0
  69. data/app/javascripts/para/simple_form_extension/fileinput.js +57 -0
  70. data/app/javascripts/para/simple_form_extension/index.js +12 -0
  71. data/app/javascripts/para/simple_form_extension/selectize.js +160 -0
  72. data/app/javascripts/para/simple_form_extension/simple_form_extension_initialization.js +62 -0
  73. data/app/javascripts/para/simple_form_extension/slider.js +43 -0
  74. data/app/javascripts/para/simple_form_extension/spinbox.js +35 -0
  75. data/app/javascripts/para/vendor/bootstrap-colorpicker.js +1025 -0
  76. data/app/javascripts/para/vendor/bootstrap-slider.js +1610 -0
  77. data/app/javascripts/para/vendor/cocoon.js +150 -0
  78. data/app/javascripts/para/vendor/jquery.datetimepicker.js +2156 -0
  79. data/app/javascripts/para/vendor/jquery.js +3 -0
  80. data/app/javascripts/para/vendor/spinbox.js +438 -0
  81. data/app/javascripts/para/vendor/vertebra.js +224 -0
  82. data/app/views/admin/para/exporter/bases/_completed.html.haml +1 -1
  83. data/app/views/layouts/para/admin.html.haml +4 -2
  84. data/app/views/para/admin/imports/new.html.haml +12 -11
  85. data/app/views/para/admin/jobs/_completed.html.haml +1 -1
  86. data/app/views/para/admin/jobs/_failed.html.haml +1 -1
  87. data/app/views/para/admin/jobs/_job.html.haml +11 -0
  88. data/app/views/para/admin/jobs/show.html.haml +1 -10
  89. data/app/views/para/admin/resources/_add_button.html.haml +1 -1
  90. data/app/views/para/admin/resources/_exports_menu.html.haml +2 -2
  91. data/app/views/para/admin/resources/_filters.html.haml +1 -1
  92. data/app/views/para/admin/resources/_imports_menu.html.haml +2 -2
  93. data/app/views/para/admin/resources/_list.html.haml +27 -26
  94. data/app/views/para/admin/resources/_navigation.html.haml +10 -11
  95. data/app/views/para/admin/resources/_subclassable_add_button.html.haml +1 -1
  96. data/app/views/para/admin/shared/_flash.html.haml +18 -0
  97. data/app/views/para/admin/shared/_header.html.haml +1 -1
  98. data/app/views/para/form/_tabs.html.haml +1 -1
  99. data/app/views/para/inputs/_nested_many.html.haml +3 -3
  100. data/app/views/para/inputs/nested_many/_add.html.haml +1 -1
  101. data/app/views/para/inputs/nested_many/_add_with_subclasses.html.haml +2 -2
  102. data/app/views/para/inputs/nested_many/_container.html.haml +1 -1
  103. data/config/locales/fr.yml +1 -0
  104. data/lib/generators/para/install/install_generator.rb +10 -14
  105. data/lib/para/attribute_field/base.rb +3 -0
  106. data/lib/para/attribute_field/wysiwyg_editor.rb +15 -0
  107. data/lib/para/attribute_field.rb +1 -1
  108. data/lib/para/components_configuration.rb +1 -1
  109. data/lib/para/engine.rb +20 -22
  110. data/lib/para/ext/turbo_stream.rb +13 -0
  111. data/lib/para/ext.rb +1 -1
  112. data/lib/para/form_builder/containers.rb +33 -22
  113. data/lib/para/form_builder/nested_form.rb +6 -5
  114. data/lib/para/inputs/nested_many_input.rb +5 -0
  115. data/lib/para/markup/modal.rb +30 -15
  116. data/lib/para/markup/resources_buttons.rb +15 -11
  117. data/lib/para/model_field_parsers/wysiwyg_editor.rb +19 -0
  118. data/lib/para/model_field_parsers.rb +1 -1
  119. data/lib/para/version.rb +1 -1
  120. data/lib/para.rb +2 -8
  121. data/lib/simple_form_extension/components/icons.rb +13 -0
  122. data/lib/simple_form_extension/components/popovers.rb +46 -0
  123. data/lib/simple_form_extension/components.rb +8 -0
  124. data/lib/simple_form_extension/ext/form_builder.rb +20 -0
  125. data/lib/simple_form_extension/file_concern.rb +74 -0
  126. data/lib/simple_form_extension/inputs/boolean_input.rb +16 -0
  127. data/lib/simple_form_extension/inputs/collection_check_boxes_input.rb +15 -0
  128. data/lib/simple_form_extension/inputs/collection_radio_buttons_input.rb +15 -0
  129. data/lib/simple_form_extension/inputs/color_input.rb +37 -0
  130. data/lib/simple_form_extension/inputs/date_time_input.rb +48 -0
  131. data/lib/simple_form_extension/inputs/file_input.rb +41 -0
  132. data/lib/simple_form_extension/inputs/image_input.rb +110 -0
  133. data/lib/simple_form_extension/inputs/numeric_input.rb +27 -0
  134. data/lib/simple_form_extension/inputs/selectize_input.rb +210 -0
  135. data/lib/simple_form_extension/inputs/slider_input.rb +30 -0
  136. data/lib/simple_form_extension/inputs.rb +16 -0
  137. data/lib/simple_form_extension/railtie.rb +21 -0
  138. data/lib/simple_form_extension/resource_name_helper.rb +9 -0
  139. data/lib/simple_form_extension/translations.rb +7 -0
  140. data/lib/simple_form_extension/version.rb +3 -0
  141. data/lib/simple_form_extension.rb +30 -0
  142. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  143. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/alpha.png +0 -0
  144. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/hue-horizontal.png +0 -0
  145. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/hue.png +0 -0
  146. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/saturation.png +0 -0
  147. data/vendor/assets/stylesheets/bootstrap-colorpicker.scss +227 -0
  148. data/vendor/assets/stylesheets/bootstrap-slider.scss +246 -0
  149. data/vendor/assets/stylesheets/bootstrap.scss +6032 -0
  150. data/vendor/assets/stylesheets/jquery.datetimepicker.scss +568 -0
  151. metadata +120 -188
  152. data/app/assets/javascripts/admin/app.coffee +0 -1
  153. data/app/assets/javascripts/para/admin/async-progress.coffee +0 -29
  154. data/app/assets/javascripts/para/admin/filters-form.coffee +0 -11
  155. data/app/assets/javascripts/para/admin/job-tracker.coffee +0 -39
  156. data/app/assets/javascripts/para/admin/table.coffee +0 -44
  157. data/app/assets/javascripts/para/admin/tabs.coffee +0 -63
  158. data/app/assets/javascripts/para/admin/theme_actions.coffee +0 -25
  159. data/app/assets/javascripts/para/admin/tree.coffee +0 -105
  160. data/app/assets/javascripts/para/admin.coffee +0 -22
  161. data/app/assets/javascripts/para/application.js +0 -13
  162. data/app/assets/javascripts/para/inputs/material-input.coffee +0 -4
  163. data/app/assets/javascripts/para/inputs/multi-select-input.coffee +0 -174
  164. data/app/assets/javascripts/para/inputs/nested_many.coffee +0 -108
  165. data/app/assets/javascripts/para/lib/ajax.coffee +0 -11
  166. data/app/assets/javascripts/para/lib/remote-file-forms.coffee +0 -59
  167. data/app/assets/javascripts/para/lib/turbolinks-forms.coffee +0 -23
  168. data/app/assets/javascripts/para/lib/turbolinks-loading.coffee +0 -25
  169. data/app/assets/javascripts/para/lib/turbolinks-reloader.coffee +0 -19
  170. data/app/assets/stylesheets/para/admin/main.sass +0 -33
  171. data/app/assets/stylesheets/para/admin/src/_affix.sass +0 -4
  172. data/app/assets/stylesheets/para/admin/src/_alert.sass +0 -17
  173. data/app/assets/stylesheets/para/admin/src/_base.sass +0 -54
  174. data/app/assets/stylesheets/para/admin/src/_breadcrumb.sass +0 -32
  175. data/app/assets/stylesheets/para/admin/src/_buttons.sass +0 -107
  176. data/app/assets/stylesheets/para/admin/src/_checkable.sass +0 -94
  177. data/app/assets/stylesheets/para/admin/src/_common.sass +0 -202
  178. data/app/assets/stylesheets/para/admin/src/_dropdown.sass +0 -40
  179. data/app/assets/stylesheets/para/admin/src/_form.sass +0 -299
  180. data/app/assets/stylesheets/para/admin/src/_list.sass +0 -89
  181. data/app/assets/stylesheets/para/admin/src/_mixins.sass +0 -113
  182. data/app/assets/stylesheets/para/admin/src/_multi-select.sass +0 -91
  183. data/app/assets/stylesheets/para/admin/src/_navigation.sass +0 -171
  184. data/app/assets/stylesheets/para/admin/src/_navtabs.sass +0 -58
  185. data/app/assets/stylesheets/para/admin/src/_nested-many.sass +0 -75
  186. data/app/assets/stylesheets/para/admin/src/_nested_one.sass +0 -22
  187. data/app/assets/stylesheets/para/admin/src/_orderable.sass +0 -44
  188. data/app/assets/stylesheets/para/admin/src/_page-loading.sass +0 -39
  189. data/app/assets/stylesheets/para/admin/src/_pagination.sass +0 -34
  190. data/app/assets/stylesheets/para/admin/src/_panel.sass +0 -55
  191. data/app/assets/stylesheets/para/admin/src/_responsive.sass +0 -117
  192. data/app/assets/stylesheets/para/admin/src/_sorting.sass +0 -36
  193. data/app/assets/stylesheets/para/admin/src/_statcard.sass +0 -41
  194. data/app/assets/stylesheets/para/admin/src/_table.sass +0 -33
  195. data/app/assets/stylesheets/para/admin/src/_tree.sass +0 -52
  196. data/app/assets/stylesheets/para/admin.sass +0 -12
  197. data/app/assets/stylesheets/para/lib/compass/_support.scss +0 -447
  198. data/app/assets/stylesheets/para/lib/compass/css3/_box-shadow.scss +0 -88
  199. data/app/assets/stylesheets/para/lib/compass/css3/_images.scss +0 -152
  200. data/app/assets/stylesheets/para/lib/compass/css3/_inline-block.scss +0 -31
  201. data/app/assets/stylesheets/para/lib/compass/css3/_text-shadow.scss +0 -82
  202. data/app/assets/stylesheets/para/lib/compass/css3/_transform.scss +0 -590
  203. data/app/assets/stylesheets/para/lib/compass/css3/_transition.scss +0 -190
  204. data/app/assets/stylesheets/para/lib/compass/css3/_user-interface.scss +0 -71
  205. data/app/assets/stylesheets/para/lib/compass/utilities/general/_hacks.scss +0 -65
  206. data/app/assets/stylesheets/para/lib/datetimepicker.sass +0 -15
  207. data/app/assets/stylesheets/para/lib/fuelux.sass +0 -40
  208. data/app/assets/stylesheets/para/lib/jasny-bootstrap.sass +0 -97
  209. data/app/assets/stylesheets/para/lib/redactor.sass +0 -86
  210. data/app/assets/stylesheets/para/lib/selectize.sass +0 -111
  211. data/app/assets/stylesheets/para/lib/slider.sass +0 -12
  212. data/app/assets/stylesheets/para/plugins-includes.sass.erb +0 -1
  213. data/lib/para/attribute_field/redactor.rb +0 -22
  214. data/lib/para/ext/request_iframe_xhr.rb +0 -17
  215. data/lib/para/iframe_transport/middleware.rb +0 -58
  216. data/lib/para/iframe_transport.rb +0 -7
  217. data/lib/para/model_field_parsers/redactor.rb +0 -19
  218. data/vendor/assets/javascripts/jquery.iframe-transport.js +0 -260
  219. data/vendor/assets/javascripts/jquery.remote-modal-form.coffee +0 -145
  220. /data/app/assets/stylesheets/admin/{app.sass → app.scss} +0 -0
  221. /data/app/{assets/javascripts → javascripts}/para/plugins-includes.js.erb +0 -0
  222. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/Sortable.js +0 -0
  223. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/jasny-bootstrap.js +0 -0
  224. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/jquery.scrollto.js +0 -0
  225. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/jquery.sortable.js +0 -0
  226. /data/vendor/assets/stylesheets/{animate.css → animate.scss} +0 -0
  227. /data/vendor/assets/stylesheets/{hint.css → hint.scss} +0 -0
  228. /data/vendor/assets/stylesheets/{jasny-bootstrap.css → jasny-bootstrap.scss} +0 -0
@@ -0,0 +1,3 @@
1
+ import jQuery from "jquery";
2
+
3
+ window.$ = window.jQuery = jQuery;
@@ -0,0 +1,438 @@
1
+ ( function( $ ) {
2
+ /*
3
+ * Fuel UX Spinbox
4
+ * https://github.com/ExactTarget/fuelux
5
+ *
6
+ * Copyright (c) 2014 ExactTarget
7
+ * Licensed under the BSD New license.
8
+ */
9
+
10
+
11
+
12
+ // -- BEGIN MODULE CODE HERE --
13
+
14
+ var old = $.fn.spinbox;
15
+
16
+ // SPINBOX CONSTRUCTOR AND PROTOTYPE
17
+
18
+ var Spinbox = function( element, options ) {
19
+ this.$element = $( element );
20
+ this.$element.find( '.btn' ).on( 'click', function( e ) {
21
+ //keep spinbox from submitting if they forgot to say type="button" on their spinner buttons
22
+ e.preventDefault();
23
+ } );
24
+ this.options = $.extend( {}, $.fn.spinbox.defaults, options );
25
+ this.$input = this.$element.find( '.spinbox-input' );
26
+ this.$element.on( 'focusin.fu.spinbox', this.$input, $.proxy( this.changeFlag, this ) );
27
+ this.$element.on( 'focusout.fu.spinbox', this.$input, $.proxy( this.change, this ) );
28
+ this.$element.on( 'keydown.fu.spinbox', this.$input, $.proxy( this.keydown, this ) );
29
+ this.$element.on( 'keyup.fu.spinbox', this.$input, $.proxy( this.keyup, this ) );
30
+
31
+ // this.bindMousewheelListeners();
32
+ this.mousewheelTimeout = {};
33
+
34
+ if ( this.options.hold ) {
35
+ this.$element.on( 'mousedown.fu.spinbox', '.spinbox-up', $.proxy( function() {
36
+ this.startSpin( true );
37
+ }, this ) );
38
+ this.$element.on( 'mouseup.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy( this.stopSpin, this ) );
39
+ this.$element.on( 'mouseout.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy( this.stopSpin, this ) );
40
+ this.$element.on( 'mousedown.fu.spinbox', '.spinbox-down', $.proxy( function() {
41
+ this.startSpin( false );
42
+ }, this ) );
43
+ } else {
44
+ this.$element.on( 'click.fu.spinbox', '.spinbox-up', $.proxy( function() {
45
+ this.step( true );
46
+ }, this ) );
47
+ this.$element.on( 'click.fu.spinbox', '.spinbox-down', $.proxy( function() {
48
+ this.step( false );
49
+ }, this ) );
50
+ }
51
+
52
+ this.switches = {
53
+ count: 1,
54
+ enabled: true
55
+ };
56
+
57
+ if ( this.options.speed === 'medium' ) {
58
+ this.switches.speed = 300;
59
+ } else if ( this.options.speed === 'fast' ) {
60
+ this.switches.speed = 100;
61
+ } else {
62
+ this.switches.speed = 500;
63
+ }
64
+
65
+ this.lastValue = this.options.value;
66
+
67
+ this.render();
68
+
69
+ if ( this.options.disabled ) {
70
+ this.disable();
71
+ }
72
+ };
73
+
74
+ Spinbox.prototype = {
75
+ constructor: Spinbox,
76
+
77
+ destroy: function() {
78
+ this.$element.remove();
79
+ // any external bindings
80
+ // [none]
81
+ // set input value attrbute
82
+ this.$element.find( 'input' ).each( function() {
83
+ $( this ).attr( 'value', $( this ).val() );
84
+ } );
85
+ // empty elements to return to original markup
86
+ // [none]
87
+ // returns string of markup
88
+ return this.$element[ 0 ].outerHTML;
89
+ },
90
+
91
+ render: function() {
92
+ var inputValue = this.parseInput( this.$input.val() );
93
+ var maxUnitLength = '';
94
+
95
+ // if input is empty and option value is default, 0
96
+ if ( inputValue !== '' && this.options.value === 0 ) {
97
+ this.value( inputValue );
98
+ } else {
99
+ this.output( this.options.value );
100
+ }
101
+
102
+ if ( this.options.units.length ) {
103
+ $.each( this.options.units, function( index, value ) {
104
+ if ( value.length > maxUnitLength.length ) {
105
+ maxUnitLength = value;
106
+ }
107
+ } );
108
+ }
109
+ },
110
+
111
+ output: function( value, updateField ) {
112
+ value = ( value + '' ).split( '.' ).join( this.options.decimalMark );
113
+ updateField = ( updateField || true );
114
+ if ( updateField ) {
115
+ this.$input.val( value );
116
+ }
117
+
118
+ return value;
119
+ },
120
+
121
+ parseInput: function( value ) {
122
+ value = ( value + '' ).split( this.options.decimalMark ).join( '.' );
123
+
124
+ return value;
125
+ },
126
+
127
+ change: function() {
128
+ var newVal = this.parseInput( this.$input.val() ) || '';
129
+
130
+ if ( this.options.units.length || this.options.decimalMark !== '.' ) {
131
+ newVal = this.parseValueWithUnit( newVal );
132
+ } else if ( newVal / 1 ) {
133
+ newVal = this.options.value = this.checkMaxMin( newVal / 1 );
134
+ } else {
135
+ newVal = this.checkMaxMin( newVal.replace( /[^0-9.-]/g, '' ) || '' );
136
+ this.options.value = newVal / 1;
137
+ }
138
+
139
+ this.output( newVal );
140
+
141
+ this.changeFlag = false;
142
+ this.triggerChangedEvent();
143
+ },
144
+
145
+ changeFlag: function() {
146
+ this.changeFlag = true;
147
+ },
148
+
149
+ stopSpin: function() {
150
+ if ( this.switches.timeout !== undefined ) {
151
+ clearTimeout( this.switches.timeout );
152
+ this.switches.count = 1;
153
+ this.triggerChangedEvent();
154
+ }
155
+ },
156
+
157
+ triggerChangedEvent: function() {
158
+ var currentValue = this.value();
159
+ if ( currentValue === this.lastValue ) return;
160
+ this.lastValue = currentValue;
161
+
162
+ // Primary changed event
163
+ this.$element.trigger( 'changed.fu.spinbox', this.output( currentValue, false ) ); // no DOM update
164
+ },
165
+
166
+ startSpin: function( type ) {
167
+ if ( !this.options.disabled ) {
168
+ var divisor = this.switches.count;
169
+
170
+ if ( divisor === 1 ) {
171
+ this.step( type );
172
+ divisor = 1;
173
+ } else if ( divisor < 3 ) {
174
+ divisor = 1.5;
175
+ } else if ( divisor < 8 ) {
176
+ divisor = 2.5;
177
+ } else {
178
+ divisor = 4;
179
+ }
180
+
181
+ this.switches.timeout = setTimeout( $.proxy( function() {
182
+ this.iterate( type );
183
+ }, this ), this.switches.speed / divisor );
184
+ this.switches.count++;
185
+ }
186
+ },
187
+
188
+ iterate: function( type ) {
189
+ this.step( type );
190
+ this.startSpin( type );
191
+ },
192
+
193
+ step: function( isIncrease ) {
194
+ // isIncrease: true is up, false is down
195
+
196
+ var digits, multiple, currentValue, limitValue;
197
+
198
+ // trigger change event
199
+ if ( this.changeFlag ) {
200
+ this.change();
201
+ }
202
+
203
+ // get current value and min/max options
204
+ currentValue = this.options.value;
205
+ limitValue = isIncrease ? this.options.max : this.options.min;
206
+
207
+ if ( ( isIncrease ? currentValue < limitValue : currentValue > limitValue ) ) {
208
+ var newVal = currentValue + ( isIncrease ? 1 : -1 ) * this.options.step;
209
+
210
+ // raise to power of 10 x number of decimal places, then round
211
+ if ( this.options.step % 1 !== 0 ) {
212
+ digits = ( this.options.step + '' ).split( '.' )[ 1 ].length;
213
+ multiple = Math.pow( 10, digits );
214
+ newVal = Math.round( newVal * multiple ) / multiple;
215
+ }
216
+
217
+ // if outside limits, set to limit value
218
+ if ( isIncrease ? newVal > limitValue : newVal < limitValue ) {
219
+ this.value( limitValue );
220
+ } else {
221
+ this.value( newVal );
222
+ }
223
+
224
+ } else if ( this.options.cycle ) {
225
+ var cycleVal = isIncrease ? this.options.min : this.options.max;
226
+ this.value( cycleVal );
227
+ }
228
+ },
229
+
230
+ value: function( value ) {
231
+ if ( value || value === 0 ) {
232
+ if ( this.options.units.length || this.options.decimalMark !== '.' ) {
233
+ this.output( this.parseValueWithUnit( value + ( this.unit || '' ) ) );
234
+ return this;
235
+
236
+ } else if ( !isNaN( parseFloat( value ) ) && isFinite( value ) ) {
237
+ this.options.value = value / 1;
238
+ this.output( value + ( this.unit ? this.unit : '' ) );
239
+ return this;
240
+
241
+ }
242
+
243
+ } else {
244
+ if ( this.changeFlag ) {
245
+ this.change();
246
+ }
247
+
248
+ if ( this.unit ) {
249
+ return this.options.value + this.unit;
250
+ } else {
251
+ return this.output( this.options.value, false ); // no DOM update
252
+ }
253
+
254
+ }
255
+ },
256
+
257
+ isUnitLegal: function( unit ) {
258
+ var legalUnit;
259
+
260
+ $.each( this.options.units, function( index, value ) {
261
+ if ( value.toLowerCase() === unit.toLowerCase() ) {
262
+ legalUnit = unit.toLowerCase();
263
+ return false;
264
+ }
265
+ } );
266
+
267
+ return legalUnit;
268
+ },
269
+
270
+ // strips units and add them back
271
+ parseValueWithUnit: function( value ) {
272
+ var unit = value.replace( /[^a-zA-Z]/g, '' );
273
+ var number = value.replace( /[^0-9.-]/g, '' );
274
+
275
+ if ( unit ) {
276
+ unit = this.isUnitLegal( unit );
277
+ }
278
+
279
+ this.options.value = this.checkMaxMin( number / 1 );
280
+ this.unit = unit || undefined;
281
+ return this.options.value + ( unit || '' );
282
+ },
283
+
284
+ checkMaxMin: function( value ) {
285
+ // if unreadable
286
+ if ( isNaN( parseFloat( value ) ) ) {
287
+ return value;
288
+ }
289
+
290
+ // if not within range return the limit
291
+ if ( !( value <= this.options.max && value >= this.options.min ) ) {
292
+ value = value >= this.options.max ? this.options.max : this.options.min;
293
+ }
294
+
295
+ return value;
296
+ },
297
+
298
+ disable: function() {
299
+ this.options.disabled = true;
300
+ this.$element.addClass( 'disabled' );
301
+ this.$input.attr( 'disabled', '' );
302
+ this.$element.find( 'button' ).addClass( 'disabled' );
303
+ },
304
+
305
+ enable: function() {
306
+ this.options.disabled = false;
307
+ this.$element.removeClass( 'disabled' );
308
+ this.$input.removeAttr( 'disabled' );
309
+ this.$element.find( 'button' ).removeClass( 'disabled' );
310
+ },
311
+
312
+ keydown: function( event ) {
313
+ var keyCode = event.keyCode;
314
+ if ( keyCode === 38 ) {
315
+ this.step( true );
316
+ } else if ( keyCode === 40 ) {
317
+ this.step( false );
318
+ }
319
+ },
320
+
321
+ keyup: function( event ) {
322
+ var keyCode = event.keyCode;
323
+
324
+ if ( keyCode === 38 || keyCode === 40 ) {
325
+ this.triggerChangedEvent();
326
+ }
327
+ },
328
+
329
+ bindMousewheelListeners: function() {
330
+ var inputEl = this.$input.get( 0 );
331
+ if ( inputEl.addEventListener ) {
332
+ //IE 9, Chrome, Safari, Opera
333
+ inputEl.addEventListener( 'mousewheel', $.proxy( this.mousewheelHandler, this ), false );
334
+ // Firefox
335
+ inputEl.addEventListener( 'DOMMouseScroll', $.proxy( this.mousewheelHandler, this ), false );
336
+ } else {
337
+ // IE <9
338
+ inputEl.attachEvent( 'onmousewheel', $.proxy( this.mousewheelHandler, this ) );
339
+ }
340
+ },
341
+
342
+ mousewheelHandler: function( event ) {
343
+ if ( !this.options.disabled ) {
344
+ var e = window.event || event; // old IE support
345
+ var delta = Math.max( -1, Math.min( 1, ( e.wheelDelta || -e.detail ) ) );
346
+ var self = this;
347
+
348
+ clearTimeout( this.mousewheelTimeout );
349
+ this.mousewheelTimeout = setTimeout( function() {
350
+ self.triggerChangedEvent();
351
+ }, 300 );
352
+
353
+ if ( delta < 0 ) {
354
+ this.step( true );
355
+ } else {
356
+ this.step( false );
357
+ }
358
+
359
+ if ( e.preventDefault ) {
360
+ e.preventDefault();
361
+ } else {
362
+ e.returnValue = false;
363
+ }
364
+
365
+ return false;
366
+ }
367
+ }
368
+ };
369
+
370
+
371
+ // SPINBOX PLUGIN DEFINITION
372
+
373
+ $.fn.spinbox = function( option ) {
374
+ var args = Array.prototype.slice.call( arguments, 1 );
375
+ var methodReturn;
376
+
377
+ var $set = this.each( function() {
378
+ var $this = $( this );
379
+ var data = $this.data( 'fu.spinbox' );
380
+ var options = typeof option === 'object' && option;
381
+
382
+ if ( !data ) {
383
+ $this.data( 'fu.spinbox', ( data = new Spinbox( this, options ) ) );
384
+ }
385
+
386
+ if ( typeof option === 'string' ) {
387
+ methodReturn = data[ option ].apply( data, args );
388
+ }
389
+ } );
390
+
391
+ return ( methodReturn === undefined ) ? $set : methodReturn;
392
+ };
393
+
394
+ // value needs to be 0 for this.render();
395
+ $.fn.spinbox.defaults = {
396
+ value: 0,
397
+ min: 0,
398
+ max: 999,
399
+ step: 1,
400
+ hold: true,
401
+ speed: 'medium',
402
+ disabled: false,
403
+ cycle: false,
404
+ units: [],
405
+ decimalMark: '.'
406
+ };
407
+
408
+ $.fn.spinbox.Constructor = Spinbox;
409
+
410
+ $.fn.spinbox.noConflict = function() {
411
+ $.fn.spinbox = old;
412
+ return this;
413
+ };
414
+
415
+
416
+ // DATA-API
417
+
418
+ $( document ).on( 'mousedown.fu.spinbox.data-api', '[data-initialize=spinbox]', function( e ) {
419
+ var $control = $( e.target ).closest( '.spinbox' );
420
+ if ( !$control.data( 'fu.spinbox' ) ) {
421
+ $control.spinbox( $control.data() );
422
+ }
423
+ } );
424
+
425
+ // Must be domReady for AMD compatibility
426
+ $( function() {
427
+ $( '[data-initialize=spinbox]' ).each( function() {
428
+ var $this = $( this );
429
+ if ( !$this.data( 'fu.spinbox' ) ) {
430
+ $this.spinbox( $this.data() );
431
+ }
432
+ } );
433
+ } );
434
+
435
+
436
+
437
+ } )( jQuery );
438
+
@@ -0,0 +1,224 @@
1
+ var _now, delegateEventSplitter, lastUniqueId, uniqueId;
2
+
3
+ // Global Vertebra namespace
4
+ window.Vertebra = {};
5
+
6
+ // Allows assigning unique ids to views
7
+ lastUniqueId = 0;
8
+
9
+ uniqueId = function(prefix) {
10
+ return [prefix, ++lastUniqueId].join('-');
11
+ };
12
+
13
+ // Regex to split delegated events string
14
+ delegateEventSplitter = /^(\S+)\s*(.*)$/;
15
+
16
+ window.camelize = function(str) {
17
+ return str.replace(/(^|[-_])(.)/g, function(match) {
18
+ return match.toUpperCase();
19
+ }).replace(/[-_]/g, '');
20
+ };
21
+
22
+ window.trim = function(str) {
23
+ return str.replace(/^\s+|\s+$/g, '');
24
+ };
25
+
26
+ window.isFunction = function(obj) {
27
+ return !!(obj && obj.constructor && obj.call && obj.apply);
28
+ };
29
+
30
+ _now = Date.now || function() {
31
+ return new Date().getTime();
32
+ };
33
+
34
+ // Throttle function borrowed from underscore.js
35
+ window.throttle = function(func, wait, options) {
36
+ var later, previous;
37
+ previous = 0;
38
+ if (options == null) {
39
+ options = {};
40
+ }
41
+ later = function() {
42
+ var args, context, result, timeout;
43
+ previous = options.leading === false ? 0 : _now();
44
+ timeout = null;
45
+ result = func.apply(context, args);
46
+ if (!timeout) {
47
+ context = args = null;
48
+ }
49
+ };
50
+ return function() {
51
+ var args, context, now, remaining, result, timeout;
52
+ now = _now();
53
+ if (!previous && options.leading === false) {
54
+ previous = now;
55
+ }
56
+ remaining = wait - (now - previous);
57
+ context = this;
58
+ args = arguments;
59
+ if (remaining <= 0 || remaining > wait) {
60
+ if (timeout) {
61
+ clearTimeout(timeout);
62
+ timeout = null;
63
+ }
64
+ previous = now;
65
+ result = func.apply(context, args);
66
+ if (!timeout) {
67
+ context = args = null;
68
+ }
69
+ } else if (!timeout && options.trailing !== false) {
70
+ timeout = setTimeout(later, remaining);
71
+ }
72
+ return result;
73
+ };
74
+ };
75
+
76
+ // Minimalist Backbon.View with support for view element, this.$ and delegated
77
+ // events on initialization.
78
+
79
+ // Only depends on jQuery, and not underscore.js
80
+ window.Vertebra.View = class View {
81
+ $(selector) {
82
+ return this.$el.find(selector);
83
+ }
84
+
85
+ constructor(options) {
86
+ var ref;
87
+ if (options.el) {
88
+ this.setElement(options.el);
89
+ }
90
+ this._eventListeners = {};
91
+ this._listeningTo = {};
92
+ this.cid = uniqueId('view');
93
+ if ((ref = this.initialize) != null) {
94
+ ref.apply(this, arguments);
95
+ }
96
+ }
97
+
98
+ setElement(el) {
99
+ this.$el = el instanceof $ ? el : $(el);
100
+ this.el = this.$el[0];
101
+ return this.delegateEvents();
102
+ }
103
+
104
+ delegateEvents() {
105
+ var events, key, match, method, results;
106
+ this._undelegateEvents();
107
+ if (!this.events) {
108
+ return;
109
+ }
110
+ events = isFunction(this.events) ? this.events() : this.events;
111
+ results = [];
112
+ for (key in events) {
113
+ method = events[key];
114
+ method = this[method];
115
+ if (!method) {
116
+ continue;
117
+ }
118
+ match = key.match(delegateEventSplitter);
119
+ results.push(this.delegate(match[1], match[2], $.proxy(method, this)));
120
+ }
121
+ return results;
122
+ }
123
+
124
+ delegate(eventName, selector, listener) {
125
+ var ref;
126
+ return (ref = this.$el) != null ? ref.on(eventName + '.delegateEvents' + this.cid, selector, listener) : void 0;
127
+ }
128
+
129
+ _undelegateEvents() {
130
+ var ref;
131
+ return (ref = this.$el) != null ? ref.off('.delegateEvents' + this.cid) : void 0;
132
+ }
133
+
134
+ listenTo(object, eventName, listener) {
135
+ var base, base1, name;
136
+ if ((base = this._listeningTo)[name = object.cid] == null) {
137
+ base[name] = {};
138
+ }
139
+ if ((base1 = this._listeningTo[object.cid])[eventName] == null) {
140
+ base1[eventName] = [];
141
+ }
142
+ this._listeningTo[object.cid][eventName].push(listener);
143
+ return object.on(eventName, (() => {
144
+ return listener.apply(this, arguments);
145
+ }));
146
+ }
147
+
148
+ on(eventName, listener) {
149
+ var base;
150
+ if ((base = this._eventListeners)[eventName] == null) {
151
+ base[eventName] = [];
152
+ }
153
+ return this._eventListeners[eventName].push(listener);
154
+ }
155
+
156
+ off(eventName, listener) {
157
+ var index, listeners, results;
158
+ if (!(listeners = this._eventListeners[eventName])) {
159
+ return;
160
+ }
161
+ if (listener) {
162
+ results = [];
163
+ for (index in listeners) {
164
+ if (listeners[index] === listener) {
165
+ results.push(listeners.splice(index, 1));
166
+ }
167
+ }
168
+ return results;
169
+ } else {
170
+ return this._eventListeners[eventName] = [];
171
+ }
172
+ }
173
+
174
+ trigger(eventName, ...args) {
175
+ var i, len, listener, listeners, results;
176
+ if ((listeners = this._eventListeners[eventName])) {
177
+ results = [];
178
+ for (i = 0, len = listeners.length; i < len; i++) {
179
+ listener = listeners[i];
180
+ results.push(listener.apply(this, args));
181
+ }
182
+ return results;
183
+ }
184
+ }
185
+
186
+ stopListeningTo(object, eventName, listener) {
187
+ var i, len, listeners, listenersHash, results;
188
+ if ((listenersHash = this._listeningTo[object.cid]) && (listeners = listenersHash[eventName])) {
189
+ results = [];
190
+ for (i = 0, len = listeners.length; i < len; i++) {
191
+ listener = listeners[i];
192
+ results.push(object.off(eventName, listener));
193
+ }
194
+ return results;
195
+ }
196
+ }
197
+
198
+ stopListening() {
199
+ var eventName, events, listeners, object, ref, results;
200
+ if (!this._listeningTo) {
201
+ return;
202
+ }
203
+ ref = this._listeningTo;
204
+ results = [];
205
+ for (object in ref) {
206
+ events = ref[object];
207
+ results.push((function() {
208
+ var results1;
209
+ results1 = [];
210
+ for (eventName in events) {
211
+ listeners = events[eventName];
212
+ results1.push(this.stopListeningTo(object, eventName, listener));
213
+ }
214
+ return results1;
215
+ }).call(this));
216
+ }
217
+ return results;
218
+ }
219
+
220
+ destroy() {
221
+ return this.stopListening();
222
+ }
223
+
224
+ };
@@ -7,5 +7,5 @@
7
7
  window.location.href = '#{ job.file.attachment_url }';
8
8
 
9
9
  = modal.footer do
10
- %button.btn.btn-default{ data: { dismiss: 'modal' } }
10
+ %button.btn.btn-default{ data: { action: 'click->para-admin-modal#closeModal' } }
11
11
  = t('para.shared.close')
@@ -22,8 +22,10 @@
22
22
  = render partial: template_path_lookup('admin/shared/_header', 'para/admin/shared/_header')
23
23
 
24
24
  .container-fluid.page-content.admin-main-page-content
25
- = display_admin_flash
25
+ = render partial: template_path_lookup('admin/shared/_flash', 'para/admin/shared/_flash')
26
26
 
27
27
  = yield
28
28
 
29
- = javascript_include_tag 'para/admin', :'data-turbolinks-eval' => false, :'data-turbolinks-suppress-warning' => true
29
+ = turbo_frame_tag "para_admin_modal", data: { controller: "para-admin-modal" }
30
+
31
+ = javascript_include_tag 'para/admin', :'data-turbo-eval' => false, :'data-turbo-suppress-warning' => true
@@ -1,14 +1,15 @@
1
- = modal id: "component-import-#{ @importer.model_name.route_key }" do |modal|
2
- = modal.header do
3
- = @importer.model_name.human
1
+ = turbo_frame_tag "para_admin_modal" do
2
+ = modal id: "component-import-#{ @importer.model_name.route_key }" do |modal|
3
+ = modal.header do
4
+ = @importer.model_name.human
4
5
 
5
- = simple_form_for @file, as: :file, url: @component.path(namespace: :imports, importer: @importer.name), remote: true do |form|
6
- = modal.body do
7
- %p= t('para.import.help_text')
6
+ = simple_form_for @file, as: :file, url: @component.path(namespace: :imports, importer: @importer.name), remote: true do |form|
7
+ = modal.body do
8
+ %p= t('para.import.help_text')
8
9
 
9
- = form.input :attachment, label: false, placeholder: t('para.import.placeholder')
10
+ = form.input :attachment, label: false, placeholder: t('para.import.placeholder')
10
11
 
11
- = modal.footer do
12
- %button.btn.btn-primary.btn-shadow{ type: 'submit' }
13
- %i.fa.fa-upload.fa-fw
14
- = t('para.import.name')
12
+ = modal.footer do
13
+ %button.btn.btn-primary.btn-shadow{ type: 'submit' }
14
+ %i.fa.fa-upload.fa-fw
15
+ = t('para.import.name')