diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 0c89963..59f7f1c 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -131,17 +131,10 @@ #add a new phase to a template def admin_addphase - @dmptemplate = Dmptemplate.find(params[:id]) + @template = Template.find(params[:id]) @phase = Phase.new - authorize @dmptemplate - if @dmptemplate.phases.count == 0 then - @phase.number = '1' - else - @phase.number = @dmptemplate.phases.count + 1 - end - respond_to do |format| - format.html - end + authorize @template + @phase.number = @template.phases.count + 1 end diff --git a/app/views/templates/admin_addphase.html.erb b/app/views/templates/admin_addphase.html.erb index 6e8a336..65a3e6c 100644 --- a/app/views/templates/admin_addphase.html.erb +++ b/app/views/templates/admin_addphase.html.erb @@ -3,73 +3,73 @@ <% javascript "admin.js" %>
| <%= t("org_admin.templates.title_label") %> | -<%= f.text_field :title, - :as => :string, - :class => "text_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_title_help_text") %> | -
| <%= t("org_admin.templates.phase_order_label") %> | -<%= f.number_field :number, :in => 1..5, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_number_help_text") %> | -
| <%= t("org_admin.templates.desc_label") %> | -
-
- <%= text_area_tag("phase-desc","" , class: "tinymce") %>
-
-
- <%= link_to( image_tag("help_button.png"), "#", :class => "phase_desc_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.templates.phase_desc_help_text_html"))%>
-
-
- |
-
| <%= t("org_admin.templates.title_label") %> | +<%= f.text_field :title, + as: :string, + class: "text_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_title_help_text") %> | +
| <%= t("org_admin.templates.phase_order_label") %> | +<%= f.number_field :number, in: 1..5, class: "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_number_help_text") %> | +
| <%= t("org_admin.templates.desc_label") %> | +
+
+ <%= text_area_tag("phase-desc","" , class: "tinymce") %>
+
+
+ <%= link_to( image_tag("help_button.png"), "#", class: "phase_desc_popover", rel: "popover", "data-html" => "true", "data-content" => t("org_admin.templates.phase_desc_help_text_html"))%>
+
+
+ |
+