diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 385493e..bcde979 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -82,7 +82,7 @@ @edit = params[:edit] == "true" ? true : false #verify if there are any sections if not create one @sections = @phase.sections - if !@sections.any?() || @sections.count == 0 then + if !@sections.any?() || @sections.count == 0 @section = @phase.sections.build @section.phase = @phase @section.title = '' @@ -93,11 +93,11 @@ @new_sec = true end #verify if section_id has been passed, if so then open that section - if params.has_key?(:section_id) then + if params.has_key?(:section_id) @open = true @section_id = params[:section_id].to_i end - if params.has_key?(:question_id) then + if params.has_key?(:question_id) @question_id = params[:question_id].to_i end end @@ -105,8 +105,9 @@ #preview a phase def admin_previewphase - @template = Template.find(params[:id]) - authorize @template + @phase = Phase.find(params[:id]) + authorize @phase.template + @template = Phase.template end diff --git a/app/views/templates/_add_guidance.html.erb b/app/views/templates/_add_guidance.html.erb index de49775..af080d0 100644 --- a/app/views/templates/_add_guidance.html.erb +++ b/app/views/templates/_add_guidance.html.erb @@ -1,93 +1,93 @@
| <%= t("org_admin.guidance.text_label") %> | -
- <%= text_area_tag("guidance-text", "", class: "tinymce") %>
-
-
- <%= link_to( image_tag("help_button.png"), "#", :class => "guidance_text_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.guidance.text_help_text_html"))%>
-
-
- |
- ||||||||
| <%= t("org_admin.guidance.by_theme_or_by_question") %> | -
- <%= select_tag "g_options", options_for_select([[t("org_admin.guidance.by_themes_label"), 1],
- [t("org_admin.guidance.by_question_label"), 2]]) %>
-
-
- <%= link_to( image_tag("help_button.png"), "#", :class => "guidance_apply_to_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.guidance.apply_to_help_text_html"))%>
-
-
+ <%= form_for :guidance, url: {action: "admin_create"}, html: {id: "new_guidance_form"} do |f| %>
+
- <%= t("helpers.submit.save")%>
-
- <%= link_to t("helpers.submit.cancel"), :back, :class => "btn cancel" %>
+
+ |
+ ||||||||
| <%= t("org_admin.guidance.published") %> | +
+
+ <%= f.check_box :published , as: :check_boxes %>
+
+ |
+ ||||||||
| <%= t("org_admin.guidance.guidance_group_label") %> | +
+
+ <%= f.collection_select(:guidance_group_ids,
+ GuidanceGroup.where(org_id: current_user.org_id).order("name ASC"),
+ :id, :name, {prompt: false, include_blank: t('helpers.none')}, {multiple: false})%>
+
+
+ <%= link_to( image_tag("help_button.png"), "#", class: "guidance_group_select_popover", rel: "popover", "data-html" => "true", "data-content" => t("org_admin.guidance.guidance_group_select_help_text_html"))%>
+
+
+ |
+