Class: AdminAssistant::ActiveRecordColumn::IndexView
Instance Attribute Summary
Attributes inherited from Column::View
#sort_order
Instance Method Summary
collapse
#header_css_class, #html, #next_sort_params, #set_instance_variables_from_options, #td_css_classes
#check_box_and_hidden_tags, #controller, #custom_template_file_path, #file_option_for_custom_template_render, #initialize, #label, #name, #paperclip?, #sort_possible?, #string, #value
Instance Method Details
#ajax_toggle? ⇒ Boolean
259
260
261
|
# File 'lib/admin_assistant/active_record_column.rb', line 259
def ajax_toggle?
@column.field_type == :boolean && @ajax_toggle_allowed
end
|
#ajax_toggle_div_id(record) ⇒ Object
263
264
265
|
# File 'lib/admin_assistant/active_record_column.rb', line 263
def ajax_toggle_div_id(record)
"#{record.class.name.underscore}_#{record.id}_#{name}"
end
|
#ajax_toggle_html(record) ⇒ Object
267
268
269
270
271
272
273
|
# File 'lib/admin_assistant/active_record_column.rb', line 267
def ajax_toggle_html(record)
<<-HTML
<div id="#{ ajax_toggle_div_id(record) }">
#{ajax_toggle_inner_html(record)}
</div>
HTML
end
|
#ajax_toggle_inner_html(record) ⇒ Object
275
276
277
278
279
280
281
282
283
284
285
286
287
|
# File 'lib/admin_assistant/active_record_column.rb', line 275
def ajax_toggle_inner_html(record)
div_id = ajax_toggle_div_id record
@action_view.link_to(
string(record),
{
:action => 'update', :id => record.id, :from => div_id,
record.class.name.underscore.to_sym => {
name => (!value(record) ? '1' : '0')
}
},
{:class => 'toggle', :rel => 'nofollow', 'data-method' => 'put'}
)
end
|
289
290
291
292
293
294
295
|
# File 'lib/admin_assistant/active_record_column.rb', line 289
def unconfigured_html(record)
if ajax_toggle?
ajax_toggle_html(record)
else
@action_view.send(:h, string(record))
end
end
|