diff --git a/Gemfile b/Gemfile index 768e046..2d9b5b9 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ # ------------------------------------------------ # SUPER ADMIN SECTION -gem "administrate", :github => 'thoughtbot/administrate', :branch =>'master' #:branch =>'v0.4.0' +gem "administrate", :github => 'thoughtbot/administrate', :branch =>'v0.7.0' # ------------------------------------------------ # USERS diff --git a/Gemfile.lock b/Gemfile.lock index 31af02b..53bf3cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,18 +1,18 @@ GIT remote: git://github.com/thoughtbot/administrate.git - revision: 47a2f99e22be87119ef0e3a7af3956984df5842c - branch: master + revision: 6bc227907e8567ca9d8c51658abc92fc2b19ca2d + branch: v0.7.0 specs: - administrate (0.4.0) + administrate (0.7.0) + actionpack (>= 4.2, < 5.1) + actionview (>= 4.2, < 5.1) + activerecord (>= 4.2, < 5.1) autoprefixer-rails (~> 6.0) - bourbon (>= 5.0.0.beta.6) datetime_picker_rails (~> 0.0.7) - jquery-rails (~> 4.0) + jquery-rails (>= 4.0) kaminari (>= 1.0) momentjs-rails (~> 2.8) - neat (~> 1.1) normalize-rails (>= 3.0) - rails (>= 4.2, < 5.1) sass-rails (~> 5.0) selectize-rails (~> 0.6) @@ -65,7 +65,7 @@ addressable (2.4.0) ansi (1.5.0) arel (6.0.3) - autoprefixer-rails (6.7.7.1) + autoprefixer-rails (6.7.7.2) execjs bcrypt (3.1.11) better_errors (2.1.1) @@ -74,9 +74,6 @@ rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bourbon (5.0.0.beta.7) - sass (~> 3.4.22) - thor (~> 0.19.1) builder (3.2.2) byebug (9.0.5) capybara (2.9.1) @@ -218,9 +215,6 @@ multi_xml (0.5.5) multipart-post (2.0.0) mysql2 (0.3.21) - neat (1.8.0) - sass (>= 3.3) - thor (~> 0.19) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) diff --git a/app/controllers/admin/annotations_controller.rb b/app/controllers/admin/annotations_controller.rb new file mode 100644 index 0000000..f0881d1 --- /dev/null +++ b/app/controllers/admin/annotations_controller.rb @@ -0,0 +1,21 @@ +module Admin + class AnnotationsController < Admin::ApplicationController + # To customize the behavior of this controller, + # you can overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Annotation. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Annotation.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/answers_controller.rb b/app/controllers/admin/answers_controller.rb index c220635..8960f9f 100644 --- a/app/controllers/admin/answers_controller.rb +++ b/app/controllers/admin/answers_controller.rb @@ -1,7 +1,7 @@ module Admin class AnswersController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/exported_plans_controller.rb b/app/controllers/admin/exported_plans_controller.rb index aecd7f0..e4bde90 100644 --- a/app/controllers/admin/exported_plans_controller.rb +++ b/app/controllers/admin/exported_plans_controller.rb @@ -1,7 +1,7 @@ module Admin class ExportedPlansController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/guidance_groups_controller.rb b/app/controllers/admin/guidance_groups_controller.rb index 6b9ad4b..95d3e7c 100644 --- a/app/controllers/admin/guidance_groups_controller.rb +++ b/app/controllers/admin/guidance_groups_controller.rb @@ -1,7 +1,7 @@ module Admin class GuidanceGroupsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/guidances_controller.rb b/app/controllers/admin/guidances_controller.rb index 6690ff3..1f2495f 100644 --- a/app/controllers/admin/guidances_controller.rb +++ b/app/controllers/admin/guidances_controller.rb @@ -1,7 +1,7 @@ module Admin class GuidancesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/identifier_schemes_controller.rb b/app/controllers/admin/identifier_schemes_controller.rb index 43911d1..eb50d8a 100644 --- a/app/controllers/admin/identifier_schemes_controller.rb +++ b/app/controllers/admin/identifier_schemes_controller.rb @@ -1,7 +1,7 @@ module Admin class IdentifierSchemesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/languages_controller.rb b/app/controllers/admin/languages_controller.rb index e70e606..e58baa9 100644 --- a/app/controllers/admin/languages_controller.rb +++ b/app/controllers/admin/languages_controller.rb @@ -1,7 +1,7 @@ module Admin class LanguagesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/notes_controller.rb b/app/controllers/admin/notes_controller.rb index c740124..db832f4 100644 --- a/app/controllers/admin/notes_controller.rb +++ b/app/controllers/admin/notes_controller.rb @@ -1,7 +1,7 @@ module Admin class NotesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/orgs_controller.rb b/app/controllers/admin/orgs_controller.rb index 91092db..d68f358 100644 --- a/app/controllers/admin/orgs_controller.rb +++ b/app/controllers/admin/orgs_controller.rb @@ -1,7 +1,7 @@ module Admin class OrgsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/perms_controller.rb b/app/controllers/admin/perms_controller.rb index 4e153cc..99e9b95 100644 --- a/app/controllers/admin/perms_controller.rb +++ b/app/controllers/admin/perms_controller.rb @@ -1,7 +1,7 @@ module Admin class PermsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/phases_controller.rb b/app/controllers/admin/phases_controller.rb index 5877a50..de6e3c3 100644 --- a/app/controllers/admin/phases_controller.rb +++ b/app/controllers/admin/phases_controller.rb @@ -1,7 +1,7 @@ module Admin class PhasesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/plans_controller.rb b/app/controllers/admin/plans_controller.rb index aaa9189..424389f 100644 --- a/app/controllers/admin/plans_controller.rb +++ b/app/controllers/admin/plans_controller.rb @@ -1,7 +1,7 @@ module Admin class PlansController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/question_formats_controller.rb b/app/controllers/admin/question_formats_controller.rb index 7644265..1338b69 100644 --- a/app/controllers/admin/question_formats_controller.rb +++ b/app/controllers/admin/question_formats_controller.rb @@ -1,7 +1,7 @@ module Admin class QuestionFormatsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/question_options_controller.rb b/app/controllers/admin/question_options_controller.rb index 237df25..103e543 100644 --- a/app/controllers/admin/question_options_controller.rb +++ b/app/controllers/admin/question_options_controller.rb @@ -1,7 +1,7 @@ module Admin class QuestionOptionsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb index 1be38bf..be5d2a7 100644 --- a/app/controllers/admin/questions_controller.rb +++ b/app/controllers/admin/questions_controller.rb @@ -1,7 +1,7 @@ module Admin class QuestionsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/regions_controller.rb b/app/controllers/admin/regions_controller.rb index 44d2065..6e5627b 100644 --- a/app/controllers/admin/regions_controller.rb +++ b/app/controllers/admin/regions_controller.rb @@ -1,7 +1,7 @@ module Admin class RegionsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index 6633242..748c165 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -1,7 +1,7 @@ module Admin class RolesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/sections_controller.rb b/app/controllers/admin/sections_controller.rb index b06bb8c..3b94a0a 100644 --- a/app/controllers/admin/sections_controller.rb +++ b/app/controllers/admin/sections_controller.rb @@ -1,7 +1,7 @@ module Admin class SectionsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/splash_logs_controller.rb b/app/controllers/admin/splash_logs_controller.rb index 4cb0f85..aa3fa22 100644 --- a/app/controllers/admin/splash_logs_controller.rb +++ b/app/controllers/admin/splash_logs_controller.rb @@ -1,7 +1,7 @@ module Admin class SplashLogsController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/suggested_answers_controller.rb b/app/controllers/admin/suggested_answers_controller.rb deleted file mode 100644 index 5ee314e..0000000 --- a/app/controllers/admin/suggested_answers_controller.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Admin - class SuggestedAnswersController < Admin::ApplicationController - # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: - # - # def index - # super - # @resources = SuggestedAnswer. - # page(params[:page]). - # per(10) - # end - - # Define a custom finder by overriding the `find_resource` method: - # def find_resource(param) - # SuggestedAnswer.find_by!(slug: param) - # end - - # See https://administrate-prototype.herokuapp.com/customizing_controller_actions - # for more information - end -end diff --git a/app/controllers/admin/templates_controller.rb b/app/controllers/admin/templates_controller.rb index 090a84b..8ac79e1 100644 --- a/app/controllers/admin/templates_controller.rb +++ b/app/controllers/admin/templates_controller.rb @@ -1,7 +1,7 @@ module Admin class TemplatesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rb index f15a730..9617c6c 100644 --- a/app/controllers/admin/themes_controller.rb +++ b/app/controllers/admin/themes_controller.rb @@ -1,7 +1,7 @@ module Admin class ThemesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/token_permission_types_controller.rb b/app/controllers/admin/token_permission_types_controller.rb index 7e90c37..37b3487 100644 --- a/app/controllers/admin/token_permission_types_controller.rb +++ b/app/controllers/admin/token_permission_types_controller.rb @@ -1,7 +1,7 @@ module Admin class TokenPermissionTypesController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/user_identifiers_controller.rb b/app/controllers/admin/user_identifiers_controller.rb index 6699719..bdf5faa 100644 --- a/app/controllers/admin/user_identifiers_controller.rb +++ b/app/controllers/admin/user_identifiers_controller.rb @@ -1,7 +1,7 @@ module Admin class UserIdentifiersController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index b456891..70251c0 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,7 +1,7 @@ module Admin class UsersController < Admin::ApplicationController # To customize the behavior of this controller, - # simply overwrite any of the RESTful actions. For example: + # you can overwrite any of the RESTful actions. For example: # # def index # super diff --git a/app/controllers/annotations_controller.rb b/app/controllers/annotations_controller.rb new file mode 100644 index 0000000..a262cb3 --- /dev/null +++ b/app/controllers/annotations_controller.rb @@ -0,0 +1,53 @@ +class AnnotationsController < ApplicationController + respond_to :html + after_action :verify_authorized + + #create annotations + def admin_create + @example_answer = Annotation.new(params[:annotation]) + authorize @example_answer + if @example_answer.save + redirect_to admin_show_phase_path(id: @example_answer.question.section.phase_id, section_id: @example_answer.question.section_id, question_id: @example_answer.question.id, edit: 'true'), notice: _('Information was successfully created.') + else + @section = @example_answer.question.section + @phase = @section.phase + @open = true + @sections = @phase.sections + @section_id = @section.id + @question_id = @example_answer.question + flash[:notice] = failed_create_error(@example_answer, _('example answer')) + render "phases/admin_show" + end + end + + + #update a example answer of a template + def admin_update + @example_answer = Annotation.includes(question: { section: {phase: :template}}).find(params[:id]) + authorize @example_answer #.question.section.phase.template + @question = @example_answer.question + @section = @question.section + @phase = @section.phase + if @example_answer.update_attributes(params[:annotation]) + redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, question_id: @question.id, edit: 'true'), notice: _('Information was successfully updated.') + else + flash[:notice] = failed_update_error(@example_answer, _('example answer')) + render action: "phases/admin_show" + end + end + + #delete an annotation + def admin_destroy + @example_answer = Annotation.includes(question: { section: {phase: :template}}).find(params[:id]) + authorize @example_answer + @question = @example_answer.question + @section = @question.section + @phase = @section.phase + if @example_answer.destroy + redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, edit: 'true'), notice: _('Information was successfully deleted.') + else + redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, edit: 'true'), notice: flash[:notice] = failed_destroy_error(@example_answer, _('example answer')) + end + end + +end \ No newline at end of file diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index 550c56f..51f76b2 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -2,68 +2,50 @@ after_action :verify_authorized respond_to :html - ## # PUT/PATCH /[:locale]/answer/[:id] def update - # create a new answer based off the passed params - - ans_params = params[:answer] - plan_id = ans_params[:plan_id] - phase_id = ans_params[:phase_id] - user_id = ans_params[:user_id] - lock_version = ans_params[:lock_version] - question_id = ans_params[:question_id] + question_id = params[:answer][:question_id] + plan_id = params[:answer][:plan_id] @question = Question.find(question_id); # If an answer id is present load that answer otherwise load by plan/question @answer = Answer.find_by(plan_id: plan_id, question_id: question_id) - @old_answer, race_on_creation = nil, false + @old_answer = nil + @timestamp = nil - # This is the first answer for the question - if @answer.nil? - @answer = Answer.new(params[:answer]) + if @answer.nil? # If there is no answer for plan/question + @answer = Answer.new(permitted_params) @answer.text = params["answer-text-#{@answer.question_id}".to_sym] + authorize @answer - @answer.save - + if @answer.save + @timestamp = @answer.updated_at.iso8601 + end @lock_version = @answer.lock_version + elsif params[:answer][:id].blank? # Someone else already added an answer while the user was working + @old_answer = Marshal::load(Marshal.dump(@answer)) + @answer.text = params["answer-text-#{@answer.question_id}".to_sym] - # Someone else already added an answer while the user was working - elsif ans_params[:id].blank? - @old_answer = Marshal::load(Marshal.dump(@answer)) - @answer.text = params["answer-text-#{@answer.question_id}".to_sym] authorize @answer @lock_version = @answer.lock_version - - # We're updating an answer (let ActiveRecord check for a race condition) - else - # if you do the obvious clone here it will overwrite the old_answer text - # in the next line - #@old_answer = @answer.clone + else # We're about updating an answer (let ActiveRecord check for a race condition) @old_answer = Marshal::load(Marshal.dump(@answer)) @answer.text = params["answer-text-#{@answer.question_id}".to_sym] + authorize @answer - @answer.update(params[:answer]) - - # The save was successful so get the lock version and nil the - # old answer + if @answer.update(permitted_params) + @answer.touch # Saves the record with the updated_at set to the current time. Needed if only answer.question_options is updated + @timestamp = @answer.updated_at.iso8601 + end @lock_version = @answer.lock_version @old_answer = nil end @section_id = @answer.question.section.id - - # these are used for updating the status line @username = @answer.user.name - @timestamp = "" - - if @answer.text.present? - @timestamp = @answer.updated_at.iso8601 - end - @nquestions = 0 @nanswers = 0 @@ -71,6 +53,7 @@ @n_section_answers = 0 plan = Plan.find(plan_id) + # Problem of N+1 queries below plan.template.phases.each do |phase| phase.sections.each do |section| section.questions.each do |question| @@ -94,11 +77,20 @@ end rescue ActiveRecord::StaleObjectError - @username = @old_answer.user.name - @lock_version = @old_answer.lock_version - respond_to do |format| - format.js {} - end - end + @username = @old_answer.user.name + @lock_version = @old_answer.lock_version + respond_to do |format| + format.js {} + end + end # End update + + private + def permitted_params + permitted = params.require(:answer).permit(:id, :plan_id, :user_id, :question_id, :lock_version, :question_option_ids => []) + if !permitted[:question_option_ids].present? #If question_option_ids has been filtered out because it was a scalar value (e.g. radiobutton answer) + permitted[:question_option_ids] = [params[:answer][:question_option_ids]] # then convert to an Array + end + return permitted + end # End permitted_params end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c952b33..a1ff6ad 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -106,4 +106,18 @@ msg end end + + ## + # Sign out of Shibboleth SP local session too. + # ------------------------------------------------------------- + def after_sign_out_path_for(resource_or_scope) + if Rails.application.config.shibboleth_enabled + return Rails.application.config.shibboleth_logout_url + root_url + super + else + super + end + end + # ------------------------------------------------------------- + end diff --git a/app/controllers/phases_controller.rb b/app/controllers/phases_controller.rb index 9d79400..99406e9 100644 --- a/app/controllers/phases_controller.rb +++ b/app/controllers/phases_controller.rb @@ -4,14 +4,16 @@ after_action :verify_authorized - # GET /plans/:plan_id/phases/:id/edit - def edit + # GET /plans/:plan_id/phases/:id/edit + def edit @plan = Plan.eager_load2(params[:plan_id]) + # authorization done on plan so found in plan_policy authorize @plan phase_id = params[:id].to_i @phase = @plan.template.phases.select {|p| p.id == phase_id}.first + @readonly = !@plan.editable_by?(current_user.id) # the eager_load pulls in ALL answers # need to restrict to just ones for this plan @@ -43,7 +45,7 @@ # create a map from theme to array of guidances # where guidance is a hash with the text and the org name - theme_guidance = {} + theme_guidance = {} guidance_groups.each do |guidance_group| guidance_group.guidances.each do |guidance| @@ -54,7 +56,7 @@ end theme_guidance[title] << { text: guidance.text, - org: guidance_group.name + org: guidance_group.name + ':' } end end @@ -83,14 +85,14 @@ if !user_signed_in? then respond_to do |format| - format.html { redirect_to edit_user_registration_path } - end - end + format.html { redirect_to edit_user_registration_path } + end + end - end + end - # GET /plans/PLANID/phases/PHASEID/status.json + # GET /plans/PLANID/phases/PHASEID/status.json def status @plan = Plan.eager_load(params[:plan_id]) authorize @plan @@ -110,9 +112,10 @@ @phase = Phase.eager_load(:sections).find_by('phases.id = ?', params[:id]) authorize @phase - @edit = (@phase.template.org == current_user.org) + @current = Template.current(@phase.template.dmptemplate_id) + @edit = (@phase.template.org == current_user.org) && (@phase.template == @current) #@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 @@ -158,13 +161,13 @@ def admin_create @phase = Phase.new(params[:phase]) authorize @phase - + @phase.description = params["phase-desc"] @phase.modifiable = true if @phase.save @phase.template.dirty = true @phase.template.save! - + redirect_to admin_show_phase_path(id: @phase.id, edit: 'true'), notice: _('Information was successfully created.') else flash[:notice] = failed_create_error(@phase, _('phase')) @@ -182,7 +185,7 @@ if @phase.update_attributes(params[:phase]) @phase.template.dirty = true @phase.template.save! - + redirect_to admin_show_phase_path(@phase), notice: _('Information was successfully updated.') else @sections = @phase.sections @@ -190,7 +193,7 @@ # These params may not be available in this context so they may need # to be set to true without the check @edit = true - @open = !params[:section_id].nil? + @open = !params[:section_id].nil? @section_id = (params[:section_id].nil? ? nil : params[:section_id].to_i) @question_id = (params[:question_id].nil? ? nil : params[:question_id].to_i) flash[:notice] = failed_update_error(@phase, _('phase')) @@ -206,15 +209,15 @@ if @phase.destroy @template.dirty = true @template.save! - + redirect_to admin_template_template_path(@template), notice: _('Information was successfully deleted.') else @sections = @phase.sections - + # These params may not be available in this context so they may need # to be set to true without the check @edit = true - @open = !params[:section_id].nil? + @open = !params[:section_id].nil? @section_id = (params[:section_id].nil? ? nil : params[:section_id].to_i) @question_id = (params[:question_id].nil? ? nil : params[:question_id].to_i) flash[:notice] = failed_destroy_error(@phase, _('phase')) diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 526f76a..b17e7b7 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -59,6 +59,12 @@ if @plan.save @plan.assign_creator(current_user) + + # pre-select org's guidance + ggs = GuidanceGroup.where(org_id: plan_params[:org_id], + optional_subset: false, + published: true) + if !ggs.blank? then @plan.guidance_groups << ggs end default = Template.find_by(is_default: true) @@ -140,7 +146,7 @@ authorize @plan # If there was no phase specified use the template's 1st phase @phase = (params[:phase].nil? ? @plan.template.phases.first : Phase.find(params[:phase])) - @readonly = @plan.editable_by?(current_user.id) + @readonly = !@plan.editable_by?(current_user.id) respond_to :html end @@ -184,6 +190,7 @@ end end @plan.save + flash[:notice] = _('Guidance choices saved.') redirect_to action: "show" end @@ -458,21 +465,21 @@ # Load the org's template(s) unless org_id.nil? org = Org.find(org_id) - @templates = Template.where(published: true, org: org, customization_of: nil).to_a + @templates = Template.valid.where(published: true, org: org, customization_of: nil).to_a @msg = _("We found multiple DMP templates corresponding to the research organisation.") if @templates.count > 1 end else funder = Org.find(funder_id) # Load the funder's template(s) - @templates = Template.where(published: true, org: funder).to_a + @templates = Template.valid.where(published: true, org: funder).to_a unless org_id.blank? org = Org.find(org_id) # Swap out any organisational cusotmizations of a funder template @templates.each do |tmplt| - customization = Template.find_by(published: true, org: org, customization_of: tmplt.dmptemplate_id) + customization = Template.valid.find_by(published: true, org: org, customization_of: tmplt.dmptemplate_id) unless customization.nil? @templates.delete(tmplt) @templates << customization diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 6ed74f3..14a6d21 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -6,12 +6,24 @@ def admin_create @question = Question.new(params[:question]) authorize @question - @question.guidance = params["new-question-guidance"] + example = @question.annotations.first + if example.present? + example.org_id = current_user.org_id + example.example_answer! + end + if params["new-question-guidance"].present? + guidance = @question.annotations.build + guidance.text = params["new-question-guidance"] + guidance.org_id = current_user.org_id + guidance.guidance! + guidance.save + end @question.default_value = params["new-question-default-value"] + @question.modifiable = true if @question.save @question.section.phase.template.dirty = true @question.section.phase.template.save! - + redirect_to admin_show_phase_path(id: @question.section.phase_id, section_id: @question.section_id, question_id: @question.id, edit: 'true'), notice: _('Information was successfully created.') else @edit = (@question.section.phase.template.org == current_user.org) @@ -21,7 +33,7 @@ @sections = @phase.sections @section_id = @question.section.id @question_id = @question.id - + flash[:notice] = failed_create_error(@question, _('question')) render template: 'phases/admin_show' end @@ -31,14 +43,23 @@ def admin_update @question = Question.find(params[:id]) authorize @question - @question.guidance = params["question-guidance-#{params[:id]}"] + guidance = @question.get_guidance_annotation(current_user.org_id) + if params["question-guidance-#{params[:id]}"].present? + if guidance.blank? + guidance = @question.annotations.build + guidance.type = :guidance + end + guidance.text = params["question-guidance-#{params[:id]}"] + guidance.save + end @question.default_value = params["question-default-value-#{params[:id]}"] @section = @question.section @phase = @section.phase + template = @phase.template if @question.update_attributes(params[:question]) - @question.section.phase.template.dirty = true - @question.section.phase.template.save! - + @phase.template.dirty = true + @phase.template.save! + redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, question_id: @question.id, edit: 'true'), notice: _('Information was successfully updated.') else @edit = (@phase.template.org == current_user.org) @@ -46,7 +67,7 @@ @sections = @phase.sections @section_id = @section.id @question_id = @question.id - + flash[:notice] = failed_update_error(@question, _('question')) render template: 'phases/admin_show' end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index dbc8dd4..bcaf9b9 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -40,10 +40,10 @@ redirect_to after_sign_up_error_path_for(resource), alert: _('You must accept the terms and conditions to register.') else existing_user = User.find_by_email(sign_up_params[:email]) - if !existing_user.nil? then - if (existing_user.password == "" || existing_user.password.nil?) && existing_user.confirmed_at.nil? then - @user = existing_user - do_update(false, true) + if !existing_user.nil? # If email exists + if (existing_user.password == "" || existing_user.password.nil?) && existing_user.confirmed_at.nil? # If user has not accepted invitation yet + existing_user.destroy # Only solution for now + super else redirect_to after_sign_up_error_path_for(resource), alert: _('That email address is already registered.') end @@ -91,16 +91,16 @@ end def do_update(require_password = true, confirm = false) - if require_password # user is changing email or password - if current_user.email != params[:user][:email] # if user changing email - if params[:user][:current_password].blank? # password needs to be present + if require_password # user is changing email or password + if current_user.email != params[:user][:email] # if user is changing email + if params[:user][:current_password].blank? # password needs to be present message = _('Please enter your password to change email address.') successfully_updated = false else successfully_updated = current_user.update_with_password(password_update) end - elsif params[:user][:password].present? # user is changing password - successfully_updated = false # shared across first 3 conditions + elsif params[:user][:password].present? # if user is changing password + successfully_updated = false # shared across first 3 conditions if params[:user][:current_password].blank? message = _('Please enter your current password') elsif params[:user][:password_confirmation].blank? @@ -110,10 +110,10 @@ else successfully_updated = current_user.update_with_password(password_update) end - else # potentially unreachable... but I dont like to leave off the else + else # potentially unreachable... but I dont like to leave off the else successfully_updated = current_user.update_with_password(password_update) end - else # password not required + else # password not required successfully_updated = current_user.update_without_password(update_params) end @@ -125,7 +125,7 @@ #render the correct page if successfully_updated if confirm - current_user.skip_confirmation! + current_user.skip_confirmation! # will error out if confirmable is turned off in user model current_user.save! end session[:locale] = current_user.get_locale unless current_user.get_locale.nil? diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 5bbc856..3a50d54 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -10,22 +10,26 @@ set_access_level(access_level) if params[:user].present? if @role.plan.owner.present? && @role.plan.owner.email == params[:user] - flash[:notice] = _('Impossible sharing plan with %{email} since that email matches with the owner of the plan.') % {email: params[:user]} - else - message = _('User added to project') - user = User.find_by(email: params[:user]) - if user.nil? - registered = false - User.invite!(email: params[:user]) - message = _('Invitation issued successfully.') + flash[:notice] = _('Cannot share plan with %{email} since that email matches with the owner of the plan.') % {email: params[:user]} + else + if Role.find_by(plan: @role.plan, user: User.find_by(email: params[:user])) # role already exists + flash[:notice] = _('Plan is already shared with %{email}.') % {email: params[:user]} + else + message = _('Plan shared with %{email}.') % {email: params[:user]} user = User.find_by(email: params[:user]) - end - @role.user = user - if @role.save - if registered then UserMailer.sharing_notification(@role, current_user).deliver_now end - flash[:notice] = message - else - flash[:notice] = failed_create_error(@role, _('role')) + if user.nil? + registered = false + User.invite!(email: params[:user]) + message = _('Invitation to %{email} issued successfully.') % {email: params[:user]} + user = User.find_by(email: params[:user]) + end + @role.user = user + if @role.save + if registered then UserMailer.sharing_notification(@role, current_user).deliver_now end + flash[:notice] = message + else + flash[:notice] = failed_create_error(@role, _('role')) + end end end else diff --git a/app/controllers/suggested_answers_controller.rb b/app/controllers/suggested_answers_controller.rb deleted file mode 100644 index e15d0c0..0000000 --- a/app/controllers/suggested_answers_controller.rb +++ /dev/null @@ -1,65 +0,0 @@ -class SuggestedAnswersController < ApplicationController - respond_to :html - after_action :verify_authorized - - #create suggested answers - def admin_create - @suggested_answer = SuggestedAnswer.new(params[:suggested_answer]) - authorize @suggested_answer - if @suggested_answer.save - # Set the template's dirty flag to true - @suggested_answer.question.section.phase.template.dirty = true - @suggested_answer.question.section.phase.template.save - - redirect_to admin_show_phase_path(id: @suggested_answer.question.section.phase_id, section_id: @suggested_answer.question.section_id, question_id: @suggested_answer.question.id, edit: 'true'), notice: _('Information was successfully created.') - else - @phase = @suggested_answer.question.section.phase - @section = @suggested_answer.question.section - @open = true - @sections = @phase.sections - @section_id = @section.id - @question_id = @suggested_answer.question - flash[:notice] = failed_create_error(@suggested_answer, _('suggested answer')) - render "phases/admin_show" - end - end - - - #update a suggested answer of a template - def admin_update - @suggested_answer = SuggestedAnswer.includes(question: { section: {phase: :template}}).find(params[:id]) - authorize @suggested_answer #.question.section.phase.template - @question = @suggested_answer.question - @section = @question.section - @phase = @section.phase - if @suggested_answer.update_attributes(params[:suggested_answer]) - # Set the template's dirty flag to true - @phase.template.dirty = true - @phase.template.save - - redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, question_id: @question.id, edit: 'true'), notice: _('Information was successfully updated.') - else - flash[:notice] = failed_update_error(@suggested_answer, _('suggested answer')) - render action: "phases/admin_show" - end - end - - #delete a suggested answer - def admin_destroy - @suggested_answer = SuggestedAnswer.includes(question: { section: {phase: :template}}).find(params[:id]) - authorize @suggested_answer - @question = @suggested_answer.question - @section = @question.section - @phase = @section.phase - if @suggested_answer.destroy - # Set the template's dirty flag to true - @phase.template.dirty = true - @phase.template.save - - redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, edit: 'true'), notice: _('Information was successfully deleted.') - else - redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, edit: 'true'), notice: flash[:notice] = failed_destroy_error(@suggested_answer, _('suggested answer')) - end - end - -end \ No newline at end of file diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 1f5efa4..76d55a5 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -10,30 +10,30 @@ # ----------------------------------------------------- def admin_index authorize Template - + funder_templates, org_templates, customizations = [], [], [] - + # Get all of the unique template family ids (dmptemplate_id) for each funder and the current org - funder_ids = Org.funders.includes(:templates).collect{|f| f.templates.collect{|ft| ft.dmptemplate_id } }.flatten.uniq - org_ids = current_user.org.templates.collect{|t| t.dmptemplate_id }.flatten.uniq - + funder_ids = Org.funders.includes(:templates).collect{|f| f.templates.valid.collect{|ft| ft.dmptemplate_id } }.flatten.uniq + org_ids = current_user.org.templates.valid.collect{|t| t.dmptemplate_id }.flatten.uniq + org_ids.each do |id| current = Template.current(id) live = Template.live(id) - + # If this isn't a customization of a funder template if current.customization_of.nil? org_templates << {current: current, live: live} - + # This is a customization of a funder template else funder_live = Template.live(current.customization_of) customizations << current.customization_of # Mark the customization as stale if the funder has a newer version - funder_templates << {current: current, live: live, stale: funder_live.updated_at > current.created_at} + funder_templates << {current: current, live: live, stale: funder_live.updated_at > current.created_at} end end - + # Get the funder templates funder_ids.each do |id| # If the org has a customization we don't want to load the funder version @@ -41,11 +41,11 @@ funder_templates << {current: Template.current(id), live: Template.live(id)} end end - - @funder_templates = funder_templates.sort{|x,y| + + @funder_templates = funder_templates.sort{|x,y| x[:current].title <=> y[:current].title } - @org_templates = org_templates.sort{|x,y| + @org_templates = org_templates.sort{|x,y| x[:current].title <=> y[:current].title } end @@ -55,7 +55,7 @@ def admin_customize @template = Template.find(params[:id]) authorize @template - + customisation = Template.deep_copy(@template) customisation.org = current_user.org customisation.version = 0 @@ -65,7 +65,7 @@ break random unless Template.exists?(dmptemplate_id: random) end customisation.save - + customisation.phases.includes(:sections, :questions).each do |phase| phase.modifiable = false phase.save! @@ -78,10 +78,10 @@ end end end - + redirect_to admin_template_template_path(customisation) end - + # PUT /org/admin/templates/:id/admin_publish # ----------------------------------------------------- def admin_publish @@ -89,7 +89,7 @@ authorize @template current = Template.current(@template.dmptemplate_id) - + # Only allow the current version to be updated if current != @template redirect_to admin_template_template_path(@template), notice: _('You can not publish a historical version of this template.') @@ -106,12 +106,6 @@ @template.published = true @template.save - # Create a new version - new_version = Template.deep_copy(@template) - new_version.version = (@template.version + 1) - new_version.published = false - new_version.save - flash[:notice] = _('Your template has been published and is now available to users.') redirect_to admin_index_template_path(current_user.org) @@ -134,23 +128,43 @@ @template.save flash[:notice] = _('Your template is no longer published. Users will not be able to create new DMPs for this template until you re-publish it') end - + redirect_to admin_index_template_path(current_user.org) end # GET /org/admin/templates/:id/admin_template # ----------------------------------------------------- def admin_template - @template = Template.includes(:org, phases: [sections: [questions: [:question_options, :question_format, - :suggested_answers]]]).find(params[:id]) + @template = Template.includes(:org, phases: [sections: [questions: [:question_options, :question_format, :annotations]]]).find(params[:id]) authorize @template - + @current = Template.current(@template.dmptemplate_id) - - unless @template == @current + + if @template == @current + # If the template is published + if @template.published? + # We need to create a new, editable version + new_version = Template.deep_copy(@template) + new_version.version = (@template.version + 1) + new_version.published = false + new_version.save + @template = new_version +# @current = Template.current(@template.dmptemplate_id) + end + else flash[:notice] = _('You are viewing a historical version of this template. You will not be able to make changes.') end - + + # If the template is published + if @template.published? + # We need to create a new, editable version + new_version = Template.deep_copy(@template) + new_version.version = (@template.version + 1) + new_version.published = false + new_version.save + @template = new_version + end + # once the correct template has been generated, we convert it to hash @hash = @template.to_hash end @@ -161,9 +175,9 @@ def admin_update @template = Template.find(params[:id]) authorize @template - + current = Template.current(@template.dmptemplate_id) - + # Only allow the current version to be updated if current != @template redirect_to admin_template_template_path(@template), notice: _('You can not edit a historical version of this template.') @@ -173,18 +187,18 @@ @template.title != params[:template][:title] @template.dirty = true end - + @template.description = params["template-desc"] if @template.update_attributes(params[:template]) flash[:notice] = _('Information was successfully updated.') - + else flash[:notice] = failed_update_error(@template, _('template')) end - + @hash = @template.to_hash render 'admin_template' - end + end end @@ -219,9 +233,9 @@ def admin_destroy @template = Template.find(params[:id]) authorize @template - + current = Template.current(@template.dmptemplate_id) - + # Only allow the current version to be destroyed if current == @template if @template.destroy @@ -246,4 +260,4 @@ @current = Template.current(@template.dmptemplate_id) end -end \ No newline at end of file +end diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 0c6a600..d50e397 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -61,6 +61,7 @@ end # ------------------------------------------------------------- + def failure redirect_to root_path end diff --git a/app/dashboards/annotation_dashboard.rb b/app/dashboards/annotation_dashboard.rb new file mode 100644 index 0000000..e26b609 --- /dev/null +++ b/app/dashboards/annotation_dashboard.rb @@ -0,0 +1,60 @@ +require "administrate/base_dashboard" + +class AnnotationDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + org: Field::BelongsTo, + question: Field::BelongsTo, + id: Field::Number, + text: Field::Text, + type: Field::String.with_options(searchable: false), + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :org, + :question, + :id, + :text, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :org, + :question, + :id, + :text, + :type, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :org, + :question, + :text, + :type, + ].freeze + + # Overwrite this method to customize how annotations are displayed + # across all pages of the admin dashboard. + # + # def display_resource(annotation) + # "Annotation ##{annotation.id}" + # end +end diff --git a/app/dashboards/org_dashboard.rb b/app/dashboards/org_dashboard.rb index 013748f..c00db7b 100644 --- a/app/dashboards/org_dashboard.rb +++ b/app/dashboards/org_dashboard.rb @@ -12,7 +12,7 @@ guidance_groups: Field::HasMany, templates: Field::HasMany, users: Field::HasMany, - suggested_answers: Field::HasMany, + annotations: Field::HasMany, token_permission_types: Field::HasMany, id: Field::Number, name: Field::String, @@ -59,7 +59,7 @@ :contact_email, :org_type, :users, - :suggested_answers, + :annotations, :token_permission_types, :id, :target_url, @@ -84,7 +84,7 @@ :guidance_groups, # :templates, # :users, -# :suggested_answers, +# :annotations, :token_permission_types, :name, :abbreviation, diff --git a/app/dashboards/question_dashboard.rb b/app/dashboards/question_dashboard.rb index 1d1f8aa..af3d8bb 100644 --- a/app/dashboards/question_dashboard.rb +++ b/app/dashboards/question_dashboard.rb @@ -10,7 +10,7 @@ ATTRIBUTE_TYPES = { answers: Field::HasMany, question_options: Field::HasMany, - suggested_answers: Field::HasMany, + annotations: Field::HasMany, themes: Field::HasMany, section: Field::BelongsTo, question_format: Field::BelongsTo, @@ -33,7 +33,7 @@ COLLECTION_ATTRIBUTES = [ :answers, :question_options, - :suggested_answers, + :annotations, :themes, ].freeze @@ -42,7 +42,7 @@ SHOW_PAGE_ATTRIBUTES = [ :answers, :question_options, - :suggested_answers, + :annotations, :themes, :section, :question_format, @@ -63,7 +63,7 @@ FORM_ATTRIBUTES = [ :answers, :question_options, - :suggested_answers, + :annotations, :themes, :section, :question_format, diff --git a/app/dashboards/suggested_answer_dashboard.rb b/app/dashboards/suggested_answer_dashboard.rb deleted file mode 100644 index 980ef11..0000000 --- a/app/dashboards/suggested_answer_dashboard.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "administrate/base_dashboard" - -class SuggestedAnswerDashboard < Administrate::BaseDashboard - # ATTRIBUTE_TYPES - # a hash that describes the type of each of the model's fields. - # - # Each different type represents an Administrate::Field object, - # which determines how the attribute is displayed - # on pages throughout the dashboard. - ATTRIBUTE_TYPES = { - org: Field::BelongsTo, - question: Field::BelongsTo, - id: Field::Number, - text: Field::Text, - is_example: Field::Boolean, - created_at: Field::DateTime, - updated_at: Field::DateTime, - }.freeze - - # COLLECTION_ATTRIBUTES - # an array of attributes that will be displayed on the model's index page. - # - # By default, it's limited to four items to reduce clutter on index pages. - # Feel free to add, remove, or rearrange items. - COLLECTION_ATTRIBUTES = [ - :org, - :question, - :id, - :text, - ].freeze - - # SHOW_PAGE_ATTRIBUTES - # an array of attributes that will be displayed on the model's show page. - SHOW_PAGE_ATTRIBUTES = [ - :org, - :question, - :id, - :text, - :is_example, - :created_at, - :updated_at, - ].freeze - - # FORM_ATTRIBUTES - # an array of attributes that will be displayed - # on the model's form (`new` and `edit`) pages. - FORM_ATTRIBUTES = [ - :org, - :question, - :text, - :is_example, - ].freeze - - # Overwrite this method to customize how suggested answers are displayed - # across all pages of the admin dashboard. - # - # def display_resource(suggested_answer) - # "SuggestedAnswer ##{suggested_answer.id}" - # end -end diff --git a/app/dashboards/user_dashboard.rb b/app/dashboards/user_dashboard.rb index 687d2b9..4ba23ad 100644 --- a/app/dashboards/user_dashboard.rb +++ b/app/dashboards/user_dashboard.rb @@ -82,7 +82,6 @@ :plans, :user_identifiers, :identifier_schemes, - :setting_objects, :orcid_id, :shibboleth_id, :created_at, @@ -122,7 +121,6 @@ # :plans, :user_identifiers, :identifier_schemes, -# :setting_objects, :firstname, :surname, :email, @@ -159,5 +157,4 @@ def display_resource(user) "#{user.firstname} #{user.surname} (##{user.id})" end - end diff --git a/app/models/annotation.rb b/app/models/annotation.rb new file mode 100644 index 0000000..8ea44dd --- /dev/null +++ b/app/models/annotation.rb @@ -0,0 +1,40 @@ +class Annotation < ActiveRecord::Base + enum type: [ :example_answer, :guidance] + ## + # Associations + belongs_to :org + belongs_to :question + + ## + # I liked type as the name for the enum so overriding inheritance column + self.inheritance_column = nil + + ## + # Possibly needed for active_admin + # -relies on protected_attributes gem as syntax depricated in rails 4.2 + attr_accessible :org_id, :question_id, :text, :type, + :org, :question, :as => [:default, :admin] + + + validates :question, :org, presence: {message: _("can't be blank")} + + ## + # returns the text from the annotation + # + # @return [String] the text from the annotation + def to_s + "#{text}" + end + + + ## + # deep copy the given annotation and all it's associations + # + # @params [Annotation] annotation to be deep copied + # @return [Annotation] the saved, copied annotation + def self.deep_copy(annotation) + annotation_copy = annotation.dup + annotation_copy.save! + return annotation_copy + end +end \ No newline at end of file diff --git a/app/models/answer.rb b/app/models/answer.rb index 54ac937..8267948 100644 --- a/app/models/answer.rb +++ b/app/models/answer.rb @@ -36,4 +36,10 @@ # # # Make sure the plan and question are associated with the same template! # validates :plan, :question, answer_for_correct_template: true + + # This method helps to decide if an answer option (:radiobuttons, :checkbox, etc ) in form views should be checked or not + # Returns true if the given option_id is present in question_options, otherwise returns false + def has_question_option(option_id) + self.question_option_ids.include?(option_id) + end end diff --git a/app/models/exported_plan.rb b/app/models/exported_plan.rb index 5684072..0bd9ef1 100644 --- a/app/models/exported_plan.rb +++ b/app/models/exported_plan.rb @@ -80,13 +80,12 @@ end def sections - phase_id = self.phase_id ||= self.plan.template.phases.first.id # Use the first phase if none was specified - sections = Phase.find(phase_id).sections - sections.sort_by(&:number) + self.phase_id ||= self.plan.template.phases.first.id + Section.where({phase_id: phase_id}).order(:number) end def questions_for_section(section_id) - questions.where(section_id: section_id).sort_by(&:number) + Question.where(id: questions).where(section_id: section_id).order(:number) end def admin_details @@ -104,16 +103,25 @@ CSV.generate do |csv| csv << [_('Section'),_('Question'),_('Answer'),_('Selected option(s)'),_('Answered by'),_('Answered at')] self.sections.each do |section| - self.questions_for_section(section).each do |question| - answer = self.plan.answer(question.id) - q_format = question.question_format - if q_format.title == _('Check box') || q_format.title == _('Multi select box') || - q_format.title == _('Radio buttons') || q_format.title == _('Dropdown') - options_string = answer.options.collect {|o| o.text}.join('; ') - else - options_string = '' + questions = self.questions_for_section(section) + if questions.present? + questions.each do |question| + answer = self.plan.answer(question.id) + q_format = question.question_format + if q_format.option_based? + options_string = answer.question_options.collect {|o| o.text}.join('; ') + else + options_string = '' + end + csv << [ + section.title, + sanitize_text(question.text), + question.option_comment_display ? sanitize_text(answer.text) : '', + options_string, + user.name, + answer.updated_at + ] end - csv << [section.title, sanitize_text(question.text), sanitize_text(answer.text), options_string, user.name, answer.updated_at] end end end @@ -122,58 +130,58 @@ def as_txt output = "#{self.plan.title}\n\n#{self.plan.template.title}\n" output += "\n"+_('Details')+"\n\n" - puts 'admin_details: '+self.admin_details.inspect self.admin_details.each do |at| value = self.send(at) if value.present? output += admin_field_t(at.to_s) + ": " + value + "\n" + else + output += admin_field_t(at.to_s) + ": " + _('-') + "\n" end end self.sections.each do |section| - output += "\n#{section.title}\n" + questions = self.questions_for_section(section) + if questions.present? + output += "\n#{section.title}\n" + questions.each do |question| + qtext = sanitize_text( question.text.gsub(/
  • /, ' * ') ) + output += "\n* #{qtext}" + answer = self.plan.answer(question.id, false) - self.questions_for_section(section).each do |question| - qtext = sanitize_text( question.text.gsub(/
  • /, ' * ') ) - output += "\n* #{qtext}" - answer = self.plan.answer(question.id, false) - - if answer.nil? - output += _('Question not answered.')+ "\n" - else - q_format = question.question_format - if q_format.title == _('Check box') || q_format.title == _('Multi select box') || - q_format.title == _('Radio buttons') || q_format.title == _('Dropdown') - output += answer.options.collect {|o| o.text}.join("\n") - if question.option_comment_display + if answer.nil? + output += _('Question not answered.')+ "\n" + else + q_format = question.question_format + if q_format.option_based? + output += answer.question_options.collect {|o| o.text}.join("\n") + if question.option_comment_display + output += "\n#{sanitize_text(answer.text)}\n" + end + else output += "\n#{sanitize_text(answer.text)}\n" end - else - output += "\n#{sanitize_text(answer.text)}\n" end end end end - output end private - + # Returns an Array of question_ids for the exported settings stored for a plan def questions - @questions ||= begin - question_settings = self.settings(:export).fields[:questions] - - return [] if question_settings.is_a?(Array) && question_settings.empty? - - questions = if question_settings.present? && question_settings != :all - Question.where(id: question_settings) + question_settings = self.settings(:export).fields[:questions] + @questions ||= if question_settings.present? + if question_settings == :all + Question.where(section_id: self.plan.sections.collect { |s| s.id }).pluck(:id) + elsif question_settings.is_a?(Array) + question_settings else - Question.where(section_id: self.plan.sections.collect {|s| s.id }) + [] end - - questions.order(:number) + else + [] end end diff --git a/app/models/org.rb b/app/models/org.rb index e11d5e1..348a7d1 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -4,13 +4,18 @@ extend Dragonfly::Model::Validations ## + # Sort order: Name ASC + default_scope { order(name: :asc) } + + + ## # Associations # belongs_to :organisation_type # depricated, but cannot be removed until migration run belongs_to :language has_many :guidance_groups has_many :templates has_many :users - has_many :suggested_answers + has_many :annotations has_and_belongs_to_many :token_permission_types, join_table: "org_token_permissions", unique: true diff --git a/app/models/plan.rb b/app/models/plan.rb index 8c8d3c7..549b4fe 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -970,7 +970,7 @@ def self.eager_load2(id) Plan.includes( [{template: [ - {phases: {sections: {questions: [{answers: :notes}, :suggested_answers, :question_format, :themes]}}}, + {phases: {sections: {questions: [{answers: :notes}, :annotations, :question_format, :themes]}}}, {customizations: :org}, :org ]}, diff --git a/app/models/question.rb b/app/models/question.rb index 336cae9..10efc8b 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -3,7 +3,7 @@ # Associations has_many :answers, :dependent => :destroy has_many :question_options, :dependent => :destroy - has_many :suggested_answers, :dependent => :destroy + has_many :annotations, :dependent => :destroy has_and_belongs_to_many :themes, join_table: "questions_themes" belongs_to :section belongs_to :question_format @@ -13,17 +13,17 @@ # TODO: evaluate if we need this accepts_nested_attributes_for :answers, :reject_if => lambda {|a| a[:text].blank? }, :allow_destroy => true accepts_nested_attributes_for :question_options, :reject_if => lambda {|a| a[:text].blank? }, :allow_destroy => true - accepts_nested_attributes_for :suggested_answers, :allow_destroy => true + accepts_nested_attributes_for :annotations, :allow_destroy => true accepts_nested_attributes_for :themes ## # Possibly needed for active_admin # -relies on protected_attributes gem as syntax depricated in rails 4.2 attr_accessible :default_value, :dependency_id, :dependency_text, :guidance,:number, - :suggested_answer, :text, :section_id, :question_format_id, - :question_options_attributes, :suggested_answers_attributes, + :annotation, :text, :section_id, :question_format_id, + :question_options_attributes, :annotations_attributes, :option_comment_display, :theme_ids, :section, :question_format, - :question_options, :suggested_answers, :answers, :themes, + :question_options, :annotations, :answers, :themes, :modifiable, :option_comment_display, :as => [:default, :admin] validates :text, :section, :number, presence: {message: _("can't be blank")} @@ -65,10 +65,10 @@ question_option_copy.question_id = question_copy.id question_option_copy.save! end - question.suggested_answers.each do |suggested_answer| - suggested_answer_copy = SuggestedAnswer.deep_copy(suggested_answer) - suggested_answer_copy.question_id = question_copy.id - suggested_answer_copy.save! + question.annotations.each do |annotation| + annotation_copy = Annotation.deep_copy(annotation) + annotation_copy.question_id = question_copy.id + annotation_copy.save! end question.themes.each do |theme| question_copy.themes << theme @@ -101,13 +101,24 @@ end ## - # get suggested answer belonging to the currents user for this question + # get example answer belonging to the currents user for this question # # @param org_id [Integer] the id for the organisation - # @return [String] the suggested_answer for this question for the specified organisation - def get_suggested_answer(org_id) - suggested_answer = suggested_answers.find_by(org_id: org_id) - return suggested_answer + # @return [String] the example answer for this question for the specified org + def get_example_answer(org_id) + example_answer = self.annotations.where(org_id: org_id).where(type: Annotation.types[:example_answer]).order(:created_at) + return example_answer.first end + ## + # get guidance belonging to the current user's org for this question(need org + # to distinguish customizations) + # + # @param org_id [Integer] the id for the organisation + # @return [String] the annotation guidance for this question for the specified org + def get_guidance_annotation(org_id) + guidance = self.annotations.where(org_id: org_id).where(type: Annotation.types[:guidance]) + return guidance.first + end + end diff --git a/app/models/question_option.rb b/app/models/question_option.rb index 84266ab..b0fec82 100644 --- a/app/models/question_option.rb +++ b/app/models/question_option.rb @@ -12,6 +12,7 @@ validates :text, :question, :number, presence: {message: _("can't be blank")} + scope :by_number, -> { order(:number) } ## # deep copy the given question_option and all it's associations # diff --git a/app/models/suggested_answer.rb b/app/models/suggested_answer.rb deleted file mode 100644 index 881f302..0000000 --- a/app/models/suggested_answer.rb +++ /dev/null @@ -1,42 +0,0 @@ -class SuggestedAnswer < ActiveRecord::Base - - ## - # Associations - belongs_to :org - belongs_to :question - - ## - # Possibly needed for active_admin - # -relies on protected_attributes gem as syntax depricated in rails 4.2 - attr_accessible :org_id, :question_id, :text, :is_example, - :org, :question, :as => [:default, :admin] - - - validates :question, :org, presence: {message: _("can't be blank")} - - # EVALUATE CLASS AND INSTANCE METHODS BELOW - # - # What do they do? do they do it efficiently, and do we need them? - - - - ## - # returns the text from the suggested_answer - # - # @return [String] the text from the suggested_answer - def to_s - "#{text}" - end - - - ## - # deep copy the given question_option and all it's associations - # - # @params [QuestionOption] question_option to be deep copied - # @return [QuestionOption] the saved, copied question_option - def self.deep_copy(suggested_answer) - suggested_answer_copy = suggested_answer.dup - suggested_answer_copy.save! - return suggested_answer_copy - end -end \ No newline at end of file diff --git a/app/models/template.rb b/app/models/template.rb index 94a845b..b10daa4 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -1,8 +1,8 @@ class Template < ActiveRecord::Base include GlobalHelpers - + before_validation :set_creation_defaults - + scope :valid, -> {where(migrated: false)} ## # Associations belongs_to :org @@ -30,17 +30,17 @@ # Retrieves the list of all dmptemplate_ids (template versioning families) for the specified Org def self.dmptemplate_ids - Template.all.distinct.pluck(:dmptemplate_id) + Template.all.valid.distinct.pluck(:dmptemplate_id) end # Retrieves the most recent version of the template for the specified Org and dmptemplate_id def self.current(dmptemplate_id) - Template.where(dmptemplate_id: dmptemplate_id).order(version: :desc).first + Template.where(dmptemplate_id: dmptemplate_id).order(version: :desc).valid.first end # Retrieves the current published version of the template for the specified Org and dmptemplate_id def self.live(dmptemplate_id) - Template.where(dmptemplate_id: dmptemplate_id, published: true).first + Template.where(dmptemplate_id: dmptemplate_id, published: true).valid.first end ## @@ -67,11 +67,11 @@ ## # convert the given template to a hash and return with all it's associations - # to use, please pre-fetch org, phases, section, questions, suggested_answers, + # to use, please pre-fetch org, phases, section, questions, annotations, # question_options, question_formats, # TODO: Themes & guidance? # - # @return [hash] hash of template, phases, sections, questions, question_options, suggested_answers + # @return [hash] hash of template, phases, sections, questions, question_options, annotations def to_hash hash = {} hash[:template] = {} @@ -90,10 +90,10 @@ section.questions.each do |question| phases[phase.number][:sections][section.number][:questions][question.number] = {} phases[phase.number][:sections][section.number][:questions][question.number][:data] = question - phases[phase.number][:sections][section.number][:questions][question.number][:suggested_answers] = {} - question.suggested_answers.each do |suggested_answer| - phases[phase.number][:sections][section.number][:questions][question.number][:suggested_answers][suggested_answer.id] = {} - phases[phase.number][:sections][section.number][:questions][question.number][:suggested_answers][suggested_answer.id][:data] = suggested_answer + phases[phase.number][:sections][section.number][:questions][question.number][:annotations] = {} + question.annotations.each do |annotation| + phases[phase.number][:sections][section.number][:questions][question.number][:annotations][annotation.id] = {} + phases[phase.number][:sections][section.number][:questions][question.number][:annotations][annotation.id][:data] = annotation end phases[phase.number][:sections][section.number][:questions][question.number][:question_options] = {} question.question_options.each do |question_option| @@ -128,6 +128,7 @@ # Only run this before_validation because rails fires this before save/create if self.id.nil? self.published = false + self.migrated = false self.dirty = false self.visibility = 1 self.is_default = false diff --git a/app/models/user.rb b/app/models/user.rb index 352b564..8ea0608 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -107,14 +107,13 @@ # # @param new_organisation_id [Integer] the id for an organisation # @return [String] the empty string as a causality of setting api_token -=begin - def organisation_id=(new_organisation_id) - unless self.can_change_org? || new_organisation_id.nil? || self.organisation.nil? + def org_id=(new_org_id) + unless self.can_change_org? || new_org_id.nil? || self.org.nil? || (new_org_id.to_s == self.org.id.to_s) # rip all permissions from the user self.perms.delete_all end # set the user's new organisation - super(new_organisation_id) + super(new_org_id) self.save! # rip api permissions from the user self.remove_token! @@ -124,10 +123,9 @@ # sets a new organisation for the user # # @param new_organisation [Organisation] the new organisation for the user - def organisation=(new_organisation) - organisation_id = new_organisation.id unless new_organisation.nil? + def organisation=(new_org) + org_id = new_org.id unless new_org.nil? end -=end ## # checks if the user is a super admin diff --git a/app/policies/annotation_policy.rb b/app/policies/annotation_policy.rb new file mode 100644 index 0000000..cf63f42 --- /dev/null +++ b/app/policies/annotation_policy.rb @@ -0,0 +1,28 @@ +class AnnotationPolicy < ApplicationPolicy + attr_reader :user, :annotation + + def initialize(user, annotation) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @annotation = annotation + end + + ## + # Users can modify annotations if: + # - They can modify templates + # - The template which they are modifying belongs to their orggi + ## + + def admin_create? + user.can_modify_templates? && (annotation.question.section.phase.template.org_id == user.org_id) + end + + def admin_update? + user.can_modify_templates? && (annotation.question.section.phase.template.org_id == user.org_id) + end + + def admin_destroy? + user.can_modify_templates? && (annotation.question.section.phase.template.org_id == user.org_id) + end + +end \ No newline at end of file diff --git a/app/policies/phase_policy.rb b/app/policies/phase_policy.rb index 5d43a7e..caa0e3c 100644 --- a/app/policies/phase_policy.rb +++ b/app/policies/phase_policy.rb @@ -8,10 +8,10 @@ end ## + # Org-admin side # Users can modify phases if: # - They can modify templates # - The template which they are modifying belongs to their org - ## def admin_show? user.can_modify_templates? && (phase.template.org_id == user.org_id) diff --git a/app/policies/plan_policy.rb b/app/policies/plan_policy.rb index d6c8703..aa99a2b 100644 --- a/app/policies/plan_policy.rb +++ b/app/policies/plan_policy.rb @@ -7,13 +7,13 @@ @user = user @plan = plan end - + def show? @plan.readable_by?(@user.id) end def edit? - @plan.editable_by?(@user.id) + @plan.readable_by?(@user.id) end def update_guidance_choices? diff --git a/app/policies/suggested_answer_policy.rb b/app/policies/suggested_answer_policy.rb deleted file mode 100644 index e6cd49c..0000000 --- a/app/policies/suggested_answer_policy.rb +++ /dev/null @@ -1,28 +0,0 @@ -class SuggestedAnswerPolicy < ApplicationPolicy - attr_reader :user, :suggested_answer - - def initialize(user, suggested_answer) - raise Pundit::NotAuthorizedError, "must be logged in" unless user - @user = user - @suggested_answer = suggested_answer - end - - ## - # Users can modify suggested answers if: - # - They can modify templates - # - The template which they are modifying belongs to their org - ## - - def admin_create? - user.can_modify_templates? && (suggested_answer.question.section.phase.template.org_id == user.org_id) - end - - def admin_update? - user.can_modify_templates? && (suggested_answer.question.section.phase.template.org_id == user.org_id) - end - - def admin_destroy? - user.can_modify_templates? && (suggested_answer.question.section.phase.template.org_id == user.org_id) - end - -end \ No newline at end of file diff --git a/app/views/admin/application/_admin_header.html.erb b/app/views/admin/application/_admin_header.html.erb deleted file mode 100644 index 6f7bcb5..0000000 --- a/app/views/admin/application/_admin_header.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -
    -
    -
    - -
    -
    -
    diff --git a/app/views/admin/application/_sidebar.html.erb b/app/views/admin/application/_sidebar.html.erb deleted file mode 100644 index 98adca4..0000000 --- a/app/views/admin/application/_sidebar.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<%# Hack for customisation %> -<%= render 'admin_header' %> - -<%# -# Sidebar - -This partial is used to display the sidebar in Administrate. -By default, the sidebar contains navigation links -for all resources in the admin dashboard, -as defined by the routes in the `admin/` namespace -%> - - diff --git a/app/views/administrate/application/_admin_header.html.erb b/app/views/administrate/application/_admin_header.html.erb new file mode 100644 index 0000000..115db95 --- /dev/null +++ b/app/views/administrate/application/_admin_header.html.erb @@ -0,0 +1,4 @@ +
    +

    Super Admin area

    + <%= link_to(image_tag("logo.jpg"), root_path)%> +
    diff --git a/app/views/administrate/application/_navigation.html.erb b/app/views/administrate/application/_navigation.html.erb new file mode 100644 index 0000000..a5cfa7a --- /dev/null +++ b/app/views/administrate/application/_navigation.html.erb @@ -0,0 +1,26 @@ +<%# Hack for customisation %> + +<%# +# Navigation + +This partial is used to display the navigation in Administrate. +By default, the navigation contains navigation links +for all resources in the admin dashboard, +as defined by the routes in the `admin/` namespace +%> + + diff --git a/app/views/administrate/application/_search.html.erb b/app/views/administrate/application/_search.html.erb new file mode 100644 index 0000000..7145011 --- /dev/null +++ b/app/views/administrate/application/_search.html.erb @@ -0,0 +1,21 @@ + diff --git a/app/views/annotations/_add_annotation.html.erb b/app/views/annotations/_add_annotation.html.erb new file mode 100644 index 0000000..8cf9113 --- /dev/null +++ b/app/views/annotations/_add_annotation.html.erb @@ -0,0 +1,25 @@ + +<%= form_for :annotation, url: admin_create_annotation_path do |f| %> + <%= f.hidden_field :org_id, value: current_user.org_id %> + <%= f.hidden_field :question_id, value: question.id %> + <%= f.hidden_field :type, value: Annotation.types[:example_answer] %> + + + + + + +
    <%= _('Example Answer')%> +
      +
    • <%= f.text_area :text, rows: 5 %> +
    • +
    +
    +
    + + +
    + <%= f.submit _('Save'), class: "btn btn-primary" %> + <%= link_to _('Cancel'), "#", id: "cancel_suugested_answer", class: "btn cancel" %> +
    +<%end%> diff --git a/app/views/annotations/_edit_annotation.html.erb b/app/views/annotations/_edit_annotation.html.erb new file mode 100644 index 0000000..6fa1e35 --- /dev/null +++ b/app/views/annotations/_edit_annotation.html.erb @@ -0,0 +1,25 @@ + +<%= form_for( annotation, url: admin_update_annotation_path(annotation.id), html: { method: :put}) do |f| %> + <%= f.hidden_field :org_id, value: current_user.org_id %> + + + + + + +
    <%= _('Example of Answer')%> +
      +
    • <%= f.text_area :text, rows: 5 %>
    • +
    +
    +
    + + +
    + <%= f.submit _('Save'), class: 'btn btn-primary' %> + <%= link_to _('Delete'), admin_destroy_annotation_path(id: annotation.id), + confirm: _("You are about to delete an example answer for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%> + <%= hidden_field_tag :question_id, question.id, class: "question_id" %> + <%= link_to _('Cancel'), '#', class: 'btn cancel cancel_edit_suggested_answer' %> +
    +<% end %> diff --git a/app/views/annotations/_show_annotation.html.erb b/app/views/annotations/_show_annotation.html.erb new file mode 100644 index 0000000..9cc93de --- /dev/null +++ b/app/views/annotations/_show_annotation.html.erb @@ -0,0 +1,15 @@ + + + + + + +
    + <%= _('Example of answer')%> + <%= raw annotation.text %>
    +
    + +
    + <%= hidden_field_tag :question_id, question.id, class: "question_id" %> + <%= link_to _('Edit Example of Answer'), '# ', class: "btn btn-primary edit_form_for_suggested_answer"%> +
    diff --git a/app/views/answers/_status.html.erb b/app/views/answers/_status.html.erb new file mode 100644 index 0000000..e1c8d8b --- /dev/null +++ b/app/views/answers/_status.html.erb @@ -0,0 +1,9 @@ + + + +
    + <% 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/answers/update.js.erb b/app/views/answers/update.js.erb index 40907ae..ec06441 100644 --- a/app/views/answers/update.js.erb +++ b/app/views/answers/update.js.erb @@ -3,10 +3,6 @@ // On success this will be "" on error it will be the // conflicting answer -// go back from "Saving..." message to "Save" button -$("#saving-<%=@question.id%>").hide(); -$("#saving-<%=@question.id%>").prev().show(); - <% if @old_answer %> $("#answer_notice_<%=@question.id%>").html("<%= escape_javascript(render partial: '/phases/answer', locals: { question: @question, answer: @old_answer}) %>"); <% else %> @@ -21,20 +17,13 @@ $("#question-form-<%= @question.id %> #answer_id").val(<%= @answer.id %>); // update the answer status - -var q_status = $("#<%=@question.id%>-status"); -var timestamp = "<%=@timestamp%>"; - -if( timestamp != "") { - q_status.text(""); - q_status.append("<%= _('Answered') %> \" title=\"<%=@timestamp%>\"><%=@timestamp%> <%= _('by') %> <%=@username%>"); - $('abbr.timeago').timeago(); -} - +$("#answer-status-<%= @question.id %>") + .html("<%= escape_javascript(render partial: '/answers/status', locals: { question_id: @question.id, answer: @answer}) %>"); +if($.fn.init_answer_status) + $.fn.init_answer_status(); // update plan progress bar $(".progress").html("<%= escape_javascript(render :partial => '/plans/progress', locals: {nquestions: @nquestions, nanswers: @nanswers}) %>"); - // update the section progress message $("#<%=@section_id%>-status").html("(<%=@n_section_questions%> <%= _('questions') %>, <%=@n_section_answers%> <%= _('answered') %>)") diff --git a/app/views/devise/registrations/_external_identifier.html.erb b/app/views/devise/registrations/_external_identifier.html.erb index 93c045a..226b270 100644 --- a/app/views/devise/registrations/_external_identifier.html.erb +++ b/app/views/devise/registrations/_external_identifier.html.erb @@ -1,8 +1,6 @@ -
    ); background-size: 16px;"> - +
    <% if id.nil? || id.identifier == '' %> - <%= link_to "#{_("Create or Link your #{scheme.description} ID")}", + <%= link_to "#{_("Link account with #{scheme.description} ID")}", Rails.application.routes.url_helpers.send( "user_#{scheme.name.downcase}_omniauth_authorize_path" ), @@ -15,9 +13,9 @@ <%= link_to "#{_("Your account has been linked to #{scheme.description}.")}", "#{scheme.user_landing_url}/#{id.identifier}", target: '_blank', title: t("identifier_schemes.schemes.#{scheme.name}.connect_tooltip", default: "") %> <% end %> - <%= link_to image_tag('remove.png', height: '16px', width: '16px'), + <%= link_to ''.html_safe, destroy_user_identifier_path(id), method: :delete, title: _("Unlink your account from #{scheme.description}. You can link again at any time."), - data: {confirm: _("Are you sure you want to unlink your #{scheme.description} ID?")} %> + data: {confirm: _("Are you sure you want to unlink #{scheme.description} ID?")} %> <% end %>
    diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 22ac7ef..ec280ec 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -63,8 +63,14 @@ <% @identifier_schemes.each do |scheme| %>
    - -
    + +
    <%= render partial: 'external_identifier', locals: {scheme: scheme, id: current_user.identifier_for(scheme)} %> diff --git a/app/views/guidances/_edit_guidance.html.erb b/app/views/guidances/_edit_guidance.html.erb index 36fe926..7138ceb 100644 --- a/app/views/guidances/_edit_guidance.html.erb +++ b/app/views/guidances/_edit_guidance.html.erb @@ -1,4 +1,4 @@ - + <%= form_for(suggested_answer, url: admin_update_suggested_answer_path(suggested_answer), html: { method: :put}) do |f| %> <%= f.hidden_field :org_id, value: current_user.org_id %> diff --git a/app/views/guidances/_guidance_display.html.erb b/app/views/guidances/_guidance_display.html.erb index bb7ade9..b3bce3b 100644 --- a/app/views/guidances/_guidance_display.html.erb +++ b/app/views/guidances/_guidance_display.html.erb @@ -2,7 +2,7 @@
    - <% if !question.guidance.nil? && question.guidance != "" %> + <% if !question.get_guidance_annotation(current_user.org).nil? && question.get_guidance_annotation(current_user.org) != "" %>
    -
    <%= raw question.guidance %>
    +
    <%= raw question.get_guidance_annotation(current_user.org).text %>
    <% end %> @@ -33,4 +33,4 @@ <% end %>
    -
    \ No newline at end of file +
    diff --git a/app/views/guidances/admin_edit.html.erb b/app/views/guidances/admin_edit.html.erb index 565f5d4..7b43313 100644 --- a/app/views/guidances/admin_edit.html.erb +++ b/app/views/guidances/admin_edit.html.erb @@ -24,7 +24,8 @@ - +
    <%= _('Text') %>
    +
    +
    <%= text_area_tag("guidance-text", @guidance.text, class: "tinymce") %>
    diff --git a/app/views/guidances/admin_new.html.erb b/app/views/guidances/admin_new.html.erb index eb7f7a3..95239c0 100644 --- a/app/views/guidances/admin_new.html.erb +++ b/app/views/guidances/admin_new.html.erb @@ -19,7 +19,8 @@ - - + <% end %>
    <%= _('Text') %>
    +
    +
    <%= text_area_tag("guidance-text", "", class: "tinymce") %>
    diff --git a/app/views/layouts/_signin_signout.html.erb b/app/views/layouts/_signin_signout.html.erb index 6222e55..8d36ff7 100644 --- a/app/views/layouts/_signin_signout.html.erb +++ b/app/views/layouts/_signin_signout.html.erb @@ -19,7 +19,7 @@ <% elsif current_user.can_modify_org_details? %>
  • <%= link_to _("Admin area"), admin_show_org_path(current_user.org_id), class: "signIn_dropdown_link" %>
  • <% elsif current_user.can_grant_permissions? %> -
  • <%= link_to _("Admin area"), admin_index_user_path, class: "signIn_dropdown_link" %>
  • +
  • <%= link_to _("Admin area"), admin_index_users_path, class: "signIn_dropdown_link" %>
  • <% end %> <% end %>
  • <%= link_to _('Sign out'), destroy_user_session_path, method: :delete, class: "signIn_dropdown_link" %>
  • @@ -37,3 +37,7 @@ <% end %>
    + + diff --git a/app/views/phases/_answer_form.html.erb b/app/views/phases/_answer_form.html.erb index bdd8c1d..aba7c44 100644 --- a/app/views/phases/_answer_form.html.erb +++ b/app/views/phases/_answer_form.html.erb @@ -31,22 +31,18 @@ <%= raw question.text %> - - <% if question.suggested_answers.any? %> - <% suggested_answer = question.suggested_answers.first %> - <% if suggested_answer.text.present? %> + + <% if question.annotations.where(type: Annotation.types[:example_answer]).any? %> + <% annotation = question.annotations.where(type: Annotation.types[:example_answer]).order(:created_at).first %> + <% if annotation.text.present? %>
    - <% if suggested_answer.is_example? then %> - <%= _('Example of answer')%> - <%else%> - <%= _('Suggested answer')%> - <%end%> + <%="#{annotation.org.abbreviation} "%> <%=_('Example of answer')%>

    - <%= raw suggested_answer.text %> + <%= raw annotation.text %>

    @@ -58,58 +54,75 @@ <% if question.option_based? %> - <% options = question.question_options.order("number") %> + <% options = question.question_options.by_number %> <% if q_format.checkbox? %> - <%= f.input :options, as: :check_boxes, collection: options, label: false, input_html: { id: "options-#{question.id}" } %> - <% elsif q_format.multiselectbox? %> - <%= f.input :options, as: :select, collection: options, label: false, input_html: { multiple: true , id: "options-#{question.id}" } %> +
      + <% options.each do |op| %> +
    1. + <%= f.check_box(:question_option_ids, { multiple: true, checked: answer.has_question_option(op.id), disabled: readonly }, op.id, nil) %> + <%= raw op.text %> +
    2. + <% end %> +
    <% elsif q_format.radiobuttons? %>
      <% options.each do |op| %> -
    1. - <% if answer.question_option_ids[0] == op.id then%> - <%= f.radio_button :option_ids, op.id, checked: true, id: "answer_option_ids_#{op.id}"%> - <%else%> - <%= f.radio_button :option_ids, op.id, checked: false, id: "answer_option_ids_#{op.id}"%> - <% end %> - <%= raw op.text %>
    2. +
    3. + <%= f.radio_button :question_option_ids, op.id, { checked: answer.has_question_option(op.id), id: "answer_option_ids_#{op.id}", disabled: readonly } %> + <%= raw op.text %> +
    4. <% end %>
    - <% elsif q_format.dropdown? %> - <%= f.input :options, as: :select, collection: options, label: false, input_html: { multiple: false, id: "options-#{question.id}" } %> + <% elsif q_format.dropdown? || q_format.multiselectbox? %> + <% + options_html = "" + options.each do |op| + options_html += answer.has_question_option(op.id) ? + "" : + "" + end + %> + <%= select_tag('answer[question_option_ids]', raw(options_html), + {multiple: q_format.multiselectbox?, include_blank: q_format.dropdown?, disabled: readonly }) %> <% end %> <% if question.option_comment_display == true %> <%= label_tag("answer-text-#{question.id}".to_sym, _('Comment')) %> - <%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %> + <% if readonly %> +

    <%= raw(answer.text) %>

    + <% else %> + <%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %> + <% end %> <%end%> <% end %> <% if q_format.textfield? %> - <%= text_field_tag("answer-text-#{question_id}".to_sym, strip_tags(answer.text), class: "question_text_field") %> + <% if readonly %> +

    <%= strip_tags(answer.text) %>

    + <% else %> + <%= text_field_tag("answer-text-#{question_id}".to_sym, strip_tags(answer.text), { class: "question_text_field" }) %> + <% end %> <% elsif q_format.textarea? %> - <%= text_area_tag("answer-text-#{question_id}".to_sym, answer.text, class: "tinymce") %> + <% if readonly %> +

    <%= raw(answer.text) %>

    + <% else %> + <%= text_area_tag("answer-text-#{question_id}".to_sym, answer.text, class: "tinymce") %> + <% end %> <% end %> - - - - - + <% if !readonly %> + + <% end %> - +
    "> + <%= render(partial: 'answers/status', locals: { question_id: question_id, answer: answer }) %> +
    <% end %> - - <% if answer.nil? || !answer.text.present? %> - <%= _('Not answered yet') %> - <% else %> - <%= _('Answered')%> <%= answer.updated_at.iso8601 %><%= _(' by')%> <%= answer.user.name %> - <% end %> @@ -119,7 +132,8 @@ <% comments = answer.notes.all %> <%= hidden_field_tag :question_id, question_id, class: "question_id" %>
      - <% if question.guidance.present? || question_guidances[question_id] %> + <% annotations = question.annotations.where("type <> ?", Annotation.types[:guidance]) %> + <% if annotations.present? || question_guidances[question_id] %> <% css_style_comment_div = "display: none;"%> <% css_style_guidance_div = ""%> @@ -127,26 +141,26 @@ <%= link_to _('Guidance'), "#", class: "guidance_accordion_button" %>
    • - <% if comments.count > 0 then%> + <% if comments.count > 0%> <% comments_label_with_count = "#{_('Notes')} (#{comments.count})"%> <%= link_to comments_label_with_count , "#", id: "notes_number_#{question_id}", class: "comments_accordion_button" %> - <%else%> + <% else %> <%= link_to _('Share note'), "#", id: "notes_number_#{question_id}", class: "comments_accordion_button" %> - <%end%> + <% end %>
    • - <%else%> + <% else %> <% css_style_comment_div = ""%> <% css_style_guidance_div = "display: none;"%>
    • - <% if comments.count > 0 then%> + <% if comments.count > 0 %> <% comments_label_with_count = "#{_('Notes')} (#{comments.count})"%>

      <%= comments_label_with_count %>

      - <%else%> + <% else %>

      <%= _('Share note') %>

      - <%end%> + <% end %>
    • - <%end%> + <% end %>
    @@ -155,25 +169,28 @@
    - - <% if question.guidance.present? %> -
    + + <% if annotations.present? %> + <% annotations.each do |annotation| %> - - +
    - -
    -
    <%= raw question.guidance %>
    -
    + + -
    + +
    +
    <%= raw annotation.text %>
    +
    + +
    + <% end %> <% end %> @@ -182,13 +199,13 @@ <% group.each do |gobj| %>
    -
    +
    <%= raw gobj[:text] %>
    <% guidance_accordion_id += 1 %> @@ -198,12 +215,10 @@
    -
    <%= render partial: "note", locals: {question: question, answer: answer, plan: plan, suffix: "" }%>
    -
    diff --git a/app/views/phases/_answer_form_ro.html.erb b/app/views/phases/_answer_form_ro.html.erb deleted file mode 100644 index 4f68019..0000000 --- a/app/views/phases/_answer_form_ro.html.erb +++ /dev/null @@ -1,246 +0,0 @@ - -<% answer = @plan.answer(question.id) %> - -
    - - <% q_format = question.question_format%> - - <% if readonly != "always" then %> -
    > - <%= semantic_form_for answer, :url => {:controller => :answers, :action => :create }, :html=>{:method=>:post}, :remote => true do |f| %> - <%= f.inputs do %> - <%= f.input :plan_id, :as => :hidden %> - <%= f.input :user_id, :as => :hidden, :input_html => { :value => current_user.id } %> - <%= f.input :question_id, :as => :hidden, :input_html => { :class => "question_id" } %> - - - - <%= raw question.text %> - - - <% suggested_answer = question.suggested_answers.where(org_id: @plan.template.org_id).first %> - <% if suggested_answer.present? %> -
    - - <% if suggested_answer.is_example? then %> - <%= _('Example of answer')%> - <%else%> - <%= _('Suggested answer')%> - <%end%> - -
    -

    - <%= raw suggested_answer.text %> -

    -
    -
    - <% end %> - - - <% if q_format.title == _('Check box') || q_format.title == _('Multi select box') || q_format.title == _('Radio buttons') || q_format.title == _('helpers.dropdown') then%> - <% options = question.options.order("number") %> - - <% if q_format.title == _('Check box') then %> - <% if readonly then %> - <%= f.input :options, :as => :check_boxes, :collection => options, :label => false, input_html => { :disabled => true, :id => "options-#{question.id}" } %> - <% else %> - <%= f.input :options, :as => :check_boxes, :collection => options, :label => false, :input_html => { :id => "options-#{question.id}" } %> - <% end %> - - <% elsif q_format.title == _('Multi select box') then %> - <% if readonly then %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => true, :disabled => true , :id => "options-#{question.id}" } %> - <% else %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => true , :id => "options-#{question.id}" } %> - <% end %> - - <% elsif q_format.title == _('Radio buttons') then%> -
      - <% options.each do |op| %> -
    1. - <% if answer.option_ids[0] == op.id then%> - <% if readonly then %> - <%= f.radio_button :option_ids, op.id, :checked => true, disabled: true, id: "answer_option_ids_#{op.id}"%> - <% else %> - <%= f.radio_button :option_ids, op.id, :checked => true, id: "answer_option_ids_#{op.id}"%> - <% end %> - <%else%> - <% if readonly then %> - <%= f.radio_button :option_ids, op.id, :checked => false, disabled: true, id: "answer_option_ids_#{op.id}"%> - <% else %> - <%= f.radio_button :option_ids, op.id, :checked => false, id: "answer_option_ids_#{op.id}"%> - <% end %> - <% end %> - <%= op.text %>
    2. - <% end %> -
    - - <% elsif q_format.title == _('Dropdown') then%> - <% if readonly then %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => false, :disabled => true, :id => "options-#{question.id}" } %> - <% else %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => false, :id => "options-#{question.id}" } %> - <% end %> - <% end %> - - <% if question.option_comment_display == true then%> - <%= label_tag("answer-text-#{question.id}".to_sym, _('Comment')) %> - <%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %> - <%end%> - - - <% elsif q_format.title == _('Text field') then %> - <%= text_field_tag("answer-text-#{question.id}".to_sym, strip_tags(answer.text), class: "question_text_field") %> - - <% elsif q_format.title == _('Text area') then%> - <%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %> - <% end %> - - <% end %> - - - <%= f.actions do %> - <% if readonly then %> - <%= f.action :submit, :label => _('Save'), :button_html => { :class => "btn btn-primary"}, :input_html => { :disabled => true } %> - <% else %> - <%= f.action :submit, :label => _('Save'), :button_html => { :class => "btn btn-primary"} %> - <% end %> - - <% end %> - <% end %> -
    - <% end %> - -
    > -

    <%= question.text %>

    -
    - <% if q_format.title == _('Check box') || q_format.title == _('Multi select box') || q_format.title == _('Radio buttons') || q_format.title == _('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 %> - <%= _('Not answered yet') %> - <% else %> - <%= _('Answered')%><%= answer.created_at %><%= _(' by')%><%= answer.user.name %> - <% end %> - -
    - - - -
    -
    - <% @comments = Notes.where("question_id = ? AND plan_id = ?", question.id, answer.plan_id ) %> - <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> - -
      - - <% if (!question.guidance.nil? && question.guidance != "") || !question_guidances.empty? then %> - - <% css_style_comment_div = "display: none;"%> - <% css_style_guidance_div = ""%> -
    • - <%= link_to _('Guidance'), "#", :class => "guidance_accordion_button" %> -
    • -
    • - <% if @comments.count > 0 then%> - <% comments_label_with_count = "#{_('Notes')} (#{@comments.count})"%> - <%= link_to comments_label_with_count , "#", :class => "comments_accordion_button" %> - <%else%> - <%= link_to _('Share note'), "#", :class => "comments_accordion_button" %> - <%end%> -
    • - <%else%> - - <% css_style_comment_div = ""%> - <% css_style_guidance_div = "display: none;"%> -
    • - <% if @comments.count > 0 then%> - <% comments_label_with_count = "#{_('Notes')} (#{@comments.count})"%> -

      <%= comments_label_with_count %>

      - <%else%> -

      <%= _('Share note') %>

      - <%end%> -
    • - <%end%> -
    -
    - - - -
    -
    - - <% if !question.guidance.nil? && question.guidance != "" then %> - - <% end %> - - <% guidance_accordion_id = 1 %> - <% question_guidances.each_pair do |theme, group| %> - <% group.each do |gobj| %> -
    - -
    -
    <%= raw gobj[:text] %>
    -
    - <% guidance_accordion_id += 1 %> -
    - <% end %> - <% end %> -
    -
    - - -
    - <%= render :partial => "comments", locals: {questionId: question.id, plan_id: answer.plan_id }%> -
    - - - -
    - -<% if last_question_id == question.id then %> -
    -<% else %> -
    -<% end %> diff --git a/app/views/phases/_show_phase.html.erb b/app/views/phases/_show_phase.html.erb index 0fb55d0..ecb5dd4 100644 --- a/app/views/phases/_show_phase.html.erb +++ b/app/views/phases/_show_phase.html.erb @@ -4,7 +4,7 @@ <%= _('Phase details')%> - <% if @phase.modifiable %> + <% if @phase.modifiable && @edit %>
    <%= link_to _('Edit phase details'), '#', class: "btn btn-primary", id: "edit_phase_button"%>
    diff --git a/app/views/phases/admin_show.html.erb b/app/views/phases/admin_show.html.erb index cd02a2d..e27f41e 100644 --- a/app/views/phases/admin_show.html.erb +++ b/app/views/phases/admin_show.html.erb @@ -17,7 +17,7 @@
    -<%= render partial: "templates/admin_nav_tabs", locals: {template: @phase.template, active: @phase.id} %> +<%= render partial: "templates/admin_nav_tabs", locals: {template: @phase.template, active: @phase.id, edit: @edit, current: @current} %>
    diff --git a/app/views/phases/edit.html.erb b/app/views/phases/edit.html.erb index f91d5f7..9c73d91 100644 --- a/app/views/phases/edit.html.erb +++ b/app/views/phases/edit.html.erb @@ -1,6 +1,6 @@ <%- model_class = Plan -%> <% javascript "plans.js" %> - +<% javascript "answers/status.js" %> <% if session[:question_id_comments].to_i != 0 then %> <% question_from_comment = Question.find(session[:question_id_comments])%> - <% if sectionid == question_from_comment.section_id then %> + <% if sectionid == question_from_comment.section_id then %> <%= hidden_field_tag :comment_section_id, question_from_comment.section_id, :class => "comment_section_id" %> - <%end%> - <% end%> + <%end%> + <% end%>
    @@ -86,24 +86,20 @@ <% section.questions.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 = @question_guidance[question.id] %> - - <%= render partial: partialname, + + <%= render partial: 'answer_form', locals: { plan: @plan, phase_id: @phase.id, question: question, question_guidances: guidances, last_question_id: section.questions.last.id, + readonly: @readonly } %> -
    +
    <% end %>
    diff --git a/app/views/plans/_answer_form.html.erb b/app/views/plans/_answer_form.html.erb deleted file mode 100644 index 45f908b..0000000 --- a/app/views/plans/_answer_form.html.erb +++ /dev/null @@ -1,269 +0,0 @@ - -<% answer = @plan.answer(question.id) %> - -
    - - <% q_format = question.question_format%> - - <% if readonly != "always" then %> -
    > - <%= semantic_form_for answer, :url => {:controller => :answers, :action => :create }, :html=>{:method=>:post}, :remote => true do |f| %> - <%= f.inputs do %> - <%= f.input :plan_id, :as => :hidden %> - <%= f.input :user_id, :as => :hidden, :input_html => { :value => current_user.id } %> - <%= f.input :question_id, :as => :hidden, :input_html => { :class => "question_id" } %> - - - - <%= raw question.text %> - - - <% suggested_answer = question.suggested_answers.find_by_organisation_id(@plan.project.organisation_id) %> - <% if !suggested_answer.nil? && suggested_answer.text != "" then %> -
    - - <% if suggested_answer.is_example? then %> - <%= _('Example of answer')%> - <%else%> - <%= _('Suggested answer')%> - <%end%> - -
    -

    - <%= raw suggested_answer.text %> -

    -
    -
    - <% end %> - - - <% if q_format.title == "Check box" || - q_format.title == "Multi select box" || - q_format.title == "Radio buttons" || - q_format.title == "Dropdown" then%> - <% options = question.options.order("number") %> - - <% if q_format.title == "Check box" then %> - <% if readonly then %> - <%= f.input :options, :as => :check_boxes, :collection => options, :label => false, input_html => { :disabled => true, :id => "options-#{question.id}" } %> - <% else %> - <%= f.input :options, :as => :check_boxes, :collection => options, :label => false, :input_html => { :id => "options-#{question.id}" } %> - <% end %> - - <% elsif q_format.title == "Multi select box" then %> - <% if readonly then %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => true, :disabled => true , :id => "options-#{question.id}" } %> - <% else %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => true , :id => "options-#{question.id}" } %> - <% end %> - - <% elsif q_format.title == "Radio buttons" then%> -
      - <% options.each do |op| %> -
    1. - <% if answer.option_ids[0] == op.id then%> - <% if readonly then %> - <%= f.radio_button :option_ids, op.id, :checked => true, disabled: true, id: "answer_option_ids_#{op.id}"%> - <% else %> - <%= f.radio_button :option_ids, op.id, :checked => true, id: "answer_option_ids_#{op.id}"%> - <% end %> - <%else%> - <% if readonly then %> - <%= f.radio_button :option_ids, op.id, :checked => false, disabled: true, id: "answer_option_ids_#{op.id}"%> - <% else %> - <%= f.radio_button :option_ids, op.id, :checked => false, id: "answer_option_ids_#{op.id}"%> - <% end %> - <% end %> - <%= op.text %>
    2. - <% end %> -
    - - <% elsif q_format.title == "Dropdown" then%> - <% if readonly then %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => false, :disabled => true, :id => "options-#{question.id}" } %> - <% else %> - <%= f.input :options, :as => :select, :collection => options, :label => false, :input_html => { :multiple => false, :id => "options-#{question.id}" } %> - <% end %> - <% end %> - - - - - <% if question.option_comment_display == true then%> - <%= label_tag("answer-text-#{question.id}".to_sym, _('Comment')) %> - <%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %> - <%end%> - - - <% elsif q_format.title == "Text field" then %> - <%= text_field_tag("answer-text-#{question.id}".to_sym, strip_tags(answer.text), class: "question_text_field") %> - - <% elsif q_format.title == "Text area" then%> - <%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %> - <% end %> - - <% end %> - - - <%= f.actions do %> - <% if readonly then %> - <%= f.action :submit, :label => _('Save'), :button_html => { :class => "btn btn-primary"}, :input_html => { :disabled => true } %> - <% else %> - <%= f.action :submit, :label => _('Save'), :button_html => { :class => "btn btn-primary"} %> - - <% end %> - - <% end %> - <% end %> -
    - <% end %> - -
    > -

    <%= question.text %>

    -
    - <% if q_format.title == "Check box" || - q_format.title == "Multi select box" || - q_format.title == "Radio buttons" || - q_format.title == "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 %> - <%= _('Not answered yet') %> - <% else %> - <%= _('Answered')%><%= answer.created_at %><%= _(' by')%><%= answer.user.name %> - <% end %> - -
    - - - -
    -
    - <% @comments = Comment.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 != "") || @question_guidances.count > 0 then %> - - <% css_style_comment_div = "display: none;"%> - <% css_style_guidance_div = ""%> -
    • - <%= link_to _('Guidance'), "#", :class => "guidance_accordion_button" %> -
    • -
    • - <% if @comments.count > 0 then%> - <% comments_label_with_count = "#{_('Notes')} (#{@comments.count})"%> - <%= link_to comments_label_with_count , "#", :class => "comments_accordion_button" %> - <%else%> - <%= link_to _('Share note'), "#", :class => "comments_accordion_button" %> - <%end%> -
    • - <%else%> - - <% css_style_comment_div = ""%> - <% css_style_guidance_div = "display: none;"%> -
    • - <% if @comments.count > 0 then%> - <% comments_label_with_count = "#{_('Notes')} (#{@comments.count})"%> -

      <%= comments_label_with_count %>

      - <%else%> -

      <%= _('Share note') %>

      - <%end%> -
    • - <%end%> -
    -
    - - - -
    -
    - - <% if !question.guidance.nil? && question.guidance != "" then %> - - <% end %> - - <% @question_guidances.each_pair do |group,themes| %> - <% themes.each_pair do |theme,guidances| %> - <% guidances.each do |guidance| %> - - <% end %> - <% end %> - <% end %> -
    -
    - - -
    - <%= render :partial => "comments", locals: {questionId: question.id, plan_id: answer.plan_id }%> -
    - - - -
    - -<% if last_question_id == question.id then %> -
    -<% else %> -
    -<% end %> diff --git a/app/views/plans/edit.html.erb b/app/views/plans/edit.html.erb index d44caea..57a7d38 100644 --- a/app/views/plans/edit.html.erb +++ b/app/views/plans/edit.html.erb @@ -8,6 +8,7 @@ <%= render :partial => "plan_title", locals: {plan: @plan} %> +

    <%=@readonly%>

    <% status = @plan.status %> diff --git a/app/views/plans/export.docx.caracal b/app/views/plans/export.docx.caracal deleted file mode 100644 index 778eb3c..0000000 --- a/app/views/plans/export.docx.caracal +++ /dev/null @@ -1,256 +0,0 @@ -#----------------------------------------------------- -# page settings -#----------------------------------------------------- - -docx.page_numbers true do - align :center -end - -docx.font do - name 'Arial' -end - -docx.p do - size 32 -end - - -#--------------------------------------------- -# Structure for docx format -#--------------------------------------------- - -docx.h1 @exported_plan.plan.title.upcase, font: 'Arial', color: '000000' -docx.h2 @plan.template.title.upcase, font: 'Arial', color: '000000' - -#---- PLAN ADMIN DETAILS ----- -if @exported_plan.admin_details.present? - docx.p - docx.h3 _('Admin Details').upcase , italic: false, font: 'Arial', color: '000000' - @exported_plan.admin_details.each do |field| - value = @exported_plan.send(field) - if value.present? - docx.p do |p| - p.text admin_field_t(field.to_s), bold: true, color: '000000' - p.text ': ', bold: true, color: '000000' - p.text value - end - end - end -end - - -#---- PLAN SECTIONS, QUESTIONS AND ANSWERS ----- -@exported_plan.sections.each do |section| - docx.p - docx.h3 section.title.upcase, italic: false, font: 'Arial', color: '000000' - - @exported_plan.questions_for_section(section.id).each do |question| - docx.p strip_tags(question.text.gsub(/
  • /, ' * ')), bold: true - - answer = @exported_plan.plan.answer(question.id, false) - if answer.nil? - docx.p _('Question not answered'), italic: true - else - q_format = question.question_format - if q_format.title == _('Check box') || q_format.title == _('Multi select box') || - q_format.title == _('Radio buttons') || q_format.title == _('Dropdown') then - answer.options.each do |option| - docx.ul do - if !option.text.nil? - li option.text - end - end - end - end - - if q_format.title == _('Date') || - q_format.title == _('Text field') || - q_format.title == _('Text area') - docx.p strip_tags(answer.text) - end - - if !answer.text.nil? && question.option_comment_display == true then - search_answer = Nokogiri::HTML::DocumentFragment.parse "
    " - search_answer.at(".//div").inner_html = answer.text - - if search_answer.css('table').present? then - table_content = search_answer.css('table').css('tbody') - - if table_content.size > 0 then - table_array = Array.new - - table_content.css('tr').each do |tr| - row_th_array = Array.new - row_td_array = Array.new - - if tr.search('th') then - tr.search('th').each do |cell| - row_th_array << cell.text.to_s - end - end - - if tr.search('td') then - tr.search('td').each do |td_cell| - if !td_cell.text.to_s.blank? then - new_val = Nokogiri::HTML::DocumentFragment.parse "

    " - new_val.at(".//p").inner_html = td_cell - td_tags = new_val.at_css('td').children.map {|x| x.name.strip} - td_text = new_val.at_css('td').children.map {|x| x.text.strip} - - start_c = 0 - end_c = td_tags.size - - c1 = Caracal::Core::Models::TableCellModel.new do - while start_c < end_c do - p do - #-- TEXT - if td_tags[start_c] == 'text' then - text td_text[start_c] - else - #-- LINK - if td_tags[start_c] == 'a' then - l_address = "" - l_text = td_text[start_c] - #-- GET HREF - td_cell.search('a').each do |link| - if link.content == td_text[start_c] then - l_address = link["href"] - end - end - link td_text[start_c], l_address - #-- BOLD TEXT - else - if td_tags[start_c] == 'strong' && td_text[start_c] != "" then - text td_text[start_c], bold: true - text ' ' - #-- ITALIC TEXT - else - if td_tags[start_c] == 'em' && td_text[start_c] != "" then - text td_text[start_c], italic: true - text ' ' - end - end - end - end - end - start_c += 1 - end - end - row_td_array << c1 - else - row_td_array << td_cell.text.to_s - end - end - end - - #--- check if all cells are empty - if row_td_array.size > 0 then - if row_td_array.all?(&:blank?) then - row_td_array = [] - end - end - - if !row_th_array.empty? then - table_array << row_th_array - end - if !row_td_array.empty? then - table_array << row_td_array - end - - end - - #--- build the table layout - docx.table table_array, border_size: 4 do - cell_style rows[0], bold: true, background: 'fbb400' - cell_style cells, size: 18, margins: { top: 100, bottom: 0, left: 100, right: 100 } - end - - end - - else - higher_level = search_answer.search('div.container').children.map {|x| x.name.strip} - all_text = search_answer.search('div.container').children.map {|x| x.inner_html.strip} - high_count = 0 - high_end_count = higher_level.size - - while high_count < high_end_count do - - if higher_level[high_count] == 'p' then - inner_txt_with_tags = Nokogiri::HTML::DocumentFragment.parse "

    " - inner_txt_with_tags.at(".//p").inner_html = all_text[high_count] - tags_type = inner_txt_with_tags.at_css('p').children.map {|x| x.name.strip} - inner_txt = inner_txt_with_tags.at_css('p').children.map {|x| x.text.strip} - - start_count = 0 - end_counter = tags_type.size - - docx.p do - while start_count < end_counter do - text_val = inner_txt[start_count].to_s - #-- TEXT - if tags_type[start_count] == 'text' && text_val != "" then - text text_val - text ' ' - #-- LINK - else - if tags_type[start_count] == 'a' && text_val != "" then - l_text = text_val - l_address = "" - # all links - search_answer.search('a').each do |link| - if link.content == text_val then - l_address = link["href"] - end - end - link text_val, l_address - #-- BOLD TEXT - else - if tags_type[start_count] == 'strong' && text_val != "" then - text text_val, bold: true - text ' ' - #-- ITALIC TEXT - else - if tags_type[start_count] == 'em' && text_val != "" then - text text_val, italic: true - text ' ' - end - end - end - end - start_count +=1 - end - end - #-- END OF P - else - if higher_level[high_count] == 'ul' then - ul_text = search_answer.search('ul').children.map {|x| x.text.strip} - docx.ul do - ul_text.each do |txt| - if !txt.blank? - li txt - end - end - end - else - if higher_level[high_count] == 'ol' then - ol_text = search_answer.search('ol').children.map {|x| x.text.strip} - docx.ol do - ol_text.each do |txt| - if !txt.blank? - li txt - end - end - end - end - end - end - - high_count += 1 - end - end - end - end - #-- add a new line - docx.p - end -end diff --git a/app/views/plans/export.docx.erb b/app/views/plans/export.docx.erb index db005f6..7f9c2c2 100644 --- a/app/views/plans/export.docx.erb +++ b/app/views/plans/export.docx.erb @@ -16,29 +16,32 @@ <% @exported_plan.sections.each do |section| %> -

    <%= section.title %>

    - <% questions = @exported_plan.questions_for_section(section.id) %> - <% questions.each do |question| %> -

    <%= raw question.text %>

    - - <% answer = @plan.answer(question.id, false) %> - <% if answer.nil? then %> -

    <%= _('Question not answered') %>

    - <% else %> - <% q_format = question.question_format %> - <% if q_format.title == _('Check box') || q_format.title == _('Multi select box') || - q_format.title == _('Radio buttons') || q_format.title == _('Dropdown') %> -
      - <% answer.question_options.each do |option| %> -
    • <%= raw option.text %>
    • - <% end %> -
    - <% if question.option_comment_display %> - <%= raw answer.text %> - <% end %> - <%else%> - <%= raw answer.text %> - <%end%> - <% end %> - <% end %> -<% end %> + <% questions = @exported_plan.questions_for_section(section.id) + if questions.present? + %> +

    <%= section.title %>

    + <% questions.each do |question| %> +

    + <%= raw question.text %> +

    + <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? %> +

    <%= _('Question not answered') %>

    + <% else %> + <% q_format = question.question_format %> + <% if q_format.option_based? %> +
      + <% answer.question_options.each do |option| %> +
    • <%= raw option.text %>
    • + <% end %> +
    + <% if question.option_comment_display %> + <%= raw answer.text %> + <% end %> + <% else %> + <%= raw answer.text %> + <% end %> + <% end%> + <% end %> + <% end %> +<% end %> diff --git a/app/views/plans/export.html.erb b/app/views/plans/export.html.erb index 990af6c..27a6b1b 100644 --- a/app/views/plans/export.html.erb +++ b/app/views/plans/export.html.erb @@ -22,54 +22,55 @@ %>
  • - <%= admin_field_t(field.to_s) -%>

    <%= value.present? ? value : _('-') -%><%= value.present? ? value : _('-') %>
    <% end %> <% @exported_plan.sections.each do |section| %> -

    <%= section.title %>

    - - - - - - - - - <% questions = @exported_plan.questions_for_section(section.id) %> - <% questions.each do |question| %> + <% questions = @exported_plan.questions_for_section(section.id) + if questions.present? %> +

    <%= section.title %>

    +
    <%= _('Questions')%><%= _('Answers')%>
    + + + + + + + + <% questions.each do |question| %> <% end %> - -
    <%= _('Questions')%><%= _('Answers')%>

    - <%= raw question.text %>

    <% answer = @plan.answer(question.id, false) %> - <% if answer.nil? then %> + <% if answer.nil? %>

    <%= _('Question not answered') %>

    <% else %> <% q_format = question.question_format %> - <% if q_format.title == _('Check box') || q_format.title == _('Multi select box') || - q_format.title == _('Radio buttons') || q_format.title == _('Dropdown') then%> + <% if q_format.option_based? %>
      - <% answer.options.each do |option| %> + <% answer.question_options.each do |option| %>
    • <%= option.text %>
    • <% end %>
    - <% if question.option_comment_display == true then%> + <% if question.option_comment_display == true %> <%= raw answer.text %> <% end %> - <%else%> + <% else%> <%= raw answer.text %> - <%end%> + <% end%> <% end %>
    - <% end %> +
    + <% end %> + <% end %>
    diff --git a/app/views/plans/export.pdf.erb b/app/views/plans/export.pdf.erb index c41b244..b9ab084 100644 --- a/app/views/plans/export.pdf.erb +++ b/app/views/plans/export.pdf.erb @@ -21,47 +21,47 @@

    <%= @plan.title %>

    <% @exported_plan.admin_details.each do |field| value = @exported_plan.send(field) - if value.present? - %> -

    <%= admin_field_t(field.to_s) -%> <%= value -%>

    + if value.present? %> +

    <%= admin_field_t(field.to_s) -%> <%= value -%>

    + <% else %> +

    <%= admin_field_t(field.to_s) -%> <%= _('-') %>

    <% end %> <% end %> <% @exported_plan.sections.each do |section| %> -

    <%= section.title %>

    - <% questions = @exported_plan.questions_for_section(section.id) %> - <% questions.each_with_index do |question, idx| %> -
    - <% unless idx == 0 && question.text == section.title %> + <% questions = @exported_plan.questions_for_section(section.id) + if questions.present? + %> +

    <%= section.title %>

    + <% questions.each do |question| %> +

    <%= raw question.text %>

    - <% end %> - <% answer = @plan.answer(question.id, false) %> - <% if answer.nil? then %> -

    <%= _('Question not answered.') -%>

    - <% else %> - <% q_format = question.question_format%> - - <% if q_format.title == _('Check box') || q_format.title == _('Multi select box') || - q_format.title == _('Radio buttons') || q_format.title == _('Dropdown') then%> -
      - <% answer.options.each do |option| %> -
    • <%= option.text %>
    • - <% end %> -
    - - <% if question.option_comment_display == true then%> + <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? then %> +

    <%= _('Question not answered.') -%>

    + <% else %> + <% q_format = question.question_format %> + <% if q_format.option_based? %> +
      + <% answer.question_options.each do |option| %> +
    • <%= option.text %>
    • + <% end %> +
    + + <% if question.option_comment_display == true then%> + <% if !answer.text.nil? then %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <%end%> + <%end%> + <%else%> + <% if !answer.text.nil? then %> <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> <%end%> - <%end%> - <%else%> - - <% if !answer.text.nil? then %> - <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> - <%end%> - <% end %> - <% end %> -
    + <% end %> + <% end %> +
    + <% end %> <% end %> <% end %> diff --git a/app/views/questions/_add_question.html.erb b/app/views/questions/_add_question.html.erb index 3a95f58..9ca04bf 100644 --- a/app/views/questions/_add_question.html.erb +++ b/app/views/questions/_add_question.html.erb @@ -114,20 +114,20 @@ - <%= _('Suggested answer/ Example')%> + <%= _('Example Answer')%>
    - <% suggested_answer = @new_question.suggested_answers.build %> - <%= f.fields_for :suggested_answers, suggested_answer do |s|%> + <% example_answer = @new_question.annotations.build %> + <% example_answer.type = :example_answer %> + <%= f.fields_for :annotations, example_answer do |s|%> <%= s.hidden_field :org_id, value: current_user.org_id %> <% end %>
    - <%= link_to( image_tag("help_button.png"), "#", class: "suggested_answer_popover", rel: "popover", "data-html" => "true", "data-content" => _('You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted.'))%> + <%= link_to( image_tag("help_button.png"), "#", class: "suggested_answer_popover", rel: "popover", "data-html" => "true", "data-content" => _('You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted.'))%>
    diff --git a/app/views/questions/_edit_question.html.erb b/app/views/questions/_edit_question.html.erb index 6c3d573..a0928df 100644 --- a/app/views/questions/_edit_question.html.erb +++ b/app/views/questions/_edit_question.html.erb @@ -106,16 +106,16 @@ - <%= _('Suggested answer/ Example')%> + <%= _('Example Answer')%>
    - <% suggested_answer = question.suggested_answers.find_by_org_id(current_user.org.id) %> - <% if suggested_answer.nil? %> - <% suggested_answer = question.suggested_answers.build %> + <% example_answer = question.get_example_answer(current_user.org.id) %> + <% if example_answer.nil? %> + <% example_answer = question.annotations.build %> + <% example_answer.type = :example_answer %> <% end %> - <%= f.fields_for :suggested_answers, suggested_answer do |s|%> + <%= f.fields_for :annotations, example_answer do |s|%> <%= s.hidden_field :org_id, value: current_user.org.id %> @@ -132,7 +132,9 @@ <%= _('Guidance')%>
    - <%= text_area_tag("question-guidance-#{question.id}", question.guidance , class: "tinymce") %> + <% guidance = question.get_guidance_annotation(current_user.org_id) %> + <% guidance_text = guidance.present? ? guidance.text : "" %> + <%= text_area_tag("question-guidance-#{question.id}", guidance_text , class: "tinymce") %>
    <%= link_to( image_tag("help_button.png"), "#", class: "question_guidance_popover", rel: "popover", "data-html" => "true", "data-content" => _("Enter specific guidance to accompany this question. If you have guidance by themes too, this will be pulled in based on your selections below so it's best not to duplicate too much text."))%> diff --git a/app/views/questions/_preview_question.html.erb b/app/views/questions/_preview_question.html.erb index dc51641..da593ea 100644 --- a/app/views/questions/_preview_question.html.erb +++ b/app/views/questions/_preview_question.html.erb @@ -57,19 +57,15 @@ <% end %> - <% suggested_answer = question.suggested_answers.find_by(org_id: current_user.org_id) %> - <% if !suggested_answer.blank? %> + <% if question.annotations.where(type: Annotation.types[:example_answer]).any? %> + <% annotation = question.annotations.where(type: Annotation.types[:example_answer]).order(:created_at).first %>
    - <% if suggested_answer.is_example? %> <%= _('Example of answer')%> - <% else %> - <%= _('Suggested answer')%> - <% end %>

    - <%= raw suggested_answer.text %> + <%= raw annotation.text %>

    @@ -80,19 +76,15 @@ <% else %> - <% suggested_answer = question.suggested_answers.find_by(org_id: current_user.org_id) %> - <% if !suggested_answer.blank? %> + <% annotations = question.annotations.find_by(org_id: current_user.org_id) %> + <% if !annotations.blank? %>
    - <% if suggested_answer.is_example? %> <%= _('Example of answer')%> - <% else %> - <%= _('Suggested answer')%> - <% end %>

    - <%= raw suggested_answer.text %> + <%= raw annotations.text %>

    @@ -106,9 +98,9 @@ <% if q_format.title == _('Text field') %> - <%elsif q_format.title == _('Text area') %> + <% elsif q_format.title == _('Text area') %> - <%end%> + <% end %>
    <%= link_to _('Save'), "#", class: "btn btn-primary", onclick: "event.preventDefault();" %> diff --git a/app/views/questions/_show_question.html.erb b/app/views/questions/_show_question.html.erb index 754d330..1f3423b 100644 --- a/app/views/questions/_show_question.html.erb +++ b/app/views/questions/_show_question.html.erb @@ -63,25 +63,22 @@ <% if !question.section.phase.template.org.funder? %> - <% suggested_answer = question.get_suggested_answer(current_user.org_id) %> - <% if !suggested_answer.nil? && suggested_answer.text != "" %> + <% example_answer = question.get_example_answer(current_user.org_id) %> + <% if example_answer.present? && example_answer.text.present? %> - <% if suggested_answer.is_example? %> - <%= _('Example of answer')%> - <% else %> - <%= _('Suggested answer')%> - <% end %> + <%= _('Example of answer')%> - <%= raw suggested_answer.text %> + <%= raw example_answer.text %> <% end %> <% end %> - <% if !question.guidance.nil? %> + <% guidance = question.get_guidance_annotation(current_user.org_id) %> + <% if guidance.present? %> <%= _('Guidance')%> - <%= raw question.guidance %> + <%= raw guidance.text %> <% end %> @@ -104,17 +101,17 @@
    <% if !question.modifiable %> - <% suggested_answer = question.get_suggested_answer(current_user.org_id) %> - <% if !suggested_answer.nil? && suggested_answer.text != "" %> + <% example_answer = question.get_example_answer(current_user.org_id) %> + <% if example_answer.present? && example_answer.text.present? %>
    - <%= render partial: 'suggested_answers/show_suggested_answer', locals: {suggested_answer: suggested_answer, question: question} %> + <%= render partial: 'annotations/show_annotation', locals: {annotation: example_answer, question: question} %>
    <% end %> <% end %> @@ -129,12 +126,12 @@ confirm: _("You are about to delete '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%>
    <% elsif !@edit && question.modifiable %> - <% suggested_answer = question.get_suggested_answer(current_user.org_id) %> - <% if suggested_answer.nil? %> + <% example_answer = question.get_example_answer(current_user.org_id) %> + <% if example_answer.nil? %>
    <%= hidden_field_tag :question_id, question.id, class: "question_id" %> - <%= link_to _('Add suggested answer/ example'), '# ', class: "btn btn-primary add_suggested_answer_button"%> + <%= link_to _('Add example answer'), '# ', class: "btn btn-primary add_suggested_answer_button"%>
    <% end %> diff --git a/app/views/shared/_accessible_combobox.html.erb b/app/views/shared/_accessible_combobox.html.erb index c2f99e0..e06ec20 100644 --- a/app/views/shared/_accessible_combobox.html.erb +++ b/app/views/shared/_accessible_combobox.html.erb @@ -4,6 +4,7 @@ "user", :url => registration_path("user"), :htmlb => {:autocomplete =>"off"}) do |f| %> +<% javascript "shared/register_form.js" %> + +<%= form_for(resource, :as => "user", :url => registration_path("user"), :htmlb => {:autocomplete =>"off"}, :html => {class: "roadmap-form"}) do |f| %> <% end %> diff --git a/app/views/suggested_answers/_add_suggested_answer.html.erb b/app/views/suggested_answers/_add_suggested_answer.html.erb deleted file mode 100644 index fa5a8bf..0000000 --- a/app/views/suggested_answers/_add_suggested_answer.html.erb +++ /dev/null @@ -1,25 +0,0 @@ - -<%= form_for :suggested_answer, url: admin_create_suggested_answer_path do |f| %> - <%= f.hidden_field :org_id, value: current_user.org_id %> - <%= f.hidden_field :question_id, value: question.id %> - - - - - - -
    <%= _('Suggested answer/ Example')%> -
      -
    • <%= f.select :is_example, {_('Example of answer') => true, _('Suggested answer') => false} %>
    • -
    • <%= f.text_area :text, rows: 5 %> -
    • -
    -
    -
    - - -
    - <%= f.submit _('Save'), class: "btn btn-primary" %> - <%= link_to _('Cancel'), "#", id: "cancel_suugested_answer", class: "btn cancel" %> -
    -<%end%> diff --git a/app/views/suggested_answers/_edit_suggested_answer.html.erb b/app/views/suggested_answers/_edit_suggested_answer.html.erb deleted file mode 100644 index f0d92b7..0000000 --- a/app/views/suggested_answers/_edit_suggested_answer.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - -<%= form_for(suggested_answer, url: admin_update_suggested_answer_path(suggested_answer), html: { method: :put}) do |f| %> - <%= f.hidden_field :org_id, value: current_user.org_id %> - - - - - - -
    <%= _('Suggested answer/ Example')%> -
      -
    • <%= f.select :is_example, {_('Example of answer') => true, _('Suggested answer') => false} %>
    • -
    • <%= f.text_area :text, rows: 5 %>
    • -
    -
    -
    - - -
    - <%= f.submit _('Save'), class: 'btn btn-primary' %> - <%= link_to _('Delete'), admin_destroy_suggested_answer_path(id: suggested_answer.id), - confirm: _("You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%> - <%= hidden_field_tag :question_id, question.id, class: "question_id" %> - <%= link_to _('Cancel'), '#', class: 'btn cancel cancel_edit_suggested_answer' %> -
    -<% end %> diff --git a/app/views/suggested_answers/_show_suggested_answer.html.erb b/app/views/suggested_answers/_show_suggested_answer.html.erb deleted file mode 100644 index 5d04606..0000000 --- a/app/views/suggested_answers/_show_suggested_answer.html.erb +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -
    - <% if suggested_answer.is_example? then %> - <%= _('Example of answer')%> - <% else %> - <%= _('Suggested answer')%> - <% end %> - <%= raw suggested_answer.text %>
    -
    - -
    - <%= hidden_field_tag :question_id, question.id, class: "question_id" %> - <%= link_to _('Edit suggested answer/ example'), '# ', class: "btn btn-primary edit_form_for_suggested_answer"%> -
    diff --git a/app/views/templates/_admin_nav_tabs.html.erb b/app/views/templates/_admin_nav_tabs.html.erb index 79b61df..937faae 100644 --- a/app/views/templates/_admin_nav_tabs.html.erb +++ b/app/views/templates/_admin_nav_tabs.html.erb @@ -1,4 +1,5 @@ + \ No newline at end of file +
    diff --git a/app/views/templates/_edit_annotations.html.erb b/app/views/templates/_edit_annotations.html.erb index 96e7708..443f6cb 100644 --- a/app/views/templates/_edit_annotations.html.erb +++ b/app/views/templates/_edit_annotations.html.erb @@ -44,19 +44,17 @@ - <%= _('Suggested answer/ Example')%> + <%= _('Example of Answer')%>
    - <% suggested_answer = question.suggested_answers.find_by_org_id(current_user.org.id) %> - <% if suggested_answer.nil? %> - <% suggested_answer = question.suggested_answers.build %> + <% annotations = question.annotations.where(org_id: current_user.org_id).where(type: Annotation.types[:example_answer]).order(:created_at).first %> + <% if annotations.nil? %> + <% annotations = question.annotations.build %> <% end %> - <%= f.fields_for :suggested_answers, suggested_answer do |s|%> + <%= f.fields_for :annotations, annotation do |s|%> <%= s.hidden_field :org_id, value: current_user.org.id %> <% end %>
    diff --git a/app/views/templates/_show_phases_sections.html.erb b/app/views/templates/_show_phases_sections.html.erb index 0c15d12..ec365d8 100644 --- a/app/views/templates/_show_phases_sections.html.erb +++ b/app/views/templates/_show_phases_sections.html.erb @@ -17,13 +17,11 @@ <% if template == current && phase.modifiable %> <%= link_to _('Delete'), admin_destroy_phase_path(phase_id: phase.id), confirm: _("You are about to delete '%{phase_title}'. This will affect versions, sections and questions linked to this phase. Are you sure?") % { :phase_title => phase.title }, method: :delete, class: "btn btn-primary"%> - <% end %> - <% if !phase.modifiable %> - <% b_label = _('View phase')%> - <% else %> <% b_label = _('Edit phase')%> + <% else %> + <% b_label = _('View phase')%> <% end %> - <%= link_to b_label, admin_show_phase_path(id: phase.id, edit: (b_label == _('org_admin.templates.edit_phase_label'))), class: "btn btn-primary" %> + <%= link_to b_label, admin_show_phase_path(id: phase.id, edit: (b_label == _('Edit phase'))), class: "btn btn-primary" %> <% if phase_hash[:sections].present? %> @@ -35,8 +33,7 @@ - <% (1..phase_hash[:sections].length).each do |section_no| %> - <% section = phase_hash[:sections][section_no] %> + <% (phase_hash[:sections].values.sort_by { |key| key[:data][:number] }).each do |section| %> <% if section.present? %> @@ -45,9 +42,9 @@ <% if section[:questions].present? %> diff --git a/app/views/templates/admin_template_history.html.erb b/app/views/templates/admin_template_history.html.erb index 297bf17..95897a8 100644 --- a/app/views/templates/admin_template_history.html.erb +++ b/app/views/templates/admin_template_history.html.erb @@ -36,6 +36,9 @@ <%= org_template.title%> + <% if org_template == @current && !org_template.published%> +     <%=_('Draft')%> + <% end %> <%= org_template.version %> @@ -60,4 +63,4 @@ -<%end%> \ No newline at end of file +<%end%> diff --git a/app/views/user_mailer/permissions_change_notification.html.erb b/app/views/user_mailer/permissions_change_notification.html.erb index 5bd0bfd..c2c0740 100644 --- a/app/views/user_mailer/permissions_change_notification.html.erb +++ b/app/views/user_mailer/permissions_change_notification.html.erb @@ -12,7 +12,7 @@ end %>

    <%= _('Hello ') %><%= @role.user.name %>,

    -

    <%= _('Your permissions relating to ') %> "<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %>" <%= _(' have been changed by') %><%="#{@current_user.firstname} #{@current_user.surname}. " %><%= _('You now have ') %><%= access_level %><%= _(' access. ') %><%= permissions %>

    +

    <%= _('Your permissions relating to ') %> "<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %>" <%= _(' have been changed by') %><%="#{@current_user.name(false)}. " %><%= _('You now have ') %><%= access_level %><%= _(' access. ') %><%= permissions %>

    <%=_('All the best,')%>
    <%= _('The ')%><%= Rails.configuration.branding[:application][:name] %><%=_(' team')%>.

    <% end %> diff --git a/app/views/user_mailer/project_access_removed_notification.html.erb b/app/views/user_mailer/project_access_removed_notification.html.erb index 63ec8d9..53a5e40 100644 --- a/app/views/user_mailer/project_access_removed_notification.html.erb +++ b/app/views/user_mailer/project_access_removed_notification.html.erb @@ -1,6 +1,6 @@ <% FastGettext.with_locale FastGettext.default_locale do %>

    <%= _('Hello ') %><%= @user.email %>,

    -

    <%= _('Your access to ') %>"<%= @plan.title %>"<%= _(' has been removed by ') %><%= "#{@current_user.firstname} #{@current_user.surname}"%>.

    +

    <%= _('Your access to ') %>"<%= @plan.title %>"<%= _(' has been removed by ') %><%= "#{@current_user.name(false)}"%>.

    <%=_('All the best,')%>
    <%= _('The ')%><%= Rails.configuration.branding[:application][:name] %><%=_(' team')%>.

    <% end %> diff --git a/app/views/user_mailer/sharing_notification.html.erb b/app/views/user_mailer/sharing_notification.html.erb index 95ee5b1..dc2fed4 100644 --- a/app/views/user_mailer/sharing_notification.html.erb +++ b/app/views/user_mailer/sharing_notification.html.erb @@ -13,7 +13,7 @@ %>

    <%= _('Hello ') %><%= @role.user.name %>,

    <%= _('A colleague has invited you to contribute to their Data Management Plan at ') %><%= link_to Rails.configuration.branding[:application][:name], root_url %>.

    -

    <%= _('You have been given ') %><%= access_level %><%= _(' access to') %> "<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %>" <%=_(' by ')%><%= "#{@user.firstname} #{@user.surname}"%>.

    +

    <%= _('You have been given ') %><%= access_level %><%= _(' access to') %> "<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %>" <%=_('by ')%><%= "#{@user.name(false)}" %>.

    <%= link_to _('Click here'), url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %><%= _(' to accept the invitation, (or copy ') %><%= url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %><%= _(' into your browser)')%>

    <%= _('If you don\'t want to accept the invitation, please ignore this email.') %>

    <%=_('All the best,')%>
    <%= _('The ')%><%= Rails.configuration.branding[:application][:name] %><%=_(' team')%>.

    diff --git a/app/views/users/admin_grant_permissions.html.erb b/app/views/users/admin_grant_permissions.html.erb index 573ea31..e15b781 100644 --- a/app/views/users/admin_grant_permissions.html.erb +++ b/app/views/users/admin_grant_permissions.html.erb @@ -6,11 +6,36 @@
    <%= form_tag( admin_update_permissions_user_path(@user), method: :put) do %> - +
    - + <% @perms.each do |perm| %> - + <% case perm.name when 'grant_permissions' %> + + <% when 'modify_templates' %> + + <% when 'modify_guidance' %> + + <% when 'use_api' %> + + <% when 'change_org_details' %> + + <% end %> <% end %> @@ -26,4 +51,4 @@
    <%= perm.name %> + <%= _('Grant permissions') %> + + <%= _('Modify templates') %> + + <%= _('Modify guidance') %> + + <%= _('API rights') %> + + <%= _('Change organisation details') %> +
    <%= submit_tag _('Save') %> <% end %> -
    \ No newline at end of file + diff --git a/config/application.rb b/config/application.rb index 8994e51..5693427 100644 --- a/config/application.rb +++ b/config/application.rb @@ -81,6 +81,8 @@ config.assets.precompile += %w(roadmap-form.scss) config.assets.precompile += %w(plans/new_plan.js) config.assets.precompile += %w(contacts/new_contact.js) + config.assets.precompile += %w(shared/register_form.js) + config.assets.precompile += %w(answers/status.js) config.autoload_paths += %W(#{config.root}/lib) config.action_controller.include_all_helpers = true @@ -90,12 +92,12 @@ # Enable shibboleth as an alternative authentication method # Requires server configuration and omniauth shibboleth provider configuration - # See config/initializers/omniauth.rb + # See config/initializers/devise.rb config.shibboleth_enabled = true - # Absolute path to Shibboleth SSO Login - config.shibboleth_login = '/Shibboleth.sso/Login' - + # Relative path to Shibboleth SSO Logout + config.shibboleth_logout_url = '/Shibboleth.sso/Logout?return=' + # Active Record will no longer suppress errors raised in after_rollback or after_commit # in the next version. Devise appears to be using those callbacks. # To accept the new behaviour use 'true' otherwise use 'false' diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index 4d12559..06f4264 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -12,7 +12,7 @@ return language.nil? ? 'en_GB' : language.abbreviation end -FastGettext.add_text_domain 'app', :path => 'config/locale', :type => :po +FastGettext.add_text_domain 'app', :path => 'config/locale', :type => :po, :ignore_fuzzy => true FastGettext.default_text_domain = 'app' FastGettext.default_available_locales = get_available_locales() FastGettext.default_locale = get_default_locale() diff --git a/config/locale/app.pot b/config/locale/app.pot index 3930575..1e57dc4 100644 --- a/config/locale/app.pot +++ b/config/locale/app.pot @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: app 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-05-12 15:25+0100\n" -"PO-Revision-Date: 2017-05-12 15:25+0100\n" +"POT-Creation-Date: 2017-05-26 15:50+0100\n" +"PO-Revision-Date: 2017-05-26 15:50+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -24,19 +24,10 @@ msgid " - " msgstr "" -msgid " - choosing default template for your institution" +msgid " I accept the terms and conditions *" msgstr "" -msgid " - no funder or institution template, choosing default template" -msgstr "" - -msgid " - there are more than one to choose from" -msgstr "" - -msgid " - using template customised by your institution" -msgstr "" - -msgid " I accept the terms and conditions *" +msgid " Plan" msgstr "" msgid " access to" @@ -45,6 +36,9 @@ msgid " access. " msgstr "" +msgid " and " +msgstr "" + msgid " by" msgstr "" @@ -66,22 +60,31 @@ msgid " once you click save!" msgstr "" +msgid " or " +msgstr "" + msgid " password. You can do this through the link below." msgstr "" +msgid " provided by " +msgstr "" + msgid " saved the following answer:" msgstr "" msgid " team" msgstr "" +msgid " that has been customised by " +msgstr "" + msgid " to accept the invitation, (or copy " msgstr "" msgid " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on " msgstr "" -msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\"" +msgid "\"Are you sure you want to unlink #{scheme.description} ID?\"" msgstr "" msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\"" @@ -108,6 +111,9 @@ msgid "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." msgstr "" +msgid "%{application_name} is provided by the %{organisation_name}. You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below." +msgstr "" + msgid "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." msgstr "" @@ -171,15 +177,6 @@ msgid "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " msgstr "" -msgid "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " -msgstr "" - -msgid "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " -msgstr "" - -msgid "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " -msgstr "" - msgid "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " msgstr "" @@ -204,6 +201,18 @@ msgid "

    You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

    If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

    " msgstr "" +msgid "" +"
    • %{organisation_name}
    • \n" +"
    • %{organisation_address_line1}
    • \n" +"
    • %{organisation_address_line2}
    • \n" +"
    • %{organisation_address_line3}
    • \n" +"
    • %{organisation_address_line4}
    • \n" +"
    • %{organisation_address_country}
    • \n" +"
    \n" +"

    Helpline: %{organisation_telephone}

    \n" +"

    Email %{organisation_email}

    " +msgstr "" + msgid "A colleague has invited you to contribute to their Data Management Plan at " msgstr "" @@ -213,9 +222,15 @@ msgid "A required setting has not been provided" msgstr "" +msgid "A version of " +msgstr "" + msgid "API Information" msgstr "" +msgid "API rights" +msgstr "" + msgid "API token" msgstr "" @@ -240,6 +255,9 @@ msgid "Add collaborator" msgstr "" +msgid "Add example answer" +msgstr "" + msgid "Add guidance" msgstr "" @@ -261,9 +279,6 @@ msgid "Add section" msgstr "" -msgid "Add suggested answer/ example" -msgstr "" - msgid "Additional comment area will be displayed." msgstr "" @@ -276,6 +291,18 @@ msgid "All the best," msgstr "" +msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo" +msgstr "" + +msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves" +msgstr "" + +msgid "Allows the user to create and edit guidance" +msgstr "" + +msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates" +msgstr "" + msgid "An error has occurred while saving/resetting your export settings." msgstr "" @@ -327,6 +354,12 @@ msgid "Before submitting, please consider:" msgstr "" +msgid "Before you get started, we need to ask a few questions to set you up with the best DMP template for your needs." +msgstr "" + +msgid "Begin typing to see a filtered list" +msgstr "" + msgid "Below is a list of users registered for your organisation. You can sort the data by each field." msgstr "" @@ -339,21 +372,24 @@ msgid "Cancel" msgstr "" +msgid "Cannot share plan with %{email} since that email matches with the owner of the plan." +msgstr "" + msgid "Change language" msgstr "" msgid "Change my password" msgstr "" +msgid "Change organisation details" +msgstr "" + msgid "Check box" msgstr "" msgid "Check this box when you are ready for this guidance to appear on user's plans." msgstr "" -msgid "Choose a template" -msgstr "" - msgid "Click here" msgstr "" @@ -390,6 +426,9 @@ msgid "Contact Email" msgstr "" +msgid "Contact Us" +msgstr "" + msgid "Contact us" msgstr "" @@ -450,6 +489,9 @@ msgid "Display additional comment area." msgstr "" +msgid "Draft" +msgstr "" + msgid "Dropdown" msgstr "" @@ -459,6 +501,9 @@ msgid "Edit" msgstr "" +msgid "Edit Example of Answer" +msgstr "" + msgid "Edit User Privileges" msgstr "" @@ -480,9 +525,6 @@ msgid "Edit question" msgstr "" -msgid "Edit suggested answer/ example" -msgstr "" - msgid "Edit template details" msgstr "" @@ -522,6 +564,12 @@ msgid "Error!" msgstr "" +msgid "Example Answer" +msgstr "" + +msgid "Example of Answer" +msgstr "" + msgid "Example of answer" msgstr "" @@ -540,6 +588,9 @@ msgid "File Name" msgstr "" +msgid "Fill in the required fields" +msgstr "" + msgid "Filter plans" msgstr "" @@ -552,13 +603,16 @@ msgid "Forgot your password?" msgstr "" +msgid "Format" +msgstr "" + msgid "Funder" msgstr "" -msgid "Funder name" +msgid "Funders templates" msgstr "" -msgid "Funders templates" +msgid "Funding organisation" msgstr "" msgid "Future plans" @@ -570,12 +624,18 @@ msgid "Grant number" msgstr "" +msgid "Grant permissions" +msgstr "" + msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgstr "" msgid "Guidance" msgstr "" +msgid "Guidance choices saved." +msgstr "" + msgid "Guidance group" msgstr "" @@ -627,10 +687,10 @@ msgid "ID" msgstr "" -msgid "If applying for funding, select your research funder." +msgid "If applying for funding, state the name exactly as in the grant proposal." msgstr "" -msgid "If applying for funding, state the name exactly as in the grant proposal." +msgid "If applying for funding, state the title exactly as in the proposal." msgstr "" msgid "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." @@ -651,9 +711,6 @@ msgid "If you would like to change your password please complete the following fields." msgstr "" -msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan." -msgstr "" - msgid "Included Elements" msgstr "" @@ -678,7 +735,7 @@ msgid "Invalid maximum pages" msgstr "" -msgid "Invitation issued successfully." +msgid "Invitation to %{email} issued successfully." msgstr "" msgid "Language" @@ -699,9 +756,6 @@ msgid "Left" msgstr "" -msgid "Link your %{application_name} account to your institutional credentials (UK users only)" -msgstr "" - msgid "List of users" msgstr "" @@ -726,16 +780,28 @@ msgid "Me" msgstr "" +msgid "Message" +msgstr "" + +msgid "Modify guidance" +msgstr "" + +msgid "Modify templates" +msgstr "" + msgid "Multi select box" msgstr "" +msgid "My Plan" +msgstr "" + msgid "My organisation isn't listed." msgstr "" -msgid "My plan" +msgid "My plans" msgstr "" -msgid "My plans" +msgid "My research organisation is not on the list" msgstr "" msgid "Name" @@ -747,9 +813,6 @@ msgid "Name of Principal Investigator(s) or main researcher(s) on the project." msgstr "" -msgid "Name of funder, if applicable." -msgstr "" - msgid "New guidance" msgstr "" @@ -771,6 +834,12 @@ msgid "No additional comment area will be displayed." msgstr "" +msgid "No funder associated with this plan" +msgstr "" + +msgid "No items available." +msgstr "" + msgid "No matches" msgstr "" @@ -780,9 +849,6 @@ msgid "Not answered yet" msgstr "" -msgid "Not applicable/not listed." -msgstr "" - msgid "Note" msgstr "" @@ -846,9 +912,6 @@ msgid "Other institutions" msgstr "" -msgid "Otherwise leave blank." -msgstr "" - msgid "Own templates" msgstr "" @@ -891,10 +954,13 @@ msgid "Plan details" msgstr "" +msgid "Plan is already shared with %{email}." +msgstr "" + msgid "Plan name" msgstr "" -msgid "Plan was successfully created." +msgid "Plan shared with %{email}." msgstr "" msgid "Plan was successfully deleted." @@ -921,6 +987,12 @@ msgid "Please enter your current password" msgstr "" +msgid "Please enter your current password below when changing your email address." +msgstr "" + +msgid "Please enter your email" +msgstr "" + msgid "Please enter your first name." msgstr "" @@ -933,18 +1005,27 @@ msgid "Please enter your surname or family name." msgstr "" +msgid "Please fill in the basic project details below" +msgstr "" + msgid "Please fill in the basic project details below and click 'Update' to save" msgstr "" +msgid "Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in." +msgstr "" + msgid "Please only enter up to 165 characters, you have used" msgstr "" -msgid "Policy Expectations" +msgid "Please select one" msgstr "" msgid "Preview" msgstr "" +msgid "Primary research organisation" +msgstr "" + msgid "Principal Investigator / Researcher" msgstr "" @@ -963,6 +1044,12 @@ msgid "Privileges" msgstr "" +msgid "Project title" +msgstr "" + +msgid "Provides the user with an API token and grants rights to harvest information from the tool" +msgstr "" + msgid "Public" msgstr "" @@ -1047,24 +1134,24 @@ msgid "Sections" msgstr "" -msgid "Select Funder" -msgstr "" - -msgid "Select Organisation" +msgid "Select a template" msgstr "" msgid "Select an action" msgstr "" +msgid "Select the funding organisation" +msgstr "" + +msgid "Select the primary research organisation responsible" +msgstr "" + msgid "Select which group this guidance relates to." msgstr "" msgid "Select which theme(s) this guidance relates to." msgstr "" -msgid "Select your research funder or no funder, as appropariate." -msgstr "" - msgid "Selected option(s)" msgstr "" @@ -1104,6 +1191,9 @@ msgid "Status" msgstr "" +msgid "Subject" +msgstr "" + msgid "Successfully unlinked your account from %{is}." msgstr "" @@ -1155,6 +1245,9 @@ msgid "That template is not currently published." msgstr "" +msgid "The" +msgstr "" + msgid "The " msgstr "" @@ -1170,9 +1263,6 @@ msgid "Themes" msgstr "" -msgid "There are a number of possible templates you could use. Please choose one." -msgstr "" - msgid "There are no public DMPs." msgstr "" @@ -1194,30 +1284,24 @@ msgid "This document was generated by %{application_name}" msgstr "" -msgid "This must be a valid email address - a message will be sent to it for confirmation." -msgstr "" - msgid "This must match what you entered in the previous field." msgstr "" msgid "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." msgstr "" +msgid "This plan is based on the default template." +msgstr "" + msgid "This plan is based on:" msgstr "" msgid "This section is locked for editing by " msgstr "" -msgid "Tick to select any other sources of guidance you wish to see." -msgstr "" - msgid "Title" msgstr "" -msgid "To see institutional questions and/or guidance, select your organisation." -msgstr "" - msgid "Top" msgstr "" @@ -1248,9 +1332,6 @@ msgid "Unlink institutional credentials alert" msgstr "" -msgid "Unlink your institutional credentials" -msgstr "" - msgid "Unlock my account" msgstr "" @@ -1272,10 +1353,10 @@ msgid "Upload a new logo file" msgstr "" -msgid "User added to project" +msgid "Users" msgstr "" -msgid "Users" +msgid "Using the generic Data Management Plan" msgstr "" msgid "Version" @@ -1299,6 +1380,15 @@ msgid "Visibility" msgstr "" +msgid "We found multiple DMP templates corresponding to the funder." +msgstr "" + +msgid "We found multiple DMP templates corresponding to the research organisation." +msgstr "" + +msgid "We found multiple DMP templates corresponding to your funder." +msgstr "" + msgid "Website" msgstr "" @@ -1311,9 +1401,15 @@ msgid "Welcome." msgstr "" +msgid "What research project are you planning?" +msgstr "" + msgid "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." msgstr "" +msgid "Which DMP template would you like to use?" +msgstr "" + msgid "While you were editing " msgstr "" @@ -1341,12 +1437,18 @@ msgid "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" msgstr "" +msgid "You are about to delete an example answer for '%{question_text}'. Are you sure?" +msgstr "" + msgid "You are not authorized to perform this action." msgstr "" msgid "You are viewing a historical version of this template. You will not be able to make changes." msgstr "" +msgid "You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted." +msgstr "" + msgid "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." msgstr "" @@ -1356,6 +1458,9 @@ msgid "You can edit any of the details below." msgstr "" +msgid "You can not continue until you have filled in all of the required information." +msgstr "" + msgid "You can not edit a historical version of this template." msgstr "" @@ -1380,9 +1485,6 @@ msgid "You have unsaved answers in the following sections:" msgstr "" -msgid "You may leave blank or select a different organisation to your own." -msgstr "" - msgid "You must accept the terms and conditions to register." msgstr "" @@ -1407,9 +1509,6 @@ msgid "Your account has been successfully linked to %{scheme}." msgstr "" -msgid "Your account is linked to your institutional credentials." -msgstr "" - msgid "Your account won't be created until you access the link above and set your password." msgstr "" @@ -1479,6 +1578,9 @@ msgid "by" msgstr "" +msgid "by " +msgstr "" + msgid "can't be blank" msgstr "" @@ -1491,12 +1593,15 @@ msgid "e.g. School/ Department" msgstr "" -msgid "format" +msgid "example answer" msgstr "" msgid "from now" msgstr "" +msgid "generic template" +msgstr "" + msgid "guidance" msgstr "" @@ -1509,9 +1614,6 @@ msgid "height must be less than 100px" msgstr "" -msgid "helpers.dropdown" -msgstr "" - msgid "helpers.is_test" msgstr "" @@ -1539,15 +1641,15 @@ msgid "must have access to guidances api" msgstr "" +msgid "no research organisation is associated with this plan" +msgstr "" + msgid "note" msgstr "" msgid "or copy" msgstr "" -msgid "org_admin.templates.edit_phase_label" -msgstr "" - msgid "organisation" msgstr "" @@ -1581,9 +1683,6 @@ msgid "select at least one theme" msgstr "" -msgid "suggested answer" -msgstr "" - msgid "template" msgstr "" diff --git a/config/locale/de/app.po b/config/locale/de/app.po index 36ef44b..7251de4 100644 --- a/config/locale/de/app.po +++ b/config/locale/de/app.po @@ -23,31 +23,22 @@ msgstr " - " #, fuzzy -msgid " - choosing default template for your institution" -msgstr " - " - -#, fuzzy -msgid " - no funder or institution template, choosing default template" -msgstr " - " - -#, fuzzy -msgid " - there are more than one to choose from" -msgstr " - " - -#, fuzzy -msgid " - using template customised by your institution" -msgstr " von " - -#, fuzzy -msgid " I accept the terms and conditions *" +msgid " I accept the terms and conditions *" msgstr "Ich akzeptiere die Nutzungsbedingungen *" +#, fuzzy +msgid " Plan" +msgstr "plans" + msgid " access to" msgstr "" msgid " access. " msgstr "" +msgid " and " +msgstr "" + #, fuzzy msgid " by" msgstr " von " @@ -73,10 +64,17 @@ msgid " once you click save!" msgstr "" +msgid " or " +msgstr "" + #, fuzzy msgid " password. You can do this through the link below." msgstr "password. You can do this through the link below." +#, fuzzy +msgid " provided by " +msgstr " von " + msgid " saved the following answer:" msgstr "" @@ -85,6 +83,10 @@ msgstr "am" #, fuzzy +msgid " that has been customised by " +msgstr " von " + +#, fuzzy msgid " to accept the invitation, (or copy " msgstr "(or copy" @@ -92,7 +94,7 @@ msgstr "" #, fuzzy -msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\"" +msgid "\"Are you sure you want to unlink #{scheme.description} ID?\"" msgstr "ID" msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\"" @@ -121,6 +123,10 @@ msgid "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." msgstr "DMPonline" +#, fuzzy +msgid "%{application_name} is provided by the %{organisation_name}. You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below." +msgstr "DMPonline" + msgid "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." msgstr "" @@ -184,15 +190,6 @@ msgid "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " msgstr "

    Falls Sie eine Vorlage für eine Institution anlegen möchten, können Sie den Knopf 'Vorlage erstellen' nutzen. Sie können verschiedene Vorlagen erstellen um auf Spezialisierungen einzugehen, z.B. für Forscher und für Doktoranden.

    " -msgid "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " -msgstr "

    Bitte beachten Sie, dass Ihre Email-Adresse als Nutzername verwendet wird. Vergessen Sie nicht, Ihre neue E-Mail-Adresse beim der nächsten Anmeldung zu verwenden, falls Sie diese geändert haben.

    " - -msgid "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " -msgstr "" - -msgid "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " -msgstr "

    Bitte wählen Sie aus folgendem Drop-Down-Menü, so dass wir bestimmen können, welche Fragen und Hilfestellungen in Ihrem Plan angezeigt werden sollen.

    Falls Sie nicht den spezifischen Anforderungen eines Geldgebers oder einer Institution folgen, wählen Sie hier, um einen generischen DMP zu schreiben , der auf den allgemeinsten Themen basiert.

    " - msgid "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " msgstr "

    Wählen Sie die für diese Frage relevanten Themen aus.

    Dies erlaubt es, sowohl generischen Hilfestellungen auf Institutions-Ebene, als auch aus anderen Quellen, wie z.B. der DINI, oder jedweder Institute oder Einrichtungen, für die Sie Unterstützung anbieten, einzubeziehen.

    Sie können mehrere Themen durch klicken und gleichzeitiges Drücken der Steuerungs- bzw. Kommando-Taste auswählen.

    " @@ -220,6 +217,19 @@ msgstr "templates" #, fuzzy +msgid "" +"
    • %{organisation_name}
    • \n" +"
    • %{organisation_address_line1}
    • \n" +"
    • %{organisation_address_line2}
    • \n" +"
    • %{organisation_address_line3}
    • \n" +"
    • %{organisation_address_line4}
    • \n" +"
    • %{organisation_address_country}
    • \n" +"
    \n" +"

    Helpline: %{organisation_telephone}

    \n" +"

    Email %{organisation_email}

    " +msgstr "DMPonline" + +#, fuzzy msgid "A colleague has invited you to contribute to their Data Management Plan at " msgstr "A colleague has invited you to contribute to their Data Management Plan at" @@ -229,9 +239,15 @@ msgid "A required setting has not been provided" msgstr "Eine benötigte Einstellung wurde nicht erbracht" +msgid "A version of " +msgstr "" + msgid "API Information" msgstr "" +msgid "API rights" +msgstr "" + msgid "API token" msgstr "" @@ -256,6 +272,9 @@ msgid "Add collaborator" msgstr "Mitarbeitende(n) hinzufügen" +msgid "Add example answer" +msgstr "" + msgid "Add guidance" msgstr "Hilfestellung hinzufügen" @@ -277,9 +296,6 @@ msgid "Add section" msgstr "Abschnitt hinzufügen" -msgid "Add suggested answer/ example" -msgstr "Antwortvorschlag / Beispiel hinzufügen" - msgid "Additional comment area will be displayed." msgstr "" @@ -292,6 +308,22 @@ msgid "All the best," msgstr "" +#, fuzzy +msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo" +msgstr "Organisation" + +#, fuzzy +msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves" +msgstr "Organisation" + +#, fuzzy +msgid "Allows the user to create and edit guidance" +msgstr "user" + +#, fuzzy +msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates" +msgstr "templates" + msgid "An error has occurred while saving/resetting your export settings." msgstr "" @@ -347,6 +379,13 @@ msgid "Before submitting, please consider:" msgstr "" +#, fuzzy +msgid "Before you get started, we need to ask a few questions to set you up with the best DMP template for your needs." +msgstr "Fragen" + +msgid "Begin typing to see a filtered list" +msgstr "" + msgid "Below is a list of users registered for your organisation. You can sort the data by each field." msgstr "Folgend findet sich die Liste von Benutzern registriert bzgl. Ihrer Org. Sie können diese Liste bzgl. aller Felder sortieren." @@ -359,6 +398,10 @@ msgid "Cancel" msgstr "Abbrechen" +#, fuzzy +msgid "Cannot share plan with %{email} since that email matches with the owner of the plan." +msgstr "plans" + msgid "Change language" msgstr "" @@ -366,15 +409,16 @@ msgid "Change my password" msgstr "Passwort ändern" +#, fuzzy +msgid "Change organisation details" +msgstr "Organisation" + msgid "Check box" msgstr "Checkbox" msgid "Check this box when you are ready for this guidance to appear on user's plans." msgstr "Markieren Sie dieses Kästchen, wenn Sie bereit sind, für diese Anleitung für Benutzer-Pläne zu erscheinen." -msgid "Choose a template" -msgstr "" - msgid "Click here" msgstr "" @@ -414,6 +458,10 @@ msgid "Contact Email" msgstr "Kontakt Email" +#, fuzzy +msgid "Contact Us" +msgstr "Kontakt" + msgid "Contact us" msgstr "Kontakt" @@ -474,6 +522,9 @@ msgid "Display additional comment area." msgstr "" +msgid "Draft" +msgstr "" + msgid "Dropdown" msgstr "Klappliste" @@ -483,6 +534,10 @@ msgid "Edit" msgstr "Bearbeiten" +#, fuzzy +msgid "Edit Example of Answer" +msgstr "Beispielantwort" + msgid "Edit User Privileges" msgstr "Bearbeiten Benutzerberechtigungen" @@ -504,9 +559,6 @@ msgid "Edit question" msgstr "Frage bearbeiten" -msgid "Edit suggested answer/ example" -msgstr "Antwortvorschlag / Beispiel bearbeiten" - msgid "Edit template details" msgstr "Details der Vorlage bearbeiten" @@ -547,6 +599,14 @@ msgid "Error!" msgstr "Fehler!" +#, fuzzy +msgid "Example Answer" +msgstr "Beispielantwort" + +#, fuzzy +msgid "Example of Answer" +msgstr "Beispielantwort" + msgid "Example of answer" msgstr "Beispielantwort" @@ -567,6 +627,9 @@ msgid "File Name" msgstr "Dateiname" +msgid "Fill in the required fields" +msgstr "" + msgid "Filter plans" msgstr "Filter Pläne" @@ -579,15 +642,19 @@ msgid "Forgot your password?" msgstr "Passwort vergessen?" +msgid "Format" +msgstr "" + msgid "Funder" msgstr "Funder" -msgid "Funder name" -msgstr "Name des Geldgebers" - msgid "Funders templates" msgstr "Vorlagen der Geldgeber" +#, fuzzy +msgid "Funding organisation" +msgstr "Organisation" + msgid "Future plans" msgstr "" @@ -597,12 +664,19 @@ msgid "Grant number" msgstr "Grantnummer" +msgid "Grant permissions" +msgstr "" + msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgstr "Das Förderkennzeichen als Referenz, sofern sinnvoll (Nur für Datenmanagement-Pläne nach der Bewilligung)." msgid "Guidance" msgstr "Hilfestellung" +#, fuzzy +msgid "Guidance choices saved." +msgstr "Hilfestellung" + msgid "Guidance group" msgstr "Hilfestellungsgruppe" @@ -656,12 +730,13 @@ msgid "ID" msgstr "ID" -msgid "If applying for funding, select your research funder." -msgstr "Falls Sie Fördermittel beantragen, wählen Sie bitte den Förderer aus." - msgid "If applying for funding, state the name exactly as in the grant proposal." msgstr "Falls Sie einen Förderantrag stellen, geben Sie bitte den Namen exakt genau so an, wie im Förderantrag." +#, fuzzy +msgid "If applying for funding, state the title exactly as in the proposal." +msgstr "Falls Sie einen Förderantrag stellen, geben Sie bitte den Namen exakt genau so an, wie im Förderantrag." + msgid "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." msgstr "Falls die Hilfestellung nur für eine bestimmte Nutzergruppe, wie z.B. eine bestimmte Fakultät oder ein Institut, bestimmt ist, wählen Sie diese Option aus. Die Nutzer können die Anzeige von Hilfestellungen dieser Untergruppe im 'Plan erstellen'-Assistenten auswählen." @@ -680,9 +755,6 @@ msgid "If you would like to change your password please complete the following fields." msgstr "Zum Ändern Ihres Passworts folgende Felder ausfüllen." -msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan." -msgstr "" - msgid "Included Elements" msgstr "Enthaltene Elemente" @@ -707,7 +779,7 @@ msgid "Invalid maximum pages" msgstr "Ungültige maximale Anzahl von Seiten" -msgid "Invitation issued successfully." +msgid "Invitation to %{email} issued successfully." msgstr "" msgid "Language" @@ -728,9 +800,6 @@ msgid "Left" msgstr "Links" -msgid "Link your %{application_name} account to your institutional credentials (UK users only)" -msgstr "Link your DMP Builder account to your institutional credentials" - msgid "List of users" msgstr "Liste der Nutzer" @@ -755,18 +824,35 @@ msgid "Me" msgstr "Ich" +#, fuzzy +msgid "Message" +msgstr "Ich" + +#, fuzzy +msgid "Modify guidance" +msgstr "Hilfestellung hinzufügen" + +#, fuzzy +msgid "Modify templates" +msgstr "templates" + msgid "Multi select box" msgstr "Mehrfachauswahlliste" +#, fuzzy +msgid "My Plan" +msgstr "Mein Plan" + msgid "My organisation isn't listed." msgstr "Meine Organisation ist nicht in der Auflistung." -msgid "My plan" -msgstr "Mein Plan" - msgid "My plans" msgstr "Meine Pläne" +#, fuzzy +msgid "My research organisation is not on the list" +msgstr "Organisation" + msgid "Name" msgstr "Name" @@ -776,9 +862,6 @@ msgid "Name of Principal Investigator(s) or main researcher(s) on the project." msgstr "Name des Principal Investigators oder der Leitung des Projektes." -msgid "Name of funder, if applicable." -msgstr "Name des Geldgebers, falls anwendbar." - msgid "New guidance" msgstr "Neue Hilfestellung" @@ -800,6 +883,13 @@ msgid "No additional comment area will be displayed." msgstr "" +#, fuzzy +msgid "No funder associated with this plan" +msgstr "plans" + +msgid "No items available." +msgstr "" + msgid "No matches" msgstr "Kein Plan erfüllt '%{filter}'" @@ -809,9 +899,6 @@ msgid "Not answered yet" msgstr "Noch nicht beantwortet" -msgid "Not applicable/not listed." -msgstr "Nicht anwendbar / nicht gelistet." - msgid "Note" msgstr "Kommentar" @@ -876,9 +963,6 @@ msgid "Other institutions" msgstr "" -msgid "Otherwise leave blank." -msgstr "Falls nicht, lassen Sie dieses Feld bitte unberührt." - msgid "Own templates" msgstr "Eigene Vorlagen" @@ -922,11 +1006,14 @@ msgid "Plan details" msgstr "Plandetails" +msgid "Plan is already shared with %{email}." +msgstr "" + msgid "Plan name" msgstr "Name des Plans" -msgid "Plan was successfully created." -msgstr "Plan wurde erfolgreich angelegt." +msgid "Plan shared with %{email}." +msgstr "" #, fuzzy msgid "Plan was successfully deleted." @@ -953,6 +1040,12 @@ msgid "Please enter your current password" msgstr "" +msgid "Please enter your current password below when changing your email address." +msgstr "" + +msgid "Please enter your email" +msgstr "" + msgid "Please enter your first name." msgstr "Bitte geben Sie ihren Vornamen ein." @@ -965,18 +1058,29 @@ msgid "Please enter your surname or family name." msgstr "Bitte geben Sie ihren Familien- bzw. Nachnamen ein." +msgid "Please fill in the basic project details below" +msgstr "" + msgid "Please fill in the basic project details below and click 'Update' to save" msgstr "Bitte geben Sie im Folgenden die Projektdetails an und wählen 'Aktualisieren' aus, um die Änderungen zu speichern." +#, fuzzy +msgid "Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in." +msgstr "

    Bitte beachten Sie, dass Ihre Email-Adresse als Nutzername verwendet wird. Vergessen Sie nicht, Ihre neue E-Mail-Adresse beim der nächsten Anmeldung zu verwenden, falls Sie diese geändert haben.

    " + msgid "Please only enter up to 165 characters, you have used" msgstr "Please only enter up to 165 characters, you have used" -msgid "Policy Expectations" -msgstr "Policy Expectations" +msgid "Please select one" +msgstr "" msgid "Preview" msgstr "Vorschau" +#, fuzzy +msgid "Primary research organisation" +msgstr "Organisation" + msgid "Principal Investigator / Researcher" msgstr "Principal Investigator / Forscher" @@ -995,6 +1099,13 @@ msgid "Privileges" msgstr "" +msgid "Project title" +msgstr "" + +#, fuzzy +msgid "Provides the user with an API token and grants rights to harvest information from the tool" +msgstr "user" + msgid "Public" msgstr "Öffentlichkeit" @@ -1079,24 +1190,27 @@ msgid "Sections" msgstr "Abschnitte" -msgid "Select Funder" -msgstr "Funder" - -msgid "Select Organisation" -msgstr "Organisation" +#, fuzzy +msgid "Select a template" +msgstr "templates" msgid "Select an action" msgstr "Wählen Sie eine Aktion" +#, fuzzy +msgid "Select the funding organisation" +msgstr "Organisation" + +#, fuzzy +msgid "Select the primary research organisation responsible" +msgstr "Organisation" + msgid "Select which group this guidance relates to." msgstr "Wählen Sie die Gruppe aus, für die diese Hilfestellung relevant ist." msgid "Select which theme(s) this guidance relates to." msgstr "Wählen Sie die Themen aus, für die diese Hilfestellung relevant ist." -msgid "Select your research funder or no funder, as appropariate." -msgstr "" - msgid "Selected option(s)" msgstr "" @@ -1137,6 +1251,9 @@ msgid "Status" msgstr "" +msgid "Subject" +msgstr "" + msgid "Successfully unlinked your account from %{is}." msgstr "" @@ -1190,6 +1307,9 @@ msgid "That template is not currently published." msgstr "templates" +msgid "The" +msgstr "" + msgid "The " msgstr "" @@ -1205,9 +1325,6 @@ msgid "Themes" msgstr "Themen" -msgid "There are a number of possible templates you could use. Please choose one." -msgstr "Es stehen verschiedene mögliche Vorlagen zur Auswahl. Bitte wählen Sie eine aus." - msgid "There are no public DMPs." msgstr "Es wurden noch keine DMPs veröffentlicht." @@ -1229,30 +1346,25 @@ msgid "This document was generated by %{application_name}" msgstr "%{application_name}" -msgid "This must be a valid email address - a message will be sent to it for confirmation." -msgstr "" - msgid "This must match what you entered in the previous field." msgstr "Die Eingabe in diesem Feld muss mit der im vorherigen Feld übereinstimmen." msgid "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." msgstr "Diese Seite bietet Ihnen einen Überblick über Ihren Plan. Sie gibt an, worauf dieser Plan basiert und gibt eine Übersicht über die Fragen, die gestellt werden." +#, fuzzy +msgid "This plan is based on the default template." +msgstr "templates" + msgid "This plan is based on:" msgstr "Dieser Plan basiert auf:" msgid "This section is locked for editing by " msgstr "Dieser Abschnitt ist gespert wegen Bearbeitung durch " -msgid "Tick to select any other sources of guidance you wish to see." -msgstr "Wählen Sie jede beliebige andere Quelle für Hilfestellungen." - msgid "Title" msgstr "Titel" -msgid "To see institutional questions and/or guidance, select your organisation." -msgstr "Um Fragen und Hilfestellung einer bestimmten Organisation zu integrieren, wählen Sie diese bitte aus." - msgid "Top" msgstr "Oben" @@ -1284,9 +1396,6 @@ msgid "Unlink institutional credentials alert" msgstr "Unlink institutional credentials alert" -msgid "Unlink your institutional credentials" -msgstr "Unlink your institutional credentials" - msgid "Unlock my account" msgstr "Unlock my account" @@ -1309,12 +1418,12 @@ msgid "Upload a new logo file" msgstr "Laden Sie ein neues Logo-Datei" -msgid "User added to project" -msgstr "" - msgid "Users" msgstr "Nutzer" +msgid "Using the generic Data Management Plan" +msgstr "" + msgid "Version" msgstr "Version" @@ -1336,6 +1445,18 @@ msgid "Visibility" msgstr "Sichtweite" +#, fuzzy +msgid "We found multiple DMP templates corresponding to the funder." +msgstr "templates" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to the research organisation." +msgstr "Organisation" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to your funder." +msgstr "templates" + msgid "Website" msgstr "Web-Seite" @@ -1349,9 +1470,17 @@ msgid "Welcome." msgstr "Willkommen." +#, fuzzy +msgid "What research project are you planning?" +msgstr "plans" + msgid "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." msgstr "Wenn Sie eine neue Phase in einer Vorlage anlegen, wird automatische eine Version erzeugt. Nachdem Sie das folgende Formular ausgefüllt haben, werden Ihnen Optionen zum erstellen von Abschnitten und Fragen angezeigt." +#, fuzzy +msgid "Which DMP template would you like to use?" +msgstr "templates" + msgid "While you were editing " msgstr "" @@ -1379,6 +1508,10 @@ msgid "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" msgstr "Sie sind dabei den Antwortvorschlag / das Beispiel für '%{question_text}' zu löschen. Sind Sie sicher?" +#, fuzzy +msgid "You are about to delete an example answer for '%{question_text}'. Are you sure?" +msgstr "Sie sind dabei den Antwortvorschlag / das Beispiel für '%{question_text}' zu löschen. Sind Sie sicher?" + msgid "You are not authorized to perform this action." msgstr "" @@ -1386,6 +1519,10 @@ msgid "You are viewing a historical version of this template. You will not be able to make changes." msgstr "templates" +#, fuzzy +msgid "You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted." +msgstr "Hier können Sie einen Text als Beispiel oder Vorschlag angeben, der Nutzern bei der Beantwortung helfen soll. Der Text erscheint oberhalb des Antwortfeldes und kann kopiert und eingefügt werden." + msgid "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." msgstr "Hier können Sie einen Text als Beispiel oder Vorschlag angeben, der Nutzern bei der Beantwortung helfen soll. Der Text erscheint oberhalb des Antwortfeldes und kann kopiert und eingefügt werden." @@ -1395,6 +1532,9 @@ msgid "You can edit any of the details below." msgstr "Alle folgenden Angaben können bearbeitet werden." +msgid "You can not continue until you have filled in all of the required information." +msgstr "" + #, fuzzy msgid "You can not edit a historical version of this template." msgstr "templates" @@ -1425,9 +1565,6 @@ msgstr "" "You have unsaved answers in the following sections:\n" -msgid "You may leave blank or select a different organisation to your own." -msgstr "Sie können eine beliebige Organisation wählen, oder das Feld leer lassen." - msgid "You must accept the terms and conditions to register." msgstr "" @@ -1455,9 +1592,6 @@ msgid "Your account has been successfully linked to %{scheme}." msgstr "Your " -msgid "Your account is linked to your institutional credentials." -msgstr "Your account is linked to your institutional credentials." - #, fuzzy msgid "Your account won't be created until you access the link above and set your password." msgstr "Your " @@ -1541,6 +1675,10 @@ msgid "by" msgstr "" +#, fuzzy +msgid "by " +msgstr " von " + msgid "can't be blank" msgstr "" @@ -1553,12 +1691,17 @@ msgid "e.g. School/ Department" msgstr "z.B. Fakultät / Einrichtung" -msgid "format" -msgstr "" +#, fuzzy +msgid "example answer" +msgstr "Beispielantwort" msgid "from now" msgstr "" +#, fuzzy +msgid "generic template" +msgstr "templates" + msgid "guidance" msgstr "" @@ -1572,9 +1715,6 @@ msgid "height must be less than 100px" msgstr "" -msgid "helpers.dropdown" -msgstr "" - msgid "helpers.is_test" msgstr "" @@ -1606,6 +1746,10 @@ msgstr "guidances" #, fuzzy +msgid "no research organisation is associated with this plan" +msgstr "Organisation" + +#, fuzzy msgid "note" msgstr "Kommentar" @@ -1614,10 +1758,6 @@ msgstr "(or copy" #, fuzzy -msgid "org_admin.templates.edit_phase_label" -msgstr "org_admin" - -#, fuzzy msgid "organisation" msgstr "Organisation" @@ -1658,10 +1798,6 @@ msgstr "select at least one theme" #, fuzzy -msgid "suggested answer" -msgstr "Antwortvorschlag" - -#, fuzzy msgid "template" msgstr "templates" diff --git a/config/locale/en_GB/app.po b/config/locale/en_GB/app.po index 26f3a5d..244d1d9 100644 --- a/config/locale/en_GB/app.po +++ b/config/locale/en_GB/app.po @@ -22,21 +22,14 @@ msgid " - " msgstr " - " -msgid " - choosing default template for your institution" -msgstr " - choosing default template for your institution" - -msgid " - no funder or institution template, choosing default template" -msgstr " - no funder or institution template, choosing default template" - -msgid " - there are more than one to choose from" -msgstr " - there are more than one to choose from" - -msgid " - using template customised by your institution" -msgstr " - using template customised by your institution" - -msgid " I accept the terms and conditions *" +#, fuzzy +msgid " I accept the terms and conditions *" msgstr " I accept the terms and conditions *" +#, fuzzy +msgid " Plan" +msgstr "plan" + msgid " access to" msgstr " access to" @@ -44,6 +37,10 @@ msgid " access. " msgstr " access to" +#, fuzzy +msgid " and " +msgstr " on " + msgid " by" msgstr " by" @@ -66,22 +63,35 @@ msgid " once you click save!" msgstr " once you click save!" +#, fuzzy +msgid " or " +msgstr " on " + msgid " password. You can do this through the link below." msgstr " password. You can do this through the link below." +#, fuzzy +msgid " provided by " +msgstr " by " + msgid " saved the following answer:" msgstr " saved the following answer:" msgid " team" msgstr " team" +#, fuzzy +msgid " that has been customised by " +msgstr " by " + msgid " to accept the invitation, (or copy " msgstr " to accept the invitation, (or copy " msgid " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on " msgstr " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on " -msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\"" +#, fuzzy +msgid "\"Are you sure you want to unlink #{scheme.description} ID?\"" msgstr "\"Are you sure you want to unlink your #{scheme.description} ID?\"" msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\"" @@ -108,6 +118,10 @@ msgid "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." msgstr "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." +#, fuzzy +msgid "%{application_name} is provided by the %{organisation_name}. You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below." +msgstr "%{application_name}" + msgid "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." msgstr "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." @@ -171,15 +185,6 @@ msgid "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " msgstr "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " -msgid "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " -msgstr "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " - -msgid "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " -msgstr "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " - -msgid "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " -msgstr "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " - msgid "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " msgstr "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " @@ -204,6 +209,19 @@ msgid "

    You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

    If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

    " msgstr "

    You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

    If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

    " +#, fuzzy +msgid "" +"
    • %{organisation_name}
    • \n" +"
    • %{organisation_address_line1}
    • \n" +"
    • %{organisation_address_line2}
    • \n" +"
    • %{organisation_address_line3}
    • \n" +"
    • %{organisation_address_line4}
    • \n" +"
    • %{organisation_address_country}
    • \n" +"
    \n" +"

    Helpline: %{organisation_telephone}

    \n" +"

    Email %{organisation_email}

    " +msgstr "%{application_name}" + msgid "A colleague has invited you to contribute to their Data Management Plan at " msgstr "A colleague has invited you to contribute to their Data Management Plan at " @@ -213,9 +231,15 @@ msgid "A required setting has not been provided" msgstr "A required setting has not been provided" +msgid "A version of " +msgstr "" + msgid "API Information" msgstr "API Information" +msgid "API rights" +msgstr "" + msgid "API token" msgstr "API token" @@ -240,6 +264,9 @@ msgid "Add collaborator" msgstr "Add collaborator" +msgid "Add example answer" +msgstr "" + msgid "Add guidance" msgstr "Add guidance" @@ -261,9 +288,6 @@ msgid "Add section" msgstr "Add section" -msgid "Add suggested answer/ example" -msgstr "Add suggested answer/ example" - msgid "Additional comment area will be displayed." msgstr "Additional comment area will be displayed." @@ -276,6 +300,22 @@ msgid "All the best," msgstr "" +#, fuzzy +msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo" +msgstr "organisation" + +#, fuzzy +msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves" +msgstr "organisation" + +#, fuzzy +msgid "Allows the user to create and edit guidance" +msgstr "guidance" + +#, fuzzy +msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates" +msgstr "template" + msgid "An error has occurred while saving/resetting your export settings." msgstr "" @@ -327,6 +367,13 @@ msgid "Before submitting, please consider:" msgstr "Before submitting, please consider:" +#, fuzzy +msgid "Before you get started, we need to ask a few questions to set you up with the best DMP template for your needs." +msgstr "questions" + +msgid "Begin typing to see a filtered list" +msgstr "" + msgid "Below is a list of users registered for your organisation. You can sort the data by each field." msgstr "Below is a list of users registered for your organisation. You can sort the data by each field." @@ -339,21 +386,26 @@ msgid "Cancel" msgstr "Cancel" +#, fuzzy +msgid "Cannot share plan with %{email} since that email matches with the owner of the plan." +msgstr "plan" + msgid "Change language" msgstr "Change language" msgid "Change my password" msgstr "Change my password" +#, fuzzy +msgid "Change organisation details" +msgstr "organisation" + msgid "Check box" msgstr "Check box" msgid "Check this box when you are ready for this guidance to appear on user's plans." msgstr "Check this box when you are ready for this guidance to appear on user's plans." -msgid "Choose a template" -msgstr "Choose a template" - msgid "Click here" msgstr "" @@ -390,6 +442,10 @@ msgid "Contact Email" msgstr "Contact Email" +#, fuzzy +msgid "Contact Us" +msgstr "Contact us" + msgid "Contact us" msgstr "Contact us" @@ -450,6 +506,9 @@ msgid "Display additional comment area." msgstr "Display additional comment area." +msgid "Draft" +msgstr "" + msgid "Dropdown" msgstr "Dropdown" @@ -459,6 +518,10 @@ msgid "Edit" msgstr "Edit" +#, fuzzy +msgid "Edit Example of Answer" +msgstr "Example of answer" + msgid "Edit User Privileges" msgstr "Edit User Privileges" @@ -480,9 +543,6 @@ msgid "Edit question" msgstr "Edit question" -msgid "Edit suggested answer/ example" -msgstr "Edit suggested answer/ example" - msgid "Edit template details" msgstr "Edit template details" @@ -522,6 +582,14 @@ msgid "Error!" msgstr "Error!" +#, fuzzy +msgid "Example Answer" +msgstr "Example of answer" + +#, fuzzy +msgid "Example of Answer" +msgstr "Example of answer" + msgid "Example of answer" msgstr "Example of answer" @@ -540,6 +608,9 @@ msgid "File Name" msgstr "File Name" +msgid "Fill in the required fields" +msgstr "" + msgid "Filter plans" msgstr "Filter plans" @@ -552,15 +623,20 @@ msgid "Forgot your password?" msgstr "Forgot your password?" +#, fuzzy +msgid "Format" +msgstr "format" + msgid "Funder" msgstr "Funder" -msgid "Funder name" -msgstr "Funder name" - msgid "Funders templates" msgstr "Funders templates" +#, fuzzy +msgid "Funding organisation" +msgstr "organisation" + msgid "Future plans" msgstr "Future plans" @@ -570,12 +646,19 @@ msgid "Grant number" msgstr "Grant number" +msgid "Grant permissions" +msgstr "" + msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgstr "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgid "Guidance" msgstr "Guidance" +#, fuzzy +msgid "Guidance choices saved." +msgstr "Guidance" + msgid "Guidance group" msgstr "Guidance group" @@ -627,12 +710,13 @@ msgid "ID" msgstr "ID" -msgid "If applying for funding, select your research funder." -msgstr "If applying for funding, select your research funder." - msgid "If applying for funding, state the name exactly as in the grant proposal." msgstr "If applying for funding, state the name exactly as in the grant proposal." +#, fuzzy +msgid "If applying for funding, state the title exactly as in the proposal." +msgstr "If applying for funding, state the name exactly as in the grant proposal." + msgid "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." msgstr "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." @@ -651,9 +735,6 @@ msgid "If you would like to change your password please complete the following fields." msgstr "If you would like to change your password please complete the following fields." -msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan." -msgstr "" - msgid "Included Elements" msgstr "Included Elements" @@ -678,7 +759,8 @@ msgid "Invalid maximum pages" msgstr "Invalid maximum pages" -msgid "Invitation issued successfully." +#, fuzzy +msgid "Invitation to %{email} issued successfully." msgstr "Invitation issued successfully." msgid "Language" @@ -699,9 +781,6 @@ msgid "Left" msgstr "Left" -msgid "Link your %{application_name} account to your institutional credentials (UK users only)" -msgstr "Link your %{application_name} account to your institutional credentials (UK users only)" - msgid "List of users" msgstr "List of users" @@ -726,18 +805,35 @@ msgid "Me" msgstr "Me" +#, fuzzy +msgid "Message" +msgstr "Me" + +#, fuzzy +msgid "Modify guidance" +msgstr "guidance" + +#, fuzzy +msgid "Modify templates" +msgstr "template" + msgid "Multi select box" msgstr "Multi select box" +#, fuzzy +msgid "My Plan" +msgstr "My plan" + msgid "My organisation isn't listed." msgstr "My organisation isn't listed." -msgid "My plan" -msgstr "My plan" - msgid "My plans" msgstr "My plans" +#, fuzzy +msgid "My research organisation is not on the list" +msgstr "organisation" + msgid "Name" msgstr "Name" @@ -747,9 +843,6 @@ msgid "Name of Principal Investigator(s) or main researcher(s) on the project." msgstr "Name of Principal Investigator(s) or main researcher(s) on the project." -msgid "Name of funder, if applicable." -msgstr "Name of funder, if applicable." - msgid "New guidance" msgstr "New guidance" @@ -771,6 +864,14 @@ msgid "No additional comment area will be displayed." msgstr "No additional comment area will be displayed." +#, fuzzy +msgid "No funder associated with this plan" +msgstr "plan" + +#, fuzzy +msgid "No items available." +msgstr "No" + msgid "No matches" msgstr "No matches" @@ -780,9 +881,6 @@ msgid "Not answered yet" msgstr "Not answered yet" -msgid "Not applicable/not listed." -msgstr "Not applicable/not listed." - msgid "Note" msgstr "Note" @@ -846,9 +944,6 @@ msgid "Other institutions" msgstr "" -msgid "Otherwise leave blank." -msgstr "Otherwise leave blank." - msgid "Own templates" msgstr "Own templates" @@ -891,11 +986,14 @@ msgid "Plan details" msgstr "Plan details" +msgid "Plan is already shared with %{email}." +msgstr "" + msgid "Plan name" msgstr "Plan name" -msgid "Plan was successfully created." -msgstr "Plan was successfully created." +msgid "Plan shared with %{email}." +msgstr "" msgid "Plan was successfully deleted." msgstr "Plan was successfully deleted." @@ -921,6 +1019,12 @@ msgid "Please enter your current password" msgstr "" +msgid "Please enter your current password below when changing your email address." +msgstr "" + +msgid "Please enter your email" +msgstr "" + msgid "Please enter your first name." msgstr "Please enter your first name." @@ -933,18 +1037,29 @@ msgid "Please enter your surname or family name." msgstr "Please enter your surname or family name." +msgid "Please fill in the basic project details below" +msgstr "" + msgid "Please fill in the basic project details below and click 'Update' to save" msgstr "Please fill in the basic project details below and click 'Update' to save" +#, fuzzy +msgid "Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in." +msgstr "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " + msgid "Please only enter up to 165 characters, you have used" msgstr "Please only enter up to 165 characters, you have used" -msgid "Policy Expectations" -msgstr "Policy Expectations" +msgid "Please select one" +msgstr "" msgid "Preview" msgstr "Preview" +#, fuzzy +msgid "Primary research organisation" +msgstr "organisation" + msgid "Principal Investigator / Researcher" msgstr "Principal Investigator / Researcher" @@ -963,6 +1078,13 @@ msgid "Privileges" msgstr "Privileges" +msgid "Project title" +msgstr "" + +#, fuzzy +msgid "Provides the user with an API token and grants rights to harvest information from the tool" +msgstr "API token" + msgid "Public" msgstr "Public" @@ -1047,24 +1169,27 @@ msgid "Sections" msgstr "Sections" -msgid "Select Funder" -msgstr "Select Funder" - -msgid "Select Organisation" -msgstr "Select Organisation" +#, fuzzy +msgid "Select a template" +msgstr "template" msgid "Select an action" msgstr "Select an action" +#, fuzzy +msgid "Select the funding organisation" +msgstr "organisation" + +#, fuzzy +msgid "Select the primary research organisation responsible" +msgstr "organisation" + msgid "Select which group this guidance relates to." msgstr "Select which group this guidance relates to." msgid "Select which theme(s) this guidance relates to." msgstr "Select which theme(s) this guidance relates to." -msgid "Select your research funder or no funder, as appropariate." -msgstr "" - msgid "Selected option(s)" msgstr "" @@ -1104,6 +1229,9 @@ msgid "Status" msgstr "" +msgid "Subject" +msgstr "" + msgid "Successfully unlinked your account from %{is}." msgstr "" @@ -1155,6 +1283,10 @@ msgid "That template is not currently published." msgstr "That template is not currently published." +#, fuzzy +msgid "The" +msgstr "The " + msgid "The " msgstr "The " @@ -1170,9 +1302,6 @@ msgid "Themes" msgstr "Themes" -msgid "There are a number of possible templates you could use. Please choose one." -msgstr "There are a number of possible templates you could use. Please choose one." - msgid "There are no public DMPs." msgstr "There are no public DMPs." @@ -1194,30 +1323,25 @@ msgid "This document was generated by %{application_name}" msgstr "This document was generated by %{application_name}" -msgid "This must be a valid email address - a message will be sent to it for confirmation." -msgstr "This must be a valid email address - a message will be sent to it for confirmation." - msgid "This must match what you entered in the previous field." msgstr "This must match what you entered in the previous field." msgid "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." msgstr "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." +#, fuzzy +msgid "This plan is based on the default template." +msgstr "template" + msgid "This plan is based on:" msgstr "This plan is based on:" msgid "This section is locked for editing by " msgstr "This section is locked for editing by " -msgid "Tick to select any other sources of guidance you wish to see." -msgstr "Tick to select any other sources of guidance you wish to see." - msgid "Title" msgstr "Title" -msgid "To see institutional questions and/or guidance, select your organisation." -msgstr "To see institutional questions and/or guidance, select your organisation." - msgid "Top" msgstr "Top" @@ -1248,9 +1372,6 @@ msgid "Unlink institutional credentials alert" msgstr "Unlink institutional credentials alert" -msgid "Unlink your institutional credentials" -msgstr "Unlink your institutional credentials" - msgid "Unlock my account" msgstr "Unlock my account" @@ -1272,12 +1393,12 @@ msgid "Upload a new logo file" msgstr "Upload a new logo file" -msgid "User added to project" -msgstr "User added to project" - msgid "Users" msgstr "Users" +msgid "Using the generic Data Management Plan" +msgstr "" + msgid "Version" msgstr "Version" @@ -1299,6 +1420,18 @@ msgid "Visibility" msgstr "Visibility" +#, fuzzy +msgid "We found multiple DMP templates corresponding to the funder." +msgstr "template" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to the research organisation." +msgstr "organisation" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to your funder." +msgstr "template" + msgid "Website" msgstr "Website" @@ -1311,9 +1444,17 @@ msgid "Welcome." msgstr "Welcome." +#, fuzzy +msgid "What research project are you planning?" +msgstr "plan" + msgid "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." msgstr "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." +#, fuzzy +msgid "Which DMP template would you like to use?" +msgstr "template" + msgid "While you were editing " msgstr "" @@ -1341,12 +1482,20 @@ msgid "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" msgstr "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" +#, fuzzy +msgid "You are about to delete an example answer for '%{question_text}'. Are you sure?" +msgstr "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" + msgid "You are not authorized to perform this action." msgstr "" msgid "You are viewing a historical version of this template. You will not be able to make changes." msgstr "You are viewing a historical version of this template. You will not be able to make changes." +#, fuzzy +msgid "You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted." +msgstr "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." + msgid "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." msgstr "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." @@ -1356,6 +1505,10 @@ msgid "You can edit any of the details below." msgstr "You can edit any of the details below." +#, fuzzy +msgid "You can not continue until you have filled in all of the required information." +msgstr "format" + msgid "You can not edit a historical version of this template." msgstr "" @@ -1380,9 +1533,6 @@ msgid "You have unsaved answers in the following sections:" msgstr "" -msgid "You may leave blank or select a different organisation to your own." -msgstr "You may leave blank or select a different organisation to your own." - msgid "You must accept the terms and conditions to register." msgstr "You must accept the terms and conditions to register." @@ -1407,9 +1557,6 @@ msgid "Your account has been successfully linked to %{scheme}." msgstr "Your account has been successfully linked to %{scheme}." -msgid "Your account is linked to your institutional credentials." -msgstr "Your account is linked to your institutional credentials." - msgid "Your account won't be created until you access the link above and set your password." msgstr "Your account won't be created until you access the link above and set your password." @@ -1482,6 +1629,10 @@ msgid "by" msgstr "" +#, fuzzy +msgid "by " +msgstr " by " + msgid "can't be blank" msgstr "" @@ -1494,12 +1645,17 @@ msgid "e.g. School/ Department" msgstr "e.g. School/ Department" -msgid "format" -msgstr "format" +#, fuzzy +msgid "example answer" +msgstr "Example of answer" msgid "from now" msgstr "from now" +#, fuzzy +msgid "generic template" +msgstr "template" + msgid "guidance" msgstr "guidance" @@ -1512,9 +1668,6 @@ msgid "height must be less than 100px" msgstr "" -msgid "helpers.dropdown" -msgstr "" - msgid "helpers.is_test" msgstr "" @@ -1542,15 +1695,16 @@ msgid "must have access to guidances api" msgstr "must have access to guidances api" +#, fuzzy +msgid "no research organisation is associated with this plan" +msgstr "organisation" + msgid "note" msgstr "note" msgid "or copy" msgstr "or copy" -msgid "org_admin.templates.edit_phase_label" -msgstr "" - msgid "organisation" msgstr "organisation" @@ -1584,9 +1738,6 @@ msgid "select at least one theme" msgstr "select at least one theme" -msgid "suggested answer" -msgstr "suggested answer" - msgid "template" msgstr "template" diff --git a/config/locale/en_US/app.po b/config/locale/en_US/app.po index 078709c..dbb07f4 100644 --- a/config/locale/en_US/app.po +++ b/config/locale/en_US/app.po @@ -22,21 +22,14 @@ msgid " - " msgstr " - " -msgid " - choosing default template for your institution" -msgstr " - choosing default template for your institution" - -msgid " - no funder or institution template, choosing default template" -msgstr " - no funder or institution template, choosing default template" - -msgid " - there are more than one to choose from" -msgstr " - there are more than one to choose from" - -msgid " - using template customised by your institution" -msgstr " - using template customized by your institution" - -msgid " I accept the terms and conditions *" +#, fuzzy +msgid " I accept the terms and conditions *" msgstr " I accept the terms and conditions *" +#, fuzzy +msgid " Plan" +msgstr "plan" + msgid " access to" msgstr " access to" @@ -44,6 +37,10 @@ msgid " access. " msgstr " access to" +#, fuzzy +msgid " and " +msgstr " on " + msgid " by" msgstr " by" @@ -66,22 +63,35 @@ msgid " once you click save!" msgstr " once you click save!" +#, fuzzy +msgid " or " +msgstr " on " + msgid " password. You can do this through the link below." msgstr " password. You can do this through the link below." +#, fuzzy +msgid " provided by " +msgstr " by " + msgid " saved the following answer:" msgstr " saved the following answer:" msgid " team" msgstr " team" +#, fuzzy +msgid " that has been customised by " +msgstr " by " + msgid " to accept the invitation, (or copy " msgstr " to accept the invitation, (or copy " msgid " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on " msgstr " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on " -msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\"" +#, fuzzy +msgid "\"Are you sure you want to unlink #{scheme.description} ID?\"" msgstr "\"Are you sure you want to unlink your #{scheme.description} ID?\"" msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\"" @@ -108,6 +118,10 @@ msgid "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." msgstr "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." +#, fuzzy +msgid "%{application_name} is provided by the %{organisation_name}. You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below." +msgstr "%{application_name}" + msgid "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." msgstr "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." @@ -171,15 +185,6 @@ msgid "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " msgstr "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " -msgid "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " -msgstr "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " - -msgid "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " -msgstr "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " - -msgid "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " -msgstr "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " - msgid "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " msgstr "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " @@ -204,6 +209,19 @@ msgid "

    You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

    If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

    " msgstr "

    You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

    If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

    " +#, fuzzy +msgid "" +"
    • %{organisation_name}
    • \n" +"
    • %{organisation_address_line1}
    • \n" +"
    • %{organisation_address_line2}
    • \n" +"
    • %{organisation_address_line3}
    • \n" +"
    • %{organisation_address_line4}
    • \n" +"
    • %{organisation_address_country}
    • \n" +"
    \n" +"

    Helpline: %{organisation_telephone}

    \n" +"

    Email %{organisation_email}

    " +msgstr "%{application_name}" + msgid "A colleague has invited you to contribute to their Data Management Plan at " msgstr "A colleague has invited you to contribute to their Data Management Plan at " @@ -213,9 +231,15 @@ msgid "A required setting has not been provided" msgstr "A required setting has not been provided" +msgid "A version of " +msgstr "" + msgid "API Information" msgstr "API Information" +msgid "API rights" +msgstr "" + msgid "API token" msgstr "API token" @@ -240,6 +264,9 @@ msgid "Add collaborator" msgstr "Add collaborator" +msgid "Add example answer" +msgstr "" + msgid "Add guidance" msgstr "Add guidance" @@ -261,9 +288,6 @@ msgid "Add section" msgstr "Add section" -msgid "Add suggested answer/ example" -msgstr "Add suggested answer/ example" - msgid "Additional comment area will be displayed." msgstr "Additional comment area will be displayed." @@ -276,6 +300,22 @@ msgid "All the best," msgstr "" +#, fuzzy +msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo" +msgstr "organization" + +#, fuzzy +msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves" +msgstr "organization" + +#, fuzzy +msgid "Allows the user to create and edit guidance" +msgstr "guidance" + +#, fuzzy +msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates" +msgstr "template" + msgid "An error has occurred while saving/resetting your export settings." msgstr "" @@ -327,6 +367,13 @@ msgid "Before submitting, please consider:" msgstr "Before submitting, please consider:" +#, fuzzy +msgid "Before you get started, we need to ask a few questions to set you up with the best DMP template for your needs." +msgstr "questions" + +msgid "Begin typing to see a filtered list" +msgstr "" + msgid "Below is a list of users registered for your organisation. You can sort the data by each field." msgstr "Below is a list of users registered for your organization. You can sort the data by each field." @@ -339,21 +386,26 @@ msgid "Cancel" msgstr "Cancel" +#, fuzzy +msgid "Cannot share plan with %{email} since that email matches with the owner of the plan." +msgstr "plan" + msgid "Change language" msgstr "Change language" msgid "Change my password" msgstr "Change my password" +#, fuzzy +msgid "Change organisation details" +msgstr "organization" + msgid "Check box" msgstr "Check box" msgid "Check this box when you are ready for this guidance to appear on user's plans." msgstr "Check this box when you are ready for this guidance to appear on user's plans." -msgid "Choose a template" -msgstr "Choose a template" - msgid "Click here" msgstr "" @@ -390,6 +442,10 @@ msgid "Contact Email" msgstr "Contact Email" +#, fuzzy +msgid "Contact Us" +msgstr "Contact us" + msgid "Contact us" msgstr "Contact us" @@ -450,6 +506,9 @@ msgid "Display additional comment area." msgstr "Display additional comment area." +msgid "Draft" +msgstr "" + msgid "Dropdown" msgstr "Dropdown" @@ -459,6 +518,10 @@ msgid "Edit" msgstr "Edit" +#, fuzzy +msgid "Edit Example of Answer" +msgstr "Example of answer" + msgid "Edit User Privileges" msgstr "Edit User Permissions" @@ -480,9 +543,6 @@ msgid "Edit question" msgstr "Edit question" -msgid "Edit suggested answer/ example" -msgstr "Edit suggested answer/ example" - msgid "Edit template details" msgstr "Edit template details" @@ -522,6 +582,14 @@ msgid "Error!" msgstr "Error!" +#, fuzzy +msgid "Example Answer" +msgstr "Example of answer" + +#, fuzzy +msgid "Example of Answer" +msgstr "Example of answer" + msgid "Example of answer" msgstr "Example of answer" @@ -540,6 +608,9 @@ msgid "File Name" msgstr "File Name" +msgid "Fill in the required fields" +msgstr "" + msgid "Filter plans" msgstr "Filter plans" @@ -552,15 +623,20 @@ msgid "Forgot your password?" msgstr "Forgot your password?" +#, fuzzy +msgid "Format" +msgstr "format" + msgid "Funder" msgstr "Funder" -msgid "Funder name" -msgstr "Funder name" - msgid "Funders templates" msgstr "Funders templates" +#, fuzzy +msgid "Funding organisation" +msgstr "organization" + msgid "Future plans" msgstr "Future plans" @@ -570,12 +646,19 @@ msgid "Grant number" msgstr "Grant Number" +msgid "Grant permissions" +msgstr "" + msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgstr "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgid "Guidance" msgstr "Guidance" +#, fuzzy +msgid "Guidance choices saved." +msgstr "Guidance" + msgid "Guidance group" msgstr "Guidance group" @@ -627,12 +710,13 @@ msgid "ID" msgstr "ID" -msgid "If applying for funding, select your research funder." -msgstr "If applying for funding, select your research funder." - msgid "If applying for funding, state the name exactly as in the grant proposal." msgstr "If applying for funding, state the name exactly as in the grant proposal." +#, fuzzy +msgid "If applying for funding, state the title exactly as in the proposal." +msgstr "If applying for funding, state the name exactly as in the grant proposal." + msgid "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." msgstr "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." @@ -651,9 +735,6 @@ msgid "If you would like to change your password please complete the following fields." msgstr "If you would like to change your password please complete the following fields." -msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan." -msgstr "" - msgid "Included Elements" msgstr "Included Elements" @@ -678,7 +759,8 @@ msgid "Invalid maximum pages" msgstr "Invalid maximum pages" -msgid "Invitation issued successfully." +#, fuzzy +msgid "Invitation to %{email} issued successfully." msgstr "Invitation issued successfully." msgid "Language" @@ -699,9 +781,6 @@ msgid "Left" msgstr "Left" -msgid "Link your %{application_name} account to your institutional credentials (UK users only)" -msgstr "Link your %{application_name} account to your institutional credentials (UK users only)" - msgid "List of users" msgstr "List of users" @@ -726,18 +805,35 @@ msgid "Me" msgstr "Me" +#, fuzzy +msgid "Message" +msgstr "Me" + +#, fuzzy +msgid "Modify guidance" +msgstr "guidance" + +#, fuzzy +msgid "Modify templates" +msgstr "template" + msgid "Multi select box" msgstr "Multi select box" +#, fuzzy +msgid "My Plan" +msgstr "My plan" + msgid "My organisation isn't listed." msgstr "My organization isn't listed." -msgid "My plan" -msgstr "My plan" - msgid "My plans" msgstr "My plans" +#, fuzzy +msgid "My research organisation is not on the list" +msgstr "organization" + msgid "Name" msgstr "Name" @@ -747,9 +843,6 @@ msgid "Name of Principal Investigator(s) or main researcher(s) on the project." msgstr "Name of Principal Investigator(s) or main researcher(s) on the project." -msgid "Name of funder, if applicable." -msgstr "Name of funder, if applicable." - msgid "New guidance" msgstr "New guidance" @@ -771,6 +864,14 @@ msgid "No additional comment area will be displayed." msgstr "No additional comment area will be displayed." +#, fuzzy +msgid "No funder associated with this plan" +msgstr "plan" + +#, fuzzy +msgid "No items available." +msgstr "No" + msgid "No matches" msgstr "No matches" @@ -780,9 +881,6 @@ msgid "Not answered yet" msgstr "Not answered yet" -msgid "Not applicable/not listed." -msgstr "Not applicable/not listed." - msgid "Note" msgstr "Note" @@ -846,9 +944,6 @@ msgid "Other institutions" msgstr "" -msgid "Otherwise leave blank." -msgstr "Otherwise leave blank." - msgid "Own templates" msgstr "Own templates" @@ -891,11 +986,14 @@ msgid "Plan details" msgstr "Plan details" +msgid "Plan is already shared with %{email}." +msgstr "" + msgid "Plan name" msgstr "Plan name" -msgid "Plan was successfully created." -msgstr "Plan was successfully created." +msgid "Plan shared with %{email}." +msgstr "" msgid "Plan was successfully deleted." msgstr "Plan was successfully deleted." @@ -921,6 +1019,12 @@ msgid "Please enter your current password" msgstr "" +msgid "Please enter your current password below when changing your email address." +msgstr "" + +msgid "Please enter your email" +msgstr "" + msgid "Please enter your first name." msgstr "Please enter your first name." @@ -933,18 +1037,29 @@ msgid "Please enter your surname or family name." msgstr "Please enter your surname or family name." +msgid "Please fill in the basic project details below" +msgstr "" + msgid "Please fill in the basic project details below and click 'Update' to save" msgstr "Please fill in the basic project details below and click 'Update' to save" +#, fuzzy +msgid "Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in." +msgstr "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " + msgid "Please only enter up to 165 characters, you have used" msgstr "Please only enter up to 165 characters, you have used" -msgid "Policy Expectations" -msgstr "Policy Expectations" +msgid "Please select one" +msgstr "" msgid "Preview" msgstr "Preview" +#, fuzzy +msgid "Primary research organisation" +msgstr "organization" + msgid "Principal Investigator / Researcher" msgstr "Principal Investigator / Researcher" @@ -963,6 +1078,13 @@ msgid "Privileges" msgstr "Permissions" +msgid "Project title" +msgstr "" + +#, fuzzy +msgid "Provides the user with an API token and grants rights to harvest information from the tool" +msgstr "API token" + msgid "Public" msgstr "Public" @@ -1047,24 +1169,27 @@ msgid "Sections" msgstr "Sections" -msgid "Select Funder" -msgstr "Select Funder" - -msgid "Select Organisation" -msgstr "Select Organization" +#, fuzzy +msgid "Select a template" +msgstr "template" msgid "Select an action" msgstr "Select an action" +#, fuzzy +msgid "Select the funding organisation" +msgstr "organization" + +#, fuzzy +msgid "Select the primary research organisation responsible" +msgstr "organization" + msgid "Select which group this guidance relates to." msgstr "Select which group this guidance relates to." msgid "Select which theme(s) this guidance relates to." msgstr "Select which theme(s) this guidance relates to." -msgid "Select your research funder or no funder, as appropariate." -msgstr "" - msgid "Selected option(s)" msgstr "" @@ -1104,6 +1229,9 @@ msgid "Status" msgstr "" +msgid "Subject" +msgstr "" + msgid "Successfully unlinked your account from %{is}." msgstr "" @@ -1155,6 +1283,10 @@ msgid "That template is not currently published." msgstr "That template is not currently published." +#, fuzzy +msgid "The" +msgstr "The " + msgid "The " msgstr "The " @@ -1170,9 +1302,6 @@ msgid "Themes" msgstr "Themes" -msgid "There are a number of possible templates you could use. Please choose one." -msgstr "There are a number of possible templates you could use. Please choose one." - msgid "There are no public DMPs." msgstr "There are no public DMPs." @@ -1194,30 +1323,25 @@ msgid "This document was generated by %{application_name}" msgstr "This document was generated by %{application_name}" -msgid "This must be a valid email address - a message will be sent to it for confirmation." -msgstr "This must be a valid email address - a message will be sent to it for confirmation." - msgid "This must match what you entered in the previous field." msgstr "This must match what you entered in the previous field." msgid "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." msgstr "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." +#, fuzzy +msgid "This plan is based on the default template." +msgstr "template" + msgid "This plan is based on:" msgstr "This plan is based on:" msgid "This section is locked for editing by " msgstr "This section is locked for editing by " -msgid "Tick to select any other sources of guidance you wish to see." -msgstr "Tick to select any other sources of guidance you wish to see." - msgid "Title" msgstr "Title" -msgid "To see institutional questions and/or guidance, select your organisation." -msgstr "To see institutional questions and/or guidance, select your organization." - msgid "Top" msgstr "Top" @@ -1248,9 +1372,6 @@ msgid "Unlink institutional credentials alert" msgstr "Unlink institutional credentials alert" -msgid "Unlink your institutional credentials" -msgstr "Unlink your institutional credentials" - msgid "Unlock my account" msgstr "Unlock my account" @@ -1272,12 +1393,12 @@ msgid "Upload a new logo file" msgstr "Upload a new logo file" -msgid "User added to project" -msgstr "User added to project" - msgid "Users" msgstr "Users" +msgid "Using the generic Data Management Plan" +msgstr "" + msgid "Version" msgstr "Version" @@ -1299,6 +1420,18 @@ msgid "Visibility" msgstr "Visibility" +#, fuzzy +msgid "We found multiple DMP templates corresponding to the funder." +msgstr "template" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to the research organisation." +msgstr "organization" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to your funder." +msgstr "template" + msgid "Website" msgstr "Website" @@ -1311,9 +1444,17 @@ msgid "Welcome." msgstr "Welcome." +#, fuzzy +msgid "What research project are you planning?" +msgstr "plan" + msgid "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." msgstr "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." +#, fuzzy +msgid "Which DMP template would you like to use?" +msgstr "template" + msgid "While you were editing " msgstr "" @@ -1341,12 +1482,20 @@ msgid "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" msgstr "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" +#, fuzzy +msgid "You are about to delete an example answer for '%{question_text}'. Are you sure?" +msgstr "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" + msgid "You are not authorized to perform this action." msgstr "" msgid "You are viewing a historical version of this template. You will not be able to make changes." msgstr "You are viewing a historical version of this template. You will not be able to make changes." +#, fuzzy +msgid "You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted." +msgstr "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." + msgid "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." msgstr "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." @@ -1356,6 +1505,10 @@ msgid "You can edit any of the details below." msgstr "You can edit any of the details below." +#, fuzzy +msgid "You can not continue until you have filled in all of the required information." +msgstr "format" + msgid "You can not edit a historical version of this template." msgstr "" @@ -1380,9 +1533,6 @@ msgid "You have unsaved answers in the following sections:" msgstr "" -msgid "You may leave blank or select a different organisation to your own." -msgstr "You may leave blank or select a different organization to your own." - msgid "You must accept the terms and conditions to register." msgstr "You must accept the terms and conditions to register." @@ -1407,9 +1557,6 @@ msgid "Your account has been successfully linked to %{scheme}." msgstr "Your account has been successfully linked to %{scheme}." -msgid "Your account is linked to your institutional credentials." -msgstr "Your account is linked to your institutional credentials." - msgid "Your account won't be created until you access the link above and set your password." msgstr "Your account won't be created until you access the link above and set your password." @@ -1482,6 +1629,10 @@ msgid "by" msgstr "" +#, fuzzy +msgid "by " +msgstr " by " + msgid "can't be blank" msgstr "" @@ -1494,12 +1645,17 @@ msgid "e.g. School/ Department" msgstr "e.g. School/ Department" -msgid "format" -msgstr "format" +#, fuzzy +msgid "example answer" +msgstr "Example of answer" msgid "from now" msgstr "from now" +#, fuzzy +msgid "generic template" +msgstr "template" + msgid "guidance" msgstr "guidance" @@ -1512,9 +1668,6 @@ msgid "height must be less than 100px" msgstr "" -msgid "helpers.dropdown" -msgstr "" - msgid "helpers.is_test" msgstr "" @@ -1542,15 +1695,16 @@ msgid "must have access to guidances api" msgstr "must have access to guidances api" +#, fuzzy +msgid "no research organisation is associated with this plan" +msgstr "organization" + msgid "note" msgstr "note" msgid "or copy" msgstr "or copy" -msgid "org_admin.templates.edit_phase_label" -msgstr "" - msgid "organisation" msgstr "organization" @@ -1584,9 +1738,6 @@ msgid "select at least one theme" msgstr "select at least one theme" -msgid "suggested answer" -msgstr "suggested answer" - msgid "template" msgstr "template" diff --git a/config/locale/es/app.po b/config/locale/es/app.po index debb763..c7cfe48 100644 --- a/config/locale/es/app.po +++ b/config/locale/es/app.po @@ -22,29 +22,23 @@ msgid " - " msgstr "" -msgid " - choosing default template for your institution" -msgstr "" - -msgid " - no funder or institution template, choosing default template" -msgstr "" - -msgid " - there are more than one to choose from" -msgstr "" - #, fuzzy -msgid " - using template customised by your institution" -msgstr " por " - -#, fuzzy -msgid " I accept the terms and conditions *" +msgid " I accept the terms and conditions *" msgstr " Acepto los términos y condiciones *" +#, fuzzy +msgid " Plan" +msgstr "plans" + msgid " access to" msgstr "" msgid " access. " msgstr "" +msgid " and " +msgstr "" + #, fuzzy msgid " by" msgstr " por " @@ -69,9 +63,16 @@ msgid " once you click save!" msgstr "" +msgid " or " +msgstr "" + msgid " password. You can do this through the link below." msgstr "" +#, fuzzy +msgid " provided by " +msgstr " por " + msgid " saved the following answer:" msgstr "" @@ -79,6 +80,10 @@ msgid " team" msgstr "am" +#, fuzzy +msgid " that has been customised by " +msgstr " por " + msgid " to accept the invitation, (or copy " msgstr "" @@ -86,7 +91,7 @@ msgstr "" #, fuzzy -msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\"" +msgid "\"Are you sure you want to unlink #{scheme.description} ID?\"" msgstr "ID" msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\"" @@ -114,6 +119,10 @@ msgid "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." msgstr "DMPonline" +#, fuzzy +msgid "%{application_name} is provided by the %{organisation_name}. You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below." +msgstr "DMPonline" + msgid "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." msgstr "" @@ -178,15 +187,6 @@ msgid "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " msgstr "

    Si desea añadir una plantilla institucional para un Plan de Gestión de Datos, use el botón 'crear plantilla'. Podrá crear más de una plantilla si lo cree conveniente. Ej: para investigadores y otro para estudiantes de postgrado.

    Su plantilla se presentará a los usuarios de su institución cuando no sean aplicables plantillas de agencias de financiación. Si quiere aññadir preguntas a las plantillas de las agencias de financiación, use las siguientes opciones de 'personalizar plantilla'

    " -msgid "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " -msgstr "

    Por favor, tenga en cuenta que su dirección de correo electrónico se usa como su nombre de usuario. Si cambia esto, recuerde usar su nueva dirección de correo electrónico al conectar.

    " - -msgid "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " -msgstr "" - -msgid "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " -msgstr "

    Por favor, seleccione la información de los siguientes desplegables, de forma que podamos determinar qué preguntas y orientación han de ser mostrados en su plan.

    Si no responde a los requisitos específicos de un financiador o institución, seleccione aquí para crear un PGD genérico basado en los temas más comunes.

    " - msgid "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " msgstr "

    Seleccione los temas relevantes para esta pregunta.

    Le permite crear guías genéricas a nivel de institución o de otras fuentes. Ej. para el DCC o cualquier escuela o departamento a la que se dirija la guía.

    Puede seleccionar varios temas usando el botón CTRL.

    " @@ -213,6 +213,19 @@ msgid "

    You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

    If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

    " msgstr "templates" +#, fuzzy +msgid "" +"
    • %{organisation_name}
    • \n" +"
    • %{organisation_address_line1}
    • \n" +"
    • %{organisation_address_line2}
    • \n" +"
    • %{organisation_address_line3}
    • \n" +"
    • %{organisation_address_line4}
    • \n" +"
    • %{organisation_address_country}
    • \n" +"
    \n" +"

    Helpline: %{organisation_telephone}

    \n" +"

    Email %{organisation_email}

    " +msgstr "DMPonline" + msgid "A colleague has invited you to contribute to their Data Management Plan at " msgstr "" @@ -222,9 +235,15 @@ msgid "A required setting has not been provided" msgstr "No se ha indicado un valor obligatorio" +msgid "A version of " +msgstr "" + msgid "API Information" msgstr "" +msgid "API rights" +msgstr "" + msgid "API token" msgstr "" @@ -249,6 +268,9 @@ msgid "Add collaborator" msgstr "Añadir colaborador" +msgid "Add example answer" +msgstr "" + msgid "Add guidance" msgstr "Añadir orientación" @@ -270,9 +292,6 @@ msgid "Add section" msgstr "Añadir sección" -msgid "Add suggested answer/ example" -msgstr "Añadir respuesta sugerida / ejemplo" - msgid "Additional comment area will be displayed." msgstr "Se mostrará un área adicional para comentarios." @@ -285,6 +304,22 @@ msgid "All the best," msgstr "" +#, fuzzy +msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo" +msgstr "Organización" + +#, fuzzy +msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves" +msgstr "Organización" + +#, fuzzy +msgid "Allows the user to create and edit guidance" +msgstr "user" + +#, fuzzy +msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates" +msgstr "templates" + msgid "An error has occurred while saving/resetting your export settings." msgstr "" @@ -341,6 +376,13 @@ msgid "Before submitting, please consider:" msgstr "" +#, fuzzy +msgid "Before you get started, we need to ask a few questions to set you up with the best DMP template for your needs." +msgstr "Preguntas" + +msgid "Begin typing to see a filtered list" +msgstr "" + msgid "Below is a list of users registered for your organisation. You can sort the data by each field." msgstr "Debajo tiene la lista de usuarios registrados en su entidad. Puede ordenar los datos por campo." @@ -353,6 +395,10 @@ msgid "Cancel" msgstr "Cancelar" +#, fuzzy +msgid "Cannot share plan with %{email} since that email matches with the owner of the plan." +msgstr "plans" + msgid "Change language" msgstr "" @@ -360,15 +406,16 @@ msgid "Change my password" msgstr "Cambiar su clave" +#, fuzzy +msgid "Change organisation details" +msgstr "Organización" + msgid "Check box" msgstr "Check box" msgid "Check this box when you are ready for this guidance to appear on user's plans." msgstr "" -msgid "Choose a template" -msgstr "" - msgid "Click here" msgstr "" @@ -407,6 +454,10 @@ msgid "Contact Email" msgstr "" +#, fuzzy +msgid "Contact Us" +msgstr "Contacto" + msgid "Contact us" msgstr "Contacto" @@ -467,6 +518,9 @@ msgid "Display additional comment area." msgstr "Mostrar un área de comentarios adicional." +msgid "Draft" +msgstr "" + msgid "Dropdown" msgstr "Dropdown" @@ -476,6 +530,10 @@ msgid "Edit" msgstr "Editar" +#, fuzzy +msgid "Edit Example of Answer" +msgstr "Respuesta de ejemplo" + msgid "Edit User Privileges" msgstr "" @@ -497,9 +555,6 @@ msgid "Edit question" msgstr "Editar la pregunta" -msgid "Edit suggested answer/ example" -msgstr "Editar respuesta sugerida / ejemplo" - msgid "Edit template details" msgstr "Editar plantilla" @@ -540,6 +595,14 @@ msgid "Error!" msgstr "¡Error!" +#, fuzzy +msgid "Example Answer" +msgstr "Respuesta de ejemplo" + +#, fuzzy +msgid "Example of Answer" +msgstr "Respuesta de ejemplo" + msgid "Example of answer" msgstr "Respuesta de ejemplo" @@ -560,6 +623,9 @@ msgid "File Name" msgstr "Título del plan" +msgid "Fill in the required fields" +msgstr "" + msgid "Filter plans" msgstr "Filtro de planes" @@ -572,15 +638,19 @@ msgid "Forgot your password?" msgstr "¿Olvidó su clave?" +msgid "Format" +msgstr "" + msgid "Funder" msgstr "Financiador" -msgid "Funder name" -msgstr "Nombre del financiador del proyecto" - msgid "Funders templates" msgstr "Plantillas de financiador" +#, fuzzy +msgid "Funding organisation" +msgstr "Organización" + msgid "Future plans" msgstr "Hoja de ruta" @@ -590,12 +660,19 @@ msgid "Grant number" msgstr "Título de subvención" +msgid "Grant permissions" +msgstr "" + msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgstr "Número de referencia de la subvención si es aplicable [SÓLO PGDs YA ADJUDICADOS]" msgid "Guidance" msgstr "Guía" +#, fuzzy +msgid "Guidance choices saved." +msgstr "Guía" + msgid "Guidance group" msgstr "Grupo de orientación" @@ -648,12 +725,13 @@ msgid "ID" msgstr "ID" -msgid "If applying for funding, select your research funder." -msgstr "Si se solicita financiación, seleccione el organismo financiador de su investigación." - msgid "If applying for funding, state the name exactly as in the grant proposal." msgstr "Si se solicita financiación, indique el nombre exactamente como en la propuesta de subvención." +#, fuzzy +msgid "If applying for funding, state the title exactly as in the proposal." +msgstr "Si se solicita financiación, indique el nombre exactamente como en la propuesta de subvención." + msgid "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." msgstr "Si la guía está dirigida a un subconjunto de los usuarios (ej: los pertenecientes a un colegio o instituto), seleccione esta opción. Los usuarios serán capaces de seleccionar esta guía cuando respondan sus preguntas durante la creación del plan." @@ -672,9 +750,6 @@ msgid "If you would like to change your password please complete the following fields." msgstr "Si quiere cambiar su clave, por favor, rellene los siguientes campos." -msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan." -msgstr "" - msgid "Included Elements" msgstr "Elementos incluídos" @@ -699,7 +774,7 @@ msgid "Invalid maximum pages" msgstr "Número de páginas inválido" -msgid "Invitation issued successfully." +msgid "Invitation to %{email} issued successfully." msgstr "" msgid "Language" @@ -720,9 +795,6 @@ msgid "Left" msgstr "Izquierdo" -msgid "Link your %{application_name} account to your institutional credentials (UK users only)" -msgstr "Vincule su cuenta de DMPonline con las credenciales de su institución (Sólo para usuarios del Reino Unido)" - msgid "List of users" msgstr "Listado de usuarios" @@ -747,18 +819,35 @@ msgid "Me" msgstr "Yo" +#, fuzzy +msgid "Message" +msgstr "Yo" + +#, fuzzy +msgid "Modify guidance" +msgstr "Añadir orientación" + +#, fuzzy +msgid "Modify templates" +msgstr "templates" + msgid "Multi select box" msgstr "Multi select box" +#, fuzzy +msgid "My Plan" +msgstr "Mi proyecto" + msgid "My organisation isn't listed." msgstr "No se muestra mi organización." -msgid "My plan" -msgstr "Mi proyecto" - msgid "My plans" msgstr "Mis planes" +#, fuzzy +msgid "My research organisation is not on the list" +msgstr "Organización" + msgid "Name" msgstr "Nombre" @@ -768,9 +857,6 @@ msgid "Name of Principal Investigator(s) or main researcher(s) on the project." msgstr "Nombre del/de los Investigador/es Principal/es o investigador/es principal/es del proyecto." -msgid "Name of funder, if applicable." -msgstr "Nombre del financiador, si corresponde." - msgid "New guidance" msgstr "Nueva orientación" @@ -792,6 +878,13 @@ msgid "No additional comment area will be displayed." msgstr "No se mostrará un área adicional para comentarios." +#, fuzzy +msgid "No funder associated with this plan" +msgstr "plans" + +msgid "No items available." +msgstr "" + msgid "No matches" msgstr "Ningún plan coincide con '%{filter}'" @@ -801,9 +894,6 @@ msgid "Not answered yet" msgstr "Aún no respondido/a" -msgid "Not applicable/not listed." -msgstr "No aplicable / no listado/a." - msgid "Note" msgstr "Nota" @@ -868,9 +958,6 @@ msgid "Other institutions" msgstr "" -msgid "Otherwise leave blank." -msgstr "Si no, déjelo en blanco." - msgid "Own templates" msgstr "Sus plantillas" @@ -914,11 +1001,14 @@ msgid "Plan details" msgstr "Detalles" +msgid "Plan is already shared with %{email}." +msgstr "" + msgid "Plan name" msgstr "Nombre de proyecto" -msgid "Plan was successfully created." -msgstr "Plan creado con éxito" +msgid "Plan shared with %{email}." +msgstr "" #, fuzzy msgid "Plan was successfully deleted." @@ -945,6 +1035,12 @@ msgid "Please enter your current password" msgstr "" +msgid "Please enter your current password below when changing your email address." +msgstr "" + +msgid "Please enter your email" +msgstr "" + msgid "Please enter your first name." msgstr "Por favor, introduzca su nombre." @@ -957,18 +1053,29 @@ msgid "Please enter your surname or family name." msgstr "Por favor, introduzca sus apellidos." +msgid "Please fill in the basic project details below" +msgstr "" + msgid "Please fill in the basic project details below and click 'Update' to save" msgstr "Por favor, rellene los detalles básicos del proyecto y haga clic en 'Actualizar' para guardarlos" +#, fuzzy +msgid "Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in." +msgstr "

    Por favor, tenga en cuenta que su dirección de correo electrónico se usa como su nombre de usuario. Si cambia esto, recuerde usar su nueva dirección de correo electrónico al conectar.

    " + msgid "Please only enter up to 165 characters, you have used" msgstr "" -msgid "Policy Expectations" -msgstr "Política esperada" +msgid "Please select one" +msgstr "" msgid "Preview" msgstr "Previsualización" +#, fuzzy +msgid "Primary research organisation" +msgstr "Organización" + msgid "Principal Investigator / Researcher" msgstr "Principal Investigador / Científico" @@ -987,6 +1094,13 @@ msgid "Privileges" msgstr "" +msgid "Project title" +msgstr "" + +#, fuzzy +msgid "Provides the user with an API token and grants rights to harvest information from the tool" +msgstr "user" + msgid "Public" msgstr "Público" @@ -1071,24 +1185,27 @@ msgid "Sections" msgstr "Secciones" -msgid "Select Funder" -msgstr "Financiador" - -msgid "Select Organisation" -msgstr "Organización" +#, fuzzy +msgid "Select a template" +msgstr "templates" msgid "Select an action" msgstr "Seleccionar una acción" +#, fuzzy +msgid "Select the funding organisation" +msgstr "Organización" + +#, fuzzy +msgid "Select the primary research organisation responsible" +msgstr "Organización" + msgid "Select which group this guidance relates to." msgstr "Seleccione a que grupo pertenece esta guía." msgid "Select which theme(s) this guidance relates to." msgstr "Seleccione a el/los tema(s) relacionados con esta orientación." -msgid "Select your research funder or no funder, as appropariate." -msgstr "" - msgid "Selected option(s)" msgstr "" @@ -1128,6 +1245,9 @@ msgid "Status" msgstr "" +msgid "Subject" +msgstr "" + msgid "Successfully unlinked your account from %{is}." msgstr "" @@ -1180,6 +1300,9 @@ msgid "That template is not currently published." msgstr "templates" +msgid "The" +msgstr "" + msgid "The " msgstr "" @@ -1195,9 +1318,6 @@ msgid "Themes" msgstr "Temas" -msgid "There are a number of possible templates you could use. Please choose one." -msgstr "Hay varias plantillas que podría usar. Por favor, elija una." - msgid "There are no public DMPs." msgstr "" @@ -1219,30 +1339,25 @@ msgid "This document was generated by %{application_name}" msgstr "DMPonline" -msgid "This must be a valid email address - a message will be sent to it for confirmation." -msgstr "" - msgid "This must match what you entered in the previous field." msgstr "Ha de coincidir con lo que introdujo en el campo anterior." msgid "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." msgstr "Esta página le proporciona una visión general de su plan. Le dice en qué está basado su plan y le da una visión general de las preguntas que se le harán." +#, fuzzy +msgid "This plan is based on the default template." +msgstr "templates" + msgid "This plan is based on:" msgstr "Este plan está basado en:" msgid "This section is locked for editing by " msgstr "Esta sección está bloqueda para su edición por " -msgid "Tick to select any other sources of guidance you wish to see." -msgstr "Marque para seleccionar cualquier otra fuente de orientación que quiera ver." - msgid "Title" msgstr "Título" -msgid "To see institutional questions and/or guidance, select your organisation." -msgstr "Para ver preguntas y/u orientación relativas a su institución, seleccione su entidad." - msgid "Top" msgstr "Superior" @@ -1274,9 +1389,6 @@ msgid "Unlink institutional credentials alert" msgstr "Desvincule las alertas relacionadas con las credenciales de su institución" -msgid "Unlink your institutional credentials" -msgstr "Desvincule las credenciales de su institución" - msgid "Unlock my account" msgstr "" @@ -1299,12 +1411,12 @@ msgid "Upload a new logo file" msgstr "" -msgid "User added to project" -msgstr "" - msgid "Users" msgstr "Usuarios" +msgid "Using the generic Data Management Plan" +msgstr "" + msgid "Version" msgstr "Versión" @@ -1326,6 +1438,18 @@ msgid "Visibility" msgstr "Visibilidad" +#, fuzzy +msgid "We found multiple DMP templates corresponding to the funder." +msgstr "templates" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to the research organisation." +msgstr "Organización" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to your funder." +msgstr "templates" + msgid "Website" msgstr "Sitio web" @@ -1339,9 +1463,17 @@ msgid "Welcome." msgstr "Bienvenido/a." +#, fuzzy +msgid "What research project are you planning?" +msgstr "plans" + msgid "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." msgstr "Cuando crea una fase nueva para su plantilla, se creará automáticamente una versión. Una vez complete el siguiente formulario se le darán las opciones para crear secciones y preguntas." +#, fuzzy +msgid "Which DMP template would you like to use?" +msgstr "templates" + msgid "While you were editing " msgstr "" @@ -1369,6 +1501,10 @@ msgid "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" msgstr "Va a eliminar una respuesta sugerida / ejemplo de '%{question_text}'. ¿Está seguro?" +#, fuzzy +msgid "You are about to delete an example answer for '%{question_text}'. Are you sure?" +msgstr "Va a eliminar una respuesta sugerida / ejemplo de '%{question_text}'. ¿Está seguro?" + msgid "You are not authorized to perform this action." msgstr "" @@ -1376,6 +1512,10 @@ msgid "You are viewing a historical version of this template. You will not be able to make changes." msgstr "templates" +#, fuzzy +msgid "You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted." +msgstr "Puede añadir un ejemplo o respuesta sugerida para ayudar a responder a sus usuarios. Se presentará bajo la caja de respuestas y pueden ser copiada y pegada." + msgid "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." msgstr "Puede añadir un ejemplo o respuesta sugerida para ayudar a responder a sus usuarios. Se presentará bajo la caja de respuestas y pueden ser copiada y pegada." @@ -1385,6 +1525,9 @@ msgid "You can edit any of the details below." msgstr "Puede editar cualquiera de los siguientes datos." +msgid "You can not continue until you have filled in all of the required information." +msgstr "" + #, fuzzy msgid "You can not edit a historical version of this template." msgstr "templates" @@ -1413,9 +1556,6 @@ msgid "You have unsaved answers in the following sections:" msgstr "" -msgid "You may leave blank or select a different organisation to your own." -msgstr "Puede dejar en blanco o seleccionar una entidad distinta a la suya." - msgid "You must accept the terms and conditions to register." msgstr "" @@ -1440,9 +1580,6 @@ msgid "Your account has been successfully linked to %{scheme}." msgstr "" -msgid "Your account is linked to your institutional credentials." -msgstr "Su cuenta enstá vinculada con las credenciales de su institución." - msgid "Your account won't be created until you access the link above and set your password." msgstr "" @@ -1523,6 +1660,10 @@ msgid "by" msgstr "" +#, fuzzy +msgid "by " +msgstr " por " + msgid "can't be blank" msgstr "" @@ -1535,12 +1676,17 @@ msgid "e.g. School/ Department" msgstr "ej: Escuela / Departmento" -msgid "format" -msgstr "" +#, fuzzy +msgid "example answer" +msgstr "Respuesta de ejemplo" msgid "from now" msgstr "" +#, fuzzy +msgid "generic template" +msgstr "templates" + msgid "guidance" msgstr "" @@ -1554,9 +1700,6 @@ msgid "height must be less than 100px" msgstr "" -msgid "helpers.dropdown" -msgstr "" - msgid "helpers.is_test" msgstr "" @@ -1587,6 +1730,10 @@ msgstr "guidances" #, fuzzy +msgid "no research organisation is associated with this plan" +msgstr "Organización" + +#, fuzzy msgid "note" msgstr "Nota" @@ -1594,10 +1741,6 @@ msgstr "" #, fuzzy -msgid "org_admin.templates.edit_phase_label" -msgstr "org_admin" - -#, fuzzy msgid "organisation" msgstr "Organización" @@ -1638,10 +1781,6 @@ msgstr "" #, fuzzy -msgid "suggested answer" -msgstr "Respuesta sugerida" - -#, fuzzy msgid "template" msgstr "templates" diff --git a/config/locale/fr/app.po b/config/locale/fr/app.po index c41d966..fc41878 100644 --- a/config/locale/fr/app.po +++ b/config/locale/fr/app.po @@ -22,29 +22,23 @@ msgid " - " msgstr "" -msgid " - choosing default template for your institution" -msgstr "" - -msgid " - no funder or institution template, choosing default template" -msgstr "" - -msgid " - there are more than one to choose from" -msgstr "" - #, fuzzy -msgid " - using template customised by your institution" -msgstr " par " - -#, fuzzy -msgid " I accept the terms and conditions *" +msgid " I accept the terms and conditions *" msgstr " Jaccepte les Conditions générales dutilisation. *" +#, fuzzy +msgid " Plan" +msgstr "plans" + msgid " access to" msgstr "" msgid " access. " msgstr "" +msgid " and " +msgstr "" + #, fuzzy msgid " by" msgstr " par " @@ -69,9 +63,16 @@ msgid " once you click save!" msgstr "" +msgid " or " +msgstr "" + msgid " password. You can do this through the link below." msgstr "" +#, fuzzy +msgid " provided by " +msgstr " par " + msgid " saved the following answer:" msgstr "" @@ -79,6 +80,10 @@ msgid " team" msgstr "am" +#, fuzzy +msgid " that has been customised by " +msgstr " par " + msgid " to accept the invitation, (or copy " msgstr "" @@ -86,7 +91,7 @@ msgstr "" #, fuzzy -msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\"" +msgid "\"Are you sure you want to unlink #{scheme.description} ID?\"" msgstr "Identifiant" msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\"" @@ -114,6 +119,10 @@ msgid "%{application_name} doesn't recognise your institutional credentials - either you haven't created an account with us or you haven't linked these details to your existing account.
    * If you do not have an account with %{application_name}, please complete the form below.
    * If you have an account with %{application_name}, please Sign in so we can link your account to your institutional credentials.
    Once you have created and/or linked your account, you'll be able to sign in with your institutional credentials directly." msgstr "DMPonline" +#, fuzzy +msgid "%{application_name} is provided by the %{organisation_name}. You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below." +msgstr "DMPonline" + msgid "%{format} is not a valid exporting format. Available formats to export are %{available_formats}." msgstr "" @@ -177,15 +186,6 @@ msgid "

    If you wish to add an institutional template for a Data Management Plan, use the 'create template' button. You can create more than one template if desired e.g. one for researchers and one for PhD students.

    Your template will be presented to users within your institution when no funder templates apply. If you want to add questions to funder templates use the 'customise template' options below.

    " msgstr "

    Si vous souhaitez ajouter un modèle institutionnel propre à un plan de gestion de données, utilisez le bouton créer un modèle. Vous pouvez au besoin créer plusieurs modèles, par ex. : un pour des chercheurs et un pour des thésards.

    Votre modèle apparaîtra aux utilisateurs de votre établissement quand aucun modèle propre à un bailleur de subvention ne sapplique. Si vous souhaitez ajouter des questions dans un modèle de bailleur de subventions, utilisez les options de personalisation de modèle ci-après.

    " -msgid "

    Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.

    " -msgstr "

    À noter que votre courriel est à utiliser comme nom dutilisateur. Si vous modifiez ces informations, rappelez-vous dutiliser votre courriel en vous connectant.

    " - -msgid "

    Please select from the following drop-down so we can determine what questions and guidance should be displayed in your plan.

    " -msgstr "" - -msgid "

    Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.

    If you aren't responding to specific requirements from a funder or an institution, select here to write a generic DMP based on the most common themes.

    " -msgstr "

    Veuillez sélectionner des éléments dans les menus déroulants ci-après pour pouvoir identifier les questions et conseils à afficher dans votre plan.

    Si votre soumission doit répondre à des prescriptions propres à un organisme financeur ou un établissement, sélectionnez ici la rédaction dun DMP à partir des thèmes les plus courants.

    " - msgid "

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    " msgstr "

    Sélectionnez les thèmes relatifs à cette question.

    Cette fonction permet dintégrer une documentation générale dassistance de votre établissement, comme encore issue dautres sources comme le DCC et des facultés ou départements auxquels vous fournissez des conseils.

    Vous pouvez sélectionner plusieurs thèmes avec la touche CTRL.

    " @@ -212,6 +212,19 @@ msgid "

    You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

    If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

    " msgstr "templates" +#, fuzzy +msgid "" +"
    • %{organisation_name}
    • \n" +"
    • %{organisation_address_line1}
    • \n" +"
    • %{organisation_address_line2}
    • \n" +"
    • %{organisation_address_line3}
    • \n" +"
    • %{organisation_address_line4}
    • \n" +"
    • %{organisation_address_country}
    • \n" +"
    \n" +"

    Helpline: %{organisation_telephone}

    \n" +"

    Email %{organisation_email}

    " +msgstr "DMPonline" + msgid "A colleague has invited you to contribute to their Data Management Plan at " msgstr "" @@ -221,9 +234,15 @@ msgid "A required setting has not been provided" msgstr "Vous navez pas précisé un réglage obligatoire" +msgid "A version of " +msgstr "" + msgid "API Information" msgstr "" +msgid "API rights" +msgstr "" + msgid "API token" msgstr "" @@ -248,6 +267,9 @@ msgid "Add collaborator" msgstr "Ajouter le collaborateur" +msgid "Add example answer" +msgstr "" + msgid "Add guidance" msgstr "Ajoutez des conseils" @@ -269,9 +291,6 @@ msgid "Add section" msgstr "Ajouter une section" -msgid "Add suggested answer/ example" -msgstr "Ajouter une suggestion/un exemple de réponse" - msgid "Additional comment area will be displayed." msgstr "" @@ -284,6 +303,22 @@ msgid "All the best," msgstr "" +#, fuzzy +msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo" +msgstr "Organisation" + +#, fuzzy +msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves" +msgstr "Organisation" + +#, fuzzy +msgid "Allows the user to create and edit guidance" +msgstr "user" + +#, fuzzy +msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates" +msgstr "templates" + msgid "An error has occurred while saving/resetting your export settings." msgstr "" @@ -340,6 +375,13 @@ msgid "Before submitting, please consider:" msgstr "" +#, fuzzy +msgid "Before you get started, we need to ask a few questions to set you up with the best DMP template for your needs." +msgstr "Questions" + +msgid "Begin typing to see a filtered list" +msgstr "" + msgid "Below is a list of users registered for your organisation. You can sort the data by each field." msgstr "La liste ci-dessous indique les utilisateurs de votre organisme. Ces informations peuvent être triées par champ." @@ -352,21 +394,26 @@ msgid "Cancel" msgstr "Annuler" +#, fuzzy +msgid "Cannot share plan with %{email} since that email matches with the owner of the plan." +msgstr "plans" + msgid "Change language" msgstr "" msgid "Change my password" msgstr "" +#, fuzzy +msgid "Change organisation details" +msgstr "Organisation" + msgid "Check box" msgstr "Case à cocher" msgid "Check this box when you are ready for this guidance to appear on user's plans." msgstr "" -msgid "Choose a template" -msgstr "" - msgid "Click here" msgstr "" @@ -405,6 +452,10 @@ msgid "Contact Email" msgstr "" +#, fuzzy +msgid "Contact Us" +msgstr "Communiquez avec nous" + msgid "Contact us" msgstr "Communiquez avec nous" @@ -465,6 +516,9 @@ msgid "Display additional comment area." msgstr "" +msgid "Draft" +msgstr "" + msgid "Dropdown" msgstr "Liste déroulante" @@ -474,6 +528,10 @@ msgid "Edit" msgstr "Modifier" +#, fuzzy +msgid "Edit Example of Answer" +msgstr "Exemple de réponse" + msgid "Edit User Privileges" msgstr "" @@ -495,9 +553,6 @@ msgid "Edit question" msgstr "Modifier la question" -msgid "Edit suggested answer/ example" -msgstr "Modifier la suggestion/lexemple de réponse" - msgid "Edit template details" msgstr "Modifier les détails du modèle" @@ -538,6 +593,14 @@ msgid "Error!" msgstr "Erreur!" +#, fuzzy +msgid "Example Answer" +msgstr "Exemple de réponse" + +#, fuzzy +msgid "Example of Answer" +msgstr "Exemple de réponse" + msgid "Example of answer" msgstr "Exemple de réponse" @@ -558,6 +621,9 @@ msgid "File Name" msgstr "Titre du plan" +msgid "Fill in the required fields" +msgstr "" + msgid "Filter plans" msgstr "Filtrer les plans" @@ -570,15 +636,19 @@ msgid "Forgot your password?" msgstr "" +msgid "Format" +msgstr "" + msgid "Funder" msgstr "Funder" -msgid "Funder name" -msgstr "Nom de lorganisme financeur" - msgid "Funders templates" msgstr "Modèles des bailleurs de subventions" +#, fuzzy +msgid "Funding organisation" +msgstr "Organisation" + msgid "Future plans" msgstr "" @@ -588,12 +658,19 @@ msgid "Grant number" msgstr "Titre de la subvention" +msgid "Grant permissions" +msgstr "" + msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]" msgstr "N° de réféence de la subvention, le cas échéant (UNIQUEMENT POUR LES DMP CRÉÉS APRÈS OCTROI DUNE SUBVENTION)" msgid "Guidance" msgstr "Conseils" +#, fuzzy +msgid "Guidance choices saved." +msgstr "Conseils" + msgid "Guidance group" msgstr "Groupe de conseils" @@ -646,12 +723,13 @@ msgid "ID" msgstr "Identifiant" -msgid "If applying for funding, select your research funder." -msgstr "Si vous soumettez une demande de subvention, sélectionnez lorganisme financeur." - msgid "If applying for funding, state the name exactly as in the grant proposal." msgstr "En cas de demande de financement, indiquer le nom exactement comme dans la demande de subvention." +#, fuzzy +msgid "If applying for funding, state the title exactly as in the proposal." +msgstr "En cas de demande de financement, indiquer le nom exactement comme dans la demande de subvention." + msgid "If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard." msgstr "Si les conseils ne sont destinés quà un sous-ensemble dutilisateurs (par ex. : faisant partie dune faculté ou dun institut), cochez cette case. Les utilisateurs pourront sélectionner ce sous-groupe de conseils lorquils répondront aux questions dans lassistant de création de plan." @@ -670,9 +748,6 @@ msgid "If you would like to change your password please complete the following fields." msgstr "" -msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan." -msgstr "" - msgid "Included Elements" msgstr "Éléments inclus" @@ -697,7 +772,7 @@ msgid "Invalid maximum pages" msgstr "Nombre de pages maxi non valide" -msgid "Invitation issued successfully." +msgid "Invitation to %{email} issued successfully." msgstr "" msgid "Language" @@ -718,9 +793,6 @@ msgid "Left" msgstr "Gauche" -msgid "Link your %{application_name} account to your institutional credentials (UK users only)" -msgstr "Reliez votre compte DMPonline à votre authentifiant détablissement" - msgid "List of users" msgstr "Liste des utilisateurs" @@ -745,18 +817,35 @@ msgid "Me" msgstr "Moi" +#, fuzzy +msgid "Message" +msgstr "Moi" + +#, fuzzy +msgid "Modify guidance" +msgstr "Ajoutez des conseils" + +#, fuzzy +msgid "Modify templates" +msgstr "templates" + msgid "Multi select box" msgstr "Boîte de sélections multiples" +#, fuzzy +msgid "My Plan" +msgstr "Mon plan" + msgid "My organisation isn't listed." msgstr "Mon établissement nest pas listé." -msgid "My plan" -msgstr "Mon plan" - msgid "My plans" msgstr "Mes plans" +#, fuzzy +msgid "My research organisation is not on the list" +msgstr "Organisation" + msgid "Name" msgstr "Prénom" @@ -766,9 +855,6 @@ msgid "Name of Principal Investigator(s) or main researcher(s) on the project." msgstr "Nom du ou des directeurs de recherche ou du ou des principaux chercheurs du projet." -msgid "Name of funder, if applicable." -msgstr "Nom de lorganisme financeur, le cas échéant." - msgid "New guidance" msgstr "Nouveaux conseils" @@ -790,6 +876,13 @@ msgid "No additional comment area will be displayed." msgstr "" +#, fuzzy +msgid "No funder associated with this plan" +msgstr "plans" + +msgid "No items available." +msgstr "" + msgid "No matches" msgstr "Pas de plans pour %{filter}" @@ -799,9 +892,6 @@ msgid "Not answered yet" msgstr "Pas encore de réponse" -msgid "Not applicable/not listed." -msgstr "Non pertinent/non répertorié." - msgid "Note" msgstr "Note" @@ -866,9 +956,6 @@ msgid "Other institutions" msgstr "" -msgid "Otherwise leave blank." -msgstr "Sinon laissez ce champ vide." - msgid "Own templates" msgstr "Modèles propres" @@ -911,11 +998,14 @@ msgid "Plan details" msgstr "Détails du plan" +msgid "Plan is already shared with %{email}." +msgstr "" + msgid "Plan name" msgstr "Nom du plan" -msgid "Plan was successfully created." -msgstr "Création du plan effectuée." +msgid "Plan shared with %{email}." +msgstr "" #, fuzzy msgid "Plan was successfully deleted." @@ -942,6 +1032,12 @@ msgid "Please enter your current password" msgstr "" +msgid "Please enter your current password below when changing your email address." +msgstr "" + +msgid "Please enter your email" +msgstr "" + msgid "Please enter your first name." msgstr "Entrez votre prénom, svp." @@ -954,18 +1050,29 @@ msgid "Please enter your surname or family name." msgstr "Entrez votre nom dusage ou de famille, svp." +msgid "Please fill in the basic project details below" +msgstr "" + msgid "Please fill in the basic project details below and click 'Update' to save" msgstr "Veuillez renseigner les premiers détails ci-après et cliquez sur 'Mettre à jour' pour enregistrer" +#, fuzzy +msgid "Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in." +msgstr "

    À noter que votre courriel est à utiliser comme nom dutilisateur. Si vous modifiez ces informations, rappelez-vous dutiliser votre courriel en vous connectant.

    " + msgid "Please only enter up to 165 characters, you have used" msgstr "" -msgid "Policy Expectations" -msgstr "Résultats attendus du plan" +msgid "Please select one" +msgstr "" msgid "Preview" msgstr "Aperçu" +#, fuzzy +msgid "Primary research organisation" +msgstr "Organisation" + msgid "Principal Investigator / Researcher" msgstr "Directeur de recherche / chercheur" @@ -984,6 +1091,13 @@ msgid "Privileges" msgstr "" +msgid "Project title" +msgstr "" + +#, fuzzy +msgid "Provides the user with an API token and grants rights to harvest information from the tool" +msgstr "user" + msgid "Public" msgstr "Public" @@ -1068,24 +1182,27 @@ msgid "Sections" msgstr "Sections" -msgid "Select Funder" -msgstr "Funder" - -msgid "Select Organisation" -msgstr "Organisation" +#, fuzzy +msgid "Select a template" +msgstr "templates" msgid "Select an action" msgstr "Sélectionnez une action" +#, fuzzy +msgid "Select the funding organisation" +msgstr "Organisation" + +#, fuzzy +msgid "Select the primary research organisation responsible" +msgstr "Organisation" + msgid "Select which group this guidance relates to." msgstr "Sélectionnez le groupe auxquel ces conseils sont liés." msgid "Select which theme(s) this guidance relates to." msgstr "Sélectionnez le ou les thèmes liés à ces conseils." -msgid "Select your research funder or no funder, as appropariate." -msgstr "" - msgid "Selected option(s)" msgstr "" @@ -1125,6 +1242,9 @@ msgid "Status" msgstr "" +msgid "Subject" +msgstr "" + msgid "Successfully unlinked your account from %{is}." msgstr "" @@ -1177,6 +1297,9 @@ msgid "That template is not currently published." msgstr "templates" +msgid "The" +msgstr "" + msgid "The " msgstr "" @@ -1192,9 +1315,6 @@ msgid "Themes" msgstr "Thèmes" -msgid "There are a number of possible templates you could use. Please choose one." -msgstr "Un certain nombre de modèle vous sont proposés. Choisissez." - msgid "There are no public DMPs." msgstr "Aucun DMP n'a été rendu public." @@ -1216,30 +1336,25 @@ msgid "This document was generated by %{application_name}" msgstr "%{application_name}" -msgid "This must be a valid email address - a message will be sent to it for confirmation." -msgstr "" - msgid "This must match what you entered in the previous field." msgstr "" msgid "This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked." msgstr "Cette page vous donne un aperçu de votre plan. Elle indique de quoi il s'inspire et donne une idée générale des questions auxquelles vous devrez répondre." +#, fuzzy +msgid "This plan is based on the default template." +msgstr "templates" + msgid "This plan is based on:" msgstr "Ce plan sinspire de :" msgid "This section is locked for editing by " msgstr "La modification de cette section a été verrouillée par " -msgid "Tick to select any other sources of guidance you wish to see." -msgstr "Cochez une ou plusieurs des sources de conseils que vous voulez voir." - msgid "Title" msgstr "Titre" -msgid "To see institutional questions and/or guidance, select your organisation." -msgstr "Sélectionnez votre organisme pour voir les questions et conseils de votre établissement." - msgid "Top" msgstr "Haut" @@ -1271,9 +1386,6 @@ msgid "Unlink institutional credentials alert" msgstr "Alerte de détachement dauthentifiant détablissement" -msgid "Unlink your institutional credentials" -msgstr "Détachez votre authentifiant détablissement" - msgid "Unlock my account" msgstr "" @@ -1296,12 +1408,12 @@ msgid "Upload a new logo file" msgstr "" -msgid "User added to project" -msgstr "" - msgid "Users" msgstr "Utilisateurs" +msgid "Using the generic Data Management Plan" +msgstr "" + msgid "Version" msgstr "Version" @@ -1323,6 +1435,18 @@ msgid "Visibility" msgstr "Visibilité" +#, fuzzy +msgid "We found multiple DMP templates corresponding to the funder." +msgstr "templates" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to the research organisation." +msgstr "Organisation" + +#, fuzzy +msgid "We found multiple DMP templates corresponding to your funder." +msgstr "templates" + msgid "Website" msgstr "Site web" @@ -1336,9 +1460,17 @@ msgid "Welcome." msgstr "Bienvenue !" +#, fuzzy +msgid "What research project are you planning?" +msgstr "plans" + msgid "When you create a new phase for your template, a version will automatically be created. Once you complete the form below you will be provided with options to create sections and questions." msgstr "Quand vous créez une nouvelle phase dans votre modèle, une version sera créée automatiquement. Quand vous remplirez la grille ci-dessous, le système affichera des options pour créer des sections et des questions." +#, fuzzy +msgid "Which DMP template would you like to use?" +msgstr "templates" + msgid "While you were editing " msgstr "" @@ -1366,6 +1498,10 @@ msgid "You are about to delete a suggested answer/ example for '%{question_text}'. Are you sure?" msgstr "Vous allez supprimer la suggestion/lexemple de réponse à la questioo : %{question_text}. En êtes-vous sûr ?" +#, fuzzy +msgid "You are about to delete an example answer for '%{question_text}'. Are you sure?" +msgstr "Vous allez supprimer la suggestion/lexemple de réponse à la questioo : %{question_text}. En êtes-vous sûr ?" + msgid "You are not authorized to perform this action." msgstr "" @@ -1373,6 +1509,10 @@ msgid "You are viewing a historical version of this template. You will not be able to make changes." msgstr "templates" +#, fuzzy +msgid "You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted." +msgstr "Vous pouvez ajouter un exemple ou une suggestion de réponse pour aider les utilisateurs. Ils safficheront au-dessus de la grille de réponse et on peut les copier/coller." + msgid "You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted." msgstr "Vous pouvez ajouter un exemple ou une suggestion de réponse pour aider les utilisateurs. Ils safficheront au-dessus de la grille de réponse et on peut les copier/coller." @@ -1382,6 +1522,9 @@ msgid "You can edit any of the details below." msgstr "Vous pouvez modifiez les informations ci-dessous." +msgid "You can not continue until you have filled in all of the required information." +msgstr "" + #, fuzzy msgid "You can not edit a historical version of this template." msgstr "templates" @@ -1410,9 +1553,6 @@ msgid "You have unsaved answers in the following sections:" msgstr "" -msgid "You may leave blank or select a different organisation to your own." -msgstr "Ce champ peut rester vide, ou vous pouvez sélectionner un autre organisme que le vôtre." - msgid "You must accept the terms and conditions to register." msgstr "" @@ -1437,9 +1577,6 @@ msgid "Your account has been successfully linked to %{scheme}." msgstr "" -msgid "Your account is linked to your institutional credentials." -msgstr "Votre compte est lié à votre authentifiant détablissement." - msgid "Your account won't be created until you access the link above and set your password." msgstr "" @@ -1520,6 +1657,10 @@ msgid "by" msgstr "" +#, fuzzy +msgid "by " +msgstr " par " + msgid "can't be blank" msgstr "" @@ -1532,12 +1673,17 @@ msgid "e.g. School/ Department" msgstr "par ex. : Faculté/Département" -msgid "format" -msgstr "" +#, fuzzy +msgid "example answer" +msgstr "Exemple de réponse" msgid "from now" msgstr "" +#, fuzzy +msgid "generic template" +msgstr "templates" + msgid "guidance" msgstr "" @@ -1551,9 +1697,6 @@ msgid "height must be less than 100px" msgstr "" -msgid "helpers.dropdown" -msgstr "" - msgid "helpers.is_test" msgstr "" @@ -1584,6 +1727,10 @@ msgstr "guidances" #, fuzzy +msgid "no research organisation is associated with this plan" +msgstr "Organisation" + +#, fuzzy msgid "note" msgstr "Note" @@ -1591,10 +1738,6 @@ msgstr "" #, fuzzy -msgid "org_admin.templates.edit_phase_label" -msgstr "org_admin" - -#, fuzzy msgid "organisation" msgstr "Organisation" @@ -1635,10 +1778,6 @@ msgstr "" #, fuzzy -msgid "suggested answer" -msgstr "Suggestion de réponse" - -#, fuzzy msgid "template" msgstr "templates" diff --git a/config/locales/devise/devise.en_GB.yml b/config/locales/devise/devise.en_GB.yml index 5de51ca..3961e3b 100644 --- a/config/locales/devise/devise.en_GB.yml +++ b/config/locales/devise/devise.en_GB.yml @@ -11,6 +11,7 @@ inactive: "Your account was not activated yet." invalid: "Invalid email or password." invalid_token: "Invalid authentication token." + invited: "You have a pending invitation, accept it to finish creating your account." locked: "Your account is locked." not_found_in_database: "Invalid email or password." timeout: "Your session expired, please sign in again to continue." diff --git a/config/locales/devise/devise.en_US.yml b/config/locales/devise/devise.en_US.yml index 115e833..826ae0f 100644 --- a/config/locales/devise/devise.en_US.yml +++ b/config/locales/devise/devise.en_US.yml @@ -11,6 +11,7 @@ inactive: "Your account was not activated yet." invalid: "Invalid email or password." invalid_token: "Invalid authentication token." + invited: "You have a pending invitation, accept it to finish creating your account." locked: "Your account is locked." not_found_in_database: "Invalid email or password." timeout: "Your session expired, please sign in again to continue." diff --git a/config/routes.rb b/config/routes.rb index 1f4d9a1..8fee9ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,14 +12,14 @@ resources :questions resources :question_formats resources :question_options - resources :suggested_answers + resources :annotations resources :answers resources :guidances resources :guidance_groups resources :themes resources :notes resources :plans - resources :plans_guidance_groups + # resources :plans_guidance_groups resources :identifier_schemes resources :exported_plans resources :regions @@ -46,7 +46,7 @@ # fix for activeadmin signout bug devise_scope :user do - get '/users/sign_out' => 'devise/sessions#destroy' + delete '/users/sign_out' => 'devise/sessions#destroy' end delete '/users/identifiers/:id', to: 'user_identifiers#destroy', as: 'destroy_user_identifier' @@ -161,7 +161,7 @@ end end - resources :suggested_answers, path: 'org/admin/templates/suggested_answers', only: [] do + resources :annotations, path: 'org/admin/templates/annotations', only: [] do member do post 'admin_create' put 'admin_update' diff --git a/db/schema.rb b/db/schema.rb index fe00e7b..fd97cce 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -16,6 +16,15 @@ # 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.datetime "created_at" + t.datetime "updated_at" + end + create_table "answers", force: :cascade do |t| t.text "text" t.integer "plan_id" @@ -167,8 +176,9 @@ t.boolean "modifiable" end + add_index "phases", ["template_id"], name: "index_phases_on_template_id", using: :btree + create_table "plans", force: :cascade do |t| - t.integer "project_id" t.string "title" t.integer "template_id" t.datetime "created_at" @@ -184,6 +194,8 @@ t.integer "visibility", default: 0, null: false end + add_index "plans", ["template_id"], name: "index_plans_on_template_id", using: :btree + create_table "plans_guidance_groups", force: :cascade do |t| t.integer "guidance_group_id" t.integer "plan_id" @@ -210,7 +222,6 @@ create_table "questions", force: :cascade do |t| t.text "text" t.text "default_value" - t.text "guidance" t.integer "number" t.integer "section_id" t.datetime "created_at" @@ -220,6 +231,8 @@ t.boolean "modifiable" end + add_index "questions", ["section_id"], name: "index_questions_on_section_id", using: :btree + create_table "questions_themes", id: false, force: :cascade do |t| t.integer "question_id", null: false t.integer "theme_id", null: false @@ -254,6 +267,8 @@ t.boolean "modifiable" end + add_index "sections", ["phase_id"], name: "index_sections_on_phase_id", using: :btree + create_table "settings", force: :cascade do |t| t.string "var", null: false t.text "value" @@ -271,15 +286,6 @@ t.datetime "updated_at", null: false end - create_table "suggested_answers", force: :cascade do |t| - t.integer "question_id" - t.integer "org_id" - t.text "text" - t.boolean "is_example" - t.datetime "created_at" - t.datetime "updated_at" - end - create_table "templates", force: :cascade do |t| t.string "title" t.text "description" @@ -293,9 +299,13 @@ t.integer "visibility" t.integer "customization_of" t.integer "dmptemplate_id" + t.boolean "migrated" 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 + create_table "themes", force: :cascade do |t| t.string "title" t.text "description" @@ -330,8 +340,8 @@ 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.datetime "created_at" + t.datetime "updated_at" t.string "encrypted_password", default: "" t.string "reset_password_token" t.datetime "reset_password_sent_at" @@ -349,7 +359,6 @@ t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" t.string "other_organisation" - t.boolean "dmponline3" t.boolean "accept_terms" t.integer "org_id" t.string "api_token" @@ -370,6 +379,8 @@ add_index "users_perms", ["user_id", "perm_id"], name: "index_users_perms_on_user_id_and_perm_id", using: :btree + 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" @@ -395,8 +406,6 @@ add_foreign_key "roles", "plans" add_foreign_key "roles", "users" add_foreign_key "sections", "phases" - add_foreign_key "suggested_answers", "orgs" - add_foreign_key "suggested_answers", "questions" add_foreign_key "templates", "orgs" add_foreign_key "themes_in_guidance", "guidances" add_foreign_key "themes_in_guidance", "themes" diff --git a/db/seeds.rb b/db/seeds.rb index 9277a5a..6c4aded 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,7 +8,8 @@ {name: 'orcid', description: 'ORCID', active: true, logo_url:'http://orcid.org/sites/default/files/images/orcid_16x16.png', user_landing_url:'https://orcid.org' }, - {name: 'shibboleth', description: 'Shibboleth', active: true} + {name: 'shibboleth', description: 'your institutional credentials', active: true, + }, ] identifier_schemes.map{ |is| IdentifierScheme.create!(is) if IdentifierScheme.find_by(name: is[:name]).nil? } @@ -349,6 +350,7 @@ org: Org.find_by(abbreviation: Rails.configuration.branding[:organisation][:abbreviation]), is_default: true, version: 0, + migrated: false, dmptemplate_id: 1}, {title: "OLD - Department of Testing Award", @@ -356,6 +358,7 @@ org: Org.find_by(abbreviation: 'GA'), is_default: false, version: 0, + migrated: false, dmptemplate_id: 2}, {title: "Department of Testing Award", @@ -363,6 +366,7 @@ org: Org.find_by(abbreviation: 'GA'), is_default: false, version: 0, + migrated:false, dmptemplate_id: 3} ] templates.map{ |t| Template.create!(t) if Template.find_by(title: t[:title]).nil? } @@ -611,7 +615,6 @@ question_format: QuestionFormat.find_by(title: "Text field"), modifiable: false, default_value: "on a server at my institution", - guidance: "Consider where your data will be stored after your research is complete.", themes: [Theme.find_by(title: "Preservation")]}, {text: "What types of data will you collect and how will it be stored?", number: 1, @@ -671,17 +674,17 @@ # Create suggested answers for a few questions # ------------------------------------------------------- -suggested_answers = [ +annotations = [ {text: "We will preserve it in Dryad or a similar data repository service.", - is_example: true, + type: Annotation.types[:example_answer], org: Org.find_by(abbreviation: 'GA'), question: Question.find_by(text: "What is your policy for long term access to your dataset?")}, {text: "We recommend that you identify the type(s) of content as well as the type of file(s) involved", - is_example: false, + type: Annotation.types[:example_answer], org: Org.find_by(abbreviation: 'GA'), question: Question.find_by(text: "What types of data will you collect and how will it be stored?")}, ] -suggested_answers.map{ |s| SuggestedAnswer.create!(s) if SuggestedAnswer.find_by(text: s[:text]).nil? } +annotations.map{ |s| Annotation.create!(s) if Annotation.find_by(text: s[:text]).nil? } # Create options for the dropdown, multi-select and radio buttons # ------------------------------------------------------- diff --git a/lib/assets/bg.gif b/lib/assets/bg.gif deleted file mode 120000 index 12456d2..0000000 --- a/lib/assets/bg.gif +++ /dev/null @@ -1 +0,0 @@ -images/bg.gif \ No newline at end of file diff --git a/lib/assets/javascripts/answers/status.js b/lib/assets/javascripts/answers/status.js new file mode 100644 index 0000000..3358bd9 --- /dev/null +++ b/lib/assets/javascripts/answers/status.js @@ -0,0 +1,17 @@ +//= require jquery.timeago.js + +$(document).ready(function(){ + $("form.answer").submit(function(){ + var saving = $(this).find('.saving-message'); + saving.show(); + }); + $("form.answer fieldset input, form.answer fieldset select").change(function(){ + var unsaved = $(this).closest('form.answer').find('.answer-unsaved'); + unsaved.show(); + }); + // TODO An adequate listener for textarea (e.g. tinymce) that triggers unsaved.show(). Temporary workaround defined at $.fn.toggle_dirty (plans.js) + $.fn.init_answer_status = function() { + $('abbr.timeago').timeago(); + } + $.fn.init_answer_status(); +}); \ No newline at end of file diff --git a/lib/assets/javascripts/application.js b/lib/assets/javascripts/application.js index 59b9a26..3f45565 100644 --- a/lib/assets/javascripts/application.js +++ b/lib/assets/javascripts/application.js @@ -84,33 +84,6 @@ $(this).closest("form").submit(); }); - $("#user_email.text_field.reg-input").blur(function () { - if (validateEmail($(this).val())) { - $(this).parent().children("div").hide(); - } - else { - $(this).parent().children("div").show(); - } - }); - - $("#user_password.text_field.reg-input").blur(function () { - if ($(this).val().length >= 8) { - $(this).parent().children("div").hide(); - } - else { - $(this).parent().children("div").show(); - } - }); - - $("#user_password_confirmation.text_field.reg-input").blur(function () { - if ($(this).val() == $("#user_password.text_field.reg-input").val()) { - $(this).parent().children("div").hide(); - } - else { - $(this).parent().children("div").show(); - } - }); - $('#user_organisation_id').on("change", function(e) { e.preventDefault(); var selected_org = $(this).select2("val"); @@ -199,17 +172,6 @@ }); // --------------------------------------------------------------------------- -function validateEmail(sEmail) { - var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/; - if (filter.test(sEmail)) { - return true; - } - else { - return false; - } -} - -// --------------------------------------------------------------------------- function selectItemsFromJsonArray(array, selector, array_of_values, callback){ var out = []; diff --git a/lib/assets/javascripts/plans.js b/lib/assets/javascripts/plans.js index 1a690e4..86acb77 100644 --- a/lib/assets/javascripts/plans.js +++ b/lib/assets/javascripts/plans.js @@ -1,6 +1,4 @@ -//= require jquery.timeago.js -//= require tinymce -//= require tinymce-jquery + var dirty = {}; @@ -112,20 +110,6 @@ } }; - // Make timestamps readable - $('abbr.timeago').timeago(); - - // Update status messages on form submission - $("form.answer").submit(function(){ - var submit_button = $(this).find('input[type="submit"]'); - var saving_message = $(this).find('.saving-message'); - submit_button.hide(); - q_id = $(this).find(".question_id").val(); - saving_message.show(); - s_status = $(this).closest(".accordion-group").find(".section-status:first"); - s_status.toggle_dirty(q_id, false); - }); - //accordion guidance $('.accordion-guidance-link').on('click', function (e) { e.stopPropagation(); @@ -148,9 +132,7 @@ // Handle section actions on accordion expansion/collapse - $('.section-collapse').on('show', function() { - $('abbr.timeago').timeago(); - }).on('hide', function(){ + $('.section-collapse').on('hide', function(){ var section = $(this); var section_id = section.attr("id").split('-')[1]; if ($.fn.is_dirty(section_id)) { @@ -178,10 +160,6 @@ $("#collapse-" + section_id).find("input[type='submit']").click(); $('#section-' + section_id + '-collapse-alert').modal("hide"); }); - - $("select, :radio, :checkbox, input").change(function() { - $(this).closest(".accordion-group").find(".section-status:first").toggle_dirty($(this).closest("form.answer").find(".question_id").val(), true); - }); // COMMENTS Javascript @@ -314,7 +292,7 @@ q_status.addClass("label-success"); // Set timestamp text and data t.text(timestamp.toUTCString()); - t.attr('title', timestamp.toISOString()).data("timeago",null).timeago(); + //t.attr('title', timestamp.toISOString()).data("timeago",null).timeago(); t.attr('data-time', timestamp.toISOString()); return true; } @@ -337,7 +315,7 @@ q_status.addClass("label-success"); // Set timestamp text and data t.text(timestamp.toUTCString()); - t.attr('title', timestamp.toISOString()).data("timeago",null).timeago(); + //t.attr('title', timestamp.toISOString()).data("timeago",null).timeago(); t.attr('data-time', timestamp.toISOString()); return true; } @@ -382,7 +360,7 @@ dirty[section_id][question_id] = is_dirty; if (is_dirty) { $("#"+question_id+"-unsaved").show(); - + $("#answer-status-"+question_id).find('.answer-unsaved').show(); // Temporary workaround ONLY triggered when textarea format type changes } else { $("#"+question_id+"-unsaved").hide(); @@ -395,5 +373,4 @@ // this is the function used to hanndle the interface between tinymce and the Dirty stuff $.fn.check_textarea = function(editor) { $("#"+editor.id).closest(".accordion-group").find(".section-status:first").toggle_dirty(editor.id.split('-')[2], editor.isDirty()); - }; diff --git a/lib/assets/javascripts/shared/register_form.js b/lib/assets/javascripts/shared/register_form.js new file mode 100644 index 0000000..82b077d --- /dev/null +++ b/lib/assets/javascripts/shared/register_form.js @@ -0,0 +1,61 @@ +$(document).ready(function() { + var email_regex = /[^@\s]+@(?:[-a-z0-9]+\.)+[a-z]{2,}$/; + var valid_email = false; + var valid_password = false; + var valid_password_confirmation = false; + var valid_accept_terms = false; + + $("#user_email.text_field.reg-input").change(function(){ + if (email_regex.test($(this).val())) { + $(this).next().hide(); + valid_email = true; + } + else { + $(this).next().show(); + valid_email = false; + } + set_aria_submit(); + }); + $("#user_password.text_field.reg-input").change(function() { + if($(this).val().length >= 8) { + $(this).next().hide(); + valid_password = true; + } + else { + $(this).next().show(); + valid_password = false; + } + // If password_confirmation is non empty already, force to check its validity + if($("#user_password_confirmation.text_field.reg-input").val().length > 0){ + console.log('force to check validity of confirmation'); + $("#user_password_confirmation.text_field.reg-input").change(); + } + set_aria_submit(); + }); + $("#user_password_confirmation.text_field.reg-input").change(function() { + if ($(this).val() === $("#user_password.text_field.reg-input").val()) { + $(this).next().hide(); + valid_password_confirmation = true; + } + else { + $(this).next().show(); + valid_password_confirmation = false; + } + set_aria_submit(); + }); + $("#user_accept_terms").change(function(){ + valid_accept_terms = $(this).prop('checked'); + set_aria_submit(); + }); + function set_aria_submit(){ + if(valid_email + && valid_password + && valid_password_confirmation + && valid_accept_terms){ + $("#sign_up_submit").attr('aria-disabled', false); + } + else { + $("#sign_up_submit").attr('aria-disabled', true); + } + } +}); \ No newline at end of file diff --git a/lib/assets/stylesheets/admin.css.less b/lib/assets/stylesheets/admin.css.less index 00ea783..075941e 100644 --- a/lib/assets/stylesheets/admin.css.less +++ b/lib/assets/stylesheets/admin.css.less @@ -1185,6 +1185,10 @@ width: 250px; } +table.dmp_details_table tr td.tinymce{ + min-width: 370px; +} + table.dmp_details_table .text_area{ width: 90%; } @@ -1666,7 +1670,7 @@ padding-right: 20px; } table.tablesorter thead tr .header { - background-image: url(bg.gif); + background-image: asset-url("bg.gif"); background-repeat: no-repeat; background-position: center right; background-color: @orange_lighter_colour; @@ -1675,10 +1679,10 @@ table.tablesorter thead tr .headerSortUp { - background-image: url(asc.gif); + background-image: asset-url("asc.gif"); } table.tablesorter thead tr .headerSortDown { - background-image: url(desc.gif); + background-image: asset-url("desc.gif"); } diff --git a/lib/assets/stylesheets/bootstrap_and_overrides.css.less b/lib/assets/stylesheets/bootstrap_and_overrides.css.less index 2796d1b..f083ce1 100644 --- a/lib/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/lib/assets/stylesheets/bootstrap_and_overrides.css.less @@ -1851,15 +1851,15 @@ table.tablesorter thead { th.header { cursor: pointer; - background: url('/assets/bg.gif') no-repeat center right; + background: asset-url('bg.gif') no-repeat center right; } th.headerSortDown { - background: @orange_lighter_colour url('/assets/desc.gif') no-repeat center right; + background: @orange_lighter_colour asset-url('desc.gif') no-repeat center right; } th.headerSortUp { - background: @orange_lighter_colour url('/assets/asc.gif') no-repeat center right; + background: @orange_lighter_colour asset-url('asc.gif') no-repeat center right; } } diff --git a/lib/assets/stylesheets/roadmap-form.scss b/lib/assets/stylesheets/roadmap-form.scss index 9abd90a..72345a1 100644 --- a/lib/assets/stylesheets/roadmap-form.scss +++ b/lib/assets/stylesheets/roadmap-form.scss @@ -150,13 +150,12 @@ input.form-submit { background-color: $primary-color; color: $reverse-text; - padding: 10px 30px; - font-size: 12pt; - margin-top: 15px; - - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; + font-size: 14px; + padding: 4px 12px; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; } /* Override the button color for the Org Admin sections */ input[type="submit"].admin{ @@ -171,13 +170,12 @@ button.form-cancel { background-color: $cancel-button-color; color: $reverse-text; - padding: 10px 30px; - font-size: 12pt; - margin-top: 15px; + font-size: 14px; + padding: 4px 12px; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; } .submit-tooltip { display: none; diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake index cc9e87e..0bd54fd 100644 --- a/lib/tasks/migrate.rake +++ b/lib/tasks/migrate.rake @@ -248,5 +248,22 @@ end end end + + desc "enforce single published version for templates" + task single_published_template: :environment do + # for each group of versions of a template + Template.all.pluck(:dmptemplate_id).uniq.each do |dmptemplate_id| + published = false + Template.where(dmptemplate_id: dmptemplate_id).order(version: :desc).each do |template| + # leave the first published template we find alone + if !published && template.published + published = true + elsif published && template.published + template.published = false + template.save! + end + end + end + end end diff --git a/test/functional/annotations_controller_test.rb b/test/functional/annotations_controller_test.rb new file mode 100644 index 0000000..8615d16 --- /dev/null +++ b/test/functional/annotations_controller_test.rb @@ -0,0 +1,116 @@ +require 'test_helper' + +class AnnotationsControllerTest < ActionDispatch::IntegrationTest + + include Devise::Test::IntegrationHelpers + + setup do + @question = Annotation.first.question + + # Get the first Org Admin + scaffold_org_admin(@question.section.phase.template.org) + end + +# TODO: The following methods SHOULD replace the old 'admin_' prefixed methods. The routes file already has +# these defined. They are defined multiple times though and we need to clean this up! In particular +# look at the unnamed routes after 'new_plan_phase' below. They are not named because they are duplicates. +# We should just have: +# +# SHOULD BE: +# -------------------------------------------------- +# suggested_answers GET /templates/:template_id/phases/:phase_id/sections/:section_id/questions/:id sections#index +# POST /templates/:template_id/phases/:phase_id/sections/:section_id/questions/:id sections#create +# suggested_answer GET /templates/:template_id/phases/:phase_id/sections/:section_id/questions/:question_id/suggested_answer/:id sections#show +# PATCH /templates/:template_id/phases/:phase_id/section/:section_id/questions/:question_id/suggested_answer/:id sections#update +# PUT /templates/:template_id/phases/:phase_id/section/:section_id/questions/:question_id/suggested_answer/:id sections#update +# DELETE /templates/:template_id/phases/:phase_id/section/:section_id/questions/:question_id/suggested_answer/:id sections#destroy +# +# CURRENT RESULTS OF `rake routes` +# -------------------------------------------------- +# admin_create_suggested_answer POST /org/admin/templates/suggested_answers/:id/admin_create suggested_answers#admin_create +# admin_update_suggested_answer PUT /org/admin/templates/suggested_answers/:id/admin_update suggested_answers#admin_update +# admin_destroy_suggested_answer DELETE /org/admin/templates/suggested_answers/:id/admin_destroy suggested_answers#admin_destroy + + + + # POST /org/admin/templates/suggested_answers/:id/admin_create (admin_create_annotation_path) + # ---------------------------------------------------------- + test "create a new annotation" do + params = {org_id: @user.org.id, question_id: @question.id, text: "Here's a suggestion"} + + # Should redirect user to the root path if they are not logged in! + post admin_create_annotation_path(@question.id), {annotation: params} + assert_unauthorized_redirect_to_root_path + + sign_in @user + + post admin_create_annotation_path(@question.id), {annotation: params} + assert_response :redirect + assert_redirected_to "#{admin_show_phase_path(@question.section.phase.id)}?edit=true&question_id=#{@question.id}§ion_id=#{@question.section.id}" + assert_equal _('Information was successfully created.'), flash[:notice] + assert_equal "Here's a suggestion", Annotation.last.text, "expected the record to have been created!" + assert assigns(:example_answer) + + # Invalid object + post admin_create_annotation_path(@question.id), {annotation: {question_id: @question.id}} + assert flash[:notice].starts_with?(_('Could not create your')) + assert_response :success + assert assigns(:example_answer) + end + + # PUT /org/admin/templates/suggested_answers/:id/admin_update (admin_update_suggested_answer_path) + # ---------------------------------------------------------- + test "update the annotation" do + params = {text: 'UPDATE'} + + # Should redirect user to the root path if they are not logged in! + put admin_update_annotation_path(Annotation.first), {annotation: params} + assert_unauthorized_redirect_to_root_path + + sign_in @user + + # Valid save + put admin_update_annotation_path(Annotation.first), {annotation: params} + assert_equal _('Information was successfully updated.'), flash[:notice] + assert_response :redirect + assert_redirected_to "#{admin_show_phase_path(@question.section.phase.id)}?edit=true&question_id=#{@question.id}§ion_id=#{@question.section.id}" + assert assigns(:example_answer) + assert assigns(:question) + assert assigns(:section) + assert assigns(:phase) + assert_equal 'UPDATE', Annotation.first.text, "expected the record to have been updated" + +# TODO: We need to add in validation checks on the model and reactivate this test + # Invalid save +# put admin_update_suggested_answer_path(SuggestedAnswer.first), {suggested_answer: {text: nil}} +# assert flash[:notice].starts_with?(_('Could not update your')) +# assert_response :success +# assert assigns(:suggested_answer) +# assert assigns(:question) +# assert assigns(:section) +# assert assigns(:phase) + end + + # DELETE /org/admin/templates/suggested_answers/:id/admin_destroy (admin_destroy_suggested_answer_path) + # ---------------------------------------------------------- + test "delete the section" do + id = Annotation.first.id + # Should redirect user to the root path if they are not logged in! + delete admin_destroy_annotation_path(id: id) + assert_unauthorized_redirect_to_root_path + + sign_in @user + + delete admin_destroy_annotation_path(id: id) + assert_equal _('Information was successfully deleted.'), flash[:notice] + assert_response :redirect + assert_redirected_to "#{admin_show_phase_path(@question.section.phase.id)}?edit=true§ion_id=#{@question.section.id}" + assert assigns(:question) + assert assigns(:section) + assert assigns(:phase) + assert_raise ActiveRecord::RecordNotFound do + Annotation.find(id).nil? + end + end + +end \ No newline at end of file diff --git a/test/functional/phases_controller_test.rb b/test/functional/phases_controller_test.rb index 4b0de7c..3cd91b5 100644 --- a/test/functional/phases_controller_test.rb +++ b/test/functional/phases_controller_test.rb @@ -101,7 +101,7 @@ assert_response :success assert assigns(:phase) - assert assigns(:edit) + #assert assigns(:edit) assert assigns(:sections) end diff --git a/test/functional/plans_controller_test.rb b/test/functional/plans_controller_test.rb index 259bfbf..3811003 100644 --- a/test/functional/plans_controller_test.rb +++ b/test/functional/plans_controller_test.rb @@ -107,20 +107,6 @@ assert assigns(:selected_guidance_groups) end - # GET /plan/:id/edit (edit_plan_path) - # ---------------------------------------------------------- - test 'show the edit plan page' do - # Should redirect user to the root path if they are not logged in! - try_no_user_and_unauthorized(edit_plan_path(@plan)) - - sign_in @user - get edit_plan_path(@plan) - assert_response :success - assert assigns(:plan) - assert assigns(:phase) - assert assigns(:readonly) - end - # PUT /plan/:id (plan_path) # ---------------------------------------------------------- test 'update the plan' do diff --git a/test/functional/questions_controller_test.rb b/test/functional/questions_controller_test.rb index 2a9cbcf..9a156f5 100644 --- a/test/functional/questions_controller_test.rb +++ b/test/functional/questions_controller_test.rb @@ -38,7 +38,7 @@ # POST /org/admin/templates/questions/:id/admin_create (admin_create_question_path) # ---------------------------------------------------------- test "create a new question" do - params = {section_id: @section.id, text: 'Test Question', number: 9, question_format_id: @question_format.id} + params = {section_id: @section.id, text: 'Test Question', number: 9, question_format_id: @question_format.id, annotations_attributes: {0 => {text: "some text", org_id: Org.first.id}}} @section.phase.template.dirty = false @section.phase.template.save! @@ -48,7 +48,11 @@ assert_unauthorized_redirect_to_root_path sign_in @user - + @new_question = Question.new + @new_question.number = @section.questions.count + 1 + example_answer = @new_question.annotations.build + example_answer.type = :example_answer + example_answer.save post admin_create_question_path(@section), {question: params} assert_response :redirect assert assigns(:question) diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb index 9b4eb29..7937867 100644 --- a/test/functional/roles_controller_test.rb +++ b/test/functional/roles_controller_test.rb @@ -9,9 +9,8 @@ scaffold_org_admin(@plan.template.org) # This should NOT be unnecessary! Owner should have full access - Role.create(user: @user, plan: @plan, access: 15) + @plan.roles << Role.create(user: @user, plan: @plan, access: 15) - @invitee = User.last end # TODO: Cleanup routes for this one. The controller currently only responds to create, update, destroy @@ -26,21 +25,49 @@ # POST /roles (roles_path) # ---------------------------------------------------------- test "create a new role" do + params = {plan_id: @plan.id, access_level: 4} # Should redirect user to the root path if they are not logged in! post roles_path, {role: params} assert_unauthorized_redirect_to_root_path - + sign_in @user + # Known user + @invitee = User.where.not(id: [@plan.owner.id, @user.id]).first post roles_path, {user: @invitee.email, role: params} - assert_equal _('User added to project'), flash[:notice] + assert_equal _('Plan shared with %{email}.') % {email: @invitee.email}, flash[:notice] assert_response :redirect assert_redirected_to share_plan_path(@plan) assert_equal @invitee.id, Role.last.user_id, "expected the record to have been created!" assert assigns(:role) - + + # Share to already invited user + post roles_path, {user: @invitee.email, role: params} + assert_equal _('Plan is already shared with %{email}.') % {email: @invitee.email}, flash[:notice] + assert_response :redirect + assert_redirected_to share_plan_path(@plan) + assert_equal @invitee.id, Role.last.user_id, "expected no record to have been created!" + assert assigns(:role) + + # Unknown user + post roles_path, {user: 'unknown_user@org.org', role: params} + assert_equal _('Invitation to unknown_user@org.org issued successfully.'), flash[:notice] + assert_response :redirect + assert_redirected_to share_plan_path(@plan) + assert_equal User.find_by(email:'unknown_user@org.org').id, Role.last.user_id, "expected the record to have been created!" + assert assigns(:role) + + # Invite owner + @invitee = User.find_by(id: @plan.owner.id) + post roles_path, {user: @invitee.email, role: params} + assert_equal _('Cannot share plan with %{email} since that email matches with the owner of the plan.') % {email: @invitee.email}, flash[:notice] + assert_response :redirect + assert_redirected_to share_plan_path(@plan) + assert_not_equal @invitee.id, Role.last.user_id, "expected no record to have been created!" + assert assigns(:role) + # Missing email post roles_path, {role: {plan_id: @plan.id, access_level: 4}} assert_equal _('Please enter an email address'), flash[:notice] @@ -52,6 +79,7 @@ # PUT /role/:id (role_path) # ---------------------------------------------------------- test "update the role" do + @invitee = User.last role = Role.create(user: @invitee, plan: @plan, access: 1) params = {access_level: 2} @@ -81,6 +109,7 @@ # DELETE /role/:id (role_path) # ---------------------------------------------------------- test "delete the section" do + @invitee = User.last role = Role.create(user: @invitee, plan: @plan, access: 1) # Should redirect user to the root path if they are not logged in! @@ -98,4 +127,4 @@ end end -end \ No newline at end of file +end diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb index ac1b5dd..a41e540 100644 --- a/test/functional/sessions_controller_test.rb +++ b/test/functional/sessions_controller_test.rb @@ -53,7 +53,11 @@ delete destroy_user_session_path assert_equal nil, session[:locale], "expected the locale to have been deleted from the session" assert_response :redirect - assert_redirected_to root_path + if Rails.application.config.shibboleth_enabled + assert_redirected_to Rails.application.config.shibboleth_logout_url + root_url + else + assert_redirected_to root_path + end end end diff --git a/test/functional/suggested_answers_controller_test.rb b/test/functional/suggested_answers_controller_test.rb deleted file mode 100644 index dcdd2ce..0000000 --- a/test/functional/suggested_answers_controller_test.rb +++ /dev/null @@ -1,116 +0,0 @@ -require 'test_helper' - -class SuggestedAnswersControllerTest < ActionDispatch::IntegrationTest - - include Devise::Test::IntegrationHelpers - - setup do - @question = SuggestedAnswer.first.question - - # Get the first Org Admin - scaffold_org_admin(@question.section.phase.template.org) - end - -# TODO: The following methods SHOULD replace the old 'admin_' prefixed methods. The routes file already has -# these defined. They are defined multiple times though and we need to clean this up! In particular -# look at the unnamed routes after 'new_plan_phase' below. They are not named because they are duplicates. -# We should just have: -# -# SHOULD BE: -# -------------------------------------------------- -# suggested_answers GET /templates/:template_id/phases/:phase_id/sections/:section_id/questions/:id sections#index -# POST /templates/:template_id/phases/:phase_id/sections/:section_id/questions/:id sections#create -# suggested_answer GET /templates/:template_id/phases/:phase_id/sections/:section_id/questions/:question_id/suggested_answer/:id sections#show -# PATCH /templates/:template_id/phases/:phase_id/section/:section_id/questions/:question_id/suggested_answer/:id sections#update -# PUT /templates/:template_id/phases/:phase_id/section/:section_id/questions/:question_id/suggested_answer/:id sections#update -# DELETE /templates/:template_id/phases/:phase_id/section/:section_id/questions/:question_id/suggested_answer/:id sections#destroy -# -# CURRENT RESULTS OF `rake routes` -# -------------------------------------------------- -# admin_create_suggested_answer POST /org/admin/templates/suggested_answers/:id/admin_create suggested_answers#admin_create -# admin_update_suggested_answer PUT /org/admin/templates/suggested_answers/:id/admin_update suggested_answers#admin_update -# admin_destroy_suggested_answer DELETE /org/admin/templates/suggested_answers/:id/admin_destroy suggested_answers#admin_destroy - - - - # POST /org/admin/templates/suggested_answers/:id/admin_create (admin_create_suggested_answer_path) - # ---------------------------------------------------------- - test "create a new section" do - params = {org_id: @user.org.id, question_id: @question.id, text: "Here's a suggestion"} - - # Should redirect user to the root path if they are not logged in! - post admin_create_suggested_answer_path(@question.id), {suggested_answer: params} - assert_unauthorized_redirect_to_root_path - - sign_in @user - - post admin_create_suggested_answer_path(@question.id), {suggested_answer: params} - assert_response :redirect - assert_redirected_to "#{admin_show_phase_path(@question.section.phase.id)}?edit=true&question_id=#{@question.id}§ion_id=#{@question.section.id}" - assert_equal _('Information was successfully created.'), flash[:notice] - assert_equal "Here's a suggestion", SuggestedAnswer.last.text, "expected the record to have been created!" - assert assigns(:suggested_answer) - - # Invalid object - post admin_create_suggested_answer_path(@question.id), {suggested_answer: {question_id: @question.id}} - assert flash[:notice].starts_with?(_('Could not create your')) - assert_response :success - assert assigns(:suggested_answer) - end - - # PUT /org/admin/templates/suggested_answers/:id/admin_update (admin_update_suggested_answer_path) - # ---------------------------------------------------------- - test "update the section" do - params = {text: 'UPDATE'} - - # Should redirect user to the root path if they are not logged in! - put admin_update_suggested_answer_path(SuggestedAnswer.first), {suggested_answer: params} - assert_unauthorized_redirect_to_root_path - - sign_in @user - - # Valid save - put admin_update_suggested_answer_path(SuggestedAnswer.first), {suggested_answer: params} - assert_equal _('Information was successfully updated.'), flash[:notice] - assert_response :redirect - assert_redirected_to "#{admin_show_phase_path(@question.section.phase.id)}?edit=true&question_id=#{@question.id}§ion_id=#{@question.section.id}" - assert assigns(:suggested_answer) - assert assigns(:question) - assert assigns(:section) - assert assigns(:phase) - assert_equal 'UPDATE', SuggestedAnswer.first.text, "expected the record to have been updated" - -# TODO: We need to add in validation checks on the model and reactivate this test - # Invalid save -# put admin_update_suggested_answer_path(SuggestedAnswer.first), {suggested_answer: {text: nil}} -# assert flash[:notice].starts_with?(_('Could not update your')) -# assert_response :success -# assert assigns(:suggested_answer) -# assert assigns(:question) -# assert assigns(:section) -# assert assigns(:phase) - end - - # DELETE /org/admin/templates/suggested_answers/:id/admin_destroy (admin_destroy_suggested_answer_path) - # ---------------------------------------------------------- - test "delete the section" do - id = SuggestedAnswer.first.id - # Should redirect user to the root path if they are not logged in! - delete admin_destroy_suggested_answer_path(id: id) - assert_unauthorized_redirect_to_root_path - - sign_in @user - - delete admin_destroy_suggested_answer_path(id: id) - assert_equal _('Information was successfully deleted.'), flash[:notice] - assert_response :redirect - assert_redirected_to "#{admin_show_phase_path(@question.section.phase.id)}?edit=true§ion_id=#{@question.section.id}" - assert assigns(:question) - assert assigns(:section) - assert assigns(:phase) - assert_raise ActiveRecord::RecordNotFound do - SuggestedAnswer.find(id).nil? - end - end - -end \ No newline at end of file diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index 45ca826..70e6edd 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -1,12 +1,12 @@ require 'test_helper' class TemplatesControllerTest < ActionDispatch::IntegrationTest - + include Devise::Test::IntegrationHelpers - + setup do scaffold_template - + # Get the first Org Admin scaffold_org_admin(@template.org) end @@ -36,41 +36,41 @@ # admin_destroy_template DELETE /org/admin/templates/:id/admin_destroy(.:format) templates#admin_destroy # admin_create_template POST /org/admin/templates/:id/admin_create(.:format) templates#admin_create # admin_update_template PUT /org/admin/templates/:id/admin_update(.:format) templates#admin_update - - + + # GET /org/admin/templates/:id/admin_index (admin_index_template_path) the :id here makes no sense! # ---------------------------------------------------------- test "get the list of admin templates" do # Should redirect user to the root path if they are not logged in! get admin_index_template_path(@user.org) assert_unauthorized_redirect_to_root_path - + sign_in @user - + get admin_index_template_path(@user.org) assert_response :success - + assert assigns(:funder_templates) assert assigns(:org_templates) - end - + end + # GET /org/admin/templates/:id/admin_template (admin_template_template_path) # ---------------------------------------------------------- test "get the admin template" do # Should redirect user to the root path if they are not logged in! get admin_template_template_path(@template) assert_unauthorized_redirect_to_root_path - + sign_in @user - + get admin_template_template_path(@template) assert_response :success - + assert assigns(:template) assert assigns(:hash) assert assigns(:current) end - + # TODO: Why are we passing an :id here!? Its a new record but we seem to need the last template's id # GET /org/admin/templates/:id/admin_new (admin_new_template_path) # ---------------------------------------------------------- @@ -78,30 +78,30 @@ # Should redirect user to the root path if they are not logged in! get admin_new_template_path(Template.last.id) assert_unauthorized_redirect_to_root_path - + sign_in @user - + get admin_new_template_path(Template.last.id) assert_response :success end - + # GET /org/admin/templates/:id/admin_template_history (admin_template_history_template_path) # ---------------------------------------------------------- test "get the admin template history page" do # Should redirect user to the root path if they are not logged in! get admin_template_history_template_path(@template) assert_unauthorized_redirect_to_root_path - + sign_in @user - + get admin_template_history_template_path(@template) assert_response :success - + assert assigns(:template) assert assigns(:templates) assert assigns(:current) end - + # DELETE /org/admin/templates/:id/admin_destroy (admin_destroy_template_path) # ---------------------------------------------------------- test "delete the admin template" do @@ -109,16 +109,16 @@ # Should redirect user to the root path if they are not logged in! delete admin_destroy_template_path(@template) assert_unauthorized_redirect_to_root_path - + sign_in @user - + family = @template.dmptemplate_id prior = Template.current(family) - + version_the_template - + current = Template.current(family) - + # Try to delete a historical version should fail delete admin_destroy_template_path(prior) assert_equal _('You cannot delete historical versions of this template.'), flash[:notice] @@ -130,31 +130,31 @@ delete admin_destroy_template_path(current) assert_response :redirect assert_redirected_to admin_index_template_path - assert_raise ActiveRecord::RecordNotFound do + assert_raise ActiveRecord::RecordNotFound do Template.find(current.id).nil? end assert_equal prior, Template.current(family), "expected the old version to now be the current version" end - + # TODO: Why are we passing an :id here!? Its a new record but we seem to need the last template's id # POST /org/admin/templates/:id/admin_create (admin_create_template_path) # ---------------------------------------------------------- test "create a template" do params = {title: 'Testing create route'} - + # Should redirect user to the root path if they are not logged in! post admin_create_template_path(@user.org), {template: params} assert_unauthorized_redirect_to_root_path - + sign_in @user - + post admin_create_template_path(@user.org), {template: params} assert_equal _('Information was successfully created.'), flash[:notice] assert_response :redirect assert_redirected_to admin_template_template_url(Template.last.id) assert assigns(:template) assert_equal 'Testing create route', Template.last.title, "expected the record to have been created!" - + # Invalid object post admin_create_template_path(@user.org), {template: {title: nil, org_id: @user.org.id}} assert flash[:notice].starts_with?(_('Could not create your')) @@ -162,23 +162,25 @@ assert assigns(:template) assert assigns(:hash) end - + # GET /org/admin/templates/:id/admin_update (admin_update_template_path) # ---------------------------------------------------------- test "update the admin template" do params = {title: 'ABCD'} - + # Should redirect user to the root path if they are not logged in! + #get admin_template_template_path(@template) # Click on 'edit' + #@template = Template.current(@template.dmptemplate_id) # Edit working copy put admin_update_template_path(@template), {template: params} assert_unauthorized_redirect_to_root_path - + sign_in @user family = @template.dmptemplate_id prior = Template.current(family) - + version_the_template - + current = Template.current(family) # We shouldn't be able to edit a historical version @@ -187,7 +189,7 @@ assert_response :redirect assert_redirected_to admin_template_template_url(prior) assert assigns(:template) - + # Make sure we get the right response when editing an unpublished template put admin_update_template_path(current), {template: params} assert_equal _('Information was successfully updated.'), flash[:notice] @@ -195,8 +197,8 @@ assert assigns(:template) assert assigns(:hash) assert_equal 'ABCD', current.reload.title, "expected the record to have been updated" - assert current.reload.dirty? - + assert current.reload.dirty? + # Make sure we get the right response when providing an invalid template put admin_update_template_path(current), {template: {title: nil}} assert flash[:notice].starts_with?(_('Could not update your')) @@ -211,7 +213,7 @@ # Make sure we are redirected if we're not logged in put admin_customize_template_path(@template) assert_unauthorized_redirect_to_root_path - + funder_template = Template.create(org: Org.funders.first, title: 'Testing integration') # Sign in as the funder so that we cna publish the template @@ -220,24 +222,24 @@ put admin_publish_template_path(funder_template) assert_response :redirect assert_redirected_to admin_index_template_path(funder_template.org) - + # Sign in as the regular user so we can customize the funder template sign_in @user - + template = Template.live(funder_template.dmptemplate_id) - + put admin_customize_template_path(template) - + customization = Template.where(customization_of: template.dmptemplate_id).last assert_response :redirect assert_redirected_to admin_template_template_url(Template.last) assert assigns(:template) - + assert_equal 0, customization.version assert_not customization.published? assert_not customization.dirty? - + # Make sure the funder templates data is not modifiable! customization.phases.each do |p| assert_not p.modifiable @@ -249,21 +251,21 @@ end end end - + # GET /org/admin/templates/:id/admin_publish (admin_publish_template_path) # ---------------------------------------------------------- test "publish a template" do # Should redirect user to the root path if they are not logged in! put admin_publish_template_path(@template) assert_unauthorized_redirect_to_root_path - + sign_in @user family = @template.dmptemplate_id prior = Template.current(family) - + version_the_template - + current = Template.current(family) # We shouldn't be able to edit a historical version @@ -272,51 +274,56 @@ assert_response :redirect assert_redirected_to admin_template_template_url(prior) assert assigns(:template) - + # Publish the current template put admin_publish_template_path(current) assert_equal _('Your template has been published and is now available to users.'), flash[:notice] assert_response :redirect assert_redirected_to admin_index_template_path(@user.org) - + current = Template.current(family) + + # Update the description so that the template gets versioned + get admin_template_template_path(current) # Click on 'edit' + new_version = Template.current(family) # Edit working copy + put admin_update_template_path(new_version), {template: {description: "this is an update"}} + # Make sure it versioned properly - current = Template.includes(:phases, :sections, :questions).find(current.id) new_version = Template.current(family) assert_not_equal current.id = new_version.id, "expected it to create a new version" assert_equal (current.version + 1), new_version.version, "expected the version to have incremented" assert current.published?, "expected the old version to be published" assert_not new_version.published?, "expected the new version to NOT be published" assert_not current.dirty?, "expected the old dirty flag to be false" - assert_not new_version.dirty?, "expected the new dirty flag to be false" + assert new_version.dirty?, "expected the new dirty flag to be true" assert_equal current.dmptemplate_id, new_version.dmptemplate_id, "expected the old and new versions to share the same dmptemplate_id" end - + # GET /org/admin/templates/:id/admin_unpublish (admin_unpublish_template_path) # ---------------------------------------------------------- test "unpublish a template" do # Should redirect user to the root path if they are not logged in! put admin_unpublish_template_path(@template) assert_unauthorized_redirect_to_root_path - + sign_in @user family = @template.dmptemplate_id prior = Template.current(family) - + version_the_template - + current = Template.current(family) - + # Publish it so we can unpublish put admin_publish_template_path(current) assert_not Template.live(family).nil? - + put admin_unpublish_template_path(current) assert_equal _('Your template is no longer published. Users will not be able to create new DMPs for this template until you re-publish it'), flash[:notice] assert_response :redirect assert_redirected_to admin_index_template_path(@user.org) - + # Make sure there are no published versions assert Template.live(family).nil? end -end \ No newline at end of file +end diff --git a/test/functional/users/omniauth_callbacks_controller_test.rb b/test/functional/users/omniauth_callbacks_controller_test.rb index 3dca1ca..d4f7e58 100644 --- a/test/functional/users/omniauth_callbacks_controller_test.rb +++ b/test/functional/users/omniauth_callbacks_controller_test.rb @@ -50,8 +50,8 @@ ### Until ORCID login becomes supported. if scheme.name == 'shibboleth' - assert [I18n.t('devise.omniauth_callbacks.user.success').gsub('%{kind}', scheme.name).downcase, - I18n.t('devise.omniauth_callbacks.success').gsub('%{kind}', scheme.name).downcase].include?(flash[:notice].downcase), "Expected a success message when simulating a valid callback from #{scheme.name}" + assert [I18n.t('devise.omniauth_callbacks.user.success').gsub('%{kind}', scheme.description).downcase, + I18n.t('devise.omniauth_callbacks.success').gsub('%{kind}', scheme.description).downcase].include?(flash[:notice].downcase), "Expected a success message when simulating a valid callback from #{scheme.name}" assert @response.redirect_url.include?(root_url), "Expected a redirect to the root page, #{root_url}, when omniauth returns with a valid identifier!" else assert_equal I18n.t('identifier_schemes.new_login_success'), flash[:notice], "Expected a success message when simulating a valid callback from #{scheme.name}" diff --git a/test/integration/authentication_test.rb b/test/integration/authentication_test.rb index 6f2fe24..c9d4c26 100644 --- a/test/integration/authentication_test.rb +++ b/test/integration/authentication_test.rb @@ -31,10 +31,14 @@ delete destroy_user_session_path assert_response :redirect - follow_redirect! + if Rails.application.config.shibboleth_enabled + assert_redirected_to Rails.application.config.shibboleth_logout_url + root_url + else + assert_redirected_to root_path + end + get root_path # Make sure that the user is sent to the page that lists their plans - assert_response :success assert_select '.welcome-message h2', _('Welcome.') end diff --git a/test/integration/template_selection_test.rb b/test/integration/template_selection_test.rb index 055db21..2567954 100644 --- a/test/integration/template_selection_test.rb +++ b/test/integration/template_selection_test.rb @@ -14,13 +14,13 @@ scaffold_org_admin(@template.org) @funder = Org.find_by(org_type: 2) - @funder_template = Template.create(title: 'Funder template', org: @funder) + @funder_template = Template.create(title: 'Funder template', org: @funder, migrated: false) # Template can't be published on creation so do it afterward @funder_template.published = true @funder_template.save @org = @researcher.org - @org_template = Template.create(title: 'Org template', org: @org) + @org_template = Template.create(title: 'Org template', org: @org, migrated: false) # Template can't be published on creation so do it afterward @org_template.published = true @org_template.save diff --git a/test/integration/template_versioning_test.rb b/test/integration/template_versioning_test.rb index aea0d73..dd59836 100644 --- a/test/integration/template_versioning_test.rb +++ b/test/integration/template_versioning_test.rb @@ -6,74 +6,70 @@ setup do scaffold_template scaffold_org_admin(@template.org) - + sign_in @user - + # Make sure the template starts out as unpublished. The controller will not allow changes once its published @template.published = false @template.save! - + @initial_id = @template.id @initial_version = @template.version @initial_title = @template.title @dmptemplate_id = @template.dmptemplate_id end - + # ---------------------------------------------------------- test 'template gets versioned when its details are updated but it is already published' do # Publish the template put admin_publish_template_path(@template) @template = Template.current(@dmptemplate_id) + get admin_template_template_path(@template) # Click on 'edit' + @template = Template.current(@dmptemplate_id) # Edit new version - assert_equal (@initial_version + 1), @template.version, "expected the version to have incremented" - assert_not_equal @initial_id, @template.id, "expected the id to have changed" - assert_equal @dmptemplate_id, @template.dmptemplate_id, "expected the dmptemplate_id to match" - assert_equal false, @template.published?, "expected the new version to be unpublished" - assert_equal @initial_title, @template.title, "expected the title to have been updated" - # Change the title after its been published put admin_update_template_path(@template), {template: {title: "Blah blah blah"}} @template = Template.current(@dmptemplate_id) - + # Make sure that the template was versioned assert_equal (@initial_version + 1), @template.version, "expected the version to have incremented" assert_not_equal @initial_id, @template.id, "expected the id to have changed" assert_equal @dmptemplate_id, @template.dmptemplate_id, "expected the dmptemplate_id to match" assert_equal false, @template.published?, "expected the new version to be unpublished" assert_not_equal @initial_title, @template.title, "expected the title to have been updated" - + # Now retrieve the published version and verify that it is unchanged old = Template.live(@dmptemplate_id) assert_equal @initial_version, old.version, "expected the version number of the published version to be the same" assert_equal @initial_id, old.id, "expected the id of the published version to be the same" assert_equal @initial_title, old.title, "expected the title of the published version to be the same" end - + # ---------------------------------------------------------- test 'template gets versioned when its phases are modified and it is already published' do @template.dirty = false @template.save! - + put admin_update_phase_path @template.phases.first, {phase: {title: 'UPDATED'}} @template.reload assert @template.dirty end - + # ---------------------------------------------------------- test 'template gets versioned when its sections are modified and it is already published' do @template.dirty = false @template.save! - + put admin_update_section_path @template.phases.first.sections.first, {section: {title: 'UPDATED'}} @template.reload assert @template.dirty end - + # ---------------------------------------------------------- test 'template gets versioned when its questions are modified and it is already published' do @template.dirty = false @template.save! - + put admin_update_question_path @template.phases.first.sections.first.questions.first, {question: {text: 'UPDATED'}} @template.reload assert @template.dirty @@ -90,7 +86,7 @@ assert_equal @dmptemplate_id, @template.dmptemplate_id, "expected the dmptemplate_id to match" assert_equal false, @template.published?, "expected the version to have remained unpublished" end - + # ---------------------------------------------------------- test 'publishing a plan unpublishes the old published plan' do put admin_publish_template_path(@template) @@ -104,7 +100,7 @@ put admin_unpublish_template_path(@template) assert Template.live(@dmptemplate_id).nil? end - + # ---------------------------------------------------------- test 'plans get attached to the appropriate template version' do =begin @@ -118,7 +114,7 @@ # Sign in as the funder so that we cna publish the template sign_in User.find_by(org: funder_template.org) - + # Publish the funder template put admin_publish_template_path(funder_template) assert_response :redirect @@ -128,41 +124,41 @@ liveA = Template.live(funder_template.dmptemplate_id) @dmptemplate_id = @template.dmptemplate_id end - + sign_in @user - + # Plan A gets attached to the template v1 post plans_path, {plan: {funder_id: @template.org.id}} planA = Plan.last assert_equal liveA, planA.template, "expected the latest published version to have been assigned to PlanA" - + # Template v2 is updated put admin_update_template_path(@template), {template: {title: "Blah blah blah"}} @template = Template.current(@dmptemplate_id) - + # Plan B gets attached to the template v1 because v2 is not yet published post plans_path, {plan: {funder_id: @template.org.id}} planB = Plan.last assert_equal liveA, planB.template, "expected the latest published version to have been assigned to PlanB" - + # Plan A should still be attached to v1 assert_equal liveA, planA.template, "expected PlanA to still be attached to the original published version" - - # Sign back in as the funder + + # Sign back in as the funder sign_in User.find_by(org: funder_template.org) - + # Template v2 is published put admin_publish_template_path(@template) @template = Template.current(@dmptemplate_id) liveB = Template.live(@dmptemplate_id) - + sign_in @user - + # Plan C gets attached to template v2 post plans_path, {plan: {funder_id: @template.org.id}} planC = Plan.last assert_equal liveB, planC.template, "expected the latest published version to have been assigned to PlanA" - + # Plan A and B are still attached to v1 assert_equal liveA, planA.template, "expected PlanA to still be attached to the original published version" assert_equal liveA, planB.template, "expected PlanB to still be attached to the original published version" diff --git a/test/test_helper.rb b/test/test_helper.rb index def6783..b33f296 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -11,16 +11,16 @@ class ActiveSupport::TestCase include GlobalHelpers - + # Suppress noisy ActiveRecord logs because fixtures load for each test ActiveRecord::Base.logger.level = Logger::INFO - + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integration tests # -- they do not yet inherit this setting #fixtures :all - + # Use the seeds.rb file to seed the test database require_relative '../db/seeds.rb' @@ -32,112 +32,115 @@ def scaffold_org_admin(org) @user = User.create!(email: "admin-#{org.abbreviation.downcase}@example.com", firstname: "Org", surname: "Admin", language: Language.find_by(abbreviation: FastGettext.locale), - password: "password123", password_confirmation: "password123", + password: "password123", password_confirmation: "password123", org: org, accept_terms: true, confirmed_at: Time.zone.now, perms: Perm.where.not(name: ['admin', 'add_organisations', 'change_org_affiliation', 'grant_api_to_orgs'])) #perms: [Perm::GRANT_PERMISSIONS, Perm::MODIFY_TEMPLATES, Perm::MODIFY_GUIDANCE, Perm::CHANGE_ORG_DETAILS]) end - - + + # Convert Ruby Class Names into attribute names (e.g. MyClass --> my_class) # ---------------------------------------------------------------------- def class_name_to_attribute_name(name) name.gsub(/([a-z]+)([A-Z])/, '\1_\2').gsub('-', '_').downcase end - - # Scaffold a new Template with one Phase, one Section, and a Question for - # each of the possible Question Formats. + + # Scaffold a new Template with one Phase, one Section, and a Question for + # each of the possible Question Formats. # ---------------------------------------------------------------------- def scaffold_template - template = Template.new(title: 'Test template', + template = Template.new(title: 'Test template', description: 'My test template', - org: Org.first) - - template.phases << Phase.new(title: 'Test phase', - description: 'My test phase', + org: Org.first, migrated: false) + + template.phases << Phase.new(title: 'Test phase', + description: 'My test phase', number: 1) - - section = Section.new(title: 'Test section', + + section = Section.new(title: 'Test section', description: 'My test section', number: 99, phase: template.phases.first) - + i = 1 # Add each type of Question to the new section QuestionFormat.all.each do |frmt| - question = Question.new(text: "Test question - #{frmt.title}", number: i, + question = Question.new(text: "Test question - #{frmt.title}", number: i, question_format: frmt) - + if frmt.option_based? 3.times do |j| question.question_options << QuestionOption.new(text: "Option #{j}", number: j) end end - + section.questions << question i += 1 end - + template.phases.first.sections << section template.save! assert template.valid?, "unable to create new Template: #{template.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" - + @template = template.reload end - + # Version the template # ---------------------------------------------------------------------- def version_the_template put admin_publish_template_path(@template) + get admin_template_template_path(@template) # Click on 'edit' + @template = Template.current(@template.dmptemplate_id) # Edit working copy + put admin_update_template_path(@template), {template: {title: "#{@template.title} - VERSIONED"}} end - - # Scaffold a new Plan based on the scaffolded Template + + # Scaffold a new Plan based on the scaffolded Template # ---------------------------------------------------------------------- def scaffold_plan scaffold_template if @template.nil? - - @plan = Plan.new(template: @template, title: 'Test Plan', grant_number: 'Grant-123', + + @plan = Plan.new(template: @template, title: 'Test Plan', grant_number: 'Grant-123', principal_investigator: 'me', principal_investigator_identifier: 'me-1234', description: "this is my plan's informative description", identifier: '1234567890', data_contact: 'me@example.com', visibility: 0, roles: [Role.new(user: User.last, creator: true)]) - + assert @plan.valid?, "unable to create new Plan: #{@plan.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" @plan.save! end - - + + # FUNCTIONAL/INTEGRATION TEST HELPERS # ---------------------------------------------------------------------- def assert_unauthorized_redirect_to_root_path assert_response :redirect assert_match "#{root_url}", @response.redirect_url - + follow_redirects - + assert_response :success assert_select '.welcome-message h2', _('Welcome.') end - + # ---------------------------------------------------------------------- def assert_authorized_redirect_to_plans_page assert_response :redirect assert_match "#{root_url}", @response.redirect_url - + # Sometimes Devise has an intermediary step prior to sending the user to the final destination follow_redirects - + assert_response :success assert_select '.main_page_content h1', _('My plans') end - + # ---------------------------------------------------------------------- def follow_redirects while @response.status >= 300 && @response.status < 400 follow_redirect! end end - + # UNIT TEST HELPERS # ---------------------------------------------------------------------- def verify_deep_copy(object, exclusions) @@ -153,40 +156,40 @@ end end end - + # ---------------------------------------------------------------------- def verify_has_many_relationship(object, new_association, initial_expected_count) # Assumes that the association name matches the pluralized name of the class rel = "#{class_name_to_attribute_name(new_association.class.name).pluralize}" - + assert_equal initial_expected_count, object.send(rel).count, "was expecting #{object.class.name} to initially have #{initial_expected_count} #{rel}" - + # Add another association for the object object.send(rel) << new_association object.save! assert_equal (initial_expected_count + 1), object.send(rel).count, "was expecting #{object.class.name} to have #{initial_expected_count + 1} #{rel} after adding a new one - #{new_association.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" - + # Remove the newly added association object.send(rel).delete(new_association) object.save! assert_equal initial_expected_count, object.send(rel).count, "was expecting #{object.class.name} to have #{initial_expected_count} #{rel} after removing the new one we added" end - + # ---------------------------------------------------------------------- def verify_belongs_to_relationship(child, parent) # Assumes that the association name matches the lower case name of the class prnt = "#{class_name_to_attribute_name(parent.class.name)}" chld = "#{class_name_to_attribute_name(child.class.name)}" - + child.send("#{prnt}=", parent) child.save! assert_equal parent, child.send(prnt), "was expecting #{chld} to have a #{prnt}.id == #{parent.id}" - + # Search the parent for the child parent.reload assert_includes parent.send("#{chld.pluralize}"), child, "was expecting the #{prnt}.#{chld.pluralize} to contain the #{chld}" end - + # STUBS FOR CALLS To EXTERNAL SITES # ---------------------------------------------------------------------- def stub_blog_calls @@ -206,7 +209,7 @@ "1 at http://www.example.com/stubbed/blog" + "" + "" - + stub_request(:get, "http://www.dcc.ac.uk/news/dmponline-0/feed"). with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}). to_return(:status => 200, :body => blog_feed, :headers => {}) diff --git a/test/unit/annotation_test.rb b/test/unit/annotation_test.rb new file mode 100644 index 0000000..9734c10 --- /dev/null +++ b/test/unit/annotation_test.rb @@ -0,0 +1,63 @@ +require 'test_helper' + +class AnnotationTest < ActiveSupport::TestCase + + setup do + scaffold_template + + @org = Org.last + @question = @template.phases.first.sections.first.questions.first + + @annotation = Annotation.create(org: @org, question: @question, text: 'Test', + type: Annotation.types[:example_answer]) + end + + # --------------------------------------------------- + test "required fields are required" do + assert_not Annotation.new.valid? + assert_not Annotation.new(org: @org, text: 'Tester').valid?, "expected the 'question' field to be required" + assert_not Annotation.new(question: @question, text: 'Tester').valid?, "expected the 'org' field to be required" + + # TODO: introduce validation on the model that requires text to be provided. + #assert_not Annotation.new(org: @org, question: @question).valid?, "expected the 'text' field to be required" + + # Ensure the bare minimum and complete versions are valid + a = Annotation.new(org: @org, question: @question, text: 'Tester') + assert a.valid?, "expected the 'org', 'question' and 'text' fields to be enough to create an Annotation! - #{a.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" + end + + # --------------------------------------------------- + test "to_s returns the text" do + assert_equal @annotation.text, @annotation.to_s + end + + # --------------------------------------------------- + test "deep_copy" do + verify_deep_copy(@annotation, ['id', 'created_at', 'updated_at']) + end + + # --------------------------------------------------- + test "can CRUD Annotation" do + obj = Annotation.create(org: @org, question: @question, text: 'Tester') + assert_not obj.id.nil?, "was expecting to be able to create a new Annotation: #{obj.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" + + obj.text = 'my tester' + obj.save! + obj.reload + assert_equal 'my tester', obj.text, "Was expecting to be able to update the text of the Annotation!" + + assert obj.destroy!, "Was unable to delete the Annotation!" + end + + # --------------------------------------------------- + test "can manage belongs_to relationship with Org" do + annotation = Annotation.new(question: @question, text: 'Testing') + verify_belongs_to_relationship(annotation, @org) + end + + # --------------------------------------------------- + test "can manage belongs_to relationship with Question" do + annotation = Annotation.new(org: @org, text: 'Testing') + verify_belongs_to_relationship(annotation, @question) + end +end \ No newline at end of file diff --git a/test/unit/org_test.rb b/test/unit/org_test.rb index c2c497d..3e7fd34 100644 --- a/test/unit/org_test.rb +++ b/test/unit/org_test.rb @@ -181,9 +181,9 @@ end # --------------------------------------------------- - test "can manage has_many relationship with SuggestedAnswers" do - sa = SuggestedAnswer.new(question: Question.first, text: 'Test Suggested Answer') - verify_has_many_relationship(@org, sa, @org.suggested_answers.count) + test "can manage has_many relationship with Annotations" do + a = Annotation.new(question: Question.first, text: 'Test Annotation') + verify_has_many_relationship(@org, a, @org.annotations.count) end # --------------------------------------------------- diff --git a/test/unit/question_test.rb b/test/unit/question_test.rb index be8981e..b73f4df 100644 --- a/test/unit/question_test.rb +++ b/test/unit/question_test.rb @@ -4,18 +4,18 @@ setup do @user = User.last - + scaffold_template - + @section = @template.phases.first.sections.first - - @question = Question.create(text: 'Test question', default_value: 'ABCD', guidance: 'Hello', - number: 999, section: @section, - question_format: QuestionFormat.where(option_based: false).first, + + @question = Question.create(text: 'Test question', default_value: 'ABCD', + number: 999, section: @section, + question_format: QuestionFormat.where(option_based: false).first, option_comment_display: true, modifiable: true, - themes: [Theme.first], - suggested_answers: [SuggestedAnswer.new(org: @user.org, - text: "just a suggestion")]) + themes: [Theme.first], + annotations: [Annotation.new(org: @user.org, + text: "just a suggestion")]) end # --------------------------------------------------- @@ -24,21 +24,21 @@ assert_not Question.new(section: @section, number: 7).valid?, "expected the 'text' field to be required" assert_not Question.new(number: 7, text: 'Testing').valid?, "expected the 'section' field to be required" assert_not Question.new(section: @section, text: 'Testing').valid?, "expected the 'number' field to be required" - + # Ensure the bar minimum and complete versions are valid a = Question.new(section: @section, text: 'Testing', number: 7) assert a.valid?, "expected the 'text', 'section' and 'number' fields to be enough to create an Question! - #{a.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" end - + # --------------------------------------------------- test "to_s returns the Question text" do assert_equal @question.text, @question.to_s end - + # --------------------------------------------------- test "returns the correct themed guidance for the org" do all = Theme.first.guidances + Theme.last.guidances - + # Attach 2 themes to the question @question.themes = [Theme.first, Theme.last] @question.save! @@ -53,25 +53,25 @@ assert @question.guidance_for_org(@user.org).first.first.include?(Theme.first.guidances.first.guidance_group.name), "expected the guidance_group.name" assert_equal Theme.first.guidances.first, @question.guidance_for_org(@user.org).first.last, "expected the guidance object to be returned" end - + # --------------------------------------------------- - test "returns the correct suggested answer for the org" do - @question.suggested_answers = [SuggestedAnswer.new(org: @user.org, text: 'Test 1', is_example: false), - SuggestedAnswer.new(org: Org.first, text: 'Test 2', is_example: false)] + test "returns the correct annotation for the org" do + @question.annotations = [Annotation.create(org: @user.org, text: 'Test 1', type: Annotation.types[:example_answer]), + Annotation.create(org: Org.first, text: 'Test 2', type: Annotation.types[:example_answer])] @question.save! - - assert_equal 'Test 1', @question.get_suggested_answer(@user.org.id).text, "expected the correct suggested answer" - assert_equal 'Test 2', @question.get_suggested_answer(Org.first.id).text, "expected the correct suggested answer" - + + assert_equal 'Test 1', @question.annotations.where(org_id: @user.org.id).first.text, "expected the correct annotation" + assert_equal 'Test 2', @question.annotations.where(org_id: Org.first.id).first.text, "expected the correct annotation" + org = Org.create(name: 'New One') - assert_equal nil, @question.get_suggested_answer(org.id), "expected no suggested answer for a new org" + assert_equal nil, @question.get_example_answer(org.id), "expected no annotation for a new org" end - + # --------------------------------------------------- test "deep copy" do verify_deep_copy(@question, ['id', 'created_at', 'updated_at']) end - + # --------------------------------------------------- test "can CRUD Question" do obj = Question.create(section: @section, text: 'Test ABC', number: 7) @@ -81,39 +81,39 @@ obj.save! obj.reload assert_equal 'Testing an update', obj.text, "Was expecting to be able to update the text of the Question!" - + assert obj.destroy!, "Was unable to delete the Question!" end - + # --------------------------------------------------- test "can manage belongs_to relationship with Section" do verify_belongs_to_relationship(@question, @template.phases.first.sections.last) end - + # --------------------------------------------------- test "can manage belongs_to relationship with QuestionFormat" do verify_belongs_to_relationship(@question, QuestionFormat.where(option_based: false).last) end - + # --------------------------------------------------- test "can manage has_many relationship with Answer" do scaffold_plan a = Answer.new(user: @user, plan: @plan, text: 'Test Answer') verify_has_many_relationship(@question, a, @question.answers.count) end - + # --------------------------------------------------- test "can manage has_many relationship with QuestionOption" do qo = QuestionOption.new(text: 'Test', number: 9) verify_has_many_relationship(@question, qo, @question.question_options.count) end - + # --------------------------------------------------- - test "can manage has_many relationship with SuggestedAnswer" do - sa = SuggestedAnswer.new(text: 'Suggested Answer', org: @user.org) - verify_has_many_relationship(@question, sa, @question.suggested_answers.count) + test "can manage has_many relationship with Annotation" do + sa = Annotation.new(text: 'Suggested Answer', org: @user.org) + verify_has_many_relationship(@question, sa, @question.annotations.count) end - + # --------------------------------------------------- test "can manage has_many relationship with Themes" do t = Theme.new(title: 'Test Theme') diff --git a/test/unit/suggested_answer_test.rb b/test/unit/suggested_answer_test.rb deleted file mode 100644 index 31be604..0000000 --- a/test/unit/suggested_answer_test.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'test_helper' - -class SuggestedAnswerTest < ActiveSupport::TestCase - - setup do - scaffold_template - - @org = Org.last - @question = @template.phases.first.sections.first.questions.first - - @suggested_answer = SuggestedAnswer.create(org: @org, question: @question, text: 'Test', - is_example: true) - end - - # --------------------------------------------------- - test "required fields are required" do - assert_not SuggestedAnswer.new.valid? - assert_not SuggestedAnswer.new(org: @org, text: 'Tester').valid?, "expected the 'question' field to be required" - assert_not SuggestedAnswer.new(question: @question, text: 'Tester').valid?, "expected the 'org' field to be required" - - # TODO: introduce validation on the model that requires text to be provided. - #assert_not SuggestedAnswer.new(org: @org, question: @question).valid?, "expected the 'text' field to be required" - - # Ensure the bare minimum and complete versions are valid - a = SuggestedAnswer.new(org: @org, question: @question, text: 'Tester') - assert a.valid?, "expected the 'org', 'question' and 'text' fields to be enough to create an SuggestedAnswer! - #{a.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" - end - - # --------------------------------------------------- - test "to_s returns the text" do - assert_equal @suggested_answer.text, @suggested_answer.to_s - end - - # --------------------------------------------------- - test "deep_copy" do - verify_deep_copy(@suggested_answer, ['id', 'created_at', 'updated_at']) - end - - # --------------------------------------------------- - test "can CRUD SuggestedAnswer" do - obj = SuggestedAnswer.create(org: @org, question: @question, text: 'Tester') - assert_not obj.id.nil?, "was expecting to be able to create a new SuggestedAnswer: #{obj.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" - - obj.text = 'my tester' - obj.save! - obj.reload - assert_equal 'my tester', obj.text, "Was expecting to be able to update the text of the SuggestedAnswer!" - - assert obj.destroy!, "Was unable to delete the SuggestedAnswer!" - end - - # --------------------------------------------------- - test "can manage belongs_to relationship with Org" do - suggested_answer = SuggestedAnswer.new(question: @question, text: 'Testing') - verify_belongs_to_relationship(suggested_answer, @org) - end - - # --------------------------------------------------- - test "can manage belongs_to relationship with Question" do - suggested_answer = SuggestedAnswer.new(org: @org, text: 'Testing') - verify_belongs_to_relationship(suggested_answer, @question) - end -end \ No newline at end of file diff --git a/test/unit/template_test.rb b/test/unit/template_test.rb index cb05949..8848c64 100644 --- a/test/unit/template_test.rb +++ b/test/unit/template_test.rb @@ -33,7 +33,7 @@ # --------------------------------------------------- test "family_ids scope only returns the dmptemplate_ids for the specific Org" do Org.all.each do |org| - family_ids = Template.all.pluck(:dmptemplate_id).uniq + family_ids = Template.valid.all.pluck(:dmptemplate_id).uniq scoped = Template.dmptemplate_ids assert_equal family_ids.count, scoped.count