From 51314a6f161ce7ae77466972073d6c46ff7c4006 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Mon, 10 Sep 2012 16:50:42 -0300 Subject: [PATCH] [custom-forms] Views --- plugins/custom_forms/public/field.js | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/custom_forms/public/icons/custom-forms.png | Bin 0 -> 4147 bytes plugins/custom_forms/public/style.css | 30 ++++++++++++++++++++++++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_select.html.erb | 33 +++++++++++++++++++++++++++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_text.html.erb | 9 +++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_field.html.erb | 10 ++++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_option.html.erb | 8 ++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/_field.html.erb | 12 ++++++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/_option.html.erb | 7 +++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/create.html.erb | 2 ++ plugins/custom_forms/views/custom_forms_plugin_myprofile/edit.html.erb | 2 ++ plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb | 26 ++++++++++++++++++++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/show_submission.html.erb | 10 ++++++++++ plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb | 25 +++++++++++++++++++++++++ plugins/custom_forms/views/custom_forms_plugin_profile/show.html.erb | 23 +++++++++++++++++++++++ plugins/custom_forms/views/shared/_form_submission.html.erb | 5 +++++ plugins/custom_forms/views/tasks/_membership_survey_accept_details.html.erb | 1 + plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb | 10 ++++++++++ 19 files changed, 408 insertions(+), 0 deletions(-) create mode 100644 plugins/custom_forms/public/field.js create mode 100644 plugins/custom_forms/public/icons/custom-forms.png create mode 100644 plugins/custom_forms/public/style.css create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_select.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_text.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_field.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_option.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/_field.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/_option.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/create.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/edit.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/show_submission.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb create mode 100644 plugins/custom_forms/views/custom_forms_plugin_profile/show.html.erb create mode 100644 plugins/custom_forms/views/shared/_form_submission.html.erb create mode 100644 plugins/custom_forms/views/tasks/_membership_survey_accept_details.html.erb create mode 100644 plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb diff --git a/plugins/custom_forms/public/field.js b/plugins/custom_forms/public/field.js new file mode 100644 index 0000000..9ea9c40 --- /dev/null +++ b/plugins/custom_forms/public/field.js @@ -0,0 +1,141 @@ +jQuery('.icon-edit').live('click', function() { + elem = this; + jQuery.fn.colorbox({ + overlayClose: false, + escKey: false, + inline: true, + href: function(){ + id = jQuery(elem).attr('field_id'); + type = jQuery('#fields_'+id+'_type').val().split('_')[0]; + selector = '#edit-'+type+'-'+id + jQuery(selector).show(); + return selector + } + }); + return false; +}); + +jQuery('.remove-field').live('click', function(){ + id = jQuery(this).attr('field_id'); + jQuery('#field-'+id).slideDown(function(){ + jQuery('#field-'+id).remove(); + }); + return false +}); + +jQuery('.remove-option').live('click', function(){ + field_id = jQuery(this).attr('field_id'); + option_id = jQuery(this).attr('option_id'); + selector = '#field-'+field_id+'-option-'+option_id + jQuery(selector).slideDown(function(){ + jQuery(selector).remove(); + jQuery.colorbox.resize(); + }); + return false +}); + +function updateEditText(id){ + new_id = id+1 + jQuery('#edit-text-'+id).attr('id', 'edit-text-'+new_id); + input = jQuery('#edit-text-'+new_id+' input'); + jQuery('#edit-text-'+new_id+' .colorbox-ok-button').attr('div_id', 'edit-text-'+new_id); + input.attr('id', input.attr('id').replace(id,new_id)); + input.attr('name', input.attr('name').replace(id,new_id)); + label = jQuery('#edit-text-'+new_id+' label'); + label.attr('for', label.attr('for').replace(id,new_id)); +} + +function updateEditSelect(id){ + new_id = id+1 + jQuery('#edit-select-'+id).attr('id', 'edit-select-'+new_id); + jQuery('#edit-select-'+new_id+' .colorbox-ok-button').attr('div_id', 'edit-select-'+new_id); + jQuery('tr[id^=field-'+id+'-option').each(function(id, element){ + jQuery(element).attr('id', jQuery(element).attr('id').replace('field-'+id,'field-'+new_id)); + }); + jQuery('#edit-select-'+new_id+' label').each(function(index, element){ + label = jQuery(element); + label.attr('for', label.attr('for').replace(id,new_id)); + }); + jQuery('#edit-select-'+new_id+' input').each(function(index, element){ + input = jQuery(element); + input.attr('id', input.attr('id').replace(id,new_id)); + input.attr('name', input.attr('name').replace(id,new_id)); + }); + jQuery('#edit-select-'+new_id+' .remove-option').each(function(index, element){ + jQuery(element).attr('field_id',new_id); + }); + jQuery('#edit-select-'+new_id+' .new-option').attr('field_id',new_id); + jQuery('#edit-select-'+new_id+' #empty-option-'+id).attr('id','empty-option-'+new_id); +} + +function updateEmptyField(id){ + id = parseInt(id); + empty_field = jQuery('#empty-field'); + empty_field.attr('last_id', (id + 1).toString()); + jQuery('#empty-field input').each(function(index, element){ + new_id = jQuery(element).attr('id').replace(id,id+1); + jQuery(element).attr('id', new_id); + new_name = jQuery(element).attr('name').replace(id,id+1); + jQuery(element).attr('name', new_name); + }); + jQuery('#empty-field select').each(function(index, element){ + new_id = jQuery(element).attr('id').replace(id,id+1); + jQuery(element).attr('id', new_id); + new_name = jQuery(element).attr('name').replace(id,id+1); + jQuery(element).attr('name', new_name); + }); + jQuery('#empty-field a').each(function(index, element){ + jQuery(element).attr('field_id', id+1); + }); + updateEditText(id); + updateEditSelect(id); +} + +function updateEmptyOption(field_id, option_id){ + field_id = parseInt(field_id); + option_id = parseInt(option_id); + new_option_id = option_id+1; + empty_option = jQuery('#empty-option-'+field_id); + empty_option.attr('option_id',new_option_id); + jQuery('#empty-option-'+field_id+' .remove-option').attr('option_id', new_option_id); + + name_id = ' #fields_'+field_id+'_choices_'+option_id+'_name'; + jQuery('#empty-option-'+field_id+name_id).attr('name', 'fields['+field_id+'][choices]['+new_option_id+'][name]'); + jQuery('#empty-option-'+field_id+name_id).attr('id', 'fields_'+field_id+'_choices_'+new_option_id+'_name'); + + value_id = ' #fields_'+field_id+'_choices_'+option_id+'_value'; + jQuery('#empty-option-'+field_id+value_id).attr('name', 'fields['+field_id+'][choices]['+new_option_id+'][value]'); + jQuery('#empty-option-'+field_id+value_id).attr('id', 'fields_'+field_id+'_choices_'+new_option_id+'_value'); +} + +jQuery('#new-field').live('click', function(){ + empty_field = jQuery('#empty-field'); + id = empty_field.attr('last_id'); + edit_text = jQuery('#edit-text-'+id); + edit_select = jQuery('#edit-select-'+id); + new_field = empty_field.clone(); + new_field.attr('id','field-'+id); + new_field.insertBefore(empty_field).slideDown(); + edit_text.clone().insertAfter(edit_text); + edit_select.clone().insertAfter(edit_select); + updateEmptyField(id); + return false +}); + +jQuery('.new-option').live('click', function(){ + field_id = jQuery(this).attr('field_id'); + empty_option = jQuery('#empty-option-'+field_id); + option_id = empty_option.attr('option_id'); + new_option = empty_option.clone(); + new_option.attr('id','field-'+field_id+'-option-'+option_id); + new_option.insertBefore(empty_option).slideDown(); + jQuery.colorbox.resize(); + updateEmptyOption(field_id, option_id); + return false +}); + +jQuery('.colorbox-ok-button').live('click', function(){ + jQuery('#'+jQuery(this).attr('div_id')).hide(); + jQuery.colorbox.close(); + return false +}); diff --git a/plugins/custom_forms/public/icons/custom-forms.png b/plugins/custom_forms/public/icons/custom-forms.png new file mode 100644 index 0000000..51122ee Binary files /dev/null and b/plugins/custom_forms/public/icons/custom-forms.png differ diff --git a/plugins/custom_forms/public/style.css b/plugins/custom_forms/public/style.css new file mode 100644 index 0000000..a5b48bc --- /dev/null +++ b/plugins/custom_forms/public/style.css @@ -0,0 +1,30 @@ +.controller-profile_editor a.control-panel-custom-forms, +.controller-profile_editor .msie6 a.control-panel-custom-forms { + background-image: url(/plugins/custom_forms/icons/custom-forms.png) +} + +.action-table { + width: 100%; + overflow: hidden; +} + +.action-table th, +.action-table td{ + text-align: center; +} + +.action-table td{ + cursor: move; +} + +.action-table .actions{ + white-space: nowrap; +} + +.action-table .new-item{ + background-color: #EEE; +} + +.edit-information { + display: none; +} diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_select.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_select.html.erb new file mode 100644 index 0000000..7f1c96b --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_select.html.erb @@ -0,0 +1,33 @@ +<% elem_id = "edit-select-#{counter}" %> +
class='edit-information'> +

<%= _('Options') %>

+ + + + + + + <% option_counter = 1 %> + <% (field.choices || {}).each do |name, value| %> + <%= render :partial => 'option', :locals => {:name => name, :value => value, :counter => counter, :option_counter => option_counter} %> + <% option_counter += 1 %> + <% end %> + <%= render :partial => 'empty_option', :locals => {:counter => counter, :option_counter => option_counter} %> + + + +
<%= _('Name') %><%= _('Value') %><%= _('Actions') %>
<%= link_to(_('NEW OPTION'), '#', :class => 'new-option', :field_id => counter)%>
+ +

<%= _('Type') %>

+ <%#= labelled_check_box _('List'), "fields[#{counter}][list]", true, field.list %> + <%#= labelled_check_box _('Multiple'), "fields[#{counter}][multiple]", true, field.multiple %> + <%= labelled_radio_button 'Radio', "fields[#{counter}][kind]", 'radio', !field.multiple && !field.list %>
+ <%= labelled_radio_button 'Check Box', "fields[#{counter}][kind]", 'check_box', field.multiple && !field.list %>
+ <%= labelled_radio_button 'Select', "fields[#{counter}][kind]", 'select', !field.multiple && field.list %>
+ <%= labelled_radio_button 'Multiple Select', "fields[#{counter}][kind]", 'multiple_select', field.multiple && field.list %>
+ + <% button_bar do %> + <%= button :ok, _('Ok'), '#', :class => 'colorbox-ok-button', :div_id => elem_id %> + <% end %> +
+ diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_text.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_text.html.erb new file mode 100644 index 0000000..968bfdf --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_text.html.erb @@ -0,0 +1,9 @@ +<% elem_id = "edit-text-#{counter}" %> +
class='edit-information'> + <%= labelled_form_field _('Default value'), text_field("fields[#{counter}]", :default_value, :value => field.default_value) %> + + <% button_bar do %> + <%= button :ok, _('Ok'), '#', :class => 'colorbox-ok-button', :div_id => elem_id %> + <% end %> +
+ diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_field.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_field.html.erb new file mode 100644 index 0000000..dad3033 --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_field.html.erb @@ -0,0 +1,10 @@ +> + <%= text_field "fields[#{counter}]", :name %> + <%= select "fields[#{counter}]", :type, type_options, :selected => type_for_options(field.class) %> + <%= check_box "fields[#{counter}]", :mandatory %> + <%= hidden_field "fields[#{counter}]", :form_id, :value => @form.id %> + + <%= button_without_text :edit, _('Edit'), '', :field_id => counter %> + <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-field', :field_id => counter, :confirm => _('Are you sure you want to remove this field?') %> + + diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_option.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_option.html.erb new file mode 100644 index 0000000..d1c9c76 --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_option.html.erb @@ -0,0 +1,8 @@ + option_id=<%= option_counter %> style="display: none;"> + <%= text_field_tag("fields[#{counter}][choices][#{option_counter}][name]") %> + <%= text_field_tag("fields[#{counter}][choices][#{option_counter}][value]") %> + + <%= 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?') %> + + + diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_field.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_field.html.erb new file mode 100644 index 0000000..68ca736 --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_field.html.erb @@ -0,0 +1,12 @@ +> + <%= text_field "fields[#{counter}]", :name, :value => field.name %> + <%= type_to_label(field.type) %> + <%= hidden_field "fields[#{counter}]", :type, :value => type_for_options(field.class) %> + <%= check_box "fields[#{counter}]", :mandatory, :checked => field.mandatory %> + <%= hidden_field "fields[#{counter}]", :real_id, :value => field.id %> + <%= hidden_field "fields[#{counter}]", :form_id, :value => @form.id %> + + <%= button_without_text :edit, _('Edit'), '#', :field_id => counter %> + <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-field', :field_id => counter, :confirm => _('Are you sure you want to remove this field?') %> + + diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb new file mode 100644 index 0000000..b739633 --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb @@ -0,0 +1,54 @@ +<% self.extend(CustomFormsPlugin::Helper) %> + +<%= error_messages_for :form %> + +<% form_for :form, @form do |f| %> + <%= required labelled_form_field _('Name'), f.text_field(:name) %> + <%= labelled_form_field(_('PerĂ­odo'), ( + date_range_field('form[begining]', 'form[ending]', @form.begining, @form.ending, + '%Y-%m-%d %H:%M', + { :time => true, :change_month => true, :change_year => true, + :date_format => 'yy-mm-dd', :time_format => 'hh:mm' }, + { :size => 14 }) + )) %> + <%= labelled_form_field _('Access'), f.select(:access, access_options(profile))%> + <% if profile.organization? %> + <%= labelled_form_field _('Triggered on membership'), f.check_box(:on_membership) %> + <% end %> + <%= labelled_form_field _('Description'), f.text_area(:description, :style => 'width: 100%') %> + +

