active_scaffold 3.2.17 → 3.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. data/CHANGELOG +5 -1
  2. metadata +17 -261
  3. data/app/assets/images/active_scaffold/add.png +0 -0
  4. data/app/assets/images/active_scaffold/arrow_down.png +0 -0
  5. data/app/assets/images/active_scaffold/arrow_up.png +0 -0
  6. data/app/assets/images/active_scaffold/close.png +0 -0
  7. data/app/assets/images/active_scaffold/close_touch.png +0 -0
  8. data/app/assets/images/active_scaffold/config.png +0 -0
  9. data/app/assets/images/active_scaffold/cross.png +0 -0
  10. data/app/assets/images/active_scaffold/gears.png +0 -0
  11. data/app/assets/images/active_scaffold/indicator-small.gif +0 -0
  12. data/app/assets/images/active_scaffold/indicator.gif +0 -0
  13. data/app/assets/images/active_scaffold/magnifier.png +0 -0
  14. data/app/assets/javascripts/active_scaffold.js.erb +0 -19
  15. data/app/assets/javascripts/jquery/active_scaffold.js +0 -1113
  16. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +0 -24
  17. data/app/assets/javascripts/jquery/draggable_lists.js +0 -27
  18. data/app/assets/javascripts/jquery/jquery.editinplace.js +0 -743
  19. data/app/assets/javascripts/jquery/tiny_mce_bridge.js +0 -7
  20. data/app/assets/javascripts/prototype/active_scaffold.js +0 -1107
  21. data/app/assets/javascripts/prototype/dhtml_history.js +0 -870
  22. data/app/assets/javascripts/prototype/form_enhancements.js +0 -117
  23. data/app/assets/javascripts/prototype/rico_corner.js +0 -370
  24. data/app/assets/javascripts/prototype/tiny_mce_bridge.js +0 -7
  25. data/app/assets/stylesheets/active_scaffold-ie.css.scss +0 -54
  26. data/app/assets/stylesheets/active_scaffold.css.scss +0 -14
  27. data/app/assets/stylesheets/active_scaffold_colors.css.scss +0 -395
  28. data/app/assets/stylesheets/active_scaffold_extensions.css.erb +0 -2
  29. data/app/assets/stylesheets/active_scaffold_images.css.scss +0 -40
  30. data/app/assets/stylesheets/active_scaffold_layout.css +0 -936
  31. data/app/assets/stylesheets/blue-theme.css +0 -74
  32. data/config/locales/de.yml +0 -125
  33. data/config/locales/en.yml +0 -127
  34. data/config/locales/es.yml +0 -128
  35. data/config/locales/fr.yml +0 -131
  36. data/config/locales/hu.yml +0 -126
  37. data/config/locales/ja.yml +0 -126
  38. data/config/locales/ru.yml +0 -135
  39. data/frontends/default/views/_action_group.html.erb +0 -24
  40. data/frontends/default/views/_add_existing_form.html.erb +0 -30
  41. data/frontends/default/views/_base_form.html.erb +0 -53
  42. data/frontends/default/views/_create_form.html.erb +0 -8
  43. data/frontends/default/views/_create_form_on_list.html.erb +0 -6
  44. data/frontends/default/views/_field_search.html.erb +0 -32
  45. data/frontends/default/views/_form.html.erb +0 -28
  46. data/frontends/default/views/_form_association.html.erb +0 -17
  47. data/frontends/default/views/_form_association_footer.html.erb +0 -47
  48. data/frontends/default/views/_form_attribute.html.erb +0 -23
  49. data/frontends/default/views/_form_hidden_attribute.html.erb +0 -7
  50. data/frontends/default/views/_form_messages.html.erb +0 -5
  51. data/frontends/default/views/_horizontal_subform.html.erb +0 -22
  52. data/frontends/default/views/_horizontal_subform_footer.html.erb +0 -0
  53. data/frontends/default/views/_horizontal_subform_header.html.erb +0 -11
  54. data/frontends/default/views/_horizontal_subform_record.html.erb +0 -43
  55. data/frontends/default/views/_human_conditions.html.erb +0 -1
  56. data/frontends/default/views/_list.html.erb +0 -18
  57. data/frontends/default/views/_list_actions.html.erb +0 -15
  58. data/frontends/default/views/_list_calculations.html.erb +0 -16
  59. data/frontends/default/views/_list_column_headings.html.erb +0 -12
  60. data/frontends/default/views/_list_header.html.erb +0 -10
  61. data/frontends/default/views/_list_inline_adapter.html.erb +0 -21
  62. data/frontends/default/views/_list_messages.html.erb +0 -28
  63. data/frontends/default/views/_list_pagination.html.erb +0 -11
  64. data/frontends/default/views/_list_pagination_links.html.erb +0 -9
  65. data/frontends/default/views/_list_record.html.erb +0 -13
  66. data/frontends/default/views/_list_record_columns.html.erb +0 -8
  67. data/frontends/default/views/_list_with_header.html.erb +0 -36
  68. data/frontends/default/views/_messages.html.erb +0 -10
  69. data/frontends/default/views/_refresh_list.js.erb +0 -1
  70. data/frontends/default/views/_render_field.js.erb +0 -20
  71. data/frontends/default/views/_row.html.erb +0 -1
  72. data/frontends/default/views/_search.html.erb +0 -34
  73. data/frontends/default/views/_search_attribute.html.erb +0 -10
  74. data/frontends/default/views/_show.html.erb +0 -8
  75. data/frontends/default/views/_show_columns.html.erb +0 -15
  76. data/frontends/default/views/_update_actions.html.erb +0 -9
  77. data/frontends/default/views/_update_calculations.js.erb +0 -4
  78. data/frontends/default/views/_update_form.html.erb +0 -6
  79. data/frontends/default/views/_update_messages.js.erb +0 -2
  80. data/frontends/default/views/_vertical_subform.html.erb +0 -12
  81. data/frontends/default/views/_vertical_subform_record.html.erb +0 -43
  82. data/frontends/default/views/action_confirmation.html.erb +0 -13
  83. data/frontends/default/views/add_existing.js.erb +0 -14
  84. data/frontends/default/views/add_existing_form.html.erb +0 -5
  85. data/frontends/default/views/create.html.erb +0 -5
  86. data/frontends/default/views/delete.html.erb +0 -13
  87. data/frontends/default/views/destroy.js.erb +0 -26
  88. data/frontends/default/views/edit_associated.js.erb +0 -12
  89. data/frontends/default/views/field_search.html.erb +0 -5
  90. data/frontends/default/views/form_messages.js.erb +0 -1
  91. data/frontends/default/views/list.html.erb +0 -1
  92. data/frontends/default/views/on_action_update.js.erb +0 -22
  93. data/frontends/default/views/on_create.js.erb +0 -38
  94. data/frontends/default/views/on_mark.js.erb +0 -6
  95. data/frontends/default/views/on_update.js.erb +0 -29
  96. data/frontends/default/views/refresh_list.js.erb +0 -2
  97. data/frontends/default/views/render_field.js.erb +0 -1
  98. data/frontends/default/views/row.js.erb +0 -2
  99. data/frontends/default/views/search.html.erb +0 -5
  100. data/frontends/default/views/show.html.erb +0 -5
  101. data/frontends/default/views/update.html.erb +0 -8
  102. data/frontends/default/views/update_column.js.erb +0 -15
  103. data/frontends/default/views/update_row.js.erb +0 -1
  104. data/lib/active_scaffold.rb +0 -373
  105. data/lib/active_scaffold/actions/common_search.rb +0 -22
  106. data/lib/active_scaffold/actions/core.rb +0 -203
  107. data/lib/active_scaffold/actions/create.rb +0 -139
  108. data/lib/active_scaffold/actions/delete.rb +0 -74
  109. data/lib/active_scaffold/actions/field_search.rb +0 -78
  110. data/lib/active_scaffold/actions/list.rb +0 -208
  111. data/lib/active_scaffold/actions/mark.rb +0 -89
  112. data/lib/active_scaffold/actions/nested.rb +0 -244
  113. data/lib/active_scaffold/actions/search.rb +0 -48
  114. data/lib/active_scaffold/actions/show.rb +0 -61
  115. data/lib/active_scaffold/actions/subform.rb +0 -23
  116. data/lib/active_scaffold/actions/update.rb +0 -156
  117. data/lib/active_scaffold/active_record_permissions.rb +0 -135
  118. data/lib/active_scaffold/attribute_params.rb +0 -200
  119. data/lib/active_scaffold/bridges.rb +0 -61
  120. data/lib/active_scaffold/bridges/ancestry.rb +0 -5
  121. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +0 -39
  122. data/lib/active_scaffold/bridges/bitfields.rb +0 -6
  123. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +0 -37
  124. data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -24
  125. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -66
  126. data/lib/active_scaffold/bridges/cancan.rb +0 -15
  127. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +0 -127
  128. data/lib/active_scaffold/bridges/carrierwave.rb +0 -12
  129. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +0 -31
  130. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +0 -10
  131. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +0 -45
  132. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +0 -17
  133. data/lib/active_scaffold/bridges/country_helper.rb +0 -9
  134. data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +0 -358
  135. data/lib/active_scaffold/bridges/date_picker.rb +0 -23
  136. data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -63
  137. data/lib/active_scaffold/bridges/date_picker/helper.rb +0 -180
  138. data/lib/active_scaffold/bridges/dragonfly.rb +0 -9
  139. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +0 -34
  140. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +0 -10
  141. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +0 -27
  142. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +0 -16
  143. data/lib/active_scaffold/bridges/file_column.rb +0 -11
  144. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +0 -46
  145. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +0 -57
  146. data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -34
  147. data/lib/active_scaffold/bridges/file_column/list_ui.rb +0 -26
  148. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +0 -43
  149. data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +0 -9
  150. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -15
  151. data/lib/active_scaffold/bridges/paperclip.rb +0 -12
  152. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +0 -27
  153. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +0 -16
  154. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +0 -36
  155. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +0 -24
  156. data/lib/active_scaffold/bridges/record_select.rb +0 -11
  157. data/lib/active_scaffold/bridges/record_select/helpers.rb +0 -92
  158. data/lib/active_scaffold/bridges/semantic_attributes.rb +0 -5
  159. data/lib/active_scaffold/bridges/semantic_attributes/column.rb +0 -20
  160. data/lib/active_scaffold/bridges/shared/date_bridge.rb +0 -209
  161. data/lib/active_scaffold/bridges/tiny_mce.rb +0 -17
  162. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +0 -46
  163. data/lib/active_scaffold/config/base.rb +0 -75
  164. data/lib/active_scaffold/config/core.rb +0 -236
  165. data/lib/active_scaffold/config/create.rb +0 -32
  166. data/lib/active_scaffold/config/delete.rb +0 -32
  167. data/lib/active_scaffold/config/field_search.rb +0 -79
  168. data/lib/active_scaffold/config/form.rb +0 -64
  169. data/lib/active_scaffold/config/list.rb +0 -247
  170. data/lib/active_scaffold/config/mark.rb +0 -30
  171. data/lib/active_scaffold/config/nested.rb +0 -42
  172. data/lib/active_scaffold/config/search.rb +0 -73
  173. data/lib/active_scaffold/config/show.rb +0 -31
  174. data/lib/active_scaffold/config/subform.rb +0 -35
  175. data/lib/active_scaffold/config/update.rb +0 -33
  176. data/lib/active_scaffold/configurable.rb +0 -29
  177. data/lib/active_scaffold/constraints.rb +0 -171
  178. data/lib/active_scaffold/data_structures/action_columns.rb +0 -142
  179. data/lib/active_scaffold/data_structures/action_link.rb +0 -185
  180. data/lib/active_scaffold/data_structures/action_links.rb +0 -191
  181. data/lib/active_scaffold/data_structures/actions.rb +0 -45
  182. data/lib/active_scaffold/data_structures/bridge.rb +0 -22
  183. data/lib/active_scaffold/data_structures/column.rb +0 -401
  184. data/lib/active_scaffold/data_structures/columns.rb +0 -75
  185. data/lib/active_scaffold/data_structures/error_message.rb +0 -24
  186. data/lib/active_scaffold/data_structures/nested_info.rb +0 -171
  187. data/lib/active_scaffold/data_structures/set.rb +0 -61
  188. data/lib/active_scaffold/data_structures/sorting.rb +0 -167
  189. data/lib/active_scaffold/engine.rb +0 -4
  190. data/lib/active_scaffold/extensions/action_controller_rendering.rb +0 -20
  191. data/lib/active_scaffold/extensions/action_controller_rescueing.rb +0 -7
  192. data/lib/active_scaffold/extensions/action_view_rendering.rb +0 -115
  193. data/lib/active_scaffold/extensions/active_record_offset.rb +0 -12
  194. data/lib/active_scaffold/extensions/array.rb +0 -7
  195. data/lib/active_scaffold/extensions/cache_association.rb +0 -16
  196. data/lib/active_scaffold/extensions/localize.rb +0 -10
  197. data/lib/active_scaffold/extensions/name_option_for_datetime.rb +0 -12
  198. data/lib/active_scaffold/extensions/nil_id_in_url_params.rb +0 -7
  199. data/lib/active_scaffold/extensions/paginator_extensions.rb +0 -26
  200. data/lib/active_scaffold/extensions/reverse_associations.rb +0 -64
  201. data/lib/active_scaffold/extensions/routing_mapper.rb +0 -48
  202. data/lib/active_scaffold/extensions/to_label.rb +0 -8
  203. data/lib/active_scaffold/extensions/unsaved_associated.rb +0 -61
  204. data/lib/active_scaffold/extensions/unsaved_record.rb +0 -20
  205. data/lib/active_scaffold/extensions/usa_state.rb +0 -46
  206. data/lib/active_scaffold/finder.rb +0 -399
  207. data/lib/active_scaffold/helpers/association_helpers.rb +0 -42
  208. data/lib/active_scaffold/helpers/controller_helpers.rb +0 -94
  209. data/lib/active_scaffold/helpers/form_column_helpers.rb +0 -322
  210. data/lib/active_scaffold/helpers/human_condition_helpers.rb +0 -64
  211. data/lib/active_scaffold/helpers/id_helpers.rb +0 -131
  212. data/lib/active_scaffold/helpers/list_column_helpers.rb +0 -374
  213. data/lib/active_scaffold/helpers/pagination_helpers.rb +0 -62
  214. data/lib/active_scaffold/helpers/search_column_helpers.rb +0 -257
  215. data/lib/active_scaffold/helpers/show_column_helpers.rb +0 -44
  216. data/lib/active_scaffold/helpers/view_helpers.rb +0 -398
  217. data/lib/active_scaffold/marked_model.rb +0 -38
  218. data/lib/active_scaffold/paginator.rb +0 -136
  219. data/lib/active_scaffold/responds_to_parent.rb +0 -70
  220. data/lib/active_scaffold/tableless.rb +0 -83
  221. data/lib/active_scaffold/version.rb +0 -9
  222. data/lib/active_scaffold_env.rb +0 -13
  223. data/lib/generators/active_scaffold/USAGE +0 -29
  224. data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
  225. data/lib/generators/active_scaffold_controller/USAGE +0 -19
  226. data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
  227. data/lib/generators/active_scaffold_controller/templates/controller.rb +0 -4
  228. data/lib/generators/active_scaffold_controller/templates/helper.rb +0 -2
  229. data/public/blank.html +0 -33
  230. data/shoulda_macros/macros.rb +0 -136
  231. data/vendor/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  232. data/vendor/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  233. data/vendor/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
  234. data/vendor/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  235. data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  236. data/vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  237. data/vendor/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  238. data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  239. data/vendor/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  240. data/vendor/assets/images/ui-icons_222222_256x240.png +0 -0
  241. data/vendor/assets/images/ui-icons_228ef1_256x240.png +0 -0
  242. data/vendor/assets/images/ui-icons_ef8c08_256x240.png +0 -0
  243. data/vendor/assets/images/ui-icons_ffd27a_256x240.png +0 -0
  244. data/vendor/assets/images/ui-icons_ffffff_256x240.png +0 -0
  245. data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +0 -1276
  246. data/vendor/assets/stylesheets/jquery-ui.css +0 -568
