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.
- data/CHANGELOG +5 -1
- metadata +17 -261
- data/app/assets/images/active_scaffold/add.png +0 -0
- data/app/assets/images/active_scaffold/arrow_down.png +0 -0
- data/app/assets/images/active_scaffold/arrow_up.png +0 -0
- data/app/assets/images/active_scaffold/close.png +0 -0
- data/app/assets/images/active_scaffold/close_touch.png +0 -0
- data/app/assets/images/active_scaffold/config.png +0 -0
- data/app/assets/images/active_scaffold/cross.png +0 -0
- data/app/assets/images/active_scaffold/gears.png +0 -0
- data/app/assets/images/active_scaffold/indicator-small.gif +0 -0
- data/app/assets/images/active_scaffold/indicator.gif +0 -0
- data/app/assets/images/active_scaffold/magnifier.png +0 -0
- data/app/assets/javascripts/active_scaffold.js.erb +0 -19
- data/app/assets/javascripts/jquery/active_scaffold.js +0 -1113
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +0 -24
- data/app/assets/javascripts/jquery/draggable_lists.js +0 -27
- data/app/assets/javascripts/jquery/jquery.editinplace.js +0 -743
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +0 -7
- data/app/assets/javascripts/prototype/active_scaffold.js +0 -1107
- data/app/assets/javascripts/prototype/dhtml_history.js +0 -870
- data/app/assets/javascripts/prototype/form_enhancements.js +0 -117
- data/app/assets/javascripts/prototype/rico_corner.js +0 -370
- data/app/assets/javascripts/prototype/tiny_mce_bridge.js +0 -7
- data/app/assets/stylesheets/active_scaffold-ie.css.scss +0 -54
- data/app/assets/stylesheets/active_scaffold.css.scss +0 -14
- data/app/assets/stylesheets/active_scaffold_colors.css.scss +0 -395
- data/app/assets/stylesheets/active_scaffold_extensions.css.erb +0 -2
- data/app/assets/stylesheets/active_scaffold_images.css.scss +0 -40
- data/app/assets/stylesheets/active_scaffold_layout.css +0 -936
- data/app/assets/stylesheets/blue-theme.css +0 -74
- data/config/locales/de.yml +0 -125
- data/config/locales/en.yml +0 -127
- data/config/locales/es.yml +0 -128
- data/config/locales/fr.yml +0 -131
- data/config/locales/hu.yml +0 -126
- data/config/locales/ja.yml +0 -126
- data/config/locales/ru.yml +0 -135
- data/frontends/default/views/_action_group.html.erb +0 -24
- data/frontends/default/views/_add_existing_form.html.erb +0 -30
- data/frontends/default/views/_base_form.html.erb +0 -53
- data/frontends/default/views/_create_form.html.erb +0 -8
- data/frontends/default/views/_create_form_on_list.html.erb +0 -6
- data/frontends/default/views/_field_search.html.erb +0 -32
- data/frontends/default/views/_form.html.erb +0 -28
- data/frontends/default/views/_form_association.html.erb +0 -17
- data/frontends/default/views/_form_association_footer.html.erb +0 -47
- data/frontends/default/views/_form_attribute.html.erb +0 -23
- data/frontends/default/views/_form_hidden_attribute.html.erb +0 -7
- data/frontends/default/views/_form_messages.html.erb +0 -5
- data/frontends/default/views/_horizontal_subform.html.erb +0 -22
- data/frontends/default/views/_horizontal_subform_footer.html.erb +0 -0
- data/frontends/default/views/_horizontal_subform_header.html.erb +0 -11
- data/frontends/default/views/_horizontal_subform_record.html.erb +0 -43
- data/frontends/default/views/_human_conditions.html.erb +0 -1
- data/frontends/default/views/_list.html.erb +0 -18
- data/frontends/default/views/_list_actions.html.erb +0 -15
- data/frontends/default/views/_list_calculations.html.erb +0 -16
- data/frontends/default/views/_list_column_headings.html.erb +0 -12
- data/frontends/default/views/_list_header.html.erb +0 -10
- data/frontends/default/views/_list_inline_adapter.html.erb +0 -21
- data/frontends/default/views/_list_messages.html.erb +0 -28
- data/frontends/default/views/_list_pagination.html.erb +0 -11
- data/frontends/default/views/_list_pagination_links.html.erb +0 -9
- data/frontends/default/views/_list_record.html.erb +0 -13
- data/frontends/default/views/_list_record_columns.html.erb +0 -8
- data/frontends/default/views/_list_with_header.html.erb +0 -36
- data/frontends/default/views/_messages.html.erb +0 -10
- data/frontends/default/views/_refresh_list.js.erb +0 -1
- data/frontends/default/views/_render_field.js.erb +0 -20
- data/frontends/default/views/_row.html.erb +0 -1
- data/frontends/default/views/_search.html.erb +0 -34
- data/frontends/default/views/_search_attribute.html.erb +0 -10
- data/frontends/default/views/_show.html.erb +0 -8
- data/frontends/default/views/_show_columns.html.erb +0 -15
- data/frontends/default/views/_update_actions.html.erb +0 -9
- data/frontends/default/views/_update_calculations.js.erb +0 -4
- data/frontends/default/views/_update_form.html.erb +0 -6
- data/frontends/default/views/_update_messages.js.erb +0 -2
- data/frontends/default/views/_vertical_subform.html.erb +0 -12
- data/frontends/default/views/_vertical_subform_record.html.erb +0 -43
- data/frontends/default/views/action_confirmation.html.erb +0 -13
- data/frontends/default/views/add_existing.js.erb +0 -14
- data/frontends/default/views/add_existing_form.html.erb +0 -5
- data/frontends/default/views/create.html.erb +0 -5
- data/frontends/default/views/delete.html.erb +0 -13
- data/frontends/default/views/destroy.js.erb +0 -26
- data/frontends/default/views/edit_associated.js.erb +0 -12
- data/frontends/default/views/field_search.html.erb +0 -5
- data/frontends/default/views/form_messages.js.erb +0 -1
- data/frontends/default/views/list.html.erb +0 -1
- data/frontends/default/views/on_action_update.js.erb +0 -22
- data/frontends/default/views/on_create.js.erb +0 -38
- data/frontends/default/views/on_mark.js.erb +0 -6
- data/frontends/default/views/on_update.js.erb +0 -29
- data/frontends/default/views/refresh_list.js.erb +0 -2
- data/frontends/default/views/render_field.js.erb +0 -1
- data/frontends/default/views/row.js.erb +0 -2
- data/frontends/default/views/search.html.erb +0 -5
- data/frontends/default/views/show.html.erb +0 -5
- data/frontends/default/views/update.html.erb +0 -8
- data/frontends/default/views/update_column.js.erb +0 -15
- data/frontends/default/views/update_row.js.erb +0 -1
- data/lib/active_scaffold.rb +0 -373
- data/lib/active_scaffold/actions/common_search.rb +0 -22
- data/lib/active_scaffold/actions/core.rb +0 -203
- data/lib/active_scaffold/actions/create.rb +0 -139
- data/lib/active_scaffold/actions/delete.rb +0 -74
- data/lib/active_scaffold/actions/field_search.rb +0 -78
- data/lib/active_scaffold/actions/list.rb +0 -208
- data/lib/active_scaffold/actions/mark.rb +0 -89
- data/lib/active_scaffold/actions/nested.rb +0 -244
- data/lib/active_scaffold/actions/search.rb +0 -48
- data/lib/active_scaffold/actions/show.rb +0 -61
- data/lib/active_scaffold/actions/subform.rb +0 -23
- data/lib/active_scaffold/actions/update.rb +0 -156
- data/lib/active_scaffold/active_record_permissions.rb +0 -135
- data/lib/active_scaffold/attribute_params.rb +0 -200
- data/lib/active_scaffold/bridges.rb +0 -61
- data/lib/active_scaffold/bridges/ancestry.rb +0 -5
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +0 -39
- data/lib/active_scaffold/bridges/bitfields.rb +0 -6
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +0 -37
- data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -24
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -66
- data/lib/active_scaffold/bridges/cancan.rb +0 -15
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +0 -127
- data/lib/active_scaffold/bridges/carrierwave.rb +0 -12
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +0 -31
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +0 -10
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +0 -45
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +0 -17
- data/lib/active_scaffold/bridges/country_helper.rb +0 -9
- data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +0 -358
- data/lib/active_scaffold/bridges/date_picker.rb +0 -23
- data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -63
- data/lib/active_scaffold/bridges/date_picker/helper.rb +0 -180
- data/lib/active_scaffold/bridges/dragonfly.rb +0 -9
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +0 -34
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +0 -10
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +0 -27
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +0 -16
- data/lib/active_scaffold/bridges/file_column.rb +0 -11
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +0 -46
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +0 -57
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -34
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +0 -26
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +0 -43
- data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +0 -9
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -15
- data/lib/active_scaffold/bridges/paperclip.rb +0 -12
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +0 -27
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +0 -16
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +0 -36
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +0 -24
- data/lib/active_scaffold/bridges/record_select.rb +0 -11
- data/lib/active_scaffold/bridges/record_select/helpers.rb +0 -92
- data/lib/active_scaffold/bridges/semantic_attributes.rb +0 -5
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +0 -20
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +0 -209
- data/lib/active_scaffold/bridges/tiny_mce.rb +0 -17
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +0 -46
- data/lib/active_scaffold/config/base.rb +0 -75
- data/lib/active_scaffold/config/core.rb +0 -236
- data/lib/active_scaffold/config/create.rb +0 -32
- data/lib/active_scaffold/config/delete.rb +0 -32
- data/lib/active_scaffold/config/field_search.rb +0 -79
- data/lib/active_scaffold/config/form.rb +0 -64
- data/lib/active_scaffold/config/list.rb +0 -247
- data/lib/active_scaffold/config/mark.rb +0 -30
- data/lib/active_scaffold/config/nested.rb +0 -42
- data/lib/active_scaffold/config/search.rb +0 -73
- data/lib/active_scaffold/config/show.rb +0 -31
- data/lib/active_scaffold/config/subform.rb +0 -35
- data/lib/active_scaffold/config/update.rb +0 -33
- data/lib/active_scaffold/configurable.rb +0 -29
- data/lib/active_scaffold/constraints.rb +0 -171
- data/lib/active_scaffold/data_structures/action_columns.rb +0 -142
- data/lib/active_scaffold/data_structures/action_link.rb +0 -185
- data/lib/active_scaffold/data_structures/action_links.rb +0 -191
- data/lib/active_scaffold/data_structures/actions.rb +0 -45
- data/lib/active_scaffold/data_structures/bridge.rb +0 -22
- data/lib/active_scaffold/data_structures/column.rb +0 -401
- data/lib/active_scaffold/data_structures/columns.rb +0 -75
- data/lib/active_scaffold/data_structures/error_message.rb +0 -24
- data/lib/active_scaffold/data_structures/nested_info.rb +0 -171
- data/lib/active_scaffold/data_structures/set.rb +0 -61
- data/lib/active_scaffold/data_structures/sorting.rb +0 -167
- data/lib/active_scaffold/engine.rb +0 -4
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +0 -20
- data/lib/active_scaffold/extensions/action_controller_rescueing.rb +0 -7
- data/lib/active_scaffold/extensions/action_view_rendering.rb +0 -115
- data/lib/active_scaffold/extensions/active_record_offset.rb +0 -12
- data/lib/active_scaffold/extensions/array.rb +0 -7
- data/lib/active_scaffold/extensions/cache_association.rb +0 -16
- data/lib/active_scaffold/extensions/localize.rb +0 -10
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +0 -12
- data/lib/active_scaffold/extensions/nil_id_in_url_params.rb +0 -7
- data/lib/active_scaffold/extensions/paginator_extensions.rb +0 -26
- data/lib/active_scaffold/extensions/reverse_associations.rb +0 -64
- data/lib/active_scaffold/extensions/routing_mapper.rb +0 -48
- data/lib/active_scaffold/extensions/to_label.rb +0 -8
- data/lib/active_scaffold/extensions/unsaved_associated.rb +0 -61
- data/lib/active_scaffold/extensions/unsaved_record.rb +0 -20
- data/lib/active_scaffold/extensions/usa_state.rb +0 -46
- data/lib/active_scaffold/finder.rb +0 -399
- data/lib/active_scaffold/helpers/association_helpers.rb +0 -42
- data/lib/active_scaffold/helpers/controller_helpers.rb +0 -94
- data/lib/active_scaffold/helpers/form_column_helpers.rb +0 -322
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +0 -64
- data/lib/active_scaffold/helpers/id_helpers.rb +0 -131
- data/lib/active_scaffold/helpers/list_column_helpers.rb +0 -374
- data/lib/active_scaffold/helpers/pagination_helpers.rb +0 -62
- data/lib/active_scaffold/helpers/search_column_helpers.rb +0 -257
- data/lib/active_scaffold/helpers/show_column_helpers.rb +0 -44
- data/lib/active_scaffold/helpers/view_helpers.rb +0 -398
- data/lib/active_scaffold/marked_model.rb +0 -38
- data/lib/active_scaffold/paginator.rb +0 -136
- data/lib/active_scaffold/responds_to_parent.rb +0 -70
- data/lib/active_scaffold/tableless.rb +0 -83
- data/lib/active_scaffold/version.rb +0 -9
- data/lib/active_scaffold_env.rb +0 -13
- data/lib/generators/active_scaffold/USAGE +0 -29
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
- data/lib/generators/active_scaffold_controller/USAGE +0 -19
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
- data/lib/generators/active_scaffold_controller/templates/controller.rb +0 -4
- data/lib/generators/active_scaffold_controller/templates/helper.rb +0 -2
- data/public/blank.html +0 -33
- data/shoulda_macros/macros.rb +0 -136
- data/vendor/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/vendor/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/vendor/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/vendor/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/vendor/assets/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_228ef1_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ef8c08_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ffd27a_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ffffff_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +0 -1276
- data/vendor/assets/stylesheets/jquery-ui.css +0 -568
@@ -1,38 +0,0 @@
|
|
1
|
-
module ActiveScaffold
|
2
|
-
module MarkedModel
|
3
|
-
# This is a module aimed at making the make session_stored marked_records available to ActiveRecord models
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.extend ClassMethods
|
7
|
-
base.scope :as_marked, lambda { where(:id => base.marked_records.to_a) }
|
8
|
-
end
|
9
|
-
|
10
|
-
def as_marked
|
11
|
-
marked_records.include?(self.id)
|
12
|
-
end
|
13
|
-
|
14
|
-
def as_marked=(value)
|
15
|
-
value = [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)
|
16
|
-
if value == true
|
17
|
-
marked_records << self.id if !as_marked
|
18
|
-
else
|
19
|
-
marked_records.delete(self.id)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
module ClassMethods
|
24
|
-
def marked_records
|
25
|
-
Thread.current[:marked_records] ||= Set.new
|
26
|
-
end
|
27
|
-
|
28
|
-
def marked_records=(marked)
|
29
|
-
Thread.current[:marked_records] = marked
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Instance-level access to the marked_records
|
34
|
-
def marked_records
|
35
|
-
self.class.marked_records
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,136 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
class Paginator
|
4
|
-
|
5
|
-
VERSION = '1.0.9'
|
6
|
-
|
7
|
-
class ArgumentError < ::ArgumentError; end
|
8
|
-
class MissingCountError < ArgumentError; end
|
9
|
-
class MissingSelectError < ArgumentError; end
|
10
|
-
|
11
|
-
attr_reader :per_page, :count
|
12
|
-
|
13
|
-
# Instantiate a new Paginator object
|
14
|
-
#
|
15
|
-
# Provide:
|
16
|
-
# * A total count of the number of objects to paginate
|
17
|
-
# * The number of objects in each page
|
18
|
-
# * A block that returns the array of items
|
19
|
-
# * The block is passed the item offset
|
20
|
-
# (and the number of items to show per page, for
|
21
|
-
# convenience, if the arity is 2)
|
22
|
-
def initialize(count, per_page, &select)
|
23
|
-
@count, @per_page = count, per_page
|
24
|
-
unless select
|
25
|
-
raise MissingSelectError, "Must provide block to select data for each page"
|
26
|
-
end
|
27
|
-
@select = select
|
28
|
-
end
|
29
|
-
|
30
|
-
# Total number of pages
|
31
|
-
def number_of_pages
|
32
|
-
(@count / @per_page).to_i + (@count % @per_page > 0 ? 1 : 0)
|
33
|
-
end
|
34
|
-
|
35
|
-
# First page object
|
36
|
-
def first
|
37
|
-
page 1
|
38
|
-
end
|
39
|
-
|
40
|
-
# Last page object
|
41
|
-
def last
|
42
|
-
page number_of_pages
|
43
|
-
end
|
44
|
-
|
45
|
-
# Iterate through pages
|
46
|
-
def each
|
47
|
-
each_with_index do |item, index|
|
48
|
-
yield item
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Iterate through pages with indices
|
53
|
-
def each_with_index
|
54
|
-
1.upto(number_of_pages) do |number|
|
55
|
-
yield(page(number), number - 1)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Retrieve page object by number
|
60
|
-
def page(number)
|
61
|
-
number = (n = number.to_i) > 0 ? n : 1
|
62
|
-
Page.new(self, number, lambda {
|
63
|
-
offset = (number - 1) * @per_page
|
64
|
-
args = [offset]
|
65
|
-
args << @per_page if @select.arity == 2
|
66
|
-
@select.call(*args)
|
67
|
-
})
|
68
|
-
end
|
69
|
-
|
70
|
-
# Page object
|
71
|
-
#
|
72
|
-
# Retrieves items for a page and provides metadata about the position
|
73
|
-
# of the page in the paginator
|
74
|
-
class Page
|
75
|
-
|
76
|
-
extend Forwardable
|
77
|
-
def_delegator :@pager, :first, :first
|
78
|
-
def_delegator :@pager, :last, :last
|
79
|
-
def_delegator :items, :each
|
80
|
-
def_delegator :items, :each_with_index
|
81
|
-
|
82
|
-
attr_reader :number, :pager
|
83
|
-
|
84
|
-
def initialize(pager, number, select) #:nodoc:
|
85
|
-
@pager, @number = pager, number
|
86
|
-
@offset = (number - 1) * pager.per_page
|
87
|
-
@select = select
|
88
|
-
end
|
89
|
-
|
90
|
-
# Retrieve the items for this page
|
91
|
-
# * Caches
|
92
|
-
def items
|
93
|
-
@items ||= @select.call
|
94
|
-
end
|
95
|
-
|
96
|
-
# Checks to see if there's a page before this one
|
97
|
-
def prev?
|
98
|
-
@number > 1
|
99
|
-
end
|
100
|
-
|
101
|
-
# Get previous page (if possible)
|
102
|
-
def prev
|
103
|
-
@pager.page(@number - 1) if prev?
|
104
|
-
end
|
105
|
-
|
106
|
-
# Checks to see if there's a page after this one
|
107
|
-
def next?
|
108
|
-
@number < @pager.number_of_pages
|
109
|
-
end
|
110
|
-
|
111
|
-
# Get next page (if possible)
|
112
|
-
def next
|
113
|
-
@pager.page(@number + 1) if next?
|
114
|
-
end
|
115
|
-
|
116
|
-
# The "item number" of the first item on this page
|
117
|
-
def first_item_number
|
118
|
-
1 + @offset
|
119
|
-
end
|
120
|
-
|
121
|
-
# The "item number" of the last item on this page
|
122
|
-
def last_item_number
|
123
|
-
if next?
|
124
|
-
@offset + @pager.per_page
|
125
|
-
else
|
126
|
-
@pager.count
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def ==(other) #:nodoc:
|
131
|
-
@pager == other.pager && self.number == other.number
|
132
|
-
end
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006 Sean Treadway
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
# a copy of this software and associated documentation files (the
|
5
|
-
# "Software"), to deal in the Software without restriction, including
|
6
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
# the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be
|
12
|
-
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
|
-
|
23
|
-
# Module containing the methods useful for child IFRAME to parent window communication
|
24
|
-
module RespondsToParent
|
25
|
-
|
26
|
-
# Executes the response body as JavaScript in the context of the parent window.
|
27
|
-
# Use this method of you are posting a form to a hidden IFRAME or if you would like
|
28
|
-
# to use IFRAME base RPC.
|
29
|
-
def responds_to_parent(&block)
|
30
|
-
yield
|
31
|
-
|
32
|
-
if performed?
|
33
|
-
# We're returning HTML instead of JS or XML now
|
34
|
-
response.headers['Content-Type'] = 'text/html; charset=UTF-8'
|
35
|
-
|
36
|
-
# Either pull out a redirect or the request body
|
37
|
-
script = if response.headers['Location']
|
38
|
-
#TODO: erase_redirect_results is missing in rails 3.0 has to be implemented
|
39
|
-
#erase redirect
|
40
|
-
"document.location.href = #{location.to_s.inspect}"
|
41
|
-
else
|
42
|
-
response.body
|
43
|
-
end
|
44
|
-
|
45
|
-
# Escape quotes, linebreaks and slashes, maintaining previously escaped slashes
|
46
|
-
# Suggestions for improvement?
|
47
|
-
script = (script || '').
|
48
|
-
gsub('\\', '\\\\\\').
|
49
|
-
gsub(/\r\n|\r|\n/, '\\n').
|
50
|
-
gsub(/['"]/, '\\\\\&').
|
51
|
-
gsub('</script>','</scr"+"ipt>')
|
52
|
-
|
53
|
-
# Clear out the previous render to prevent double render
|
54
|
-
response.request.env['action_controller.instance'].instance_variable_set(:@_response_body, nil)
|
55
|
-
|
56
|
-
# Eval in parent scope and replace document location of this frame
|
57
|
-
# so back button doesn't replay action on targeted forms
|
58
|
-
# loc = document.location to be set after parent is updated for IE
|
59
|
-
# with(window.parent) - pull in variables from parent window
|
60
|
-
# setTimeout - scope the execution in the windows parent for safari
|
61
|
-
# window.eval - legal eval for Opera
|
62
|
-
render :text => "<html><body><script type='text/javascript' charset='utf-8'>
|
63
|
-
var loc = document.location;
|
64
|
-
with(window.parent) { setTimeout(function() { window.eval('#{script}'); if (typeof(loc) !== 'undefined') loc.replace('about:blank'); }, 1) };
|
65
|
-
</script></body></html>".html_safe
|
66
|
-
end
|
67
|
-
end
|
68
|
-
alias respond_to_parent responds_to_parent
|
69
|
-
end
|
70
|
-
|
@@ -1,83 +0,0 @@
|
|
1
|
-
class ActiveScaffold::Tableless < ActiveRecord::Base
|
2
|
-
class Relation < ActiveRecord::Relation
|
3
|
-
attr_reader :conditions
|
4
|
-
def initialize(klass, table)
|
5
|
-
super
|
6
|
-
@conditions ||= []
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize_copy(other)
|
10
|
-
@conditions = @conditions.dup
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
def where(opts, *rest)
|
15
|
-
unless opts.blank?
|
16
|
-
opts = opts.with_indifferent_access if opts.is_a? Hash
|
17
|
-
@conditions << (rest.empty? ? opts : [opts, *rest])
|
18
|
-
end
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
def merge(r)
|
23
|
-
super.tap do |merged|
|
24
|
-
merged.conditions.concat r.conditions unless r.nil? || r.is_a?(Array)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def except(*skips)
|
29
|
-
super.tap do |new_relation|
|
30
|
-
new_relation.conditions = conditions unless skips.include? :where
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def to_a
|
35
|
-
@klass.find_all(self)
|
36
|
-
end
|
37
|
-
|
38
|
-
def find_one(id)
|
39
|
-
@klass.find_one(id, self)
|
40
|
-
end
|
41
|
-
|
42
|
-
def execute_simple_calculation(operation, column_name, distinct)
|
43
|
-
@klass.execute_simple_calculation(self, operation, column_name, distinct)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.columns; @columns ||= []; end
|
48
|
-
def self.table_name; @table_name ||= ActiveModel::Naming.plural(self); end
|
49
|
-
def self.table_exists?; true; end
|
50
|
-
self.abstract_class = true
|
51
|
-
class << self
|
52
|
-
private
|
53
|
-
def relation
|
54
|
-
@relation ||= ActiveScaffold::Tableless::Relation.new(self, arel_table)
|
55
|
-
super
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.column(name, sql_type = nil, options = {})
|
60
|
-
column = ActiveRecord::ConnectionAdapters::Column.new(name.to_s, options[:default], sql_type.to_s, options.has_key?(:null) ? options[:null] : true)
|
61
|
-
column.tap { columns << column }
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.find_all(relation)
|
65
|
-
raise 'self.find_all must be implemented in a Tableless model'
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.find_one(id, relation)
|
69
|
-
raise 'self.find_one must be implemented in a Tableless model'
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.execute_simple_calculation(relation, operation, column_name, distinct)
|
73
|
-
if operation == 'count' && column_name == :all && !distinct
|
74
|
-
find_all(relation).size
|
75
|
-
else
|
76
|
-
raise "self.execute_simple_calculation must be implemented in a Tableless model to support #{operation} #{column_name} #{' distinct' if distinct} columns"
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def destroy
|
81
|
-
raise 'destroy must be implemented in a Tableless model'
|
82
|
-
end
|
83
|
-
end
|
data/lib/active_scaffold_env.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# TODO: clean up extensions. some could be organized for autoloading, and others could be removed entirely.
|
2
|
-
Dir["#{File.dirname __FILE__}/active_scaffold/extensions/*.rb"].each { |file| require file }
|
3
|
-
module ActiveScaffold
|
4
|
-
autoload :Tableless, 'active_scaffold/tableless'
|
5
|
-
end
|
6
|
-
|
7
|
-
ActionController::Base.send(:include, ActiveScaffold)
|
8
|
-
ActionController::Base.send(:include, RespondsToParent)
|
9
|
-
ActionController::Base.send(:include, ActiveScaffold::Helpers::ControllerHelpers)
|
10
|
-
ActionView::Base.send(:include, ActiveScaffold::Helpers::ViewHelpers)
|
11
|
-
|
12
|
-
ActionController::Base.class_eval {include ActiveRecordPermissions::ModelUserAccess::Controller}
|
13
|
-
ActiveRecord::Base.class_eval {include ActiveRecordPermissions::ModelUserAccess::Model}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Scaffolds an entire resource, from model and migration to controller,
|
3
|
-
along with a full test suite and configured to use active_scaffold.
|
4
|
-
The resource is ready to use as a starting point for your RESTful,
|
5
|
-
resource-oriented application.
|
6
|
-
|
7
|
-
Pass the name of the model (in singular form), either CamelCased or
|
8
|
-
under_scored, as the first argument, and an optional list of attribute
|
9
|
-
pairs.
|
10
|
-
|
11
|
-
Attribute pairs are field:type arguments specifying the
|
12
|
-
model's attributes. Timestamps are added by default, so you don't have to
|
13
|
-
specify them by hand as 'created_at:datetime updated_at:datetime'.
|
14
|
-
|
15
|
-
You don't have to think up every attribute up front, but it helps to
|
16
|
-
sketch out a few so you can start working with the resource immediately.
|
17
|
-
|
18
|
-
For example, 'active_scaffold post title:string body:text published:boolean'
|
19
|
-
gives you a model with those three attributes, a controller configured to use active_scaffold,
|
20
|
-
as well as a resources :posts with additional active_scaffold routes
|
21
|
-
declaration in config/routes.rb.
|
22
|
-
|
23
|
-
If you want to remove all the generated files, run
|
24
|
-
'rails destroy active_scaffold ModelName'.
|
25
|
-
|
26
|
-
Examples:
|
27
|
-
`rails generate active_scaffold post`
|
28
|
-
`rails generate active_scaffold post title:string body:text published:boolean`
|
29
|
-
`rails generate active_scaffold purchase order_id:integer amount:decimal`
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'rails/generators/rails/resource/resource_generator'
|
2
|
-
#require 'generators/active_scaffold_controller/active_scaffold_controller_generator'
|
3
|
-
|
4
|
-
module Rails
|
5
|
-
module Generators
|
6
|
-
class ActiveScaffoldGenerator < ResourceGenerator #metagenerator
|
7
|
-
remove_hook_for :resource_controller
|
8
|
-
remove_hook_for :resource_route
|
9
|
-
remove_class_option :actions
|
10
|
-
|
11
|
-
def add_resource_route
|
12
|
-
route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
|
13
|
-
route_config << "resources :#{file_name.pluralize} do as_routes end"
|
14
|
-
route_config << " end" * class_path.size
|
15
|
-
route route_config
|
16
|
-
end
|
17
|
-
|
18
|
-
invoke "active_scaffold_controller"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Stubs out a active_scaffolded controller. Pass the model name,
|
3
|
-
either CamelCased or under_scored.
|
4
|
-
The controller name is retrieved as a pluralized version of the model
|
5
|
-
name.
|
6
|
-
|
7
|
-
To create a controller within a module, specify the model name as a
|
8
|
-
path like 'parent_module/controller_name'.
|
9
|
-
|
10
|
-
This generates a controller class in app/controllers and invokes helper,
|
11
|
-
template engine and test framework generators.
|
12
|
-
|
13
|
-
Example:
|
14
|
-
`rails generate active_scaffold_controller CreditCard`
|
15
|
-
|
16
|
-
Credit card controller with URLs like /credit_card/debit.
|
17
|
-
Controller: app/controllers/credit_cards_controller.rb
|
18
|
-
Functional Test: test/functional/credit_cards_controller_test.rb
|
19
|
-
Helper: app/helpers/credit_cards_helper.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
#require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
|
2
|
-
|
3
|
-
module Rails
|
4
|
-
module Generators
|
5
|
-
class ActiveScaffoldControllerGenerator < NamedBase #metagenerator
|
6
|
-
include ResourceHelpers
|
7
|
-
|
8
|
-
def self.source_root
|
9
|
-
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
-
end
|
11
|
-
|
12
|
-
check_class_collision :suffix => "Controller"
|
13
|
-
|
14
|
-
class_option :orm, :banner => "NAME", :type => :string, :required => true,
|
15
|
-
:desc => "ORM to generate the controller for"
|
16
|
-
|
17
|
-
def create_controller_files
|
18
|
-
template 'controller.rb', File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb")
|
19
|
-
template 'helper.rb', File.join('app/helpers', class_path, "#{controller_file_name}_helper.rb")
|
20
|
-
end
|
21
|
-
|
22
|
-
hook_for :test_framework, :as => :scaffold
|
23
|
-
|
24
|
-
def create_view_root_folder
|
25
|
-
empty_directory File.join("app/views", controller_file_path)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|