<%= _('Fields') %>

+ + + + + + + + <% counter = 1 %> + <% @fields.each do |field| %> + <%= render :partial => 'field', :locals => {:field => field, :counter => counter} %> + <% counter += 1 %> + <% end %> + <%= render :partial => 'empty_field', :locals => {:field => @empty_field, :counter => counter} %> + + + +
<%= _('Name') %><%= _('Type') %><%= _('Mandatory') %><%= _('Actions') %>
<%= link_to(_('NEW FIELD'), '#', :id => 'new-field')%>
+ + <% counter = 1 %> + <% @fields.each do |field| %> + <%= render :partial => 'edit_text', :locals => {:field => field, :counter => counter} %> + <%= render :partial => 'edit_select', :locals => {:field => field, :counter => counter} %> + <% counter += 1 %> + <% end %> + + <%= render :partial => 'edit_text', :locals => {:field => @empty_field, :counter => counter} %> + <%= render :partial => 'edit_select', :locals => {:field => @empty_field, :counter => counter} %> + + <% button_bar do %> + <%= submit_button :save, _('Save'), :cancel => {:action => 'index'}%> + <% end %> +<% end %> + +<%= javascript_include_tag '../plugins/custom_forms/field' %> diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_option.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_option.html.erb new file mode 100644 index 0000000..b6278c4 --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_option.html.erb @@ -0,0 +1,7 @@ + style="display: auto;"> + <%= text_field_tag("fields[#{counter}][choices][#{option_counter}][name]", name) %> + <%= text_field_tag("fields[#{counter}][choices][#{option_counter}][value]", value) %> + + <%= 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?') %> + + diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/create.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/create.html.erb new file mode 100644 index 0000000..77e947e --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/create.html.erb @@ -0,0 +1,2 @@ +

