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" %>

- <%= @dmptemplate.title %> - -
- <%= link_to t("org_admin.templates.view_all_templates"), - admin_index_dmptemplate_path, - :class => "btn btn-primary" %> -
+ <%= @template.title %> + +
+ <%= link_to t("org_admin.templates.view_all_templates"), + admin_index_template_path, + class: "btn btn-primary" %> +

-<%= render :partial => "admin_nav_tabs", locals: {dmptemplate: @dmptemplate, active: "add_plan"} %> +<%= render partial: "admin_nav_tabs", locals: {template: @template, active: "add_plan"} %>
- - -
-
- - - <%= form_for :phase, :url => { :action => "admin_createphase"} do |f| %> -

- <%= t("org_admin.templates.phase_details_label")%> -

- <%= raw t("org_admin.templates.phase_new_text_html")%> -
-
- <%= f.hidden_field :dmptemplate_id, :value => @dmptemplate.id%> - - - - - - - - - - - - - -
<%= 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"))%> -
-
-
-
- - -
- <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.cancel"), admin_dmptemplate_path(@dmptemplate), :class => "btn cancel" %> -
- - <%end%> -
-
-
+ + +
+
+ + + <%= form_for :phase, url: { action: "admin_createphase"} do |f| %> +

+ <%= t("org_admin.templates.phase_details_label")%> +

+ <%= raw t("org_admin.templates.phase_new_text_html")%> +
+
+ <%= f.hidden_field :template_id, value: @template.id%> + + + + + + + + + + + + + +
<%= 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"))%> +
+
+
+
+ + +
+ <%= f.submit t("helpers.submit.save"), class: "btn btn-primary" %> + <%= link_to t("helpers.submit.cancel"), admin_template_template_path(@template), class: "btn cancel" %> +
+ + <%end%> +
+
+
- -<%= tinymce :content_css => asset_path("application.css") %> \ No newline at end of file + +<%= tinymce content_css: asset_path("application.css") %> \ No newline at end of file