Commit 51314a6f161ce7ae77466972073d6c46ff7c4006
1 parent
96b8283e
Exists in
master
and in
28 other branches
[custom-forms] Views
Showing
19 changed files
with
408 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,141 @@ | @@ -0,0 +1,141 @@ | ||
1 | +jQuery('.icon-edit').live('click', function() { | ||
2 | + elem = this; | ||
3 | + jQuery.fn.colorbox({ | ||
4 | + overlayClose: false, | ||
5 | + escKey: false, | ||
6 | + inline: true, | ||
7 | + href: function(){ | ||
8 | + id = jQuery(elem).attr('field_id'); | ||
9 | + type = jQuery('#fields_'+id+'_type').val().split('_')[0]; | ||
10 | + selector = '#edit-'+type+'-'+id | ||
11 | + jQuery(selector).show(); | ||
12 | + return selector | ||
13 | + } | ||
14 | + }); | ||
15 | + return false; | ||
16 | +}); | ||
17 | + | ||
18 | +jQuery('.remove-field').live('click', function(){ | ||
19 | + id = jQuery(this).attr('field_id'); | ||
20 | + jQuery('#field-'+id).slideDown(function(){ | ||
21 | + jQuery('#field-'+id).remove(); | ||
22 | + }); | ||
23 | + return false | ||
24 | +}); | ||
25 | + | ||
26 | +jQuery('.remove-option').live('click', function(){ | ||
27 | + field_id = jQuery(this).attr('field_id'); | ||
28 | + option_id = jQuery(this).attr('option_id'); | ||
29 | + selector = '#field-'+field_id+'-option-'+option_id | ||
30 | + jQuery(selector).slideDown(function(){ | ||
31 | + jQuery(selector).remove(); | ||
32 | + jQuery.colorbox.resize(); | ||
33 | + }); | ||
34 | + return false | ||
35 | +}); | ||
36 | + | ||
37 | +function updateEditText(id){ | ||
38 | + new_id = id+1 | ||
39 | + jQuery('#edit-text-'+id).attr('id', 'edit-text-'+new_id); | ||
40 | + input = jQuery('#edit-text-'+new_id+' input'); | ||
41 | + jQuery('#edit-text-'+new_id+' .colorbox-ok-button').attr('div_id', 'edit-text-'+new_id); | ||
42 | + input.attr('id', input.attr('id').replace(id,new_id)); | ||
43 | + input.attr('name', input.attr('name').replace(id,new_id)); | ||
44 | + label = jQuery('#edit-text-'+new_id+' label'); | ||
45 | + label.attr('for', label.attr('for').replace(id,new_id)); | ||
46 | +} | ||
47 | + | ||
48 | +function updateEditSelect(id){ | ||
49 | + new_id = id+1 | ||
50 | + jQuery('#edit-select-'+id).attr('id', 'edit-select-'+new_id); | ||
51 | + jQuery('#edit-select-'+new_id+' .colorbox-ok-button').attr('div_id', 'edit-select-'+new_id); | ||
52 | + jQuery('tr[id^=field-'+id+'-option').each(function(id, element){ | ||
53 | + jQuery(element).attr('id', jQuery(element).attr('id').replace('field-'+id,'field-'+new_id)); | ||
54 | + }); | ||
55 | + jQuery('#edit-select-'+new_id+' label').each(function(index, element){ | ||
56 | + label = jQuery(element); | ||
57 | + label.attr('for', label.attr('for').replace(id,new_id)); | ||
58 | + }); | ||
59 | + jQuery('#edit-select-'+new_id+' input').each(function(index, element){ | ||
60 | + input = jQuery(element); | ||
61 | + input.attr('id', input.attr('id').replace(id,new_id)); | ||
62 | + input.attr('name', input.attr('name').replace(id,new_id)); | ||
63 | + }); | ||
64 | + jQuery('#edit-select-'+new_id+' .remove-option').each(function(index, element){ | ||
65 | + jQuery(element).attr('field_id',new_id); | ||
66 | + }); | ||
67 | + jQuery('#edit-select-'+new_id+' .new-option').attr('field_id',new_id); | ||
68 | + jQuery('#edit-select-'+new_id+' #empty-option-'+id).attr('id','empty-option-'+new_id); | ||
69 | +} | ||
70 | + | ||
71 | +function updateEmptyField(id){ | ||
72 | + id = parseInt(id); | ||
73 | + empty_field = jQuery('#empty-field'); | ||
74 | + empty_field.attr('last_id', (id + 1).toString()); | ||
75 | + jQuery('#empty-field input').each(function(index, element){ | ||
76 | + new_id = jQuery(element).attr('id').replace(id,id+1); | ||
77 | + jQuery(element).attr('id', new_id); | ||
78 | + new_name = jQuery(element).attr('name').replace(id,id+1); | ||
79 | + jQuery(element).attr('name', new_name); | ||
80 | + }); | ||
81 | + jQuery('#empty-field select').each(function(index, element){ | ||
82 | + new_id = jQuery(element).attr('id').replace(id,id+1); | ||
83 | + jQuery(element).attr('id', new_id); | ||
84 | + new_name = jQuery(element).attr('name').replace(id,id+1); | ||
85 | + jQuery(element).attr('name', new_name); | ||
86 | + }); | ||
87 | + jQuery('#empty-field a').each(function(index, element){ | ||
88 | + jQuery(element).attr('field_id', id+1); | ||
89 | + }); | ||
90 | + updateEditText(id); | ||
91 | + updateEditSelect(id); | ||
92 | +} | ||
93 | + | ||
94 | +function updateEmptyOption(field_id, option_id){ | ||
95 | + field_id = parseInt(field_id); | ||
96 | + option_id = parseInt(option_id); | ||
97 | + new_option_id = option_id+1; | ||
98 | + empty_option = jQuery('#empty-option-'+field_id); | ||
99 | + empty_option.attr('option_id',new_option_id); | ||
100 | + jQuery('#empty-option-'+field_id+' .remove-option').attr('option_id', new_option_id); | ||
101 | + | ||
102 | + name_id = ' #fields_'+field_id+'_choices_'+option_id+'_name'; | ||
103 | + jQuery('#empty-option-'+field_id+name_id).attr('name', 'fields['+field_id+'][choices]['+new_option_id+'][name]'); | ||
104 | + jQuery('#empty-option-'+field_id+name_id).attr('id', 'fields_'+field_id+'_choices_'+new_option_id+'_name'); | ||
105 | + | ||
106 | + value_id = ' #fields_'+field_id+'_choices_'+option_id+'_value'; | ||
107 | + jQuery('#empty-option-'+field_id+value_id).attr('name', 'fields['+field_id+'][choices]['+new_option_id+'][value]'); | ||
108 | + jQuery('#empty-option-'+field_id+value_id).attr('id', 'fields_'+field_id+'_choices_'+new_option_id+'_value'); | ||
109 | +} | ||
110 | + | ||
111 | +jQuery('#new-field').live('click', function(){ | ||
112 | + empty_field = jQuery('#empty-field'); | ||
113 | + id = empty_field.attr('last_id'); | ||
114 | + edit_text = jQuery('#edit-text-'+id); | ||
115 | + edit_select = jQuery('#edit-select-'+id); | ||
116 | + new_field = empty_field.clone(); | ||
117 | + new_field.attr('id','field-'+id); | ||
118 | + new_field.insertBefore(empty_field).slideDown(); | ||
119 | + edit_text.clone().insertAfter(edit_text); | ||
120 | + edit_select.clone().insertAfter(edit_select); | ||
121 | + updateEmptyField(id); | ||
122 | + return false | ||
123 | +}); | ||
124 | + | ||
125 | +jQuery('.new-option').live('click', function(){ | ||
126 | + field_id = jQuery(this).attr('field_id'); | ||
127 | + empty_option = jQuery('#empty-option-'+field_id); | ||
128 | + option_id = empty_option.attr('option_id'); | ||
129 | + new_option = empty_option.clone(); | ||
130 | + new_option.attr('id','field-'+field_id+'-option-'+option_id); | ||
131 | + new_option.insertBefore(empty_option).slideDown(); | ||
132 | + jQuery.colorbox.resize(); | ||
133 | + updateEmptyOption(field_id, option_id); | ||
134 | + return false | ||
135 | +}); | ||
136 | + | ||
137 | +jQuery('.colorbox-ok-button').live('click', function(){ | ||
138 | + jQuery('#'+jQuery(this).attr('div_id')).hide(); | ||
139 | + jQuery.colorbox.close(); | ||
140 | + return false | ||
141 | +}); |
4.05 KB
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +.controller-profile_editor a.control-panel-custom-forms, | ||
2 | +.controller-profile_editor .msie6 a.control-panel-custom-forms { | ||
3 | + background-image: url(/plugins/custom_forms/icons/custom-forms.png) | ||
4 | +} | ||
5 | + | ||
6 | +.action-table { | ||
7 | + width: 100%; | ||
8 | + overflow: hidden; | ||
9 | +} | ||
10 | + | ||
11 | +.action-table th, | ||
12 | +.action-table td{ | ||
13 | + text-align: center; | ||
14 | +} | ||
15 | + | ||
16 | +.action-table td{ | ||
17 | + cursor: move; | ||
18 | +} | ||
19 | + | ||
20 | +.action-table .actions{ | ||
21 | + white-space: nowrap; | ||
22 | +} | ||
23 | + | ||
24 | +.action-table .new-item{ | ||
25 | + background-color: #EEE; | ||
26 | +} | ||
27 | + | ||
28 | +.edit-information { | ||
29 | + display: none; | ||
30 | +} |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_select.html.erb
0 → 100644
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +<% elem_id = "edit-select-#{counter}" %> | ||
2 | +<div id=<%= elem_id %> class='edit-information'> | ||
3 | + <h1><%= _('Options') %></h1> | ||
4 | + <table class='action-table' style='width: 420px'> | ||
5 | + <tr> | ||
6 | + <th style='width: 40%'><%= _('Name') %></th> | ||
7 | + <th style='width: 40%'><%= _('Value') %></th> | ||
8 | + <th style='width: 20%'><%= _('Actions') %></th> | ||
9 | + </tr> | ||
10 | + <% option_counter = 1 %> | ||
11 | + <% (field.choices || {}).each do |name, value| %> | ||
12 | + <%= render :partial => 'option', :locals => {:name => name, :value => value, :counter => counter, :option_counter => option_counter} %> | ||
13 | + <% option_counter += 1 %> | ||
14 | + <% end %> | ||
15 | + <%= render :partial => 'empty_option', :locals => {:counter => counter, :option_counter => option_counter} %> | ||
16 | + <tr class='new-item'> | ||
17 | + <td colspan='3'><strong><%= link_to(_('NEW OPTION'), '#', :class => 'new-option', :field_id => counter)%></strong></td> | ||
18 | + </tr> | ||
19 | + </table> | ||
20 | + | ||
21 | + <h2><%= _('Type') %></h2> | ||
22 | + <%#= labelled_check_box _('List'), "fields[#{counter}][list]", true, field.list %> | ||
23 | + <%#= labelled_check_box _('Multiple'), "fields[#{counter}][multiple]", true, field.multiple %> | ||
24 | + <%= labelled_radio_button 'Radio', "fields[#{counter}][kind]", 'radio', !field.multiple && !field.list %><br /> | ||
25 | + <%= labelled_radio_button 'Check Box', "fields[#{counter}][kind]", 'check_box', field.multiple && !field.list %><br /> | ||
26 | + <%= labelled_radio_button 'Select', "fields[#{counter}][kind]", 'select', !field.multiple && field.list %><br /> | ||
27 | + <%= labelled_radio_button 'Multiple Select', "fields[#{counter}][kind]", 'multiple_select', field.multiple && field.list %><br /> | ||
28 | + | ||
29 | + <% button_bar do %> | ||
30 | + <%= button :ok, _('Ok'), '#', :class => 'colorbox-ok-button', :div_id => elem_id %> | ||
31 | + <% end %> | ||
32 | +</div> | ||
33 | + |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_text.html.erb
0 → 100644
@@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
1 | +<% elem_id = "edit-text-#{counter}" %> | ||
2 | +<div id=<%= elem_id %> class='edit-information'> | ||
3 | + <%= labelled_form_field _('Default value'), text_field("fields[#{counter}]", :default_value, :value => field.default_value) %> | ||
4 | + | ||
5 | + <% button_bar do %> | ||
6 | + <%= button :ok, _('Ok'), '#', :class => 'colorbox-ok-button', :div_id => elem_id %> | ||
7 | + <% end %> | ||
8 | +</div> | ||
9 | + |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_field.html.erb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +<tr id="empty-field" style='display: none' last_id=<%= counter %>> | ||
2 | + <td style="text-align: left"><%= text_field "fields[#{counter}]", :name %></td> | ||
3 | + <td><%= select "fields[#{counter}]", :type, type_options, :selected => type_for_options(field.class) %></td> | ||
4 | + <td><%= check_box "fields[#{counter}]", :mandatory %></td> | ||
5 | + <%= hidden_field "fields[#{counter}]", :form_id, :value => @form.id %> | ||
6 | + <td class='actions'> | ||
7 | + <%= button_without_text :edit, _('Edit'), '', :field_id => counter %> | ||
8 | + <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-field', :field_id => counter, :confirm => _('Are you sure you want to remove this field?') %> | ||
9 | + </td> | ||
10 | +</tr> |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_option.html.erb
0 → 100644
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
1 | +<tr id=<%= "empty-option-#{counter}" %> option_id=<%= option_counter %> style="display: none;"> | ||
2 | + <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][name]") %></td> | ||
3 | + <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][value]") %></td> | ||
4 | + <td class='actions'> | ||
5 | + <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-option', :field_id => counter, :option_id => option_counter, :confirm => _('Are you sure you want to remove this option?') %> | ||
6 | + </td> | ||
7 | +</tr> | ||
8 | + |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_field.html.erb
0 → 100644
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +<tr id=<%= "field-#{counter}" %>> | ||
2 | + <td style="text-align: left"><%= text_field "fields[#{counter}]", :name, :value => field.name %></td> | ||
3 | + <td><%= type_to_label(field.type) %></td> | ||
4 | + <%= hidden_field "fields[#{counter}]", :type, :value => type_for_options(field.class) %> | ||
5 | + <td><%= check_box "fields[#{counter}]", :mandatory, :checked => field.mandatory %></td> | ||
6 | + <%= hidden_field "fields[#{counter}]", :real_id, :value => field.id %> | ||
7 | + <%= hidden_field "fields[#{counter}]", :form_id, :value => @form.id %> | ||
8 | + <td class='actions'> | ||
9 | + <%= button_without_text :edit, _('Edit'), '#', :field_id => counter %> | ||
10 | + <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-field', :field_id => counter, :confirm => _('Are you sure you want to remove this field?') %> | ||
11 | + </td> | ||
12 | +</tr> |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb
0 → 100644
@@ -0,0 +1,54 @@ | @@ -0,0 +1,54 @@ | ||
1 | +<% self.extend(CustomFormsPlugin::Helper) %> | ||
2 | + | ||
3 | +<%= error_messages_for :form %> | ||
4 | + | ||
5 | +<% form_for :form, @form do |f| %> | ||
6 | + <%= required labelled_form_field _('Name'), f.text_field(:name) %> | ||
7 | + <%= labelled_form_field(_('Período'), ( | ||
8 | + date_range_field('form[begining]', 'form[ending]', @form.begining, @form.ending, | ||
9 | + '%Y-%m-%d %H:%M', | ||
10 | + { :time => true, :change_month => true, :change_year => true, | ||
11 | + :date_format => 'yy-mm-dd', :time_format => 'hh:mm' }, | ||
12 | + { :size => 14 }) | ||
13 | + )) %> | ||
14 | + <%= labelled_form_field _('Access'), f.select(:access, access_options(profile))%> | ||
15 | + <% if profile.organization? %> | ||
16 | + <%= labelled_form_field _('Triggered on membership'), f.check_box(:on_membership) %> | ||
17 | + <% end %> | ||
18 | + <%= labelled_form_field _('Description'), f.text_area(:description, :style => 'width: 100%') %> | ||
19 | + | ||
20 | + <h2><%= _('Fields') %></h2> | ||
21 | + <table class="action-table" id='fields-table'> | ||
22 | + <tr> | ||
23 | + <th style='width: 40%'><%= _('Name') %></th> | ||
24 | + <th style='width: 30%'><%= _('Type') %></th> | ||
25 | + <th style='width: 10%'><%= _('Mandatory') %></th> | ||
26 | + <th style='width: 20%'><%= _('Actions') %></th> | ||
27 | + </tr> | ||
28 | + <% counter = 1 %> | ||
29 | + <% @fields.each do |field| %> | ||
30 | + <%= render :partial => 'field', :locals => {:field => field, :counter => counter} %> | ||
31 | + <% counter += 1 %> | ||
32 | + <% end %> | ||
33 | + <%= render :partial => 'empty_field', :locals => {:field => @empty_field, :counter => counter} %> | ||
34 | + <tr class='new-item'> | ||
35 | + <td colspan='5'><strong><%= link_to(_('NEW FIELD'), '#', :id => 'new-field')%></strong></td> | ||
36 | + </tr> | ||
37 | + </table> | ||
38 | + | ||
39 | + <% counter = 1 %> | ||
40 | + <% @fields.each do |field| %> | ||
41 | + <%= render :partial => 'edit_text', :locals => {:field => field, :counter => counter} %> | ||
42 | + <%= render :partial => 'edit_select', :locals => {:field => field, :counter => counter} %> | ||
43 | + <% counter += 1 %> | ||
44 | + <% end %> | ||
45 | + | ||
46 | + <%= render :partial => 'edit_text', :locals => {:field => @empty_field, :counter => counter} %> | ||
47 | + <%= render :partial => 'edit_select', :locals => {:field => @empty_field, :counter => counter} %> | ||
48 | + | ||
49 | + <% button_bar do %> | ||
50 | + <%= submit_button :save, _('Save'), :cancel => {:action => 'index'}%> | ||
51 | + <% end %> | ||
52 | +<% end %> | ||
53 | + | ||
54 | +<%= javascript_include_tag '../plugins/custom_forms/field' %> |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_option.html.erb
0 → 100644
@@ -0,0 +1,7 @@ | @@ -0,0 +1,7 @@ | ||
1 | +<tr id=<%= "field-#{counter}-option-#{option_counter}" %> style="display: auto;"> | ||
2 | + <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][name]", name) %></td> | ||
3 | + <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][value]", value) %></td> | ||
4 | + <td class='actions'> | ||
5 | + <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-option', :field_id => counter, :option_id => option_counter, :confirm => _('Are you sure you want to remove this option?') %> | ||
6 | + </td> | ||
7 | +</tr> |
plugins/custom_forms/views/custom_forms_plugin_myprofile/create.html.erb
0 → 100644
plugins/custom_forms/views/custom_forms_plugin_myprofile/edit.html.erb
0 → 100644
plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb
0 → 100644
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +<% self.extend CustomFormsPlugin::Helper %> | ||
2 | + | ||
3 | +<h1><%= _('Manage forms') %></h1> | ||
4 | +<table class="action-table"> | ||
5 | + <tr> | ||
6 | + <th style='width: 40%'><%= _('Name') %></th> | ||
7 | + <th style='width: 30%'><%= _('Period') %></th> | ||
8 | + <th style='width: 10%'><%= _('Submissions') %></th> | ||
9 | + <th style='width: 10%'><%= _('Access') %></th> | ||
10 | + <th style='width: 10%'><%= _('Actions') %></th> | ||
11 | + </tr> | ||
12 | + <% @forms.each do |form| %> | ||
13 | + <tr> | ||
14 | + <td><%= form.name %></td> | ||
15 | + <td><%= period_range(form) %></td> | ||
16 | + <td><%= form.submissions.count > 0 ? link_to(form.submissions.count, {:action => 'submissions', :id => form.id}) : 0 %></td> | ||
17 | + <td><%= access_text(form) %></td> | ||
18 | + <td class="actions"> | ||
19 | + <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => form.id %> | ||
20 | + <%= button_without_text :remove, _('Remove'), {:action => 'remove', :id => form.id}, :confirm => _('Are you sure you want to remove this form?') %></td> | ||
21 | + </tr> | ||
22 | + <% end %> | ||
23 | + <tr id="new-item"> | ||
24 | + <td colspan='5'><strong><%= link_to(_('NEW FORM'), :action => 'create')%></strong></td> | ||
25 | + </tr> | ||
26 | +</table> |
plugins/custom_forms/views/custom_forms_plugin_myprofile/show_submission.html.erb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +<h1><%= @form.name %></h1> | ||
2 | +<p><%= @form.description %></p> | ||
3 | + | ||
4 | +<% fields_for :submission, @submission do |f| %> | ||
5 | + <%= render :partial => 'shared/form_submission', :locals => {:f => f} %> | ||
6 | +<% end %> | ||
7 | + | ||
8 | +<% button_bar do %> | ||
9 | + <%= button :back, _('Back to submissions'), :action => 'submissions', :id => @form.id %> | ||
10 | +<% end %> |
plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb
0 → 100644
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +<% self.extend CustomFormsPlugin::Helper %> | ||
2 | + | ||
3 | +<h1><%= _('Submissions for %s') % @form.name %></h1> | ||
4 | + | ||
5 | +<% if @form.submissions.empty? %> | ||
6 | + <%= _('There are no submissions for this form.') %> | ||
7 | +<% else %> | ||
8 | + <table class="action-table"> | ||
9 | + <tr> | ||
10 | + <th style='width: 50%'><%= _('Author') %></th> | ||
11 | + <th style='width: 50%'><%= _('Time') %></th> | ||
12 | + </tr> | ||
13 | + <% @submissions.each do |submission| %> | ||
14 | + <tr> | ||
15 | + <% author = submission.profile.present? ? submission.profile.name : submission.author_name %> | ||
16 | + <td><%= link_to(author, {:action => 'show_submission', :id => submission.id}) %></td> | ||
17 | + <td><%= time_format(submission.created_at) %></td> | ||
18 | + </tr> | ||
19 | + <% end %> | ||
20 | + </table> | ||
21 | +<% end %> | ||
22 | + | ||
23 | +<% button_bar do %> | ||
24 | + <%= button :back, _('Back to forms'), :action => 'index' %> | ||
25 | +<% end %> |
plugins/custom_forms/views/custom_forms_plugin_profile/show.html.erb
0 → 100644
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +<h1><%= @form.name %></h1> | ||
2 | +<p><%= @form.description %></p> | ||
3 | + | ||
4 | +<% if @submission.id.nil? %> | ||
5 | + <%= error_messages_for :submission %> | ||
6 | + | ||
7 | + <% form_for :submission, @submission do |f| %> | ||
8 | + <% if !user %> | ||
9 | + <%= required labelled_form_field _('Author name'), text_field_tag(:author_name, @submission.author_name) %> | ||
10 | + <%= required labelled_form_field _('Author email'), text_field_tag(:author_email, @submission.author_email) %> | ||
11 | + <% end %> | ||
12 | + | ||
13 | + <%= render :partial => 'shared/form_submission', :locals => {:f => f} %> | ||
14 | + | ||
15 | + <% button_bar do %> | ||
16 | + <%= submit_button :save, _('Save'), :cancel => {:action => 'index'} %> | ||
17 | + <% end %> | ||
18 | + <% end %> | ||
19 | +<% else %> | ||
20 | + <% fields_for :submission, @submission do |f| %> | ||
21 | + <%= render :partial => 'shared/form_submission', :locals => {:f => f} %> | ||
22 | + <% end %> | ||
23 | +<% end %> |
plugins/custom_forms/views/shared/_form_submission.html.erb
0 → 100644
plugins/custom_forms/views/tasks/_membership_survey_accept_details.html.erb
0 → 100644
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +<%= f.object_name.to_s %> |
plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +<% @form = CustomFormsPlugin::Form.find(task.form_id) %> | ||
2 | +<% @submission = CustomFormsPlugin::Submission.new(:form_id => @form.id, :profile_id => user.id) %> | ||
3 | + | ||
4 | +<h2><%= @form.name %></h2> | ||
5 | +<p><%= @form.description %></p> | ||
6 | + | ||
7 | +<% f.fields_for :submission do |fi| %> | ||
8 | + <%#= fi.error_messages_for :submission %> | ||
9 | + <%= render :partial => 'shared/form_submission', :locals => {:f => fi} %> | ||
10 | +<% end %> |