<%= _('New form') %>

+<%= render :partial => 'form' %> diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/edit.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/edit.html.erb new file mode 100644 index 0000000..1aad8ee --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/edit.html.erb @@ -0,0 +1,2 @@ +

<%= _('Edit form') %>

+<%= render :partial => 'form' %> diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb new file mode 100644 index 0000000..54fcb9e --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/index.html.erb @@ -0,0 +1,26 @@ +<% self.extend CustomFormsPlugin::Helper %> + +

<%= _('Manage forms') %>

+ + + + + + + + + <% @forms.each do |form| %> + + + + + + + + <% end %> + + + +
<%= _('Name') %><%= _('Period') %><%= _('Submissions') %><%= _('Access') %><%= _('Actions') %>
<%= form.name %><%= period_range(form) %><%= form.submissions.count > 0 ? link_to(form.submissions.count, {:action => 'submissions', :id => form.id}) : 0 %><%= access_text(form) %> + <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => form.id %> + <%= button_without_text :remove, _('Remove'), {:action => 'remove', :id => form.id}, :confirm => _('Are you sure you want to remove this form?') %>
<%= link_to(_('NEW FORM'), :action => 'create')%>
diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/show_submission.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/show_submission.html.erb new file mode 100644 index 0000000..2d4dac6 --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/show_submission.html.erb @@ -0,0 +1,10 @@ +

