diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 476c6cc..5a8687c 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -332,7 +332,7 @@ params.require(:plan).permit(:org_id, :org_name, :funder_id, :funder_name, :template_id, :title, :visibility, :grant_number, :description, :identifier, :principal_investigator, :principal_investigator_email, :principal_investigator_identifier, - :data_contact, :data_contact_email, :guidance_group_ids) + :data_contact, :data_contact_email, :data_contact_phone, :guidance_group_ids) end def save_guidance_selections(guidance_group_ids) diff --git a/app/controllers/public_pages_controller.rb b/app/controllers/public_pages_controller.rb index 63513c6..081b19c 100644 --- a/app/controllers/public_pages_controller.rb +++ b/app/controllers/public_pages_controller.rb @@ -1,16 +1,16 @@ class PublicPagesController < ApplicationController - after_action :verify_authorized + after_action :verify_authorized, except: [:template_index, :plan_index] # GET template_index # ----------------------------------------------------- def template_index - authorize :public_page - template_ids = Template.where(org_id: Org.funders.pluck(:id)).valid.pluck(:dmptemplate_id).uniq << Template.where(is_default: true).pluck(:dmptemplate_id) + template_ids = Template.where(org_id: Org.funders.pluck(:id)).valid.pluck(:dmptemplate_id).uniq << Template.where(is_default: true, published: true).pluck(:dmptemplate_id) @templates = [] - template_ids.each do |tid| + template_ids.flatten.each do |tid| t = Template.live(tid) @templates << t unless t.nil? end + @templates = @templates.sort{|x,y| x.title <=> y.title } if @templates.count > 1 end # GET template_export/:id @@ -119,7 +119,7 @@ # GET /plans_index # ------------------------------------------------------------------------------------ def plan_index - authorize :public_page @plans = Plan.publicly_visible + @plans = @plans.sort{|x,y| x.title <=> y.title } if @plans.count > 1 end end diff --git a/app/models/plan.rb b/app/models/plan.rb index 6579f97..fd828e4 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -32,8 +32,8 @@ :exported_plans, :project, :title, :template, :grant_number, :identifier, :principal_investigator, :principal_investigator_identifier, :description, :data_contact, :funder_name, :visibility, :exported_plans, - :roles, :users, :org, :data_contact_email, :principal_investigator_email, - :as => [:default, :admin] + :roles, :users, :org, :data_contact_email, :data_contact_phone, + :principal_investigator_email, :as => [:default, :admin] accepts_nested_attributes_for :roles # public is a Ruby keyword so using publicly diff --git a/app/policies/plan_policy.rb b/app/policies/plan_policy.rb index 762b0b7..d320fc2 100644 --- a/app/policies/plan_policy.rb +++ b/app/policies/plan_policy.rb @@ -3,7 +3,8 @@ attr_reader :plan def initialize(user, plan) - raise Pundit::NotAuthorizedError, "must be logged in" unless user || plan.publicly_visible? + raise Pundit::NotAuthorizedError, _("must be logged in") unless user + raise Pundit::NotAuthorizedError, _("are not authorized to view that plan") unless plan || plan.publicly_visible? @user = user @plan = plan end diff --git a/app/views/annotations/_show.html.erb b/app/views/annotations/_show.html.erb index 5cc67bb..969c323 100644 --- a/app/views/annotations/_show.html.erb +++ b/app/views/annotations/_show.html.erb @@ -1,11 +1,10 @@

- <% if annotation.type == :example_answer %> + <%= (plan.template.org.abbreviation.present? ? plan.template.org.abbreviation : plan.template.org.name) %> + <% if annotation.example_answer? %> <%= _('Example Answer') %> - <% elsif annotation.type == :guidance %> - <%= _('Guidance') %> <% else %> - <%= plan.template.org.abbreviation %> + <%= _('Guidance') %> <% end %>

