Top Level Namespace
Defined Under Namespace
Modules: InlineForms, InlineFormsHelper, Kernel
Classes: GeoCodeCuracao, GeoCodeCuracaoController, InlineFormsController, IsACuracaoIdNumberValidator, IsCuracaoPhoneValidator, IsEmailAddressValidator, MustBeAValueValidator, MustBePresentValidator, MustBeUniqueValidator
Constant Summary
collapse
- RUBY =
File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
- USAGE =
"
USAGE: inline_forms <options> <app-name>
'inline_forms MyApp' will create a rails app in directory MyApp. It will also
try to create a MyApp_development mysql database and grant permissions on that
database to user 'MyApp' identified by 'MyApp', unless you specify
--skip-db-setup
Options:
--skip-db-setup # skip setup of mysql development database
--help # show this message
VERSION: #{InlineForms::VERSION}
"
Instance Method Summary
collapse
-
#check_box_edit(object, attribute) ⇒ Object
-
#check_box_show(object, attribute) ⇒ Object
boolean, bit unaptly named check_box.
-
#check_box_update(object, attribute) ⇒ Object
-
#check_list_edit(object, attribute) ⇒ Object
-
#check_list_show(object, attribute) ⇒ Object
-
#check_list_update(object, attribute) ⇒ Object
-
#date_select_edit(object, attribute) ⇒ Object
-
#date_select_show(object, attribute) ⇒ Object
-
#date_select_update(object, attribute) ⇒ Object
-
#dropdown_edit(object, attribute) ⇒ Object
-
#dropdown_show(object, attribute) ⇒ Object
-
#dropdown_update(object, attribute) ⇒ Object
-
#dropdown_with_integers_edit(object, attribute) ⇒ Object
-
#dropdown_with_integers_show(object, attribute) ⇒ Object
dropdown_with_integers generates a dropdown menu with the given list of integers as options.
-
#dropdown_with_integers_update(object, attribute) ⇒ Object
-
#dropdown_with_values_edit(object, attribute) ⇒ Object
-
#dropdown_with_values_show(object, attribute) ⇒ Object
-
#dropdown_with_values_update(object, attribute) ⇒ Object
-
#file_field_edit(object, attribute) ⇒ Object
-
#file_field_show(object, attribute) ⇒ Object
-
#file_field_update(object, attribute) ⇒ Object
-
#geo_code_curacao_edit(object, attribute) ⇒ Object
-
#geo_code_curacao_show(object, attribute) ⇒ Object
-
#geo_code_curacao_update(object, attribute) ⇒ Object
-
#image_field_edit(object, attribute) ⇒ Object
-
#image_field_show(object, attribute) ⇒ Object
-
#image_field_update(object, attribute) ⇒ Object
-
#info_edit(object, attribute) ⇒ Object
-
#info_show(object, attribute) ⇒ Object
-
#info_update(object, attribute) ⇒ Object
-
#infoadmin_edit(object, attribute) ⇒ Object
-
#infoadmin_show(object, attribute) ⇒ Object
-
#infoadmin_update(object, attribute) ⇒ Object
-
#question_list_edit(object, attribute) ⇒ Object
-
#question_list_show(object, attribute) ⇒ Object
-
#question_list_update(object, attribute) ⇒ Object
-
#radio_button_edit(object, attribute) ⇒ Object
-
#radio_button_show(object, attribute) ⇒ Object
[ :sex , “gender”, :radio_button, { 1 => ‘male’, 2 => ‘female’ } ],.
-
#radio_button_update(object, attribute) ⇒ Object
-
#scale_with_integers_edit(object, attribute) ⇒ Object
-
#scale_with_integers_show(object, attribute) ⇒ Object
scale_with_integers generates a scale with the given list of integers as options.
-
#scale_with_integers_update(object, attribute) ⇒ Object
-
#scale_with_values_edit(object, attribute) ⇒ Object
-
#scale_with_values_show(object, attribute) ⇒ Object
scale_with_values generates a scale with the given list of values as options.
-
#scale_with_values_update(object, attribute) ⇒ Object
-
#slider_with_values_edit(object, attribute) ⇒ Object
-
#slider_with_values_show(object, attribute) ⇒ Object
-
#slider_with_values_update(object, attribute) ⇒ Object
-
#text_area_edit(object, attribute) ⇒ Object
-
#text_area_show(object, attribute) ⇒ Object
-
#text_area_update(object, attribute) ⇒ Object
-
#text_field_edit(object, attribute) ⇒ Object
-
#text_field_show(object, attribute) ⇒ Object
-
#text_field_update(object, attribute) ⇒ Object
Instance Method Details
#check_box_edit(object, attribute) ⇒ Object
8
9
10
|
# File 'lib/app/helpers/form_elements/check_box.rb', line 8
def check_box_edit(object, attribute)
check_box_tag attribute.to_s, 1, object.send(attribute)
end
|
#check_box_show(object, attribute) ⇒ Object
boolean, bit unaptly named check_box
3
4
5
6
|
# File 'lib/app/helpers/form_elements/check_box.rb', line 3
def check_box_show(object, attribute)
values = attribute_values(object, attribute)
link_to_inline_edit object, attribute, values[object.send(attribute) ? 1 : 0 ][1]
end
|
#check_box_update(object, attribute) ⇒ Object
12
13
14
|
# File 'lib/app/helpers/form_elements/check_box.rb', line 12
def check_box_update(object, attribute)
object[attribute.to_s.to_sym] = params[attribute.to_s.to_sym].nil? ? 0 : 1
end
|
#check_list_edit(object, attribute) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/app/helpers/form_elements/check_list.rb', line 16
def check_list_edit(object, attribute)
object.send(attribute).build if object.send(attribute).empty?
if cancan_enabled?
values = object.send(attribute).first.class.name.constantize.accessible_by(current_ability).order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
else
values = object.send(attribute).first.class.name.constantize.order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
end
out = '<div class="edit_form_checklist">'
out << '<ul>'
values.each do | item |
out << '<li>'
out << check_box_tag( attribute.to_s + '[' + item.id.to_s + ']', 1, object.send(attribute.to_s.singularize + "_ids").include?(item.id) )
out << '<div class="edit_form_checklist_text">'
out << h(item._presentation)
out << '</div>'
out << '<div style="clear: both;"></div>'
out << '</li>'
end
out << '</ul>'
out << '</div>'
out.html_safe
end
|
#check_list_show(object, attribute) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/app/helpers/form_elements/check_list.rb', line 4
def check_list_show(object, attribute)
out = '<ul class="checklist">'
out << link_to_inline_edit(object, attribute) if object.send(attribute).empty?
object.send(attribute).sort.each do | item |
out << '<li>'
out << link_to_inline_edit(object, attribute, item._presentation )
out << '</li>'
end
out << '</ul>'
out.html_safe
end
|
#check_list_update(object, attribute) ⇒ Object
39
40
41
42
|
# File 'lib/app/helpers/form_elements/check_list.rb', line 39
def check_list_update(object, attribute)
params[attribute] ||= {}
object.send(attribute.to_s.singularize + '_ids=', params[attribute].keys)
end
|
#date_select_edit(object, attribute) ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/app/helpers/form_elements/date.rb', line 8
def date_select_edit(object, attribute)
css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id
out << '<SCRIPT>'.html_safe
out << "$(function() { ".html_safe
out << '$("#'.html_safe + css_id.html_safe + '").datepicker();'.html_safe
out << '});'.html_safe
out << '</SCRIPT>'.html_safe
return out
end
|
#date_select_show(object, attribute) ⇒ Object
4
5
6
|
# File 'lib/app/helpers/form_elements/date.rb', line 4
def date_select_show(object, attribute)
link_to_inline_edit object, attribute, object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y")
end
|
#date_select_update(object, attribute) ⇒ Object
19
20
21
|
# File 'lib/app/helpers/form_elements/date.rb', line 19
def date_select_update(object, attribute)
object[attribute.to_sym] = params[attribute.to_sym]
end
|
#dropdown_edit(object, attribute) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/app/helpers/form_elements/dropdown.rb', line 9
def dropdown_edit(object, attribute)
object.send('build_' + attribute.to_s) unless object.send(attribute)
o = object.send(attribute).class.name.constantize
if cancan_enabled?
values = o.accessible_by(current_ability).order(o.order_by_clause)
else
values = o.order(o.order_by_clause)
end
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_s.foreign_key.to_sym, values, 'id', '_presentation', :selected => object.send(attribute).id)
end
|
#dropdown_show(object, attribute) ⇒ Object
4
5
6
7
|
# File 'lib/app/helpers/form_elements/dropdown.rb', line 4
def dropdown_show(object, attribute)
attribute_value = object.send(attribute)._presentation rescue nil
link_to_inline_edit object, attribute, attribute_value
end
|
#dropdown_update(object, attribute) ⇒ Object
21
22
23
|
# File 'lib/app/helpers/form_elements/dropdown.rb', line 21
def dropdown_update(object, attribute)
object[attribute.to_s.foreign_key.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_s.foreign_key.to_sym]
end
|
#dropdown_with_integers_edit(object, attribute) ⇒ Object
12
13
14
15
16
|
# File 'lib/app/helpers/form_elements/dropdown_with_integers.rb', line 12
def dropdown_with_integers_edit(object, attribute)
values = attribute_values(object, attribute)
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
end
|
#dropdown_with_integers_show(object, attribute) ⇒ Object
dropdown_with_integers generates a dropdown menu with the given list of integers as options
values must be a Range or a one-dimensional array of Integers
7
8
9
10
|
# File 'lib/app/helpers/form_elements/dropdown_with_integers.rb', line 7
def dropdown_with_integers_show(object, attribute)
values = attribute_values(object, attribute)
link_to_inline_edit object, attribute, values[object.send(attribute)][1]
end
|
#dropdown_with_integers_update(object, attribute) ⇒ Object
18
19
20
|
# File 'lib/app/helpers/form_elements/dropdown_with_integers.rb', line 18
def dropdown_with_integers_update(object, attribute)
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
end
|
#dropdown_with_values_edit(object, attribute) ⇒ Object
8
9
10
11
12
|
# File 'lib/app/helpers/form_elements/dropdown_with_values.rb', line 8
def dropdown_with_values_edit(object, attribute)
values = attribute_values(object, attribute)
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
end
|
#dropdown_with_values_show(object, attribute) ⇒ Object
4
5
6
7
|
# File 'lib/app/helpers/form_elements/dropdown_with_values.rb', line 4
def dropdown_with_values_show(object, attribute)
values = attribute_values(object, attribute)
link_to_inline_edit object, attribute, values[object.send(attribute)][1]
end
|
#dropdown_with_values_update(object, attribute) ⇒ Object
13
14
15
|
# File 'lib/app/helpers/form_elements/dropdown_with_values.rb', line 13
def dropdown_with_values_update(object, attribute)
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
end
|
#file_field_edit(object, attribute) ⇒ Object
7
8
9
|
# File 'lib/app/helpers/form_elements/file_field.rb', line 7
def file_field_edit(object, attribute)
file_field_tag attribute, :class => 'input_text_field'
end
|
#file_field_show(object, attribute) ⇒ Object
3
4
5
|
# File 'lib/app/helpers/form_elements/file_field.rb', line 3
def file_field_show(object, attribute)
link_to_inline_edit object, attribute, 'xxx' end
|
#file_field_update(object, attribute) ⇒ Object
11
12
13
|
# File 'lib/app/helpers/form_elements/file_field.rb', line 11
def file_field_update(object, attribute)
object.send(attribute + '=', params[attribute.to_sym])
end
|
#geo_code_curacao_edit(object, attribute) ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/app/helpers/form_elements/geo_code_curacao.rb', line 8
def geo_code_curacao_edit(object, attribute)
attribute_value = object.send(attribute).presentation rescue nil
out = text_field_tag attribute, attribute_value
out << '<script>
$( "#geo_code_curacao" ).autocomplete({
source: "/geo_code_curacao",
minLength: 2,
});
</script>'.html_safe
end
|
#geo_code_curacao_show(object, attribute) ⇒ Object
4
5
6
7
|
# File 'lib/app/helpers/form_elements/geo_code_curacao.rb', line 4
def geo_code_curacao_show(object, attribute)
attribute_value = object.send(attribute).presentation rescue nil
link_to_inline_edit object, attribute, attribute_value
end
|
#geo_code_curacao_update(object, attribute) ⇒ Object
19
20
21
22
23
|
# File 'lib/app/helpers/form_elements/geo_code_curacao.rb', line 19
def geo_code_curacao_update(object, attribute)
geo_code = params[attribute].scan(/\d\d\d\d\d\d/).to_s || nil
object[attribute.to_sym] = GeoCodeCuracao.new(geo_code).valid? ? geo_code : nil
end
|
#image_field_edit(object, attribute) ⇒ Object
7
8
9
|
# File 'lib/app/helpers/form_elements/image_field.rb', line 7
def image_field_edit(object, attribute)
file_field_tag attribute, :class => 'input_text_field'
end
|
#image_field_show(object, attribute) ⇒ Object
3
4
5
|
# File 'lib/app/helpers/form_elements/image_field.rb', line 3
def image_field_show(object, attribute)
link_to_inline_edit object, attribute, image_tag( object.send(attribute).send(:url) )
end
|
#image_field_update(object, attribute) ⇒ Object
11
12
13
|
# File 'lib/app/helpers/form_elements/image_field.rb', line 11
def image_field_update(object, attribute)
object.send(attribute.to_s + '=', params[attribute.to_sym])
end
|
#info_edit(object, attribute) ⇒ Object
7
8
9
|
# File 'lib/app/helpers/form_elements/info.rb', line 7
def info_edit(object, attribute)
object[attribute]
end
|
#info_show(object, attribute) ⇒ Object
3
4
5
|
# File 'lib/app/helpers/form_elements/info.rb', line 3
def info_show(object, attribute)
object.send(attribute)
end
|
#info_update(object, attribute) ⇒ Object
11
12
|
# File 'lib/app/helpers/form_elements/info.rb', line 11
def info_update(object, attribute)
end
|
#infoadmin_edit(object, attribute) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/app/helpers/form_elements/infoadmin.rb', line 7
def infoadmin_edit(object, attribute)
object.send('build_' + attribute.to_s) unless object.send(attribute)
o = object.send(attribute).class.name.constantize
if cancan_enabled?
values = o.accessible_by(current_ability).order(o.order_by_clause)
else
values = o.order(o.order_by_clause)
end
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_s.foreign_key.to_sym, values, 'id', '_presentation', :selected => object.send(attribute).id)
end
|
#infoadmin_show(object, attribute) ⇒ Object
3
4
5
|
# File 'lib/app/helpers/form_elements/infoadmin.rb', line 3
def infoadmin_show(object, attribute)
object.send(attribute)._presentation rescue ''
end
|
#infoadmin_update(object, attribute) ⇒ Object
19
20
21
|
# File 'lib/app/helpers/form_elements/infoadmin.rb', line 19
def infoadmin_update(object, attribute)
object[attribute.to_s.foreign_key.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_s.foreign_key.to_sym]
end
|
#question_list_edit(object, attribute) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/app/helpers/form_elements/question_list.rb', line 16
def question_list_edit(object, attribute)
object.send(attribute).build if object.send(attribute).empty?
values = object.send(attribute).first.class.name.constantize.find(:all) out = '<div class="edit_form_checklist">'
out << '<ul>'
Question.all.each do | question |
out << '<li>'
out << h(question._presentation)
unless question.subquestions.empty?
out << '<ul>'
question.subquestions.each do | subquestion |
out << '<li>'
out << h(subquestion._presentation)
out << '</li>'
end
out << '</ul>'
end
out << '</li>'
end
out << '</ul>'
out << '</div>'
out.html_safe
end
|
#question_list_show(object, attribute) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/app/helpers/form_elements/question_list.rb', line 4
def question_list_show(object, attribute)
out = '<ul class="question_list">'
out << link_to_inline_edit(object, attribute) if object.send(attribute).empty?
object.send(attribute).sort.each do | item |
out << '<li>'
out << link_to_inline_edit(object, attribute, item._presentation )
out << '</li>'
end
out << '</ul>'
out.html_safe
end
|
#question_list_update(object, attribute) ⇒ Object
40
41
42
43
|
# File 'lib/app/helpers/form_elements/question_list.rb', line 40
def question_list_update(object, attribute)
params[attribute] ||= {}
object.send(attribute.singularize + '_ids=', params[attribute].keys)
end
|
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/app/helpers/form_elements/radio_button.rb', line 11
def radio_button_edit(object, attribute)
out ='<ul class="radio_list">'
values = attribute_values(object, attribute)
values.each do |key,value|
out << '<li>'
out << radio_button_tag(attribute.to_s, key, key == object.send(attribute))
out << value
out << '</li>'
end
out << '</ul>'
raw out
end
|
[ :sex , “gender”, :radio_button, { 1 => ‘male’, 2 => ‘female’ } ],
6
7
8
9
|
# File 'lib/app/helpers/form_elements/radio_button.rb', line 6
def radio_button_show(object, attribute)
values = attribute_values(object, attribute)
link_to_inline_edit object, attribute, values.assoc(object.send(attribute))[1] end
|
24
25
26
|
# File 'lib/app/helpers/form_elements/radio_button.rb', line 24
def radio_button_update(object, attribute)
object[attribute.to_s.to_sym] = params[attribute.to_s.to_sym]
end
|
#scale_with_integers_edit(object, attribute) ⇒ Object
13
14
15
16
17
|
# File 'lib/app/helpers/form_elements/scale_with_integers.rb', line 13
def scale_with_integers_edit(object, attribute)
values = attribute_values(object, attribute)
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
end
|
#scale_with_integers_show(object, attribute) ⇒ Object
scale_with_integers generates a scale with the given list of integers as options
values must be a Range or a one-dimensional array of Integers
8
9
10
11
|
# File 'lib/app/helpers/form_elements/scale_with_integers.rb', line 8
def scale_with_integers_show(object, attribute)
values = attribute_values(object, attribute)
link_to_inline_edit object, attribute, values[object.send(attribute).to_s]
end
|
#scale_with_integers_update(object, attribute) ⇒ Object
19
20
21
|
# File 'lib/app/helpers/form_elements/scale_with_integers.rb', line 19
def scale_with_integers_update(object, attribute)
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
end
|
#scale_with_values_edit(object, attribute) ⇒ Object
12
13
14
15
16
|
# File 'lib/app/helpers/form_elements/scale_with_values.rb', line 12
def scale_with_values_edit(object, attribute)
values = attribute_values(object, attribute)
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
end
|
#scale_with_values_show(object, attribute) ⇒ Object
scale_with_values generates a scale with the given list of values as options
values must be a hash { integer => string, … } or an one-dimensional array of strings
7
8
9
10
|
# File 'lib/app/helpers/form_elements/scale_with_values.rb', line 7
def scale_with_values_show(object, attribute)
values = attribute_values(object, attribute)
link_to_inline_edit object, attribute, values[object.send(attribute)][1]
end
|
#scale_with_values_update(object, attribute) ⇒ Object
18
19
20
|
# File 'lib/app/helpers/form_elements/scale_with_values.rb', line 18
def scale_with_values_update(object, attribute)
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
end
|
#slider_with_values_edit(object, attribute) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/app/helpers/form_elements/slider_with_values.rb', line 36
def slider_with_values_edit(object, attribute)
values = attribute_values(object, attribute)
css_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
out = "".html_safe
out << "<div class='slider slider_#{attribute.to_s}' id='slider_#{css_id}'></div>".html_safe
out << "<div class='slider_value' id='value_#{css_id}'>#{values[object.send(attribute)][1]}</div>".html_safe
out << "<div style='clear: both' />".html_safe
out << "<input type='hidden' name='_#{object.class.to_s.underscore}[#{attribute}]' value='0' id='input_#{css_id}' />".html_safe
out << ('<script>
$(function() {
var displayvalues = ' + values.collect {|x| x[1]}.inspect + ';
$( "#slider_' + css_id + '" ).slider(
{
value:' + object.send(attribute).to_s + ',
range: "min",
min: 0,
max: 5,
step: 1,
slide: function( event, ui ) {
$( "#input_' + css_id + '" ).val( ui.value );
$( "#value_' + css_id + '" ).html( displayvalues[ui.value] );
}
}
);
$( "#value_' + css_id + '" ).html(displayvalues[' + object.send(attribute).to_s + ']);
$( "#input_' + css_id + '" ).val(' + object.send(attribute).to_s + ');
});
</script>').html_safe
out
end
|
#slider_with_values_show(object, attribute) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/app/helpers/form_elements/slider_with_values.rb', line 4
def slider_with_values_show(object, attribute)
values = attribute_values(object, attribute)
value = object.send(attribute)
display_value = values[value][1]
css_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
if value == 0
out = "?"
else
out = "".html_safe
out << "<div class='slider slider_#{attribute.to_s}' id='slider_#{css_id}'></div>".html_safe
out << "<div class='slider_value' id='value_#{css_id}'>#{display_value}</div>".html_safe
out << "<div style='clear: both' />".html_safe
out << "<input type='hidden' name='_#{object.class.to_s.underscore}[#{attribute}]' value='0' id='input_#{css_id}' />".html_safe
out << ('<script>
$(function() {
var displayvalues = ' + values.collect {|x| x[1]}.inspect + ';
$( "#slider_' + css_id + '" ).slider(
{
value:' + object.send(attribute).to_s + ',
range: "min",
disabled: true,
min: 0,
max: 5,
step: 1,
}
);
});
</script>').html_safe
end
link_to_inline_edit object, attribute, out
end
|
#slider_with_values_update(object, attribute) ⇒ Object
67
68
69
|
# File 'lib/app/helpers/form_elements/slider_with_values.rb', line 67
def slider_with_values_update(object, attribute)
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
end
|
#text_area_edit(object, attribute) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/app/helpers/form_elements/text_area.rb', line 28
def text_area_edit(object, attribute)
if defined? Ckeditor
cktext_area_tag(
attribute,
object[attribute],
:input_html => { :id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
:width => '100%'},
:height => '200px'
)
else
text_area_tag attribute, object[attribute], :class => 'attribute_text_area'
end
end
|
#text_area_show(object, attribute) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/app/helpers/form_elements/text_area.rb', line 3
def text_area_show(object, attribute)
if defined? Ckeditor
link_to_inline_edit object,
attribute,
'<div class="ckeditor_area">'.html_safe +
cktext_area_tag(
attribute,
object[attribute],
:input_html => { :id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
:width => '100%' },
:height => '200px',
:toolbar => "None",
:readOnly => "true",
:resize_enabled => "false",
:toolbarCanCollapse => "false"
) +
image_tag( 'glass_plate.gif',
:class => "glass_plate",
:title => '' ) +
'</div>'.html_safe
else
link_to_inline_edit object, attribute, object[attribute]
end
end
|
#text_area_update(object, attribute) ⇒ Object
42
43
44
|
# File 'lib/app/helpers/form_elements/text_area.rb', line 42
def text_area_update(object, attribute)
object[attribute.to_sym] = params[attribute.to_sym]
end
|
#text_field_edit(object, attribute) ⇒ Object
7
8
9
|
# File 'lib/app/helpers/form_elements/text_field.rb', line 7
def text_field_edit(object, attribute)
text_field_tag attribute, object[attribute], :class => 'input_text_field'
end
|
#text_field_show(object, attribute) ⇒ Object
3
4
5
|
# File 'lib/app/helpers/form_elements/text_field.rb', line 3
def text_field_show(object, attribute)
link_to_inline_edit object, attribute, object.send(attribute)
end
|
#text_field_update(object, attribute) ⇒ Object
11
12
13
|
# File 'lib/app/helpers/form_elements/text_field.rb', line 11
def text_field_update(object, attribute)
object[attribute.to_s.to_sym] = params[attribute.to_sym]
end
|