<%= @form.name %>

+

<%= @form.description %>

+ +<% fields_for :submission, @submission do |f| %> + <%= render :partial => 'shared/form_submission', :locals => {:f => f} %> +<% end %> + +<% button_bar do %> + <%= button :back, _('Back to submissions'), :action => 'submissions', :id => @form.id %> +<% end %> diff --git a/plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb b/plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb new file mode 100644 index 0000000..e03b7e4 --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/submissions.html.erb @@ -0,0 +1,25 @@ +<% self.extend CustomFormsPlugin::Helper %> + +

<%= _('Submissions for %s') % @form.name %>

+ +<% if @form.submissions.empty? %> + <%= _('There are no submissions for this form.') %> +<% else %> + + + + + + <% @submissions.each do |submission| %> + + <% author = submission.profile.present? ? submission.profile.name : submission.author_name %> + + + + <% end %> +
<%= _('Author') %><%= _('Time') %>
<%= link_to(author, {:action => 'show_submission', :id => submission.id}) %><%= time_format(submission.created_at) %>
+<% end %> + +<% button_bar do %> + <%= button :back, _('Back to forms'), :action => 'index' %> +<% end %> diff --git a/plugins/custom_forms/views/custom_forms_plugin_profile/show.html.erb b/plugins/custom_forms/views/custom_forms_plugin_profile/show.html.erb new file mode 100644 index 0000000..fb180ec --- /dev/null +++ b/plugins/custom_forms/views/custom_forms_plugin_profile/show.html.erb @@ -0,0 +1,23 @@ +

