Commit bedac4e4d130911a45498e0dfa3508e33e64d4f2
1 parent
3526dd07
Exists in
master
and in
22 other branches
Prevents expired form from being submited in task page
Showing
2 changed files
with
5 additions
and
1 deletions
Show diff stats
plugins/custom_forms/lib/custom_forms_plugin/membership_survey.rb
| ... | ... | @@ -9,6 +9,8 @@ class CustomFormsPlugin::MembershipSurvey < Task |
| 9 | 9 | |
| 10 | 10 | def perform |
| 11 | 11 | form = CustomFormsPlugin::Form.find(form_id) |
| 12 | + raise 'Form expired' if form.expired? | |
| 13 | + | |
| 12 | 14 | answers = build_answers(submission, form) |
| 13 | 15 | s = CustomFormsPlugin::Submission.create!(:form => form, :profile => target) |
| 14 | 16 | answers.map {|answer| answer.submission = s; answer.save!} | ... | ... |
plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb
| ... | ... | @@ -3,8 +3,10 @@ |
| 3 | 3 | |
| 4 | 4 | <h2><%= @form.name %></h2> |
| 5 | 5 | <p><%= @form.description %></p> |
| 6 | +<% if @form.expired? %> | |
| 7 | + <h3><%= _('Sorry, you can\'t fill this form right now') %></h3> | |
| 8 | +<% end %> | |
| 6 | 9 | |
| 7 | 10 | <% f.fields_for :submission do |fi| %> |
| 8 | - <%#= fi.error_messages_for :submission %> | |
| 9 | 11 | <%= render :partial => 'shared/form_submission', :locals => {:f => fi} %> |
| 10 | 12 | <% end %> | ... | ... |