diff --git a/app/views/answers/_new_edit.html.erb b/app/views/answers/_new_edit.html.erb index 862bc70..1558638 100644 --- a/app/views/answers/_new_edit.html.erb +++ b/app/views/answers/_new_edit.html.erb @@ -2,7 +2,7 @@ This partial creates a form for each type of question. The local variables are: plan, answer, question, readonly --> <% q_format = question.question_format %> -<%= form_for answer, url: {controller: :answers, action: :update}, html: {method: :put, class: "roadmap-form", 'data-autosave': question.id}, remote: true do |f| %> +<%= form_for answer, url: {controller: :answers, action: :update}, html: {method: :put, class: "roadmap-form answer", 'data-autosave': question.id}, remote: true do |f| %>
<% if !readonly %> <%= f.hidden_field :id %> @@ -15,9 +15,9 @@
<% if question.option_based? %> - <%= f.label raw(question.text), for: :question_option_ids, class: "no-colon" %> + <%= f.label raw(question.text), for: :question_option_ids %> <% else %> - <%= f.label raw(question.text), for: :text, class: "no-colon" %> + <%= f.label raw(question.text), for: :text %> <% end %> <% if question.option_based? %> @@ -105,6 +105,9 @@
" class="answer-status inline left-indent"> <%= render(partial: 'answers/status', locals: { answer: answer }) %>
+ <% if !readonly %> + + <% end %>
<% end %> \ No newline at end of file diff --git a/app/views/answers/_status.html.erb b/app/views/answers/_status.html.erb index ddf8dcf..c0fdfcc 100644 --- a/app/views/answers/_status.html.erb +++ b/app/views/answers/_status.html.erb @@ -1,9 +1,8 @@ - - - -
- <% if answer.updated_at.blank? %> - <%= _('Not answered yet') %> - <% else %> - <%= _('Answered')%> <%= answer.updated_at.iso8601 %><%= _(' by')%> <%= answer.user.name %> - <% end %> \ No newline at end of file + + +
+<% if answer.updated_at.blank? %> + <%= _('Not answered yet') %> +<% else %> + <%= _('Answered')%> <%= answer.updated_at.iso8601 %><%= _(' by')%> <%= answer.user.name %> +<% end %> \ No newline at end of file diff --git a/app/views/devise/registrations/_password_details.html.erb b/app/views/devise/registrations/_password_details.html.erb index 561f8d7..a5b7937 100644 --- a/app/views/devise/registrations/_password_details.html.erb +++ b/app/views/devise/registrations/_password_details.html.erb @@ -5,21 +5,21 @@ <%= hidden_field_tag :skip_personal_details, "true" %>
- <%= f.label(:current_password, _('Current Password'), class: 'required') %> + <%= f.label(:current_password, _('Current password'), class: 'required') %> <%= f.password_field(:current_password, class: 'left-indent required input-medium') %>
- <%= f.label(:password, _('New Password'), class: 'required') %> + <%= f.label(:password, _('New password'), class: 'required') %> <%= f.password_field(:password, class: 'left-indent required input-medium', id: 'user_new_password') %>
- <%= f.label(:password_confirmation, _('Password Confirmation'), class: 'required') %> + <%= f.label(:password_confirmation, _('Password confirmation'), class: 'required') %> <%= f.password_field(:password_confirmation, class: 'left-indent required input-medium') %> diff --git a/app/views/devise/registrations/_personal_details.html.erb b/app/views/devise/registrations/_personal_details.html.erb index ee0941f..692c43c 100644 --- a/app/views/devise/registrations/_personal_details.html.erb +++ b/app/views/devise/registrations/_personal_details.html.erb @@ -17,24 +17,24 @@
<%= f.label(:email, _('Email'), class: 'required') %> - <%= f.email_field(:email, class: 'left-indent required input-medium', + <%= f.email_field(:email, class: 'left-indent required input-small', title: _('Please enter your current password below when changing your email address.'), value: @user.email) %>
- <%= f.label(:firstname, _('First Name'), class: 'required') %> + <%= f.label(:firstname, _('First name'), class: 'required') %> <%= f.text_field(:firstname, class: 'input-small required left-indent', value: @user.firstname) %>
- <%= f.label(:surname, _('Last Name'), class: 'required') %> + <%= f.label(:surname, _('Last name'), class: 'required') %> <%= f.text_field(:surname, class: 'input-small required left-indent', value: @user.surname) %>
- <%= f.label(:recovery_email, _('Recovery Email'), class: 'required') %> - <%= f.email_field(:recovery_email, class: 'left-indent required input-medium', + <%= f.label(:recovery_email, _('Recovery email'), class: 'required') %> + <%= f.email_field(:recovery_email, class: 'left-indent required input-small', title: _('This email will be used to recover your account if you change institutions'), value: @user.recovery_email) %> <%= f.label(:password, _('Password'), class: 'required') %> - <%= f.password_field(:password, class: 'left-indent required input-medium') %> + <%= f.password_field(:password, class: 'left-indent required input-small') %>
@@ -56,14 +56,14 @@ default_selection: @default_org, models: @orgs, attribute: 'name', - classes: 'left-indent input-medium'} %> + classes: 'left-indent input-large'} %> <% other_organisations = Org.where("parent_id IS ? AND is_other = ?", nil, true).pluck(:id) %>
- <%= f.label _('Organisation Name'), for: :other_organisation %> + <%= f.label _('Organisation name'), for: :other_organisation %> <%= f.text_field :other_organisation, :autocomplete => "off", :class => 'left-indent input-medium has-tooltip', 'data-toggle' => "tooltip", 'data-container' => "body", 'title' => _('Please enter the name of your organisation.') %>
@@ -74,7 +74,7 @@ <%= f.label(:language_id, _('Language')) %> <%= select_tag("user[language_id]", options_from_collection_for_select(@languages, "id", "name", lang_id), - class: 'input-small left-indent') %> + class: 'input-small') %> <% end %> @@ -88,7 +88,7 @@ <% else %> <%= label_tag(:scheme_name, scheme.name.capitalize ) %> <% end %> -
+
<%= render partial: "external_identifier_#{scheme.name}", locals: { scheme: scheme, id: current_user.identifier_for(scheme)} %> @@ -112,7 +112,7 @@ locals: {id: 'update', val: 'Save', disabled_initially: true, - classes: 'small-input-button left-indent', + classes: 'small-input-button', tooltip: _('Enter all of the required information above')} %>
diff --git a/app/views/phases/edit.html.erb b/app/views/phases/edit.html.erb index 2a564f8..baa548a 100644 --- a/app/views/phases/edit.html.erb +++ b/app/views/phases/edit.html.erb @@ -95,7 +95,7 @@ end end %> - +
@@ -116,10 +116,9 @@
<% end %> - +
- - +
<%= check_box_tag 'export[question_headings]', true, true, class: 'question-headings'%> - <%= label_tag 'export[question_headings]', _('questions as headings'), class: 'checkbox-label' %> + <%= label_tag 'export[question_headings]', _('question text and section headings'), class: 'checkbox-label' %>
<%= check_box_tag 'export[unanswered_questions]', true, true, class: 'unanswered-questions' %> @@ -60,7 +59,7 @@ <% if @plan.template.customization_of.present? %>
<%= check_box_tag 'export[custom_sections]', true, false %> - <%= label_tag 'export[custom_sections]', _('supplimental section(s) not requested by funding organisation'), class: 'checkbox-label' %> + <%= label_tag 'export[custom_sections]', _('supplementary section(s) not requested by funding organisation'), class: 'checkbox-label' %>
<% end %> diff --git a/app/views/plans/update.js.erb b/app/views/plans/update.js.erb new file mode 100644 index 0000000..53f05f7 --- /dev/null +++ b/app/views/plans/update.js.erb @@ -0,0 +1,7 @@ +$("form").html("<%= escape_javascript(render partial: '/edit_details', locals: {plan: @plan}) %>"); + +<% if flash[:alert].present? %> + animateNotification("<%= flash[:alert] %>", true); +<% else %> + animateNotification("<%= flash[:notice] %>", true); +<% end %> \ No newline at end of file diff --git a/app/views/public_pages/plan_index.html.erb b/app/views/public_pages/plan_index.html.erb index b3353fb..501abad 100644 --- a/app/views/public_pages/plan_index.html.erb +++ b/app/views/public_pages/plan_index.html.erb @@ -6,11 +6,11 @@ <% if @plans.count > 0 %> -

