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,61 +0,0 @@
1
- module ActiveScaffold
2
- module Bridges
3
- ActiveScaffold.autoload_subdir('bridges', self)
4
- module Shared
5
- autoload :DateBridge, 'active_scaffold/bridges/shared/date_bridge'
6
- end
7
-
8
- mattr_accessor :bridges
9
- mattr_accessor :bridges_run
10
- self.bridges = {}
11
-
12
- def self.register(file)
13
- match = file.match(/(active_scaffold\/bridges\/(.*))\.rb\Z/)
14
- self.bridges[match[2].to_sym] = match[1] if match
15
- end
16
-
17
- def self.load(bridge_name)
18
- bridge = self.bridges[bridge_name.to_sym]
19
- if bridge.is_a? String
20
- if ActiveScaffold.exclude_bridges.exclude? bridge_name.to_sym
21
- bridge = bridge.camelize.constantize
22
- self.bridges[bridge_name.to_sym] = bridge
23
- else
24
- self.bridges.delete bridge_name
25
- bridge = nil
26
- end
27
- end
28
- bridge
29
- end
30
- class << self
31
- alias_method :[], :load
32
- end
33
-
34
- def self.run_all
35
- return false if self.bridges_run
36
- self.bridges.keys.each do |bridge_name|
37
- bridge = self[bridge_name]
38
- bridge.run if bridge
39
- end
40
- self.bridges_run = true
41
- end
42
-
43
- def self.all_stylesheets
44
- self.bridges.keys.collect do |bridge_name|
45
- bridge = self[bridge_name]
46
- bridge.stylesheets if bridge and bridge.install?
47
- end.compact.flatten
48
- end
49
-
50
- def self.all_javascripts
51
- self.bridges.keys.collect do |bridge_name|
52
- bridge = self[bridge_name]
53
- bridge.javascripts if bridge and bridge.install?
54
- end.compact.flatten
55
- end
56
- end
57
- end
58
-
59
- (Dir[File.join(File.dirname(__FILE__), "bridges/*.rb")] - [__FILE__]).each{|bridge_require|
60
- ActiveScaffold::Bridges.register bridge_require
61
- }
@@ -1,5 +0,0 @@
1
- class ActiveScaffold::Bridges::Ancestry < ActiveScaffold::DataStructures::Bridge
2
- def self.install
3
- require File.join(File.dirname(__FILE__), "ancestry/ancestry_bridge.rb")
4
- end
5
- end
@@ -1,39 +0,0 @@
1
- ActiveScaffold::Config::Core.class_eval do
2
- def initialize_with_ancestry(model_id)
3
- initialize_without_ancestry(model_id)
4
-
5
- return unless self.model.respond_to? :ancestry_column
6
-
7
- self.columns << :parent_id
8
- self.columns[:parent_id].form_ui = :ancestry
9
- update.columns.exclude :ancestry
10
- create.columns.exclude :ancestry, :parent_id
11
- list.columns.exclude :ancestry, :parent_id
12
- end
13
-
14
- alias_method_chain :initialize, :ancestry
15
- end
16
-
17
- module ActiveScaffold::Bridges
18
- class Ancestry
19
- module FormColumnHelpers
20
- def active_scaffold_input_ancestry(column, options)
21
- select_options = []
22
- select_control_options = {:selected => @record.parent_id}
23
- select_control_options[:include_blank] = as_(:_select_) if @record.parent_id.nil?
24
- traverse_ancestry = proc do|key, value|
25
- unless key == @record
26
- select_options << ["#{'__' * key.depth}#{key.to_label}", key.id]
27
- value.each(&traverse_ancestry) if value.is_a?(Hash) && !value.empty?
28
- end
29
- end
30
- @record.class.arrange.each(&traverse_ancestry)
31
- select(:record, :ancestry, select_options, select_control_options, options)
32
- end
33
- end
34
- end
35
- end
36
-
37
- ActionView::Base.class_eval do
38
- include ActiveScaffold::Bridges::Ancestry::FormColumnHelpers
39
- end
@@ -1,6 +0,0 @@
1
- class ActiveScaffold::Bridges::Bitfields < ActiveScaffold::DataStructures::Bridge
2
- def self.install
3
- require File.join(File.dirname(__FILE__), "bitfields/bitfields_bridge")
4
- ActiveScaffold::Config::Core.send :include, ActiveScaffold::Bridges::Bitfields::BitfieldsBridge
5
- end
6
- end
@@ -1,37 +0,0 @@
1
- module ActiveScaffold
2
- module Bridges
3
- class Bitfields
4
- module BitfieldsBridge
5
- def initialize_with_bitfields(model_id)
6
- initialize_without_bitfields(model_id)
7
- return unless self.model.respond_to?(:bitfields) and self.model.bitfields.present?
8
-
9
- self.model.bitfields.each do |column_name, options|
10
- self.columns << options.keys
11
- options.each do |column, value|
12
- self.columns[column].form_ui = :checkbox
13
- self.columns[column].weight = 1000 + value.to_s(2).size
14
- end
15
- end
16
- end
17
-
18
- def _load_action_columns_with_bitfields
19
- self.model.bitfields.each do |column_name, options|
20
- columns = options.keys.sort_by { |column| self.columns[column].weight }
21
- [:create, :update, :show, :subform].each do |action|
22
- self.send(action).columns.add_subgroup(column_name) { |group| group.add *columns } if self.actions.included? action
23
- end
24
- end if self.model.respond_to?(:bitfields) and self.model.bitfields.present?
25
-
26
- _load_action_columns_without_bitfields
27
- end
28
-
29
-
30
- def self.included(base)
31
- base.alias_method_chain :initialize, :bitfields
32
- base.alias_method_chain :_load_action_columns, :bitfields
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,24 +0,0 @@
1
- class ActiveScaffold::Bridges::CalendarDateSelect < ActiveScaffold::DataStructures::Bridge
2
- def self.install
3
- # check to see if the old bridge was installed. If so, warn them
4
- # we can detect this by checking to see if the bridge was installed before calling this code
5
-
6
- if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_calendar_date_select")
7
- raise RuntimeError, "We've detected that you have active_scaffold_calendar_date_select_bridge installed. This plugin has been moved to core. Please remove active_scaffold_calendar_date_select_bridge to prevent any conflicts"
8
- end
9
-
10
- require File.join(File.dirname(__FILE__), "calendar_date_select/as_cds_bridge.rb")
11
- end
12
-
13
- def self.install?
14
- super && ActiveScaffold.js_framework == :prototype
15
- end
16
-
17
- def self.stylesheets
18
- calendar_date_select_stylesheets
19
- end
20
-
21
- def self.javascripts
22
- calendar_date_select_javascripts
23
- end
24
- end
@@ -1,66 +0,0 @@
1
- module ActiveScaffold::Config
2
- class Core < Base
3
-
4
- def initialize_with_calendar_date_select(model_id)
5
- initialize_without_calendar_date_select(model_id)
6
-
7
- calendar_date_select_fields = self.model.columns.collect{|c| c.name.to_sym if [:date, :datetime].include?(c.type) }.compact
8
- # check to see if file column was used on the model
9
- return if calendar_date_select_fields.empty?
10
-
11
- # automatically set the forum_ui to a file column
12
- calendar_date_select_fields.each{|field|
13
- self.columns[field].form_ui = :calendar_date_select
14
- }
15
- end
16
-
17
- alias_method_chain :initialize, :calendar_date_select
18
-
19
- end
20
- end
21
-
22
-
23
- module ActiveScaffold
24
- module Bridges
25
- class CalendarDateSelect
26
- # Helpers that assist with the rendering of a Form Column
27
- module FormColumnHelpers
28
- def active_scaffold_input_calendar_date_select(column, options)
29
- options[:class] = "#{options[:class]} text-input".strip
30
- calendar_date_select("record", column.name, options.merge(column.options))
31
- end
32
- end
33
-
34
- module SearchColumnHelpers
35
- def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
36
- if current_search.is_a? Hash
37
- value = controller.class.condition_value_for_datetime(current_search[name], column.column.type == :date ? :to_date : :to_time)
38
- else
39
- value = current_search
40
- end
41
- calendar_date_select("record", column.name,
42
- {:name => "#{options[:name]}[#{name}]",
43
- :value => (value ? l(value) : nil),
44
- :class => 'text-input',
45
- :id => "#{options[:id]}_#{name}",
46
- :time => column_datetime?(column) ? true : false,
47
- :style => (options[:show].nil? || options[:show]) ? nil : "display: none"})
48
- end
49
- end
50
- end
51
- end
52
- end
53
-
54
- ActionView::Base.class_eval do
55
- include ActiveScaffold::Bridges::CalendarDateSelect::FormColumnHelpers
56
- include ActiveScaffold::Bridges::Shared::DateBridge::SearchColumnHelpers
57
- alias_method :active_scaffold_search_calendar_date_select, :active_scaffold_search_date_bridge
58
- include ActiveScaffold::Bridges::Shared::DateBridge::HumanConditionHelpers
59
- alias_method :active_scaffold_human_condition_calendar_date_select, :active_scaffold_human_condition_date_bridge
60
- include ActiveScaffold::Bridges::CalendarDateSelect::SearchColumnHelpers
61
- end
62
-
63
- ActiveScaffold::Finder::ClassMethods.module_eval do
64
- include ActiveScaffold::Bridges::Shared::DateBridge::Finder::ClassMethods
65
- alias_method :condition_for_calendar_date_select_type, :condition_for_date_bridge_type
66
- end
@@ -1,15 +0,0 @@
1
- class ActiveScaffold::Bridges::Cancan < ActiveScaffold::DataStructures::Bridge
2
- def self.install
3
- require File.join(File.dirname(__FILE__), "cancan", "cancan_bridge.rb")
4
-
5
- ActiveScaffold::ClassMethods.send :include, ActiveScaffold::Bridges::Cancan::ClassMethods
6
- ActiveScaffold::Actions::Core.send :include, ActiveScaffold::Bridges::Cancan::Actions::Core
7
- ActiveScaffold::Actions::Nested.send :include, ActiveScaffold::Bridges::Cancan::Actions::Core
8
- ActionController::Base.send :include, ActiveScaffold::Bridges::Cancan::ModelUserAccess::Controller
9
- ::ActiveRecord::Base.send :include, ActiveScaffold::Bridges::Cancan::ModelUserAccess::Model
10
- ::ActiveRecord::Base.send :include, ActiveScaffold::Bridges::Cancan::ActiveRecord
11
- end
12
- def self.install?
13
- Object.const_defined? 'CanCan'
14
- end
15
- end
@@ -1,127 +0,0 @@
1
- # Allow users to easily define aliases for AS actions.
2
- # Ability#as_action_aliases should be called by the user in his ability class
3
- #
4
- # class Ability < CanCan::Ability
5
- # def initialize(user)
6
- # as_action_aliases
7
- # end
8
- # end
9
- #
10
- module CanCan
11
- module Ability
12
- def as_action_aliases
13
- alias_action :list, :row, :show_search, :render_field, :to => :read
14
- alias_action :update_column, :add_association, :edit_associated,
15
- :edit_associated, :new_existing, :add_existing, :to => :update
16
- alias_action :delete, :destroy_existing, :to => :destroy
17
- end
18
- end
19
- end
20
-
21
- module ActiveScaffold::Bridges
22
- class Cancan
23
-
24
- # controller level authorization
25
- # As already has callbacks to ensure authorization at controller method via "authorization_method"
26
- # but let's include this too, just in case, no sure how performance is affected tough :TODO benchmark
27
- module ClassMethods
28
- extend ActiveSupport::Concern
29
- included do
30
- alias_method_chain :active_scaffold, :cancan
31
- end
32
-
33
- def active_scaffold_with_cancan(model_id = nil, &block)
34
- active_scaffold_without_cancan(model_id, &block)
35
- authorize_resource(
36
- :class => active_scaffold_config.model,
37
- :instance => :record
38
- )
39
- end
40
- end
41
-
42
- # beginning of chain integration
43
- module Actions
44
- module Core
45
- extend ActiveSupport::Concern
46
- included do
47
- alias_method_chain :beginning_of_chain, :cancan
48
- end
49
- # :TODO can this be expanded more ?
50
- def beginning_of_chain_with_cancan
51
- beginning_of_chain_without_cancan.accessible_by(current_ability)
52
- end
53
- end
54
- end
55
-
56
- # This is a module aimed at making the current_ability available to ActiveRecord models for permissions.
57
- module ModelUserAccess
58
- module Controller
59
- extend ActiveSupport::Concern
60
- included do
61
- prepend_before_filter :assign_current_ability_to_models
62
- end
63
-
64
- # We need to give the ActiveRecord classes a handle to the current ability. We don't want to just pass the object,
65
- # because the object may change (someone may log in or out). So we give ActiveRecord a proc that ties to the
66
- # current_ability_method on this ApplicationController.
67
- def assign_current_ability_to_models
68
- ::ActiveRecord::Base.current_ability_proc = proc {send(:current_ability)}
69
- end
70
- end
71
-
72
- module Model
73
- extend ActiveSupport::Concern
74
-
75
- module ClassMethods
76
- # The proc to call that retrieves the current_ability from the ApplicationController.
77
- attr_accessor :current_ability_proc
78
-
79
- # Class-level access to the current ability
80
- def current_ability
81
- ::ActiveRecord::Base.current_ability_proc.call if ::ActiveRecord::Base.current_ability_proc
82
- end
83
- end
84
-
85
- # Instance-level access to the current ability
86
- def current_ability; self.class.current_ability end
87
- end
88
- end
89
-
90
-
91
- # plug into AS#authorized_for calls
92
- module ActiveRecord
93
- extend ActiveSupport::Concern
94
- included do
95
- extend SecurityMethods
96
- include SecurityMethods
97
- alias_method_chain :authorized_for?, :cancan
98
- class << self
99
- alias_method_chain :authorized_for?, :cancan
100
- end
101
- end
102
-
103
- module SecurityMethods
104
- class InvalidArgument < StandardError; end
105
-
106
- # is usually called with :crud_type and :column, or :action
107
- # {:crud_type=>:update, :column=>"some_colum_name"}
108
- # {:action=>"edit"}
109
- # to allow access cancan must allow both :crud_type and :action
110
- # if cancan says "no", it delegates to default AS behavior
111
- def authorized_for_with_cancan?(options = {})
112
- raise InvalidArgument if options[:crud_type].blank? and options[:action].blank?
113
- if current_ability.present?
114
- crud_type_result = options[:crud_type].nil? ? true : current_ability.can?(options[:crud_type], self)
115
- action_result = options[:action].nil? ? true : current_ability.can?(options[:action].to_sym, self)
116
- else
117
- crud_type_result, action_result = false, false
118
- end
119
- default_result = authorized_for_without_cancan?(options)
120
- result = (crud_type_result && action_result) || default_result
121
- return result
122
- end
123
- end
124
- end
125
-
126
- end
127
- end
@@ -1,12 +0,0 @@
1
- class ActiveScaffold::Bridges::Carrierwave < ActiveScaffold::DataStructures::Bridge
2
- def self.install
3
- require File.join(File.dirname(__FILE__), "carrierwave/form_ui")
4
- require File.join(File.dirname(__FILE__), "carrierwave/list_ui")
5
- require File.join(File.dirname(__FILE__), "carrierwave/carrierwave_bridge_helpers")
6
- require File.join(File.dirname(__FILE__), "carrierwave/carrierwave_bridge")
7
- ActiveScaffold::Config::Core.send :include, ActiveScaffold::Bridges::Carrierwave::CarrierwaveBridge
8
- end
9
- def self.install?
10
- Object.const_defined? 'CarrierWave'
11
- end
12
- end
@@ -1,31 +0,0 @@
1
- module ActiveScaffold
2
- module Bridges
3
- class Carrierwave
4
- module CarrierwaveBridge
5
- def initialize_with_carrierwave(model_id)
6
- initialize_without_carrierwave(model_id)
7
- return unless self.model.respond_to?(:uploaders) && self.model.uploaders.present?
8
-
9
- self.update.multipart = true
10
- self.create.multipart = true
11
-
12
- self.model.uploaders.keys.each do |field|
13
- configure_carrierwave_field(field.to_sym)
14
- end
15
- end
16
-
17
- def self.included(base)
18
- base.alias_method_chain :initialize, :carrierwave
19
- end
20
-
21
- private
22
- def configure_carrierwave_field(field)
23
- self.columns << field
24
- self.columns[field].form_ui ||= :carrierwave # :TODO thumbnail
25
- self.columns[field].params.add "#{field}_cache"
26
- self.columns[field].params.add "remove_#{field}"
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,10 +0,0 @@
1
- module ActiveScaffold
2
- module Bridges
3
- class Carrierwave
4
- module CarrierwaveBridgeHelpers
5
- mattr_accessor :thumbnail_style
6
- self.thumbnail_style = :thumbnail
7
- end
8
- end
9
- end
10
- end