diff --git a/app/controllers/phases_controller.rb b/app/controllers/phases_controller.rb
new file mode 100644
index 0000000..5c08f41
--- /dev/null
+++ b/app/controllers/phases_controller.rb
@@ -0,0 +1,47 @@
+class PhasesController < ApplicationController
+
+ after_action :verify_authorized
+
+ TEXTAREA = QuestionFormat.where(title: "Text area").first.id
+ TEXTFIELD = QuestionFormat.where(title: "Text field").first.id
+ RADIO = QuestionFormat.where(title: "Radio buttons").first.id
+ CHECKBOX = QuestionFormat.where(title: "Check box").first.id
+ DROPDOWN = QuestionFormat.where(title: "Dropdown").first.id
+ MULTI = QuestionFormat.where(title: "Multi select box").first.id
+
+ # GET /phases/1/edit
+ def edit
+
+ @textarea = TEXTAREA
+ @textfield = TEXTFIELD
+ @radio = RADIO
+ @checkbox = CHECKBOX
+ @dropdown = DROPDOWN
+ @multi = MULTI
+
+ @plan = Plan.find(params[:plan_id])
+ authorize @plan
+ @phase = Phase.where(template_id: @plan.template_id, slug: params[:id]).first
+
+ @sections = @phase.sections
+ @section_answers = Hash.new
+ @phase.sections.each do |section|
+ nanswers = 0
+ questions = section.questions
+ questions.each do |q|
+ answers = q.answers.where(plan_id: @plan)
+ nanswers += answers.count
+ end
+ @section_answers[section.id] = nanswers
+ end
+
+ if !user_signed_in? then
+ respond_to do |format|
+ format.html { redirect_to edit_user_registration_path }
+ end
+ end
+
+ end
+
+
+end
diff --git a/app/helpers/phases_helper.rb b/app/helpers/phases_helper.rb
new file mode 100644
index 0000000..610c227
--- /dev/null
+++ b/app/helpers/phases_helper.rb
@@ -0,0 +1,2 @@
+module PhasesHelper
+end
diff --git a/app/models/plan_guidance_group.rb b/app/models/plan_guidance_group.rb
new file mode 100644
index 0000000..7b76499
--- /dev/null
+++ b/app/models/plan_guidance_group.rb
@@ -0,0 +1,11 @@
+# Used to link plans to guidance groups
+# the links are created at plan creation stage
+# and link to all possible GGs
+# then the selected field keeps track of which ones the user has turned on /off
+#
+class PlanGuidanceGroup < ActiveRecord::Base
+ belongs_to :plan
+ belongs_to :guidance_group
+
+ attr_accessible :selected
+end
diff --git a/app/views/phases/_add_note.html.erb b/app/views/phases/_add_note.html.erb
new file mode 100644
index 0000000..00584fd
--- /dev/null
+++ b/app/views/phases/_add_note.html.erb
@@ -0,0 +1,20 @@
+
+
+<% new_note = Note.new %>
+<% answerid = answer.id %>
+
+<%= form_for :new_note,
+ :url => {:controller => :notes, :action => :create },
+ :html=>{:method=>:post, :id => "new_note_form_#{answerid}", :class => "add_note_form"} do |f| %>
+ <%= f.hidden_field :user_id, :value => current_user.id %>
+ <%= f.hidden_field :answer_id, :value => answerid %>
+
+ <%= text_area_tag("#{answerid}new_note_text".to_sym, "" , class: "tinymce") %>
+
+
+
+
+ <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary new_comment_submit_button" %>
+
+
+<%end%>
diff --git a/app/views/phases/_answer_form.html.erb b/app/views/phases/_answer_form.html.erb
new file mode 100644
index 0000000..289ef9b
--- /dev/null
+++ b/app/views/phases/_answer_form.html.erb
@@ -0,0 +1,209 @@
+
+
+
+
+ <% q_format = question.question_format %>
+
+
+
+ <% if answer.created_at.nil? %>
+
<%= t("helpers.notanswered") %>
+ <% else %>
+
<%= t("helpers.answered_by")%><%= answer.created_at %><%= t("helpers.answered_by_part2")%><%= answer.user.name %>
+ <% end %>
+
+
+<%= t("helpers.unsaved") %>
+
+
+
+
+
+ <% comments = answer.notes.all %>
+ <%= hidden_field_tag :question_id, question.id, :class => "question_id" %>
+
+
+
+
+
+
+
+
+
+ <% if question.guidance.present? %>
+
+
+
+
+
+
+
+
<%= raw question.guidance %>
+
+
+
+ <% end %>
+
+
+
+
+ <% question_guidances.each_index do |gindex| %>
+ <% qguidance = @question_guidances[gindex]
+ orgname = qguidance[:orgname]
+ theme = qguidance[:theme]
+ guidance = qguidance[:guidance]
+ %>
+
+
+
+
+
+
+
+
+
<%= raw guidance.text %>
+
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+<% if last_question_id == question.id then %>
+
+<% else %>
+
+<% end %>
diff --git a/app/views/phases/_answer_form_ro.html.erb b/app/views/phases/_answer_form_ro.html.erb
new file mode 100644
index 0000000..64a0fb0
--- /dev/null
+++ b/app/views/phases/_answer_form_ro.html.erb
@@ -0,0 +1,248 @@
+
+<% answer = @plan.answer(question.id) %>
+
+
+
+ <% q_format = question.question_format%>
+
+ <% if readonly != "always" then %>
+
+ <% end %>
+
+
>
+
<%= question.text %>
+
+ <% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") %>
+
+ <% if answer.options.is_a? Option then %>
+ - <%= answer.options.text %>
+ <% else %>
+ <% answer.options.each do |o| %>
+ - <%= o.text %>
+ <% end %>
+ <% end %>
+
+ <% end %>
+
+ <%= raw answer.text %>
+
+
+
+ <% if answer.created_at.nil? then %>
+
<%= t("helpers.notanswered") %>
+ <% else %>
+
<%= t("helpers.answered_by")%><%= answer.created_at %><%= t("helpers.answered_by_part2")%><%= answer.user.name %>
+ <% end %>
+
<%= t("helpers.unsaved") %>
+
+
+
+
+
+
+ <% @comments = Notes.where("question_id = ? AND plan_id = ?", question.id, answer.plan_id ) %>
+ <%= hidden_field_tag :question_id, question.id, :class => "question_id" %>
+ <% @question_guidances = @plan.guidance_for_question(question) %>
+
+
+
+
+
+
+
+
+ <% if !question.guidance.nil? && question.guidance != "" then %>
+
+
+
+
<%= raw question.guidance %>
+
+
+ <% end %>
+
+ <% @question_guidances.each_pair do |group,themes| %>
+ <% themes.each_pair do |theme,guidances| %>
+ <% guidances.each do |guidance| %>
+
+
+
+
<%= raw guidance.text %>
+
+
+ <% end %>
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+<% if last_question_id == question.id then %>
+
+<% else %>
+
+<% end %>
diff --git a/app/views/phases/_archive_note.html.erb b/app/views/phases/_archive_note.html.erb
new file mode 100644
index 0000000..904c82d
--- /dev/null
+++ b/app/views/phases/_archive_note.html.erb
@@ -0,0 +1,23 @@
+
+<%= form_for(note, :url => {:controller => :notes, :action => :archive } , :html => { :method => :put, :class => "archive_note_form", :id => "archive_note_form_#{note.id}"}) do |f| %>
+ <%= f.hidden_field :id, :value => note.id %>
+ <%= f.hidden_field :archived_by, :value => current_user.id %>
+
+ <%= render :partial => "view_note", locals: {note: note} %>
+
+ <% if current_user.id == note.user_id then %>
+ <%= t('helpers.notes.archive_own_note_question')%>
+ <% button_label = t("helpers.notes.archive_own_comment_button_label") %>
+ <% else%>
+ <%= t("helpers.notes.archive_note_question")%>
+ <% button_label = t("helpers.notes.archive_comment_button_label") %>
+ <%end%>
+
+
+
+ <%= hidden_field_tag :note_id, note.id, :class => "comment_id" %>
+ <%= f.submit button_label, :class => "btn btn-primary archive_comment_submit_button" %>
+ <%= link_to t("helpers.submit.cancel"), "#", :class => "cancel_archive_comment btn cancel" %>
+
+
+<%end%>
diff --git a/app/views/phases/_edit_note.html.erb b/app/views/phases/_edit_note.html.erb
new file mode 100644
index 0000000..f931d7f
--- /dev/null
+++ b/app/views/phases/_edit_note.html.erb
@@ -0,0 +1,16 @@
+
+
+<%= form_for(note, :url => {:controller => :notes, :action => :update } , :html => { :method => :put, :class => "edit_note_form", :id=> "edit_note_form_#{note.id}"}) do |f| %>
+ <%= f.hidden_field :id, :value => note.id %>
+
+ <%= text_area_tag("#{note.id}_note_text".to_sym, note.text , class: "tinymce") %>
+
+
+
+
+ <%= hidden_field_tag :answer, note.answer_id, :class => "answer_id" %>
+ <%= hidden_field_tag :note_id, note.id, :class => "note_id" %>
+ <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary edit_note_submit_button" %>
+
+
+<%end%>
diff --git a/app/views/phases/_list_notes.html.erb b/app/views/phases/_list_notes.html.erb
new file mode 100644
index 0000000..12b17ab
--- /dev/null
+++ b/app/views/phases/_list_notes.html.erb
@@ -0,0 +1,87 @@
+
+
+<% if notes.count > 1 then%>
+ <% style_to_add = "height:150px; overflow-y:auto;" %>
+<%else%>
+ <% style_to_add = "" %>
+<%end%>
+
+
+
+
+
+
+ <% notes.order("updated_at DESC").each do |c|%>
+
+ |
+ <% user = c.user %>
+ <%= user.name %>
+ (<%= l c.updated_at, format: :custom %>)
+ |
+
+
+ <% if c.archived %>
+
+ <% if c.archived_by == current_user.id %>
+ <%= t("helpers.comments.retracted")%>
+ <% else %>
+ <% archived_by_user = User.find(c.archived_by) %>
+ <%= t("helpers.comments.clear_by")%> <%= archived_by_user.name %>
+ <%end%>
+
+ <%else%>
+
+ <%= link_to t("helpers.comments.view_label"),"#", :class => "dmp_table_link view_comment_button" %>
+ <%= hidden_field_tag :note_id, c.id, :class => "comment_id" %>
+
+ <% if current_user.id == c.user_id %>
+ <%= link_to t("helpers.comments.edit_label"),"#", :class => "dmp_table_link edit_comment_button" %>
+ <%= hidden_field_tag :note_id, c.id, :class => "comment_id" %>
+ <%= link_to t("helpers.comments.retract_label"),"#", :class => "dmp_table_link archive_comment_button" %>
+ <% end%>
+
+ <% if @plan.administerable_by?(current_user.id) && current_user.id != c.user_id %>
+ <%= hidden_field_tag :note_id, c.id, :class => "comment_id" %>
+ <%= link_to t("helpers.comments.clear_label"),"#", :class => "dmp_table_link archive_comment_button" %>
+ <% end%>
+ <%end%>
+
+ |
+
+ <%end%>
+
+
+
+
+
+
+
+<% notes_not_archived = notes.where("archived IS NULL") %>
+<% latest_note = notes_not_archived.order("updated_at DESC").first %>
+<% if !latest_note.nil? then%>
+
+<%end%>
+
+<%notes.order("updated_at DESC").each do |com|%>
+
+
+
+
+
+
+
+
+
+<%end%>
diff --git a/app/views/phases/_note.html.erb b/app/views/phases/_note.html.erb
new file mode 100644
index 0000000..9a9906a
--- /dev/null
+++ b/app/views/phases/_note.html.erb
@@ -0,0 +1,37 @@
+
+
+ <% notes = answer.notes.all %>
+ <% answerid = answer.id %>
+ <%= hidden_field_tag :answer_id, answer.id %>
+
+ <% if notes.count > 0 %>
+
+
+
+
+
+
+
+ <%= render :partial => "list_notes", locals: {notes: notes, plan:plan} %>
+
+
+
+
+
+
+
+
+
+
+
+ <% else%>
+ <%= t("helpers.comments.add_comment_text")%>
+ <%= render :partial => "add_note", locals: {answer: answer}%>
+ <% end%>
diff --git a/app/views/phases/_view_note.html.erb b/app/views/phases/_view_note.html.erb
new file mode 100644
index 0000000..6b7737f
--- /dev/null
+++ b/app/views/phases/_view_note.html.erb
@@ -0,0 +1,11 @@
+
+<% user = User.find(note.user_id) %>
+
+
+
diff --git a/app/views/phases/edit.html.erb b/app/views/phases/edit.html.erb
new file mode 100644
index 0000000..51e638a
--- /dev/null
+++ b/app/views/phases/edit.html.erb
@@ -0,0 +1,166 @@
+<%- model_class = Plan -%>
+<% javascript "plans.js" %>
+
+
+
+
+
+<%= render :partial => "/plans/plan_title", locals: {plan: @plan} %>
+
+
+
+<% status = @plan.status %>
+
+ <%space_used = status["space_used"].to_i
+ space_title = t("helpers.plan.export.space_used", space_used: space_used, num_pages: @plan.template.settings(:export).max_pages)
+ answered = %(#{status["num_answers"]}/#{status["num_questions"]})%>
+
+ <%= answered -%> <%= t("helpers.project.questions_answered")%>
+ ;" title="<%= answered -%> <%= t("helpers.project.questions_answered")%>">
+
+
+
+
+
+ = 100 ? "class=bar-full-text" : "" -%>><%= space_title -%>
+ " style="width: <%= space_used -%>%;" title="<%= space_title -%>">
+
+
+
+
+
+<%= render :partial => "/plans/plan_nav_tabs", locals: {plan: @plan, active: @phase.title } %>
+
+
+
+
+
+
+ <% @sections.each do |section| %>
+
+
+ <% if session[:question_id_comments].to_i != 0 then %>
+ <% question_from_comment = Question.find(session[:question_id_comments])%>
+ <% if section.id == question_from_comment.section_id then %>
+ <%= hidden_field_tag :comment_section_id, question_from_comment.section_id, :class => "comment_section_id" %>
+ <%end%>
+ <% end%>
+
+
+
+
+
+
+ <% num_section_questions = section.questions.count %>
+ <% num_section_answers = @section_answers[section.id] %>
+ <% question_word = "questions" %>
+ <% if num_section_questions == 1 then %>
+ <% question_word = "question" %>
+ <% end %>
+ <% section_status = "#{num_section_questions} #{question_word}, #{num_section_answers} answered" %>
+
+
+
+
+
+
+
+ <%= raw section.description %>
+
+
+
+
+
+
+
<%= t ('helpers.loading')%>
+
+
+
<%= t ('helpers.saving')%>
+
+
+
<%= t ('helpers.removing')%>
+
+
+
+
+ <% section.questions.order("number").each do |question| %>
+ <% if question.id == session[:question_id_comments].to_i then id_css = "current_question" end %>
+
+ <% partialname = "answer_form"
+ if @readonly
+ partialname += "_ro"
+ end
+ %>
+
+ <% guidances = @plan.guidance_for_question(question) %>
+
+ <%= render partial: partialname,
+ locals: {
+ plan: @plan,
+ answer: @plan.answer(question.id),
+ question_guidances: guidances,
+ question: question,
+ last_question_id: section.questions.order("number DESC").first.id
+ }
+ %>
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
<%= t("helpers.project.not_saved_answers_text_alert")%>
+
+
<%= t("helpers.project.not_saved_answers_confirmation_alert")%>
+
+
+
+
+
+
+
+ <% end %>
+
+
+ <%= tinymce :content_css => asset_path("application.css"), :setup => "function(editor){editor.on('change', function(e){$.fn.check_textarea(editor)});}" %>
+
+
+
+<%= render :partial => "plans/export", locals: {plan: @plan} %>
+
+
+<% session.delete(:question_id_comments)%>
diff --git a/app/views/plans/_dropdowns_new_plan.html.erb b/app/views/plans/_dropdowns_new_plan.html.erb
new file mode 100644
index 0000000..5413579
--- /dev/null
+++ b/app/views/plans/_dropdowns_new_plan.html.erb
@@ -0,0 +1,41 @@
+
+
+<%= semantic_form_for @plan, :url => {:controller => :plans, :action => :create }, :html=>{:method=>:post} do |f| %>
+ <%= f.inputs do %>
+ <%= hidden_field_tag :default_tag, "false" ,:id => "default_tag" %>
+
+
+
<%= t('helpers.project.create_page.title') %>
+
+
<%= raw t('helpers.project.create_page.desc_html')%>
+
+
+
+
+
+
+
+
+ <%= f.input :funder_id,
+ :as => :select,
+ :collection => @funders,
+ :label => t('helpers.project.create_page.funders_question'),
+ :input_html => { :multiple => false, :class => ["select2", "select2-container"] },
+ :include_blank => constant("organisation_types.funder") %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <%= f.actions do %>
+ <%= f.action :submit,
+ :as => :button,
+ :input_html => { :id => "create-plan-button", :class => "btn btn-primary"},
+ :label => t('helpers.project.create') %>
+ <% end %>
+
+<% end %>
diff --git a/app/views/plans/_plan_details.html.erb b/app/views/plans/_plan_details.html.erb
new file mode 100644
index 0000000..430288b
--- /dev/null
+++ b/app/views/plans/_plan_details.html.erb
@@ -0,0 +1,321 @@
+
+
+
+
+
+
+
">
+
+
+
+ <%= raw t('helpers.project.project_details_editing_text_html')%>
+
+
+
+
+
+
+ <%= semantic_form_for @plan, :url => {:controller => :plans, :action => :update }, :html=>{:method=>:put} do |f| %>
+ <%= f.inputs do %>
+
+
+
+
+
+ | <%= t('helpers.project.project_name') %> |
+
+ <%= f.text_field :title, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.project_name_help_text') %>
+ |
+
+
+ | <%= t('helpers.project.project_identifier') %> |
+
+ <%= f.text_field :identifier, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.project_identifier_help_text') %>
+ |
+
+
+ | <%= t('helpers.project.grant_title') %> |
+
+ <%= f.text_field :grant_number, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.grant_help_text') %>
+ |
+
+
+ | <%= t('helpers.project.principal_investigator') %> |
+
+ <%= f.text_field :principal_investigator, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.principal_investigator_help_text') %>
+ |
+
+
+ | <%= t('helpers.project.principal_investigator_id') %> |
+
+ <%= f.text_field :principal_investigator_identifier, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.principal_investigator_id_help_text') %>
+ |
+
+
+ | <%= t('helpers.project.project_data_contact') %> |
+
+ <%= f.text_field :data_contact, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.project_data_contact_help_text') %>
+ |
+
+
+ | <%= t('helpers.desc') %> |
+
+ <%= f.text_area :description, { :rows => 7, :class => 'text_area has-tooltip', 'data-toggle' => "tooltip", 'data-html' => "true", 'title'=> t('helpers.project.project_desc_help_text_html')} %>
+ |
+
+
+
+ <% end %>
+
+ <%= f.actions do %>
+
+ <%end%>
+ <%end%>
+
+
+
+
+
">
+
+
<%= t('helpers.project.project_details_text_html')%>
+
+
+
+
+
+
+
+
+
+ | <%= t('helpers.project.project_name') %> |
+ <%= @plan.title %> |
+
+
+
+ | <%= t('helpers.project.project_identifier') %> |
+
+ <% if !@plan.identifier.nil? && @plan.identifier != "" then %>
+ <%= @plan.identifier %>
+ <%else%>
+ -
+ <%end%>
+ |
+
+
+
+ | <%= t('helpers.project.grant_title') %> |
+
+ <% if !@plan.grant_number.nil? && @plan.grant_number!= "" then %>
+ <%= @plan.grant_number %>
+ <%else%>
+ -
+ <%end%>
+ |
+
+
+ | <%= t('helpers.project.principal_investigator') %> |
+ <% if !@plan.principal_investigator.nil? && @plan.principal_investigator != "" then %>
+ <%= @plan.principal_investigator %>
+ <%else%>
+ -
+ <%end%>
+ |
+
+ <% if !@plan.principal_investigator_identifier.nil? && @plan.principal_investigator_identifier != "" then %>
+
+ | <%= t('helpers.project.principal_investigator_id') %> |
+
+ <%= @plan.principal_investigator_identifier %>
+ |
+
+ <%end%>
+
+ | <%= t('helpers.project.project_data_contact') %> |
+ <% if !@plan.data_contact.nil? && @plan.data_contact != "" then%>
+ <%= @plan.data_contact %>
+ <%else%>
+ -
+ <%end%>
+ |
+
+
+ | <%= t('helpers.desc') %> |
+ <% if !@plan.description.nil? && @plan.description != "" then%>
+ <%= @plan.description %>
+ <%else%>
+ -
+ <%end%>
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= semantic_form_for @plan, :url => {:controller => :plans, :action => :update_guidance_choices }, :html=>{:method=>:put}, :remote => true do |f| %>
+ <%= f.inputs do %>
+ <%= f.input :plan_guidance_groups,
+ :as => :check_boxes,
+ :collection => selected_guidance_groups %>
+ <% end %>
+
+ <%= f.actions do %>
+
+ <%end%>
+ <%end%>
+
+
+
+
+
+
+
+
<%= t('helpers.project.project_static_info')%>
+
+
+
+ <%if @plan.template.org.name? %>
+
+ | <%= constant("organisation_types.funder") %> |
+ <%= @plan.template.org.name %> |
+
+ <%end%>
+ <%if @plan.template.customization_of.present? %>
+ <%= " (Customised from #{ @plan.template.customization_of.org.name })" %>
+ <%end%>
+
+
+
+
+
+ <% phases = @plan.template.phases %>
+ <% if phases.any? %>
+ <% if phases.count == 1 then %>
+ <% phases.each do |phase| %>
+
+
+ <%= render :partial => "plans/export", locals: {plan: plan} %>
+
+
<%= raw phase.description %>
+ <% if !phase.sections.nil? %>
+
+
+
+ | <%= t('helpers.sections_label')%> |
+ <%= t('helpers.questions_label')%> |
+
+
+
+ <% phase.sections.each do |section| %>
+
+ |
+ <%= section.title %>
+ |
+
+ <% if section.questions.any? %>
+ <% questions = section.questions.sort_by(&:number) %>
+
+ <% questions.each do |ques|%>
+ -
+ <%= raw ques.text %>
+
+ <%end%>
+
+ <%end%>
+ |
+
+ <%end%>
+
+
+ <%end%>
+ <%end%>
+ <%else%>
+
+ <%= raw @plan.template.description %>
+
+ <% phases.each do |phase| %>
+
+
+
+
+
+
+ <%= render :partial => "plans/export", locals: {plan: @plan} %>
+
+
<%= raw phase.description %>
+
+
+ <% if !phase.sections.nil? %>
+
+
+
+ | <%= t('helpers.sections_label')%> |
+ <%= t('helpers.questions_label')%> |
+
+
+
+ <% phase.sections.each do |section| %>
+
+ |
+ <%= section.title %>
+ |
+
+ <% if section.questions.any? %>
+ <% questions = section.questions.sort_by(&:number) %>
+
+ <% questions.each do |ques|%>
+ -
+ - <%= raw ques.text %>
+
+ <%end%>
+
+ <%end%>
+ |
+
+ <%end%>
+
+
+ <%end%>
+
+
+
+
+ <%end%>
+ <%end%>
+ <%end%>
+
diff --git a/app/views/plans/_plan_nav_tabs.html.erb b/app/views/plans/_plan_nav_tabs.html.erb
new file mode 100644
index 0000000..3ae1018
--- /dev/null
+++ b/app/views/plans/_plan_nav_tabs.html.erb
@@ -0,0 +1,38 @@
+
+
+
+
+
+ - >
+ <%= link_to t("helpers.project.tab_plan"), plan_path(plan) %>
+
+
+
+ <% plan.template.phases.each do |phase| %>
+ - >
+ <%= link_to phase.title, edit_plan_phase_path(plan,phase) %>
+
+ <% end %>
+
+
+ <% if @plan.administerable_by?(current_user.id) then %>
+ <% if active == "share" %>
+ -
+ <% else %>
+
-
+ <% end %>
+ <%= link_to t("helpers.project.share.tab_share"), ["share", plan] %>
+
+ <% end %>
+
+
+ <% if active == "export" then %>
+ -
+ <% else %>
+
-
+ <% end %>
+ <%= link_to t("helpers.project.tab_export"), ["export",plan] %>
+
+
+
+
diff --git a/app/views/plans/_plan_title.html.erb b/app/views/plans/_plan_title.html.erb
new file mode 100644
index 0000000..d134aa1
--- /dev/null
+++ b/app/views/plans/_plan_title.html.erb
@@ -0,0 +1,8 @@
+
+
+
+
+ <%= plan.title %>
+
+
+
diff --git a/app/views/plans/create.html.erb b/app/views/plans/create.html.erb
new file mode 100644
index 0000000..b1ef328
--- /dev/null
+++ b/app/views/plans/create.html.erb
@@ -0,0 +1,14 @@
+
+
+
+
Choose one of these templates
+
+<%= debug @templates %>
+
+<% @templates.each do |t| %>
+
<%= t %>
+<% end %>
+
+
+
+
diff --git a/app/views/plans/new.html.erb b/app/views/plans/new.html.erb
new file mode 100644
index 0000000..4198eb4
--- /dev/null
+++ b/app/views/plans/new.html.erb
@@ -0,0 +1,10 @@
+<%# javascript "projects.js" %>
+
+
+
<%= @error %>
+
+ <%= render "dropdowns_new_plan" %>
+
+
+
+
diff --git a/db/migrate/20170130105546_create_plan_guidance_groups.rb b/db/migrate/20170130105546_create_plan_guidance_groups.rb
new file mode 100644
index 0000000..b3d330e
--- /dev/null
+++ b/db/migrate/20170130105546_create_plan_guidance_groups.rb
@@ -0,0 +1,10 @@
+class CreatePlanGuidanceGroups < ActiveRecord::Migration
+ def change
+ create_table :plan_guidance_groups do |t|
+ t.references :plan, index: true, foreign_key: true
+ t.references :guidance_group, index: true, foreign_key: true
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/db/migrate/20170130111947_add_selected_to_plan_guidance_groups.rb b/db/migrate/20170130111947_add_selected_to_plan_guidance_groups.rb
new file mode 100644
index 0000000..d9548ba
--- /dev/null
+++ b/db/migrate/20170130111947_add_selected_to_plan_guidance_groups.rb
@@ -0,0 +1,5 @@
+class AddSelectedToPlanGuidanceGroups < ActiveRecord::Migration
+ def change
+ add_column :plan_guidance_groups, :selected, :boolean
+ end
+end
diff --git a/test/fixtures/plan_guidance_groups.yml b/test/fixtures/plan_guidance_groups.yml
new file mode 100644
index 0000000..03f68c5
--- /dev/null
+++ b/test/fixtures/plan_guidance_groups.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ plan_id:
+ guidance_group_id:
+
+two:
+ plan_id:
+ guidance_group_id:
diff --git a/test/models/plan_guidance_group_test.rb b/test/models/plan_guidance_group_test.rb
new file mode 100644
index 0000000..8afe24e
--- /dev/null
+++ b/test/models/plan_guidance_group_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PlanGuidanceGroupTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end