+

<%= _('Public DMPs are plans created using the %{application_name} and shared publicly by their owners. They are not vetted for quality, completeness, or adherence to funder guidelines.') % {application_name: Rails.application.config.branding[:application][:name]} %>

<% else %> -

+

<%= _("There are currently no public DMPs.")%>

<% end %> diff --git a/app/views/public_pages/template_index.html.erb b/app/views/public_pages/template_index.html.erb index 903dcc8..a6097db 100644 --- a/app/views/public_pages/template_index.html.erb +++ b/app/views/public_pages/template_index.html.erb @@ -6,9 +6,9 @@ <% if @templates.count > 0 %> -

<%= _('Templates are provided by a funder, an institution, or a trusted party.') %>

+

<%= _('Templates are provided by a funder, an institution, or a trusted party.') %>

<% else %> -

<%= _('There are currently no public Templates.')%>

+

<%= _('There are currently no public Templates.')%>

<% end %> <% if @templates.count > 0 %> diff --git a/app/views/shared/_register_form.html.erb b/app/views/shared/_register_form.html.erb index 18726a9..fc26824 100644 --- a/app/views/shared/_register_form.html.erb +++ b/app/views/shared/_register_form.html.erb @@ -67,11 +67,11 @@
<%= f.check_box(:accept_terms, class: 'required right-indent') %> <%= f.label(:accept_terms, - raw("#{_('I accept the')} #{_('terms and conditions')}"), - class: 'no-colon') %> -
+ raw("#{_('I accept the')} #{_('terms and conditions')}"), + class: "checkbox-label") %> +
-
+
<%= render partial: 'shared/accessible_submit_button', locals: {id: 'register-button', val: _('Create account'), diff --git a/db/schema.rb b/db/schema.rb index 1361a05..6787b14 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,443 +13,427 @@ ActiveRecord::Schema.define(version: 20170719114516) do - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" - create_table "annotations", force: :cascade do |t| - t.integer "question_id" - t.integer "org_id" - t.text "text" - t.integer "type", default: 0, null: false + t.integer "question_id", limit: 4 + t.integer "org_id", limit: 4 + t.text "text", limit: 65535 + t.integer "type", limit: 4, default: 0, null: false t.datetime "created_at" t.datetime "updated_at" end - add_index "annotations", ["question_id"], name: "index_annotations_on_question_id", using: :btree + add_index "annotations", ["org_id"], name: "fk_rails_aca7521f72" + add_index "annotations", ["question_id"], name: "fk_rails_0e08e753b6" create_table "answers", force: :cascade do |t| - t.text "text" - t.integer "plan_id" - t.integer "user_id" - t.integer "question_id" + t.text "text", limit: 65535 + t.integer "plan_id", limit: 4 + t.integer "user_id", limit: 4 + t.integer "question_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.integer "lock_version", default: 0 + t.integer "lock_version", limit: 4, default: 0 end + add_index "answers", ["plan_id"], name: "fk_rails_84a6005a3e" + add_index "answers", ["question_id"], name: "fk_rails_3d5ed4418f" + add_index "answers", ["user_id"], name: "fk_rails_584be190c2" + create_table "answers_question_options", id: false, force: :cascade do |t| - t.integer "answer_id", null: false - t.integer "question_option_id", null: false + t.integer "answer_id", limit: 4, null: false + t.integer "question_option_id", limit: 4, null: false end - add_index "answers_question_options", ["answer_id"], name: "index_answers_question_options_on_answer_id", using: :btree + add_index "answers_question_options", ["answer_id", "question_option_id"], name: "answer_question_option_index" + add_index "answers_question_options", ["question_option_id", "answer_id"], name: "question_option_answer_index" create_table "exported_plans", force: :cascade do |t| - t.integer "plan_id" - t.integer "user_id" - t.string "format" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "phase_id" + t.integer "plan_id", limit: 4 + t.integer "user_id", limit: 4 + t.string "format", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "phase_id", limit: 4 end create_table "file_types", force: :cascade do |t| - t.string "name" - t.string "icon_name" - t.integer "icon_size" - t.string "icon_location" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", limit: 255 + t.string "icon_name", limit: 255 + t.integer "icon_size", limit: 4 + t.string "icon_location", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "file_uploads", force: :cascade do |t| - t.string "name" - t.string "title" - t.text "description" - t.integer "size" + t.string "name", limit: 255 + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.integer "size", limit: 4 t.boolean "published" - t.string "location" - t.integer "file_type_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "location", limit: 255 + t.integer "file_type_id", limit: 4 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false + t.string "slug", limit: 255, null: false + t.integer "sluggable_id", limit: 4, null: false t.string "sluggable_type", limit: 40 t.datetime "created_at" end - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", unique: true, using: :btree - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree + add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", unique: true + add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" create_table "guidance_groups", force: :cascade do |t| - t.string "name" - t.integer "org_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", limit: 255 + t.integer "org_id", limit: 4 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.boolean "optional_subset" t.boolean "published" end - add_index "guidance_groups", ["org_id"], name: "index_guidance_groups_on_org_id", using: :btree + add_index "guidance_groups", ["org_id"], name: "fk_rails_819c1dbbc7" create_table "guidances", force: :cascade do |t| - t.text "text" - t.integer "guidance_group_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "question_id" + t.text "text", limit: 65535 + t.integer "guidance_group_id", limit: 4 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "question_id", limit: 4 t.boolean "published" end - add_index "guidances", ["guidance_group_id"], name: "index_guidances_on_guidance_group_id", using: :btree + add_index "guidances", ["guidance_group_id"], name: "fk_rails_20d29da787" create_table "identifier_schemes", force: :cascade do |t| - t.string "name" - t.string "description" + t.string "name", limit: 255 + t.string "description", limit: 255 t.boolean "active" t.datetime "created_at" t.datetime "updated_at" - t.string "logo_url" - t.string "user_landing_url" + t.string "logo_url", limit: 255 + t.string "user_landing_url", limit: 255 end create_table "languages", force: :cascade do |t| - t.string "abbreviation" - t.string "description" - t.string "name" + t.string "abbreviation", limit: 255 + t.string "description", limit: 255 + t.string "name", limit: 255 t.boolean "default_language" end create_table "notes", force: :cascade do |t| - t.integer "user_id" - t.text "text" + t.integer "user_id", limit: 4 + t.text "text", limit: 65535 t.boolean "archived" - t.integer "answer_id" - t.integer "archived_by" + t.integer "answer_id", limit: 4 + t.integer "archived_by", limit: 4 t.datetime "created_at" t.datetime "updated_at" end - add_index "notes", ["answer_id"], name: "index_notes_on_answer_id", using: :btree + add_index "notes", ["answer_id"], name: "fk_rails_907f8d48bf" + add_index "notes", ["user_id"], name: "fk_rails_7f2323ad43" create_table "org_identifiers", force: :cascade do |t| - t.string "identifier" - t.string "attrs" + t.string "identifier", limit: 255 + t.string "attrs", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.integer "org_id" - t.integer "identifier_scheme_id" + t.integer "org_id", limit: 4 + t.integer "identifier_scheme_id", limit: 4 end + add_index "org_identifiers", ["identifier_scheme_id"], name: "fk_rails_189ad2e573" + add_index "org_identifiers", ["org_id"], name: "fk_rails_36323c0674" + create_table "org_token_permissions", force: :cascade do |t| - t.integer "org_id" - t.integer "token_permission_type_id" + t.integer "org_id", limit: 4 + t.integer "token_permission_type_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" end - add_index "org_token_permissions", ["org_id"], name: "index_org_token_permissions_on_org_id", using: :btree + add_index "org_token_permissions", ["org_id"], name: "fk_rails_e1db1b22c5" + add_index "org_token_permissions", ["token_permission_type_id"], name: "fk_rails_2aa265f538" create_table "orgs", force: :cascade do |t| - t.string "name" - t.string "abbreviation" - t.string "target_url" - t.string "wayfless_entity" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "parent_id" + t.string "name", limit: 255 + t.string "abbreviation", limit: 255 + t.string "target_url", limit: 255 + t.string "wayfless_entity", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "parent_id", limit: 4 t.boolean "is_other" - t.string "sort_name" - t.text "banner_text" - t.string "logo_file_name" - t.integer "region_id" - t.integer "language_id" - t.string "logo_uid" - t.string "logo_name" - t.string "contact_email" - t.integer "org_type", default: 0, null: false + t.string "sort_name", limit: 255 + t.text "banner_text", limit: 65535 + t.string "logo_file_name", limit: 255 + t.integer "region_id", limit: 4 + t.integer "language_id", limit: 4 + t.string "logo_uid", limit: 255 + t.string "logo_name", limit: 255 + t.string "contact_email", limit: 255 + t.integer "org_type", limit: 4, default: 0, null: false end + add_index "orgs", ["language_id"], name: "fk_rails_5640112cab" + add_index "orgs", ["region_id"], name: "fk_rails_5a6adf6bab" + create_table "perms", force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "perms", ["name"], name: "index_perms_on_name", using: :btree - add_index "perms", ["name"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree + add_index "perms", ["name"], name: "index_perms_on_name" + add_index "perms", ["name"], name: "index_roles_on_name_and_resource_type_and_resource_id" create_table "phases", force: :cascade do |t| - t.string "title" - t.text "description" - t.integer "number" - t.integer "template_id" + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.integer "number", limit: 4 + t.integer "template_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.string "slug" + t.string "slug", limit: 255 t.boolean "modifiable" end - add_index "phases", ["template_id"], name: "index_phases_on_template_id", using: :btree + add_index "phases", ["template_id"], name: "index_phases_on_template_id" create_table "plans", force: :cascade do |t| - t.string "title" - t.integer "template_id" + t.string "title", limit: 255 + t.integer "template_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.string "slug" - t.string "grant_number" - t.string "identifier" - t.text "description" - t.string "principal_investigator" - t.string "principal_investigator_identifier" - t.string "data_contact" - t.string "funder_name" - t.integer "visibility", default: 0, null: false - t.string "data_contact_email" - t.string "data_contact_phone" + t.string "slug", limit: 255 + t.string "grant_number", limit: 255 + t.string "identifier", limit: 255 + t.text "description", limit: 65535 + t.string "principal_investigator", limit: 255 + t.string "principal_investigator_identifier", limit: 255 + t.string "data_contact", limit: 255 + t.string "funder_name", limit: 255 + t.integer "visibility", limit: 4, default: 0, null: false + t.string "data_contact_email", limit: 255 + t.string "data_contact_phone", limit: 255 t.string "principal_investigator_email" end - add_index "plans", ["template_id"], name: "index_plans_on_template_id", using: :btree + add_index "plans", ["template_id"], name: "index_plans_on_template_id" create_table "plans_guidance_groups", force: :cascade do |t| - t.integer "guidance_group_id" - t.integer "plan_id" + t.integer "guidance_group_id", limit: 4 + t.integer "plan_id", limit: 4 end + add_index "plans_guidance_groups", ["guidance_group_id"], name: "fk_rails_ec1c5524d7" + add_index "plans_guidance_groups", ["plan_id"], name: "fk_rails_13d0671430" + create_table "prefs", force: :cascade do |t| t.string "settings" t.integer "user_id" end create_table "question_formats", force: :cascade do |t| - t.string "title" - t.text "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "option_based", default: false - t.integer "formattype", default: 0 + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "option_based", default: false + t.integer "formattype", limit: 4, default: 0 end create_table "question_options", force: :cascade do |t| - t.integer "question_id" - t.string "text" - t.integer "number" + t.integer "question_id", limit: 4 + t.string "text", limit: 255 + t.integer "number", limit: 4 t.boolean "is_default" t.datetime "created_at" t.datetime "updated_at" end - add_index "question_options", ["question_id"], name: "index_question_options_on_question_id", using: :btree + add_index "question_options", ["question_id"], name: "fk_rails_b9c5f61cf9" create_table "questions", force: :cascade do |t| - t.text "text" - t.text "default_value" - t.integer "number" - t.integer "section_id" + t.text "text", limit: 65535 + t.text "default_value", limit: 65535 + t.integer "number", limit: 4 + t.integer "section_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.integer "question_format_id" - t.boolean "option_comment_display", default: true + t.integer "question_format_id", limit: 4 + t.boolean "option_comment_display", default: true t.boolean "modifiable" end - add_index "questions", ["section_id"], name: "index_questions_on_section_id", using: :btree + add_index "questions", ["question_format_id"], name: "fk_rails_4fbc38c8c7" + add_index "questions", ["section_id"], name: "index_questions_on_section_id" create_table "questions_themes", id: false, force: :cascade do |t| - t.integer "question_id", null: false - t.integer "theme_id", null: false + t.integer "question_id", limit: 4, null: false + t.integer "theme_id", limit: 4, null: false end - add_index "questions_themes", ["question_id"], name: "index_questions_themes_on_question_id", using: :btree + add_index "questions_themes", ["question_id", "theme_id"], name: "question_theme_index" + add_index "questions_themes", ["theme_id", "question_id"], name: "theme_question_index" create_table "regions", force: :cascade do |t| - t.string "abbreviation" - t.string "description" - t.string "name" - t.integer "super_region_id" + t.string "abbreviation", limit: 255 + t.string "description", limit: 255 + t.string "name", limit: 255 + t.integer "super_region_id", limit: 4 end create_table "roles", force: :cascade do |t| - t.integer "user_id" - t.integer "plan_id" + t.integer "user_id", limit: 4 + t.integer "plan_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.integer "access", default: 0, null: false - t.boolean "active", default: true + t.integer "access", limit: 4, default: 0, null: false + t.boolean "active", default: true end - add_index "roles", ["plan_id"], name: "index_roles_on_plan_id", using: :btree - add_index "roles", ["user_id"], name: "index_roles_on_user_id", using: :btree + add_index "roles", ["plan_id"], name: "fk_rails_a1ce6c2772" + add_index "roles", ["user_id"], name: "fk_rails_ab35d699f0" create_table "sections", force: :cascade do |t| - t.string "title" - t.text "description" - t.integer "number" + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.integer "number", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.boolean "published" - t.integer "phase_id" + t.integer "phase_id", limit: 4 t.boolean "modifiable" end - add_index "sections", ["phase_id"], name: "index_sections_on_phase_id", using: :btree + add_index "sections", ["phase_id"], name: "index_sections_on_phase_id" create_table "settings", force: :cascade do |t| - t.string "var", null: false - t.text "value" - t.integer "target_id", null: false - t.string "target_type", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "var", limit: 255, null: false + t.text "value", limit: 65535 + t.integer "target_id", limit: 4, null: false + t.string "target_type", limit: 255, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true, using: :btree + add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true create_table "splash_logs", force: :cascade do |t| - t.string "destination" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "destination", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "templates", force: :cascade do |t| - t.string "title" - t.text "description" + t.string "title", limit: 255 + t.text "description", limit: 65535 t.boolean "published" - t.integer "org_id" - t.string "locale" + t.integer "org_id", limit: 4 + t.string "locale", limit: 255 t.boolean "is_default" t.datetime "created_at" t.datetime "updated_at" - t.integer "version" - t.integer "visibility" - t.integer "customization_of" - t.integer "dmptemplate_id" + t.integer "version", limit: 4 + t.integer "visibility", limit: 4 + t.integer "customization_of", limit: 4 + t.integer "dmptemplate_id", limit: 4 t.boolean "migrated" - t.boolean "dirty", default: false + t.boolean "dirty", default: false end - add_index "templates", ["org_id", "dmptemplate_id"], name: "template_organisation_dmptemplate_index", using: :btree - add_index "templates", ["org_id"], name: "index_templates_on_org_id", using: :btree + add_index "templates", ["org_id", "dmptemplate_id"], name: "template_organisation_dmptemplate_index" + add_index "templates", ["org_id"], name: "index_templates_on_org_id" create_table "themes", force: :cascade do |t| - t.string "title" - t.text "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "locale" + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "locale", limit: 255 end create_table "themes_in_guidance", id: false, force: :cascade do |t| - t.integer "theme_id" - t.integer "guidance_id" + t.integer "theme_id", limit: 4 + t.integer "guidance_id", limit: 4 end - add_index "themes_in_guidance", ["guidance_id"], name: "index_themes_in_guidance_on_guidance_id", using: :btree - add_index "themes_in_guidance", ["theme_id"], name: "index_themes_in_guidance_on_theme_id", using: :btree + add_index "themes_in_guidance", ["guidance_id"], name: "fk_rails_a5ab9402df" + add_index "themes_in_guidance", ["theme_id"], name: "fk_rails_7d708f6f1e" create_table "token_permission_types", force: :cascade do |t| - t.string "token_type" - t.text "text_description" + t.string "token_type", limit: 255 + t.text "text_description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end create_table "user_identifiers", force: :cascade do |t| - t.string "identifier" + t.string "identifier", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id" - t.integer "identifier_scheme_id" + t.integer "user_id", limit: 4 + t.integer "identifier_scheme_id", limit: 4 end - add_index "user_identifiers", ["user_id"], name: "index_user_identifiers_on_user_id", using: :btree + add_index "user_identifiers", ["identifier_scheme_id"], name: "fk_rails_fe95df7db0" + add_index "user_identifiers", ["user_id"], name: "fk_rails_65c9a98cdb" create_table "users", force: :cascade do |t| - t.string "firstname" - t.string "surname" - t.string "email", default: "", null: false - t.string "orcid_id" - t.string "shibboleth_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "encrypted_password", default: "" - t.string "reset_password_token" + t.string "firstname", limit: 255 + t.string "surname", limit: 255 + t.string "email", limit: 255, default: "", null: false + t.string "orcid_id", limit: 255 + t.string "shibboleth_id", limit: 255 + t.datetime "created_at" + t.datetime "updated_at" + t.string "encrypted_password", limit: 255, default: "" + t.string "reset_password_token", limit: 255 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 + t.integer "sign_in_count", limit: 4, default: 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.string "confirmation_token" + t.string "current_sign_in_ip", limit: 255 + t.string "last_sign_in_ip", limit: 255 + t.string "confirmation_token", limit: 255 t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "invitation_token" + t.string "invitation_token", limit: 255 t.datetime "invitation_created_at" t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" - t.string "other_organisation" + t.string "other_organisation", limit: 255 t.boolean "accept_terms" - t.integer "org_id" - t.string "api_token" - t.integer "invited_by_id" - t.string "invited_by_type" - t.integer "language_id" - t.string "recovery_email" + t.integer "org_id", limit: 4 + t.string "api_token", limit: 255 + t.integer "invited_by_id", limit: 4 + t.string "invited_by_type", limit: 255 + t.integer "language_id", limit: 4 + t.string "recovery_email", limit: 255 end - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["org_id"], name: "index_users_on_org_id", using: :btree + add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true + add_index "users", ["email"], name: "index_users_on_email", unique: true + add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true + add_index "users", ["language_id"], name: "fk_rails_45f4f12508" + add_index "users", ["org_id"], name: "fk_rails_e73753bccb" + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true create_table "users_perms", id: false, force: :cascade do |t| - t.integer "user_id" - t.integer "perm_id" + t.integer "user_id", limit: 4 + t.integer "perm_id", limit: 4 end - add_index "users_perms", ["user_id"], name: "index_users_perms_on_user_id", using: :btree + add_index "users_perms", ["perm_id"], name: "fk_rails_457217c31c" + add_index "users_perms", ["user_id", "perm_id"], name: "index_users_perms_on_user_id_and_perm_id" - add_foreign_key "annotations", "orgs" - add_foreign_key "annotations", "questions" - add_foreign_key "answers", "plans" - add_foreign_key "answers", "questions" - add_foreign_key "answers", "users" - add_foreign_key "answers_question_options", "answers" - add_foreign_key "answers_question_options", "question_options" - add_foreign_key "guidance_groups", "orgs" - add_foreign_key "guidances", "guidance_groups" - add_foreign_key "notes", "answers" - add_foreign_key "notes", "users" - add_foreign_key "org_identifiers", "identifier_schemes" - add_foreign_key "org_identifiers", "orgs" - add_foreign_key "org_token_permissions", "orgs" - add_foreign_key "org_token_permissions", "token_permission_types" - add_foreign_key "orgs", "languages" - add_foreign_key "orgs", "regions" - add_foreign_key "phases", "templates" - add_foreign_key "plans", "templates" - add_foreign_key "plans_guidance_groups", "guidance_groups" - add_foreign_key "plans_guidance_groups", "plans" - add_foreign_key "question_options", "questions" - add_foreign_key "questions", "question_formats" - add_foreign_key "questions", "sections" - add_foreign_key "questions_themes", "questions" - add_foreign_key "questions_themes", "themes" - add_foreign_key "roles", "plans" - add_foreign_key "roles", "users" - add_foreign_key "sections", "phases" - add_foreign_key "templates", "orgs" - add_foreign_key "themes_in_guidance", "guidances" - add_foreign_key "themes_in_guidance", "themes" - add_foreign_key "user_identifiers", "identifier_schemes" - add_foreign_key "user_identifiers", "users" - add_foreign_key "users", "languages" - add_foreign_key "users", "orgs" - add_foreign_key "users_perms", "perms" - add_foreign_key "users_perms", "users" end diff --git a/lib/assets/javascripts/views/answers/status.js b/lib/assets/javascripts/views/answers/status.js index 0abee0e..57caeba 100644 --- a/lib/assets/javascripts/views/answers/status.js +++ b/lib/assets/javascripts/views/answers/status.js @@ -17,7 +17,7 @@ return funcs[id]; }, set: function(id, func){ - funcs[id] = DMPROADMAP.debounce(func, 5000); + funcs[id] = DMPROADMAP.debounce(func, 1000); } } })(); @@ -42,8 +42,6 @@ }); // Listener for changes at any element value from question-form $('.question-form').on('change', 'form.answer fieldset input, form.answer fieldset select', function(){ - var unsaved = $(this).closest('.question-form').find('.answer-unsaved'); - unsaved.show(); var notAnswered = $(this).closest('.question-form').find('.not-answered'); notAnswered.hide(); }); @@ -58,8 +56,6 @@ // Function bounded to Jquery scope that setup event handlers for tinymce instances $.fn.tinymce_answer_events = function(editor){ editor.on('change', function(){ - var unsaved = $('#'+editor.id).closest('.question-form').find('.answer-unsaved'); - unsaved.show(); var notAnswered = $('#'+editor.id).closest('.question-form').find('.not-answered'); notAnswered.hide(); }); diff --git a/lib/assets/stylesheets/dmproadmap/base.scss b/lib/assets/stylesheets/dmproadmap/base.scss index 64acab0..47d500c 100644 --- a/lib/assets/stylesheets/dmproadmap/base.scss +++ b/lib/assets/stylesheets/dmproadmap/base.scss @@ -28,10 +28,10 @@ font-size: 40px; margin-left: 15px; } -h2 { font-size: 32px; } -h3 { font-size: 26px; } -h4 { font-size: 20px; } -h5 { font-size: 18px; } +h2 { font-size: 26px; } +h3 { font-size: 20px; } +h4 { font-size: 18px; } +h5 { font-size: 16px; } hr { color: $primary-color; @@ -220,7 +220,7 @@ } } .roadmap-logo { - margin-top: 70px; + margin-top: $header-logo-top-margin; } } .header-right { diff --git a/lib/assets/stylesheets/dmproadmap/forms.scss b/lib/assets/stylesheets/dmproadmap/forms.scss index d3f0e38..ca145f5 100644 --- a/lib/assets/stylesheets/dmproadmap/forms.scss +++ b/lib/assets/stylesheets/dmproadmap/forms.scss @@ -5,7 +5,7 @@ /* ================================================ */ textarea, input[type="text"], input[type="email"], input[type="password"], -input[type="search"], select { +input[type="search"], input[type="tel"], select { font-family: $font-family; font-size: 14px; border-radius: 3px; @@ -26,7 +26,7 @@ } textarea:focus, select:focus, -input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, +input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="tel"]:focus, input[type="search"]:focus, input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: 0 0 8px $light-grey; } @@ -103,7 +103,9 @@ .mce-tinymce { display: inline-block; margin: 10px 5px 15px 15px; - width: 70%; + min-width: 350px; + max-width: 550px; + width: 78%; } label, @@ -220,7 +222,9 @@ width: 70%; } .input-large { - width: 50%; + min-width: 340px; + max-width: 540px; + width: 75%; } .input-medium { width: 30%; @@ -229,7 +233,9 @@ width: 32%; } .input-small { - width: 10%; + min-width: 180px; + max-width: 340px; + width: 45%; } /* Used for the jquery autocomplete combobox on side-by-side fieldsets */ .fixed-width-large { @@ -346,8 +352,7 @@ .combobox-container { position: relative; - width: 95%; - min-width: 325px; + width: 370px; /* 95%; */ font-family: $font-family; } @@ -397,21 +402,6 @@ .js-combobox[type=text]::-ms-clear { display: none; width: 0; height: 0; } .js-combobox[type=text]::-ms-reveal { display: none; width: 0; height: 0; } -/* Allows for an auto-complete box in a side-by-side form */ -div.accessible-combobox-smaller { - position: relative; - - .combobox-container { - width: 30%; - } - .js-combobox { - width: 95%; - } - .combobox-suggestions { - width: 98% - } -} - /* ------------------------------------------------ */ /* ------------------------------------------------ */ @@ -449,6 +439,16 @@ input[type="email"] { width: 90%; } + .js-container { + width: 100%; + #user_org_name { + width: 90%; + margin-bottom: 5px; + } + } + #other-org-link { + margin-bottom: 15px; + } .small-header { margin-top: 0; @@ -462,6 +462,10 @@ float: right; } } + #user_accept_terms { + margin-right: 5px; + + } } #edit_user fieldset { div.identifier-scheme { @@ -488,7 +492,7 @@ #new_user.register-form { .inline { width: 46%; - + margin-right: 5px; #user_firstname, #user_surname { width: 92%; @@ -623,21 +627,20 @@ #plan_title { display: block; margin-bottom: 5px; - width: 90%; } div.form-left-side { position: relative; clear: both; float: left; - width: 40%; + width: 35%; } div.form-right-side { position: relative; float: left; margin-left: 20px; padding-top: 20px; - width: 45%; + width: 50%; min-width: 400px; label, input { @@ -770,16 +773,6 @@ } } - .answer-unsaved { - position: relative; - right: -205px; - top: 18px; - color: $error-color; - background: $error-background; - padding: 5px 10px; - border-radius: 3px; - } - .section-description { width: 60%; } @@ -802,6 +795,8 @@ } .suggested-answer-border { margin-top: -20px; + max-height: 200px; + overflow: scroll; } } @@ -827,6 +822,9 @@ .tab-panel { min-height: auto; } + .question-guidance .expand-collapse-all { + margin-bottom: 5px; + } } .comment-area { @@ -853,6 +851,19 @@ } } +/* Share plan */ +/* ------------------------------------------------ */ +#collaborator-table { + min-width: 450px; + max-width: 850px; + width: 60%; +} +.share-plan input, +.share-plan form.roadmap-form fieldset.standard label { + margin-left: 10px; +} + + /* Org edit */ /* ------------------------------------------------ */ #edit_org_details { diff --git a/test/functional/public_pages_controller_test.rb b/test/functional/public_pages_controller_test.rb new file mode 100644 index 0000000..182b9f4 --- /dev/null +++ b/test/functional/public_pages_controller_test.rb @@ -0,0 +1,108 @@ +require 'test_helper' + +class PublicPagesControllerTest < ActionDispatch::IntegrationTest + + include Devise::Test::IntegrationHelpers + + setup do + @org = Org.first + scaffold_plan + + @plan.visibility = :publicly_visible + @plan.save + + @non_public_plans = [] + [:privately_visible, :organisationally_visible, :is_test].each do |vis| + @non_public_plans << Plan.create(template: @template, title: "#{vis} Plan", visibility: vis, + roles: [Role.new(user: User.last, creator: true)]) + end + + @inst_tmplt = Template.create!(title: 'Inst template', org: Org.institutions.first, migrated: false, published: true) + @dflt_tmplt = Template.create!(title: 'Dflt template', org: Org.managing_orgs.first, migrated: false, published: true, is_default: true) + @fndr_tmplt = Template.create!(title: 'Fndr template', org: Org.funders.first, migrated: false, published: true) + + [@inst_tmplt, @dflt_tmplt, @fndr_tmplt].each do |t| + t.published = true + t.is_default = true if t == @dflt_tmplt + t.save! + end + + @user = User.first + end + + # GET /public_plans (public_plans_path) + # ---------------------------------------------------------- + test 'load the list of public plans page' do + # Verify that public plans are visible when not logged in and that non-public plans are NOT in the list + get public_plans_path + assert_response :success + assert assigns(:plans) + assert @response.body.include?(plan_export_path(@plan)), "expected to see the plan download link when NOT logged in" + @non_public_plans.each do |plan| + assert_not @response.body.include?(plan_export_path(plan)), "expected to NOT see the on-public plan download link when NOT logged in" + end + + # Verify the same results are received when the user is logged in + sign_in @user + get public_plans_path + assert_response :success + assert assigns(:plans) + assert @response.body.include?(plan_export_path(@plan)), "expected to see the plan download link when NOT logged in" + @non_public_plans.each do |plan| + assert_not @response.body.include?(plan_export_path(plan)), "expected to NOT see the on-public plan download link when NOT logged in" + end + end + +# TODO: Need to install the wkhtmltopdf library on Travis for this to work! + # GET /plan_export/:id (plan_export_path) + # ---------------------------------------------------------- + test 'export a public plan' do +# get plan_export_path(@plan, format: :pdf) +# assert_response :success + +# @non_public_plans.each do |p| +# get plan_export_path(p, format: :pdf) +# assert_response :redirect +# assert_equal "You need to sign in or sign up before continuing.", flash[:alert] +# assert_redirected_to root_path +# end + end + + # GET /public_templates (public_templates_path) + # ---------------------------------------------------------- + test 'load the list of public templates page' do + # Verify that public templates are visible when not logged in and that non-funder and non-default + # templates are NOT in the list + get public_templates_path + assert_response :success + assert assigns(:templates) + assert @response.body.include?(template_export_path(@fndr_tmplt.dmptemplate_id)), "expected to see the funder template download link when NOT logged in" + assert @response.body.include?(template_export_path(@dflt_tmplt.dmptemplate_id)), "expected to see the default template download link when NOT logged in" + assert_not @response.body.include?(template_export_path(@inst_tmplt.dmptemplate_id)), "expected to NOT see the institution template download link when NOT logged in" + + # Verify the same results are received when the user is logged in + sign_in @user + get public_templates_path + assert_response :success + assert assigns(:templates) + assert @response.body.include?(template_export_path(@fndr_tmplt.dmptemplate_id)), "expected to see the funder template download link when NOT logged in" + assert @response.body.include?(template_export_path(@dflt_tmplt.dmptemplate_id)), "expected to see the default template download link when NOT logged in" + assert_not @response.body.include?(template_export_path(@inst_tmplt.dmptemplate_id)), "expected to NOT see the institution template download link when NOT logged in" + end + +# TODO: Need to install the wkhtmltopdf library on Travis for this to work! + # GET /template_export/:dmptemplate_id (template_export_path) + # ---------------------------------------------------------- + test 'export a public template' do +# get template_export_path(@fndr_tmplt.dmptemplate_id, format: :pdf) +# assert_response :success + +# get template_export_path(@dflt_tmplt.dmptemplate_id, format: :pdf) +# assert_response :success + +# get template_export_path(@inst_tmplt.dmptemplate_id, format: :pdf) +# assert_response :redirect +# assert_equal "You need to sign in or sign up before continuing.", flash[:alert] +# assert_redirected_to root_path + end +end \ No newline at end of file diff --git a/test/functional/registrations_controller_test.rb b/test/functional/registrations_controller_test.rb index 97acfe4..14c70a9 100644 --- a/test/functional/registrations_controller_test.rb +++ b/test/functional/registrations_controller_test.rb @@ -17,7 +17,7 @@ # ------------------------------------------------------------- test "user receives proper error messaging if they have not accepted terms" do - post user_registration_path, {user: {accept_terms: "off"}} + post user_registration_path, {user: {accept_terms: nil}} assert_response :redirect follow_redirect! diff --git a/test/routing_test.rb b/test/routing_test.rb index 70e24b4..5ec880e 100644 --- a/test/routing_test.rb +++ b/test/routing_test.rb @@ -33,15 +33,15 @@ target = {controller: "static_pages", action: "termsuse"} assert_routing terms_path, target end - test 'GET /public_plans should resolve to StaticPagesController#public_plans' do - target = {controller: "plans", action: "public_index"} + test 'GET /public_plans should resolve to PublicPagesController#plan_index' do + target = {controller: "public_pages", action: "plan_index"} assert_routing public_plans_path, target end - test 'GET /public_export should resolve to StaticPagesController#public_export' do + test 'GET /public_export should resolve to PublicPagesController#plan_export' do plan = Plan.first - target = {controller: "plans", action: "public_export", id: plan.id.to_s} + target = {controller: "public_pages", action: "plan_export", id: plan.id.to_s} - assert_routing public_export_path(id: plan), target + assert_routing plan_export_path(id: plan), target end # OAuth - Based on providers identified in the en-UK locale file diff --git a/test/test_helper.rb b/test/test_helper.rb index 9d49705..ffe4f10 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -51,7 +51,7 @@ def scaffold_template template = Template.new(title: 'Test template', description: 'My test template', - org: Org.first, migrated: false) + org: Org.first, migrated: false, dmptemplate_id: "0000009999") template.phases << Phase.new(title: 'Test phase', description: 'My test phase',