inline_forms 1.6.70 → 2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +42 -0
- data/bin/inline_forms +419 -40
- data/inline_forms.gemspec +1 -1
- data/lib/app/assets/images/add.png +0 -0
- data/lib/app/assets/images/close.png +0 -0
- data/lib/app/assets/images/tooltip-bubble-down-left.png +0 -0
- data/lib/app/assets/images/tooltip-bubble-down-right.png +0 -0
- data/lib/app/assets/images/tooltip-bubble-up-left.png +0 -0
- data/lib/app/assets/images/tooltip-bubble-up-right.png +0 -0
- data/lib/app/assets/images/trash.png +0 -0
- data/lib/app/assets/javascripts/ckeditor/config.js +40 -39
- data/lib/app/assets/javascripts/inline_forms.js +32 -12
- data/lib/app/assets/javascripts/inline_forms_application.js +1 -7
- data/lib/app/assets/javascripts/jquery.qtip.js +3395 -0
- data/lib/app/assets/stylesheets/inline_forms.css +399 -5
- data/lib/app/assets/stylesheets/inline_forms_application.css +3 -3
- data/lib/app/assets/stylesheets/jquery.qtip.css +567 -0
- data/lib/app/controllers/inline_forms_application_controller.rb +2 -1
- data/lib/app/controllers/inline_forms_controller.rb +2 -2
- data/lib/app/helpers/form_elements/check_list.rb +14 -7
- data/lib/app/helpers/form_elements/date.rb +8 -3
- data/lib/app/helpers/form_elements/dropdown.rb +1 -1
- data/lib/app/helpers/form_elements/dropdown_with_values.rb +1 -1
- data/lib/app/helpers/form_elements/plain_text_area.rb +1 -1
- data/lib/app/helpers/form_elements/radio_button.rb +6 -5
- data/lib/app/helpers/form_elements/slider_with_values.rb +1 -1
- data/lib/app/helpers/form_elements/text_area.rb +10 -12
- data/lib/app/helpers/form_elements/text_area_without_ckeditor.rb +1 -1
- data/lib/app/helpers/form_elements/text_field.rb +2 -2
- data/lib/app/helpers/inline_forms_helper.rb +37 -32
- data/lib/app/views/inline_forms/_close.html.erb +2 -12
- data/lib/app/views/inline_forms/_edit.html.erb +21 -54
- data/lib/app/views/inline_forms/_header.html.erb +1 -0
- data/lib/app/views/inline_forms/_list.html.erb +24 -28
- data/lib/app/views/inline_forms/_new.html.erb +50 -52
- data/lib/app/views/inline_forms/_show.html.erb +39 -83
- data/lib/app/views/layouts/devise.html.erb +14 -4
- data/lib/app/views/layouts/inline_forms.html.erb +23 -15
- data/lib/inline_forms/version.rb +1 -1
- metadata +41 -23
- checksums.yaml +0 -15
- data/bin/inline_forms_app_template.rb +0 -16
- data/bin/inline_forms_installer_core.rb +0 -423
- data/lib/app/helpers/form_elements/decimal_field.rb +0 -15
- data/lib/app/helpers/form_elements/dropdown_with_other.rb +0 -153
- data/lib/app/helpers/form_elements/info_list.rb +0 -22
- data/lib/app/helpers/form_elements/integer_field.rb +0 -15
- data/lib/app/helpers/form_elements/kansen_slider.rb +0 -89
- data/lib/app/helpers/form_elements/month_year_picker.rb +0 -33
- data/lib/app/helpers/form_elements/move.rb +0 -17
- data/lib/app/views/inline_forms/_flash.html.erb +0 -13
- data/lib/app/views/inline_forms/_new_nested.html.erb +0 -43
- data/lib/app/views/inline_forms/_tree.html.erb +0 -46
@@ -9,8 +9,9 @@ class InlineFormsApplicationController < ActionController::Base
|
|
9
9
|
#set the locale based on the subdomain
|
10
10
|
def set_locale
|
11
11
|
I18n.locale = extract_locale_from_subdomain || I18n.default_locale
|
12
|
+
|
12
13
|
end
|
13
|
-
|
14
|
+
|
14
15
|
# Get locale code from request subdomain (like http://it.application.local:3000)
|
15
16
|
def extract_locale_from_subdomain
|
16
17
|
locale = request.subdomains.first
|
@@ -113,7 +113,7 @@ class InlineFormsController < ApplicationController
|
|
113
113
|
@update_span = params[:update]
|
114
114
|
attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list
|
115
115
|
attributes.each do | attribute, name, form_element |
|
116
|
-
send("#{form_element.to_s}_update", @object, attribute) unless form_element == :
|
116
|
+
send("#{form_element.to_s}_update", @object, attribute) unless form_element == :associated || (cancan_enabled? && cannot?(:read, @Klass.to_s.underscore.pluralize.to_sym, attribute))
|
117
117
|
end
|
118
118
|
@parent_class = params[:parent_class]
|
119
119
|
@parent_id = params[:parent_id]
|
@@ -206,7 +206,7 @@ class InlineFormsController < ApplicationController
|
|
206
206
|
# Thanks Ryan Bates: http://railscasts.com/episodes/255-undo-with-paper-trail
|
207
207
|
def revert
|
208
208
|
@update_span = params[:update]
|
209
|
-
@version =
|
209
|
+
@version = Version.find(params[:id])
|
210
210
|
@version.reify.save!
|
211
211
|
@object = @Klass.find(@version.item_id)
|
212
212
|
authorize!(:revert, @object) if cancan_enabled?
|
@@ -3,13 +3,14 @@ InlineForms::SPECIAL_COLUMN_TYPES[:check_list]=:no_migration
|
|
3
3
|
|
4
4
|
# checklist
|
5
5
|
def check_list_show(object, attribute)
|
6
|
-
out = ''
|
7
|
-
out
|
6
|
+
out = '<ul class="checklist">'
|
7
|
+
out << link_to_inline_edit(object, attribute) if object.send(attribute).empty?
|
8
8
|
object.send(attribute).sort.each do | item |
|
9
|
-
out <<
|
9
|
+
out << '<li>'
|
10
10
|
out << link_to_inline_edit(object, attribute, item._presentation )
|
11
|
-
out << '</
|
11
|
+
out << '</li>'
|
12
12
|
end
|
13
|
+
out << '</ul>'
|
13
14
|
out.html_safe
|
14
15
|
end
|
15
16
|
|
@@ -20,13 +21,19 @@ def check_list_edit(object, attribute)
|
|
20
21
|
else
|
21
22
|
values = object.send(attribute).first.class.name.constantize.order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
|
22
23
|
end
|
23
|
-
out = ''
|
24
|
+
out = '<div class="edit_form_checklist">'
|
25
|
+
out << '<ul>'
|
24
26
|
values.each do | item |
|
25
|
-
out <<
|
27
|
+
out << '<li>'
|
26
28
|
out << check_box_tag( attribute.to_s + '[' + item.id.to_s + ']', 1, object.send(attribute.to_s.singularize + "_ids").include?(item.id) )
|
27
|
-
out <<
|
29
|
+
out << '<div class="edit_form_checklist_text">'
|
30
|
+
out << h(item._presentation)
|
28
31
|
out << '</div>'
|
32
|
+
out << '<div style="clear: both;"></div>'
|
33
|
+
out << '</li>'
|
29
34
|
end
|
35
|
+
out << '</ul>'
|
36
|
+
out << '</div>'
|
30
37
|
out.html_safe
|
31
38
|
end
|
32
39
|
|
@@ -3,13 +3,18 @@ InlineForms::SPECIAL_COLUMN_TYPES[:date_select]=:date
|
|
3
3
|
|
4
4
|
# date
|
5
5
|
def date_select_show(object, attribute)
|
6
|
-
link_to_inline_edit object, attribute, object.send(attribute).nil? ? "
|
6
|
+
link_to_inline_edit object, attribute, object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y")
|
7
7
|
end
|
8
8
|
|
9
9
|
def date_select_edit(object, attribute)
|
10
10
|
css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
|
11
|
-
out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id
|
12
|
-
out <<
|
11
|
+
out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id
|
12
|
+
out << '<SCRIPT>'.html_safe
|
13
|
+
out << "$(function() { ".html_safe
|
14
|
+
out << '$("#'.html_safe + css_id.html_safe + '").datepicker({ yearRange: "-100:+5" });'.html_safe
|
15
|
+
out << '});'.html_safe
|
16
|
+
out << '</SCRIPT>'.html_safe
|
17
|
+
return out
|
13
18
|
end
|
14
19
|
|
15
20
|
def date_select_update(object, attribute)
|
@@ -3,7 +3,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown]=:belongs_to
|
|
3
3
|
|
4
4
|
# dropdown
|
5
5
|
def dropdown_show(object, attribute)
|
6
|
-
attribute_value = object.send(attribute)._presentation rescue
|
6
|
+
attribute_value = object.send(attribute)._presentation rescue nil
|
7
7
|
link_to_inline_edit object, attribute, attribute_value
|
8
8
|
end
|
9
9
|
|
@@ -4,7 +4,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_values]=:integer
|
|
4
4
|
# dropdown_with_values
|
5
5
|
def dropdown_with_values_show(object, attribute)
|
6
6
|
values = attribute_values(object, attribute)
|
7
|
-
link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : "
|
7
|
+
link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : ""
|
8
8
|
end
|
9
9
|
def dropdown_with_values_edit(object, attribute)
|
10
10
|
# the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
|
@@ -2,7 +2,7 @@
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:plain_text_area]=:text
|
3
3
|
|
4
4
|
def plain_text_area_show(object, attribute)
|
5
|
-
link_to_inline_edit object, attribute,
|
5
|
+
link_to_inline_edit object, attribute, object[attribute] #.empty? ? 'Click here to edit' : object[attribute]
|
6
6
|
end
|
7
7
|
|
8
8
|
def plain_text_area_edit(object, attribute)
|
@@ -10,15 +10,16 @@ def radio_button_show(object, attribute)
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def radio_button_edit(object, attribute)
|
13
|
-
out =''
|
13
|
+
out ='<ul class="radio_list">'
|
14
14
|
values = attribute_values(object, attribute)
|
15
15
|
values.each do |key,value|
|
16
|
-
out <<
|
16
|
+
out << '<li>'
|
17
17
|
out << radio_button_tag(attribute.to_s, key, key == object.send(attribute))
|
18
|
-
out <<
|
19
|
-
out << '</
|
18
|
+
out << value
|
19
|
+
out << '</li>'
|
20
20
|
end
|
21
|
-
out
|
21
|
+
out << '</ul>'
|
22
|
+
raw out
|
22
23
|
end
|
23
24
|
|
24
25
|
def radio_button_update(object, attribute)
|
@@ -9,14 +9,13 @@ def text_area_show(object, attribute)
|
|
9
9
|
cktext_area_tag(
|
10
10
|
attribute,
|
11
11
|
object[attribute],
|
12
|
-
:id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
12
|
+
:input_html => { :id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
13
|
+
:width => '100%' },
|
14
|
+
:height => '200px',
|
15
|
+
:toolbar => "None",
|
16
|
+
:readOnly => "true",
|
17
|
+
:resize_enabled => "false",
|
18
|
+
:toolbarCanCollapse => "false"
|
20
19
|
) +
|
21
20
|
image_tag( 'glass_plate.gif',
|
22
21
|
:class => "glass_plate",
|
@@ -32,10 +31,9 @@ def text_area_edit(object, attribute)
|
|
32
31
|
cktext_area_tag(
|
33
32
|
attribute,
|
34
33
|
object[attribute],
|
35
|
-
:id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
36
|
-
|
37
|
-
|
38
|
-
}
|
34
|
+
:input_html => { :id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
35
|
+
:width => '100%'},
|
36
|
+
:height => '200px'
|
39
37
|
)
|
40
38
|
else
|
41
39
|
text_area_tag attribute, object[attribute], :class => 'attribute_text_area'
|
@@ -2,7 +2,7 @@
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:text_area_without_ckeditor]=:text
|
3
3
|
|
4
4
|
def text_area_without_ckeditor_show(object, attribute)
|
5
|
-
link_to_inline_edit object, attribute,
|
5
|
+
link_to_inline_edit object, attribute, object[attribute]
|
6
6
|
end
|
7
7
|
|
8
8
|
def text_area_without_ckeditor_edit(object, attribute)
|
@@ -2,11 +2,11 @@
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:text_field]=:string
|
3
3
|
|
4
4
|
def text_field_show(object, attribute)
|
5
|
-
link_to_inline_edit object, attribute, (object
|
5
|
+
link_to_inline_edit object, attribute, (object.send attribute.to_sym)
|
6
6
|
end
|
7
7
|
|
8
8
|
def text_field_edit(object, attribute)
|
9
|
-
text_field_tag attribute, (object.send attribute.to_sym), :class => 'input_text_field'
|
9
|
+
text_field_tag attribute, (object.send attribute.to_sym), :class => 'input_text_field'
|
10
10
|
end
|
11
11
|
|
12
12
|
def text_field_update(object, attribute)
|
@@ -19,54 +19,35 @@ module InlineFormsHelper
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# close link
|
22
|
-
def close_link( object, update_span
|
23
|
-
link_to
|
22
|
+
def close_link( object, update_span )
|
23
|
+
link_to image_tag( 'close.png',
|
24
|
+
:class => "close_icon",
|
25
|
+
:title => t('inline_forms.view.close') ),
|
24
26
|
send( object.class.to_s.underscore + '_path',
|
25
27
|
object,
|
26
28
|
:update => update_span,
|
27
29
|
:close => true ),
|
28
|
-
:remote => true
|
29
|
-
:class => html_class,
|
30
|
-
:title => t('inline_forms.view.close')
|
30
|
+
:remote => true
|
31
31
|
end
|
32
32
|
|
33
33
|
# destroy link
|
34
34
|
def link_to_destroy( object, update_span )
|
35
35
|
if cancan_disabled? || ( can? :delete, object )
|
36
|
-
link_to
|
36
|
+
link_to image_tag( 'trash.png',
|
37
|
+
:class => "trash_icon",
|
38
|
+
:title => t('inline_forms.view.trash') ),
|
37
39
|
send( object.class.to_s.underscore + '_path',
|
38
40
|
object,
|
39
41
|
:update => update_span ),
|
40
42
|
:method => :delete,
|
41
|
-
:remote => true
|
42
|
-
:title => t('inline_forms.view.trash')
|
43
|
+
:remote => true
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
|
-
#
|
47
|
-
def
|
48
|
-
|
49
|
-
|
50
|
-
:update => update_span,
|
51
|
-
:parent_class => parent_class,
|
52
|
-
:parent_id => parent_id,
|
53
|
-
),
|
54
|
-
:remote => true,
|
55
|
-
:class => html_class,
|
56
|
-
:title => t('inline_forms.view.add_new', :model => model.model_name.human )
|
57
|
-
)
|
58
|
-
if cancan_enabled?
|
59
|
-
if can? :create, model.to_s.pluralize.underscore.to_sym
|
60
|
-
if parent_class.nil?
|
61
|
-
raw out
|
62
|
-
else
|
63
|
-
raw out if can? :update, parent_class.find(parent_id) # can update this specific parent object???
|
64
|
-
end
|
65
|
-
end
|
66
|
-
else
|
67
|
-
raw out
|
68
|
-
end
|
69
|
-
end
|
47
|
+
# # undo link
|
48
|
+
# def link_to_undo_destroy(object, update_span )
|
49
|
+
# link_to(t('inline_forms.view.undo'), revert_version_path(object.versions.scoped.last), :method => :post)
|
50
|
+
# end
|
70
51
|
|
71
52
|
# link_to_inline_edit
|
72
53
|
def link_to_inline_edit(object, attribute, attribute_value='')
|
@@ -87,6 +68,30 @@ module InlineFormsHelper
|
|
87
68
|
end
|
88
69
|
end
|
89
70
|
|
71
|
+
# link to new record
|
72
|
+
def link_to_new_record(model, path_to_new, update_span, parent_class, parent_id)
|
73
|
+
out = ""
|
74
|
+
out << "<li class='new_record_link'>"
|
75
|
+
out << (link_to image_tag( 'add.png',
|
76
|
+
:class => "new_record_icon",
|
77
|
+
:title => t('inline_forms.view.add_new', :model => model.model_name.human ) ),
|
78
|
+
send(path_to_new, :update => update_span, :parent_class => parent_class, :parent_id => parent_id ),
|
79
|
+
:remote => true)
|
80
|
+
out << "<div style='clear: both;'></div>"
|
81
|
+
out << "</li>"
|
82
|
+
if cancan_enabled?
|
83
|
+
if can? :create, model.to_s.pluralize.underscore.to_sym
|
84
|
+
if parent_class.nil?
|
85
|
+
raw out
|
86
|
+
else
|
87
|
+
raw out if can? :update, parent_class.find(parent_id) # can update this specific parent object???
|
88
|
+
end
|
89
|
+
end
|
90
|
+
else
|
91
|
+
raw out
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
90
95
|
# url to other language
|
91
96
|
def locale_url(request, locale)
|
92
97
|
subdomains = request.subdomains
|
@@ -1,12 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%= link_to_destroy(@object, @update_span) -%>
|
4
|
-
</div>
|
5
|
-
<div class="small-11 column">
|
6
|
-
<%= link_to h(@object._presentation), send(@object.class.to_s.underscore + "_path", @object, :update => @update_span), :remote => true -%>
|
7
|
-
</div>
|
8
|
-
<% else %>
|
9
|
-
<div class="small-12 column">
|
10
|
-
<%= link_to h(@object._presentation), send(@object.class.to_s.underscore + "_path", @object, :update => @update_span), :remote => true -%>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
1
|
+
<%= link_to_destroy(@object, @update_span) -%>
|
2
|
+
<%= link_to h(@object._presentation), send(@object.class.to_s.underscore + "_path", @object, :update => @update_span), :remote => true -%>
|
@@ -1,56 +1,23 @@
|
|
1
|
-
<% @BUTTONS_UNDER = [ "text_area", "kansen_slider" ] %>
|
2
1
|
<%= form_tag send(@object.class.to_s.underscore + '_path', :update => @update_span,
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<div class="small-2 columns">
|
25
|
-
<%= link_to( send( @object.class.to_s.underscore + '_path', :update => @update_span || "field_#{@attribute}_#{@object.id.to_s}",
|
26
|
-
:attribute => @attribute,
|
27
|
-
:form_element => @form_element,
|
28
|
-
:sub_id => @sub_id ),
|
29
|
-
:method => :get, # this is going to the show method!
|
30
|
-
:remote => true ) do %>
|
31
|
-
<input type="button" name="cancel" value="cancel" class="button alert postfix radius" />
|
32
|
-
<% end %>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
<% else %>
|
36
|
-
<div class="row collapse">
|
37
|
-
<div class="small-9 columns">
|
38
|
-
<%= send("#{@form_element}_edit", @object, @attribute) %>
|
39
|
-
</div>
|
40
|
-
<div class="small-1 columns">
|
41
|
-
<%= submit_tag "ok", :class => "postfix button"-%>
|
42
|
-
</div>
|
43
|
-
<div class="small-2 columns">
|
44
|
-
<%= link_to( send( @object.class.to_s.underscore + '_path', :update => @update_span || "field_#{@attribute}_#{@object.id.to_s}",
|
45
|
-
:attribute => @attribute,
|
46
|
-
:form_element => @form_element,
|
47
|
-
:sub_id => @sub_id ),
|
48
|
-
:method => :get, # this is going to the show method!
|
49
|
-
:remote => true ) do %>
|
50
|
-
<input type="button" name="cancel" value="cancel" class="button alert postfix radius" />
|
51
|
-
<% end %>
|
52
|
-
</div>
|
53
|
-
</div>
|
54
|
-
<% end%>
|
55
|
-
|
2
|
+
:attribute => @attribute,
|
3
|
+
:form_element => @form_element,
|
4
|
+
:sub_id => @sub_id ),
|
5
|
+
:method => :put, # this is going to the update method!
|
6
|
+
:multipart => true,
|
7
|
+
:class => "edit_form",
|
8
|
+
:remote => true do -%>
|
9
|
+
<div class="edit_form_field">
|
10
|
+
<%= send("#{@form_element}_edit", @object, @attribute) %>
|
11
|
+
</div>
|
12
|
+
<%= link_to( send( @object.class.to_s.underscore + '_path', :update => @update_span || "field_#{@attribute}_#{@object.id.to_s}",
|
13
|
+
:attribute => @attribute,
|
14
|
+
:form_element => @form_element,
|
15
|
+
:sub_id => @sub_id ),
|
16
|
+
:method => :get, # this is going to the show method!
|
17
|
+
:class => "edit_form_cancel",
|
18
|
+
:remote => true ) do %>
|
19
|
+
<input type="button" name="cancel" value="cancel" />
|
20
|
+
<% end %>
|
21
|
+
<%= submit_tag "ok", :class => "edit_form_submit"-%>
|
22
|
+
<div style="clear: both;"></div>
|
56
23
|
<% end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div id="Header">Inline Forms</div>
|
@@ -1,3 +1,16 @@
|
|
1
|
+
<% flash.each do |key, value| %>
|
2
|
+
<div id="flash" class="flash <%= key %>"><%= value %></div>
|
3
|
+
<%#*<script type="text/javascript">%>
|
4
|
+
<%#*$(function() { $("#flash").delay(1000).fadeToggle('2000'); } );%>
|
5
|
+
<%#*</script>%>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<!-- purpose: list objects. we come here from #index and from #new.
|
9
|
+
If we come here for the 'first' time, we dont' have parents; its just a list of objects.
|
10
|
+
But if we come here because we are called from the show partial, then we have to deal wits some parent object.
|
11
|
+
Unfortaunatlly, the way :locals work, these are local variables, like object, but if we come from a controller,
|
12
|
+
they are @object. We need this magic here to rewrite all the @variables to variables. Ugh. -->
|
13
|
+
|
1
14
|
<% ul_needed = true %>
|
2
15
|
<% if not defined?(parent_class) %>
|
3
16
|
<% # we didn't come here via _show.html.erb %>
|
@@ -34,8 +47,9 @@
|
|
34
47
|
<% objects = objects.paginate :page => params[:page], :per_page => @PER_PAGE || 5, :conditions => conditions %>
|
35
48
|
<% end %>
|
36
49
|
|
37
|
-
<%= raw "<
|
38
|
-
|
50
|
+
<%= raw "<ul id=\"#{update_span}\" class=\"inline_forms_list\">" if ul_needed -%>
|
51
|
+
<!-- # link to new -->
|
52
|
+
<%= link_to_new_record(model, path_to_new, update_span, parent_class, parent_id) -%>
|
39
53
|
<!-- # list of objects -->
|
40
54
|
<% for object in objects %>
|
41
55
|
<% if parent_class.nil? %>
|
@@ -45,24 +59,12 @@
|
|
45
59
|
<% css_class_id = parent_class.to_s.underscore + '_' + parent_id.to_s + '_' + attribute.to_s.singularize.underscore + "_" + object.id.to_s -%>
|
46
60
|
<% path_to_object = attribute.to_s.singularize.underscore + "_path" %>
|
47
61
|
<% end %>
|
48
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
<%= link_to h(object._presentation),
|
55
|
-
send( path_to_object, object, :update => css_class_id),
|
56
|
-
:remote => true -%>
|
57
|
-
</div>
|
58
|
-
<% else %>
|
59
|
-
<div class="small-12 column">
|
60
|
-
<%= link_to h(object._presentation),
|
61
|
-
send( path_to_object, object, :update => css_class_id),
|
62
|
-
:remote => true -%>
|
63
|
-
</div>
|
64
|
-
<% end %>
|
65
|
-
</div>
|
62
|
+
<li id="<%= css_class_id -%>" class="<%= cycle('odd', 'even') -%>" >
|
63
|
+
<%= link_to_destroy(object, css_class_id) -%>
|
64
|
+
<%= link_to h(object._presentation),
|
65
|
+
send( path_to_object, object, :update => css_class_id),
|
66
|
+
:remote => true -%>
|
67
|
+
</li>
|
66
68
|
<% end -%>
|
67
69
|
<!-- # pagination -->
|
68
70
|
<% if parent_id.nil? -%>
|
@@ -70,11 +72,5 @@
|
|
70
72
|
<% else %>
|
71
73
|
<% pagination = will_paginate objects, :remote => true, :params => {:controller => attribute, :action => :index, :id => nil, :parent_class => parent_class, :parent_id => parent_id, :update => "#{parent_class.to_s.underscore}_#{parent_id}_#{attribute}", :ul_needed => true } -%>
|
72
74
|
<% end %>
|
73
|
-
|
74
|
-
|
75
|
-
<div class='small-11 small-centered column'>
|
76
|
-
<%= raw pagination %>
|
77
|
-
</div>
|
78
|
-
</div>
|
79
|
-
<% end %>
|
80
|
-
<%= raw "</div>" if ul_needed -%>
|
75
|
+
<%= raw "<li class=\"#{cycle('odd', 'even')}\">" + pagination + "</li>" if pagination -%>
|
76
|
+
<%= raw "</ul>" if ul_needed -%>
|