@@ -1,63 +0,0 @@
1
- class File #:nodoc:
2
-
3
- unless File.respond_to?(:binread)
4
- def self.binread(file)
5
- File.open(file, 'rb') { |f| f.read }
6
- end
7
- end
8
-
9
- end
10
-
11
- ActiveScaffold::Config::Core.class_eval do
12
- def initialize_with_date_picker(model_id)
13
- initialize_without_date_picker(model_id)
14
-
15
- date_picker_fields = self.model.columns.collect{|c| {:name => c.name.to_sym, :type => c.type} if [:date, :datetime].include?(c.type) }.compact
16
- # check to see if file column was used on the model
17
- return if date_picker_fields.empty?
18
-
19
- # automatically set the forum_ui to a date_picker or datetime_picker
20
- date_picker_fields.each{|field|
21
- col_config = self.columns[field[:name]]
22
- col_config.form_ui = (field[:type] == :date ? :date_picker : :datetime_picker)
23
- }
24
- end
25
-
26
- alias_method_chain :initialize, :date_picker
27
- end
28
-
29
- ActiveRecord::ConnectionAdapters::Column.class_eval do
30
- class << self
31
- def fallback_string_to_date_with_date_picker(string)
32
- Date.strptime(string, I18n.t('date.formats.default')) rescue fallback_string_to_date_without_date_picker(string)
33
- end
34
- alias_method_chain :fallback_string_to_date, :date_picker
35
- end
36
- end
37
-
38
- ActionView::Base.class_eval do
39
- include ActiveScaffold::Bridges::Shared::DateBridge::SearchColumnHelpers
40
- alias_method :active_scaffold_search_date_picker, :active_scaffold_search_date_bridge
41
- alias_method :active_scaffold_search_datetime_picker, :active_scaffold_search_date_bridge
42
- include ActiveScaffold::Bridges::Shared::DateBridge::HumanConditionHelpers
43
- alias_method :active_scaffold_human_condition_date_picker, :active_scaffold_human_condition_date_bridge
44
- alias_method :active_scaffold_human_condition_datetime_picker, :active_scaffold_human_condition_date_bridge
45
- include ActiveScaffold::Bridges::DatePicker::Helper::SearchColumnHelpers
46
- include ActiveScaffold::Bridges::DatePicker::Helper::FormColumnHelpers
47
- alias_method :active_scaffold_input_datetime_picker, :active_scaffold_input_date_picker
48
- include ActiveScaffold::Bridges::DatePicker::Helper::DatepickerColumnHelpers
49
- end
50
- ActiveScaffold::Finder::ClassMethods.module_eval do
51
- include ActiveScaffold::Bridges::Shared::DateBridge::Finder::ClassMethods
52
- def datetime_conversion_for_condition_with_datepicker(column)
53
- if column.search_ui == :date_picker
54
- :to_date
55
- else
56
- datetime_conversion_for_condition_without_datepicker(column)
57
- end
58
- end
59
- alias_method_chain :datetime_conversion_for_condition, :datepicker
60
-
61
- alias_method :condition_for_date_picker_type, :condition_for_date_bridge_type
62
- alias_method :condition_for_datetime_picker_type, :condition_for_date_picker_type
63
- end
@@ -1,180 +0,0 @@
1
- module ActiveScaffold::Bridges
2
- class DatePicker
3
- module Helper
4
- DATE_FORMAT_CONVERSION = {
5
- /%a/ => 'D',
6
- /%A/ => 'DD',
7
- /%b/ => 'M',
8
- /%B/ => 'MM',
9
- /%d/ => 'dd',
10
- /%e/ => 'd',
11
- /%j/ => 'oo',
12
- /%m/ => 'mm',
13
- /%y/ => 'y',
14
- /%Y/ => 'yy',
15
- /%H/ => 'hh', # options ampm => false
16
- /%I/ => 'hh', # options ampm => true
17
- /%M/ => 'mm',
18
- /%p/ => 'tt',
19
- /%S/ => 'ss',
20
- /%[cUWwxXZz]/ => ''
21
- }
22
-
23
- def self.date_options_for_locales
24
- I18n.available_locales.collect do |locale|
25
- locale_date_options = date_options(locale)
26
- if locale_date_options
27
- "$.datepicker.regional['#{locale}'] = #{locale_date_options.to_json};"
28
- else
29
- nil
30
- end
31
- end.compact.join('')
32
- end
33
-
34
- def self.date_options(locale)
35
- begin
36
- date_picker_options = { :closeText => as_(:close),
37
- :prevText => as_(:previous),
38
- :nextText => as_(:next),
39
- :currentText => as_(:today),
40
- :monthNames => I18n.translate!('date.month_names', :locale => locale)[1..-1],
41
- :monthNamesShort => I18n.translate!('date.abbr_month_names', :locale => locale)[1..-1],
42
- :dayNames => I18n.translate!('date.day_names', :locale => locale),
43
- :dayNamesShort => I18n.translate!('date.abbr_day_names', :locale => locale),
44
- :dayNamesMin => I18n.translate!('date.abbr_day_names', :locale => locale),
45
- :changeYear => true,
46
- :changeMonth => true,
47
- }
48
-
49
- as_date_picker_options = I18n.translate! :date_picker_options, :scope => :active_scaffold, :locale => locale, :default => ''
50
- date_picker_options.merge!(as_date_picker_options) if as_date_picker_options.is_a? Hash
51
- Rails.logger.warn "ActiveScaffold: Missing date picker localization for your locale: #{locale}" if as_date_picker_options.blank?
52
-
53
- js_format = self.to_datepicker_format(I18n.translate!('date.formats.default', :locale => locale, :default => ''))
54
- date_picker_options[:dateFormat] = js_format unless js_format.blank?
55
- date_picker_options
56
- rescue
57
- raise if locale == I18n.locale
58
- end
59
- end
60
-
61
- def self.datetime_options_for_locales
62
- I18n.available_locales.collect do |locale|
63
- locale_datetime_options = datetime_options(locale)
64
- if locale_datetime_options
65
- "$.timepicker.regional['#{locale}'] = #{locale_datetime_options.to_json};"
66
- else
67
- nil
68
- end
69
- end.compact.join('')
70
- end
71
-
72
- def self.datetime_options(locale)
73
- begin
74
- rails_time_format = I18n.translate! 'time.formats.picker', :locale => locale
75
- datetime_picker_options = {:ampm => false,
76
- :hourText => I18n.translate!('datetime.prompts.hour', :locale => locale),
77
- :minuteText => I18n.translate!('datetime.prompts.minute', :locale => locale),
78
- :secondText => I18n.translate!('datetime.prompts.second', :locale => locale)
79
- }
80
-
81
- as_datetime_picker_options = I18n.translate! :datetime_picker_options, :scope => :active_scaffold, :locale => locale, :default => ''
82
- datetime_picker_options.merge!(as_datetime_picker_options) if as_datetime_picker_options.is_a? Hash
83
- Rails.logger.warn "ActiveScaffold: Missing datetime picker localization for your locale: #{locale}" if as_datetime_picker_options.blank?
84
-
85
- date_format, time_format = self.split_datetime_format(self.to_datepicker_format(rails_time_format))
86
- datetime_picker_options[:dateFormat] = date_format unless date_format.nil?
87
- unless time_format.nil?
88
- datetime_picker_options[:timeFormat] = time_format
89
- datetime_picker_options[:ampm] = true if rails_time_format.include?('%I')
90
- end
91
- datetime_picker_options
92
- rescue
93
- raise if locale == I18n.locale
94
- end
95
- end
96
-
97
- def self.to_datepicker_format(rails_format)
98
- return nil if rails_format.nil?
99
- if rails_format =~ /%[cUWwxXZz]/
100
- Rails.logger.warn("AS DatePicker::Helper: rails date format #{rails_format} includes options which can't be converted to jquery datepicker format. Options %c, %U, %W, %w, %x %X, %z, %Z are not supported by datepicker and will be removed")
101
- nil
102
- end
103
- js_format = rails_format.dup
104
- DATE_FORMAT_CONVERSION.each do |key, value|
105
- js_format.gsub!(key, value)
106
- end
107
- js_format
108
- end
109
-
110
- def self.split_datetime_format(datetime_format)
111
- date_format = datetime_format
112
- time_format = nil
113
- time_start_indicators = %w{hh mm tt ss}
114
- unless datetime_format.nil?
115
- start_indicator = time_start_indicators.detect {|indicator| datetime_format.include?(indicator)}
116
- unless start_indicator.nil?
117
- pos_time_format = datetime_format.index(start_indicator)
118
- date_format = datetime_format.to(pos_time_format - 1)
119
- time_format = datetime_format.from(pos_time_format)
120
- end
121
- end
122
- return date_format, time_format
123
- end
124
-
125
- module DatepickerColumnHelpers
126
- def datepicker_split_datetime_format(datetime_format)
127
- ActiveScaffold::Bridges::DatePicker::Helper.split_datetime_format(datetime_format)
128
- end
129
-
130
- def to_datepicker_format(rails_format)
131
- ActiveScaffold::Bridges::DatePicker::Helper.to_datepicker_format(rails_format)
132
- end
133
-
134
- def datepicker_format_options(column, format, options)
135
- if column.form_ui == :date_picker
136
- js_format = to_datepicker_format(I18n.translate!("date.formats.#{format}"))
137
- options['date:dateFormat'] = js_format unless js_format.nil?
138
- else
139
- rails_time_format = I18n.translate!("time.formats.#{format}")
140
- date_format, time_format = datepicker_split_datetime_format(self.to_datepicker_format(rails_time_format))
141
- options['date:dateFormat'] = date_format unless date_format.nil?
142
- unless time_format.nil?
143
- options['time:timeFormat'] = time_format
144
- options['time:ampm'] = true if rails_time_format.include?('%I')
145
- end
146
- end unless format == :default
147
- end
148
- end
149
-
150
- module SearchColumnHelpers
151
- def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
152
- if current_search.is_a? Hash
153
- value = controller.class.condition_value_for_datetime(current_search[name], column.search_ui == :date_picker ? :to_date : :to_time)
154
- else
155
- value = current_search
156
- end
157
- options = column.options.merge(options).except!(:include_blank, :discard_time, :discard_date, :value)
158
- options = active_scaffold_input_text_options(options.merge(column.options))
159
- options[:class] << " #{column.search_ui.to_s}"
160
- options[:style] = (options[:show].nil? || options[:show]) ? nil : "display: none"
161
- format = options.delete(:format) || column.search_ui == :date_picker ? :default : :picker
162
- datepicker_format_options(column, format, options)
163
- text_field_tag("#{options[:name]}[#{name}]", value ? l(value, :format => format) : nil, options.merge(:id => "#{options[:id]}_#{name}", :name => "#{options[:name]}[#{name}]"))
164
- end
165
- end
166
-
167
- module FormColumnHelpers
168
- def active_scaffold_input_date_picker(column, options)
169
- options = active_scaffold_input_text_options(options.merge(column.options))
170
- options[:class] << " #{column.form_ui.to_s}"
171
- value = controller.class.condition_value_for_datetime(@record.send(column.name), column.form_ui == :date_picker ? :to_date : :to_time)
172
- format = options.delete(:format) || column.form_ui == :date_picker ? :default : :picker
173
- datepicker_format_options(column, format, options)
174
- options[:value] = (value ? l(value, :format => format) : nil)
175
- text_field(:record, column.name, options)
176
- end
177
- end
178
- end
179
- end
180
- end
@@ -1,9 +0,0 @@
1
- class ActiveScaffold::Bridges::Dragonfly < ActiveScaffold::DataStructures::Bridge
2
- def self.install
3
- require File.join(File.dirname(__FILE__), "dragonfly/form_ui")
4
- require File.join(File.dirname(__FILE__), "dragonfly/list_ui")
5
- require File.join(File.dirname(__FILE__), "dragonfly/dragonfly_bridge_helpers")
6
- require File.join(File.dirname(__FILE__), "dragonfly/dragonfly_bridge")
7
- ActiveScaffold::Config::Core.send :include, ActiveScaffold::Bridges::Dragonfly::DragonflyBridge
8
- end
9
- end
@@ -1,34 +0,0 @@
1
- module ActiveScaffold
2
- module Bridges
3
- class Dragonfly
4
- module DragonflyBridge
5
- def initialize_with_dragonfly(model_id)
6
- initialize_without_dragonfly(model_id)
7
- return unless self.model.respond_to?(:dragonfly_attachment_classes) && self.model.dragonfly_attachment_classes.present?
8
-
9
- self.update.multipart = true
10
- self.create.multipart = true
11
-
12
- self.model.dragonfly_attachment_classes.each do |attachment|
13
- configure_dragonfly_field(attachment.attribute)
14
- end
15
- end
16
-
17
- def self.included(base)
18
- base.alias_method_chain :initialize, :dragonfly
19
- end
20
-
21
- private
22
- def configure_dragonfly_field(field)
23
- self.columns << field
24
- self.columns[field].form_ui ||= :dragonfly
25
- self.columns[field].params.add "remove_#{field}"
26
-
27
- [:name, :uid].each do |f|
28
- self.columns.exclude("#{field}_#{f}".to_sym)
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,10 +0,0 @@
1
- module ActiveScaffold
2
- module Bridges
3
- class Dragonfly
4
- module DragonflyBridgeHelpers
5
- mattr_accessor :thumbnail_style
6
- self.thumbnail_style = 'x30>'
7
- end
8
- end
9
- end
10
- end
@@ -1,27 +0,0 @@
1
- module ActiveScaffold
2
- module Helpers
3
- module FormColumnHelpers
4
- def active_scaffold_input_dragonfly(column, options)
5
- options = active_scaffold_input_text_options(options)
6
- input = file_field(:record, column.name, options)
7
- dragonfly = @record.send("#{column.name}")
8
- if dragonfly.present?
9
- if ActiveScaffold.js_framework == :jquery
10
- js_remove_file_code = "$(this).prev().val('true'); $(this).parent().hide().next().show(); return false;";
11
- else
12
- js_remove_file_code = "$(this).previous().value='true'; $(this).up().hide().next().show(); return false;";
13
- end
14
-
15
- content = active_scaffold_column_dragonfly(column, @record)
16
- content_tag(:div,
17
- content + " | " +
18
- hidden_field(:record, "remove_#{column.name}", :value => "false") +
19
- content_tag(:a, as_(:remove_file), {:href => '#', :onclick => js_remove_file_code})
20
- ) + content_tag(:div, input, :style => "display: none")
21
- else
22
- input
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,16 +0,0 @@
1
- module ActiveScaffold
2
- module Helpers
3
- module ListColumnHelpers
4
- def active_scaffold_column_dragonfly(column, record)
5
- attachment = record.send("#{column.name}")
6
- return nil unless attachment.present?
7
- content = if attachment.image?
8
- image_tag(attachment.thumb(column.options[:thumb] || ActiveScaffold::Bridges::Dragonfly::DragonflyBridgeHelpers.thumbnail_style).url, :border => 0)
9
- else
10
- attachment.name
11
- end
12
- link_to(content, attachment.remote_url, {'data-popup' => true, :target => '_blank'})
13
- end
14
- end
15
- end
16
- end
@@ -1,11 +0,0 @@
1
- class ActiveScaffold::Bridges::FileColumn < ActiveScaffold::DataStructures::Bridge
2
- def self.install
3
- if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_file_column")
4
- raise RuntimeError, "We've detected that you have active_scaffold_file_column_bridge installed. This plugin has been moved to core. Please remove active_scaffold_file_column_bridge to prevent any conflicts"
5
- end
6
- require File.join(File.dirname(__FILE__), "file_column/as_file_column_bridge")
7
- require File.join(File.dirname(__FILE__), "file_column/form_ui")
8
- require File.join(File.dirname(__FILE__), "file_column/list_ui")
9
- require File.join(File.dirname(__FILE__), "file_column/file_column_helpers")
10
- end
11
- end
@@ -1,46 +0,0 @@
1
- ActiveScaffold::DataStructures::Column.class_eval do
2
- attr_accessor :file_column_display
3
- end
4
-
5
- module ActiveScaffold::Config
6
- class Core < Base
7
- attr_accessor :file_column_fields
8
- def initialize_with_file_column(model_id)
9
- initialize_without_file_column(model_id)
10
-
11
- return unless ActiveScaffold::Bridges::FileColumn::FileColumnHelpers.klass_has_file_column_fields?(self.model)
12
-
13
- self.model.send :extend, ActiveScaffold::Bridges::FileColumn::FileColumnHelpers
14
-
15
- # include the "delete" helpers for use with active scaffold, unless they are already included
16
- self.model.generate_delete_helpers
17
-
18
- # switch on multipart
19
- self.update.multipart = true
20
- self.create.multipart = true
21
-
22
- self.model.file_column_fields.each{ |field|
23
- configure_file_column_field(field)
24
- }
25
- end
26
-
27
- alias_method_chain :initialize, :file_column unless self.instance_methods.include?("initialize_without_file_column")
28
-
29
- def configure_file_column_field(field)
30
- # set list_ui first because it gets its default value from form_ui
31
- self.columns[field].list_ui ||= self.model.field_has_image_version?(field, "thumb") ? :thumbnail : :download_link_with_filename
32
- self.columns[field].form_ui ||= :file_column
33
-
34
- # these 2 parameters are necessary helper attributes for the file column that must be allowed to be set to the model by active scaffold.
35
- self.columns[field].params.add "#{field}_temp", "delete_#{field}"
36
-
37
- # set null to false so active_scaffold wont set it to null
38
- # delete_file_column will take care of deleting a file or not.
39
- self.model.columns_hash[field.to_s].instance_variable_set("@null", false)
40
-
41
- rescue
42
- false
43
- end
44
-
45
- end
46
- end
@@ -1,57 +0,0 @@
1
- module ActiveScaffold
2
- module Bridges
3
- class FileColumn
4
- module FileColumnHelpers
5
- class << self
6
- def file_column_fields(klass)
7
- klass.instance_methods.grep(/_just_uploaded\?$/).collect{|m| m[0..-16].to_sym }
8
- end
9
-
10
- def generate_delete_helpers(klass)
11
- file_column_fields(klass).each { |field|
12
- klass.send :class_eval, <<-EOF, __FILE__, __LINE__ + 1 unless klass.methods.include?("#{field}_with_delete=")
13
- attr_reader :delete_#{field}
14
-
15
- def delete_#{field}=(value)
16
- value = (value=="true") if String===value
17
- return unless value
18
-
19
- # passing nil to the file column causes the file to be deleted. Don't delete if we just uploaded a file!
20
- self.#{field} = nil unless self.#{field}_just_uploaded?
21
- end
22
- EOF
23
- }
24
- end
25
-
26
- def klass_has_file_column_fields?(klass)
27
- true unless file_column_fields(klass).empty?
28
- end
29
- end
30
-
31
- def file_column_fields
32
- @file_column_fields||=FileColumnHelpers.file_column_fields(self)
33
- end
34
-
35
- def options_for_file_column_field(field)
36
- self.allocate.send("#{field}_options")
37
- end
38
-
39
- def field_has_image_version?(field, version="thumb")
40
- begin
41
- # the only way to get to the options of a particular field is to use the instance method
42
- options = options_for_file_column_field(field)
43
- versions = options[:magick][:versions]
44
- raise unless versions.stringify_keys[version]
45
- true
46
- rescue
47
- false
48
- end
49
- end
50
-
51
- def generate_delete_helpers
52
- FileColumnHelpers.generate_delete_helpers(self)
53
- end
54
- end
55
- end
56
- end
57
- end