<%= @form.name %>

+

<%= @form.description %>

+ +<% if @submission.id.nil? %> + <%= error_messages_for :submission %> + + <% form_for :submission, @submission do |f| %> + <% if !user %> + <%= required labelled_form_field _('Author name'), text_field_tag(:author_name, @submission.author_name) %> + <%= required labelled_form_field _('Author email'), text_field_tag(:author_email, @submission.author_email) %> + <% end %> + + <%= render :partial => 'shared/form_submission', :locals => {:f => f} %> + + <% button_bar do %> + <%= submit_button :save, _('Save'), :cancel => {:action => 'index'} %> + <% end %> + <% end %> +<% else %> + <% fields_for :submission, @submission do |f| %> + <%= render :partial => 'shared/form_submission', :locals => {:f => f} %> + <% end %> +<% end %> diff --git a/plugins/custom_forms/views/shared/_form_submission.html.erb b/plugins/custom_forms/views/shared/_form_submission.html.erb new file mode 100644 index 0000000..ec2f336 --- /dev/null +++ b/plugins/custom_forms/views/shared/_form_submission.html.erb @@ -0,0 +1,5 @@ +<% self.extend(CustomFormsPlugin::Helper) %> + +<% @form.fields.each do |field| %> + <%= display_custom_field(field, @submission, f.object_name) %> +<% end %> diff --git a/plugins/custom_forms/views/tasks/_membership_survey_accept_details.html.erb b/plugins/custom_forms/views/tasks/_membership_survey_accept_details.html.erb new file mode 100644 index 0000000..d07b23b --- /dev/null +++ b/plugins/custom_forms/views/tasks/_membership_survey_accept_details.html.erb @@ -0,0 +1 @@ +<%= f.object_name.to_s %> diff --git a/plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb b/plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb new file mode 100644 index 0000000..0c802be --- /dev/null +++ b/plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb @@ -0,0 +1,10 @@ +<% @form = CustomFormsPlugin::Form.find(task.form_id) %> +<% @submission = CustomFormsPlugin::Submission.new(:form_id => @form.id, :profile_id => user.id) %> + +

<%= @form.name %>

+

<%= @form.description %>

+ +<% f.fields_for :submission do |fi| %> + <%#= fi.error_messages_for :submission %> + <%= render :partial => 'shared/form_submission', :locals => {:f => fi} %> +<% end %> -- libgit2 0.21.2