Module: ActiveScaffold
- Defined in:
- lib/active_scaffold.rb,
lib/active_scaffold/finder.rb,
lib/active_scaffold/version.rb,
lib/active_scaffold/constraints.rb,
lib/active_scaffold/configurable.rb,
lib/active_scaffold/marked_model.rb,
lib/active_scaffold/bridges/bridge.rb,
lib/active_scaffold/attribute_params.rb,
lib/active_scaffold/helpers/id_helpers.rb,
lib/active_scaffold/helpers/view_helpers.rb,
lib/active_scaffold/bridges/shared/date_bridge.rb,
lib/active_scaffold/helpers/controller_helpers.rb,
lib/active_scaffold/helpers/pagination_helpers.rb,
lib/active_scaffold/helpers/association_helpers.rb,
lib/active_scaffold/helpers/form_column_helpers.rb,
lib/active_scaffold/helpers/list_column_helpers.rb,
lib/active_scaffold/helpers/show_column_helpers.rb,
lib/active_scaffold/bridges/dragonfly/lib/form_ui.rb,
lib/active_scaffold/bridges/dragonfly/lib/list_ui.rb,
lib/active_scaffold/bridges/paperclip/lib/form_ui.rb,
lib/active_scaffold/bridges/paperclip/lib/list_ui.rb,
lib/active_scaffold/helpers/search_column_helpers.rb,
lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb,
lib/active_scaffold/bridges/carrierwave/lib/list_ui.rb,
lib/active_scaffold/bridges/file_column/lib/form_ui.rb,
lib/active_scaffold/bridges/file_column/lib/list_ui.rb,
lib/active_scaffold/helpers/human_condition_helpers.rb,
lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb,
lib/active_scaffold/bridges/ancestry/lib/ancestry_bridge.rb,
lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb,
lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge.rb,
lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge.rb,
lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb,
lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb,
lib/active_scaffold/bridges/file_column/lib/file_column_helpers.rb,
lib/active_scaffold/bridges/calendar_date_select/lib/as_cds_bridge.rb,
lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge_helpers.rb,
lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb,
lib/active_scaffold/bridges/record_select/lib/record_select_bridge.rb,
lib/active_scaffold/bridges/country_helper/lib/country_helper_bridge.rb,
lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb,
lib/active_scaffold/bridges/semantic_attributes/lib/semantic_attributes_bridge.rb,
lib/active_scaffold/bridges/validation_reflection/lib/validation_reflection_bridge.rb
Defined Under Namespace
Modules: Actions, AncestryBridge, AttributeParams, Bridges, CancanBridge, ClassMethods, Config, Configurable, Constraints, CountryHelperBridge, DataStructures, Finder, Helpers, MarkedModel, RecordSelectBridge, SemanticAttributesBridge, TinyMceBridge, ValidationReflectionBridge, Version
Classes: ActionNotAllowed, ControllerNotFound, DependencyFailure, MalformedConstraint, RecordNotAllowed, ReverseAssociationRequired
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.autoload_subdir(dir, mod = self, root = File.dirname(__FILE__)) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/active_scaffold.rb', line 28
def self.autoload_subdir(dir, mod=self, root = File.dirname(__FILE__))
Dir["#{root}/active_scaffold/#{dir}/*.rb"].each { |file|
basename = File.basename(file, ".rb")
mod.module_eval {
autoload basename.camelcase.to_sym, "active_scaffold/#{dir}/#{basename}"
}
}
end
|
.exclude_bridges ⇒ Object
142
143
144
|
# File 'lib/active_scaffold.rb', line 142
def self.exclude_bridges
@@exclude_bridges ||= []
end
|
.exclude_bridges=(bridges) ⇒ Object
exclude bridges you do not need name of bridge subdir should be used to exclude it eg
ActiveScaffold.exclude_bridges = [:cancan, :ancestry]
if you are using Activescaffold as a gem add to initializer
if you are using Activescaffold as a plugin add to active_scaffold_env.rb
138
139
140
|
# File 'lib/active_scaffold.rb', line 138
def self.exclude_bridges=(bridges)
@@exclude_bridges = bridges
end
|
.included(base) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/active_scaffold.rb', line 64
def self.included(base)
base.extend(ClassMethods)
base.module_eval do
before_filter :handle_user_settings
before_filter :check_input_device
end
base.helper_method :touch_device?
base.helper_method :hover_via_click?
end
|
.js_framework ⇒ Object
128
129
130
|
# File 'lib/active_scaffold.rb', line 128
def self.js_framework
@@js_framework ||= :prototype
end
|
.js_framework=(framework) ⇒ Object
124
125
126
|
# File 'lib/active_scaffold.rb', line 124
def self.js_framework=(framework)
@@js_framework = framework
end
|
146
147
148
|
# File 'lib/active_scaffold.rb', line 146
def self.root
File.dirname(__FILE__) + "/.."
end
|
.set_defaults(&block) ⇒ Object
Instance Method Details
#active_scaffold_config ⇒ Object
80
81
82
|
# File 'lib/active_scaffold.rb', line 80
def active_scaffold_config
self.class.active_scaffold_config
end
|
#active_scaffold_config_for(klass) ⇒ Object
84
85
86
|
# File 'lib/active_scaffold.rb', line 84
def active_scaffold_config_for(klass)
self.class.active_scaffold_config_for(klass)
end
|
#active_scaffold_session_storage(id = (params[:eid] || params[:controller])) ⇒ Object
88
89
90
91
92
|
# File 'lib/active_scaffold.rb', line 88
def active_scaffold_session_storage(id = (params[:eid] || params[:controller]))
session_index = "as:#{id}"
session[session_index] ||= {}
session[session_index]
end
|
106
107
108
109
110
111
112
113
114
|
# File 'lib/active_scaffold.rb', line 106
def check_input_device
if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod|iPad)/i]
session[:input_device_type] = 'TOUCH'
session[:hover_supported] = false
else
session[:input_device_type] = 'MOUSE'
session[:hover_supported] = true
end if session[:input_device_type].nil?
end
|
#handle_user_settings ⇒ Object
at some point we need to pass the session and params into config. we’ll just take care of that before any particular action occurs by passing those hashes off to the UserSettings class of each action.
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/active_scaffold.rb', line 95
def handle_user_settings
if self.class.uses_active_scaffold?
active_scaffold_config.actions.each do |action_name|
conf_instance = active_scaffold_config.send(action_name) rescue next
next if conf_instance.class::UserSettings == ActiveScaffold::Config::Base::UserSettings active_scaffold_session_storage[action_name] ||= {}
conf_instance.user = conf_instance.class::UserSettings.new(conf_instance, active_scaffold_session_storage[action_name], params)
end
end
end
|
#hover_via_click? ⇒ Boolean
120
121
122
|
# File 'lib/active_scaffold.rb', line 120
def hover_via_click?
session[:hover_supported] == false
end
|
#touch_device? ⇒ Boolean
116
117
118
|
# File 'lib/active_scaffold.rb', line 116
def touch_device?
session[:input_device_type] == 'TOUCH'
end
|