diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 427e6e0..a653686 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,6 +1,6 @@ class ProjectsController < ApplicationController before_filter :get_plan_list_columns, only: %i( index ) - after_action :verify_authorized, except: [:publicly_available, :public_export] + after_action :verify_authorized respond_to :html @@ -26,12 +26,6 @@ end end end - - # GET /projects/publicly_available - # ----------------------------------------------------------- - def public_plans - @projects = Project.public_visibility.order(title: :asc) - end # GET /projects/1 # GET /projects/1.json @@ -39,10 +33,15 @@ def show @project = Project.find(params[:id]) authorize @project + @show_form = false if params[:show_form] == "yes" then @show_form = true end + + @visibilities = Visibility.all + @default_visibility = @visibilities.select{ |v| v.default }.first + if user_signed_in? && @project.readable_by(current_user.id) then respond_to do |format| format.html # show.html.erb @@ -133,34 +132,6 @@ end end - # GET /projects/[:project_slug]/public_export - # ------------------------------------------------------------- - def public_export - @project = Project.find(params[:id]) - - # Force PDF response - - request.format = :pdf - - # if the project is designated as public - if @project.visibility == Visibility.find_by(name: 'public') - @plan = @project.plans.first - - generate_export - - else - - # If the user is signed in and this is their plan - if user_signed_in? && @project.readable_by(current_user) - generate_export - else - - # Otherwise redirect to the home page with an unauthorized message - redirect_to root_path, notice: I18n.t('helpers.settings.plans.errors.no_access_account') - end - end - end - # POST /projects # POST /projects.json # ----------------------------------------------------------- @@ -208,9 +179,13 @@ def update @project = Project.find(params[:id]) authorize @project - + if user_signed_in? && @project.editable_by(current_user.id) then - if @project.update_attributes(project_params) + attrs = project_params + + attrs[:visibility] = Visibility.find(attrs[:visibility]) unless attrs[:visibility].nil? + + if @project.update_attributes(attrs) respond_to do |format| format.html { redirect_to({:action => "show", :id => @project.slug, notice: I18n.t('helpers.project.success_update') }) } end @@ -345,7 +320,7 @@ def project_params params.require(:project).permit(:title, :grant_number, :identifier, :description, :principal_investigator, :principal_investigator_identifier, - :data_contact, :funder_name, :is_test, :is_public, + :data_contact, :funder_name, :visibility, :dmptemplate_id, :organisation_id, :funder_id, :institution_id, :guidance_group_ids, :project_group_ids) end diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 8408cfe..0242446 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -15,4 +15,58 @@ def roadmap end + # GET /projects/publicly_available + # ----------------------------------------------------------- + def public_plans + public_visibility = Visibility.find_by(name: 'public') + @projects = Project.where(visibility: public_visibility).order(title: :asc) + end + + # GET /projects/[:project_slug]/public_export + # ------------------------------------------------------------- + def public_export + @project = Project.find(params[:id]) + + # Force PDF response + request.format = :pdf + + # if the project is designated as public + if @project.visibility == Visibility.find_by(name: 'public') + @plan = @project.plans.first + + @exported_plan = ExportedPlan.new.tap do |ep| + ep.plan = @plan + ep.user = current_user ||= nil + #ep.format = request.format.try(:symbol) + ep.format = request.format.to_sym + plan_settings = @plan.settings(:export) + + Settings::Dmptemplate::DEFAULT_SETTINGS.each do |key, value| + ep.settings(:export).send("#{key}=", plan_settings.send(key)) + end + end + + @exported_plan.save! # FIXME: handle invalid request types without erroring? + file_name = @exported_plan.project_name + + respond_to do |format| + format.pdf do + @formatting = @plan.settings(:export).formatting + render pdf: file_name, + margin: @formatting[:margin], + footer: { + center: t('helpers.plan.export.pdf.generated_by'), + font_size: 8, + spacing: (@formatting[:margin][:bottom] / 2) - 4, + right: '[page] of [topage]' + } + end + end + + else + + # Otherwise redirect to the home page with an unauthorized message + redirect_to root_path, notice: I18n.t('helpers.settings.plans.errors.no_access_account') + end + end end \ No newline at end of file diff --git a/app/views/layouts/_navigation.html.erb b/app/views/layouts/_navigation.html.erb index 9f97b09..41afc99 100644 --- a/app/views/layouts/_navigation.html.erb +++ b/app/views/layouts/_navigation.html.erb @@ -99,12 +99,12 @@ - <% if current_path == "/plans/publicly_available" then %> + <% if current_path == "/plans/public_plans" then %>
  • <% else %>
  • <% end %> - <%= t("helpers.publicly_available_label") %> + <%= t("helpers.public_plans_label") %>
  • diff --git a/app/views/projects/_project_details.html.erb b/app/views/projects/_project_details.html.erb index a57b3c6..8c77cd5 100644 --- a/app/views/projects/_project_details.html.erb +++ b/app/views/projects/_project_details.html.erb @@ -76,13 +76,10 @@ - <%= t('helpers.project.project_is_test') %> - <%= (@project.is_test? ? t('helpers.yes') : t('helpers.no')) %> + <%= t('helpers.project.visibility') %> + <%= (@project.visibility.nil? ? t("helpers.project.visibilities.#{@default_visibility.name}") : t("helpers.project.visibilities.#{@project.visibility.name}")) %> - - <%= t('helpers.project.project_is_public') %> - <%= (@project.is_public? ? t('helpers.yes') : t('helpers.no')) %> - + @@ -147,13 +144,19 @@ - <%= t('helpers.project.project_is_test') %> - <%= f.check_box :is_test, {class: 'check_box', title: t('helpers.project.project_is_test_help_text'), autocomplete: 'off'} %> + <%= t('helpers.project.visibility') %> + + <% selected = (@project.visibility.nil? ? @default_visibility.id : @project.visibility.id) %> + + <% @visibilities.collect{ |v| {name: v.name, id: v.id} }.each do |visibility| %> +
    + /> + <%= t("helpers.project.visibilities.#{visibility[:name]}") %> +
    + <% end %> + - - <%= t('helpers.project.project_is_public') %> - <%= f.check_box :is_public, {class: 'check_box', title: t('helpers.project.project_is_public_help_text'), autocomplete: 'off'} %> - + <% end %> diff --git a/app/views/projects/publicly_available.html.erb b/app/views/projects/publicly_available.html.erb deleted file mode 100644 index a2e94ed..0000000 --- a/app/views/projects/publicly_available.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -<%- model_class = Project -%> -

    - <%= t("helpers.project.publicly_available_title") %> -

    - - -<% if @projects.count > 0 %> -

    - <%= raw t("helpers.project.publicly_available_text", {app_name: Rails.configuration.branding[:application][:name]}) %> -

    - - - - - <% ['name', 'template', 'organisation', 'owner'].each do |column| %> - <%= project_list_column_heading(column) %> - <% end %> - - - - - <% @projects.each do |project| %> - - <% ['non_link_name', 'template', 'organisation', 'owner'].each do |column| %> - <%= project_list_column_body(column, project) %> - <% end %> - - - - <% end %> - -
    - <%= link_to t("helpers.project.tab_export"), "#{public_export_project_path(project)}", :class => "dmp_table_link" %> -
    - - -<% else %> -

    - <%= raw t("helpers.project.project_text_when_no_project")%> -

    -<% end %> diff --git a/config/locales/de.yml b/config/locales/de.yml index b9a1613..5d31697 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -289,6 +289,7 @@ news_label: "Aktuelles" help_label: "Hilfe" contact_label: "Kontakt" + public_plans_label: "Öffentliche DMPs" jisc: "Das DCC wird untertützt von" greeting: "Hallo" @@ -511,13 +512,14 @@ project_identifier_help_text: "Eine Identifikationskürzel, wie es von Förderern oder Institutionen vergeben wird." project_static_info: "Dieser Plan basiert auf:" projects_title: "Meine Pläne" - default_visibility: "Organisatorische" - test_visibility: "Test" - public_visibility: "Öffentlichkeit" - project_is_test: "Test oder praxisplan?" - project_is_test_help_text: "Dieser Plan ist für die Prüfung oder Praxis puposes. Es wird von anderen Benutzern nicht angezeigt werden, es sei denn, Sie explizit freigeben sie mit ihnen (es wird jedoch in Website-Statistiken berücksichtigt werden)." - project_is_public: "Öffentlich im Internet verfügbar?" - project_is_public_help_text: "Ihr Plan erscheint auf der Seite Public DMPs dieser Website." + + visibility: "Sichtweite" + visibilities: + test: "Test oder Praxis Plan" + private: "Private (Besitzer, Miteigentümer und Admins) Siehe unsere Nutzungsbedingungen." + organisational: "Mit anderen innerhalb Ihrer Organisation" + public: "Öffentlich im Internet. Ihr DMP erscheint auf der Public DMPs Seite dieser Seite." + project_settings_text: "Die hier ausgewählten Einträge werden in der Tabelle unten angezeigt. Sie können die Daten durch jeden ihrer Tabellenköpfe sortieren oder filtern, indem Sie eine Zeichenkette in der Suchbox eingeben." project_text_when_no_project: "

    Willkommen.
    Sie können nun ihren ersten DMP erstellen.
    Wählen Sie 'Plan erstellen' weiter unten aus, um zu beginnen.

    " project_text_when_project: "

    Die folgende Tabelle listet alle von Ihnen erstellten und von anderen mit Ihnen geteilten Pläne.
    Diese können jederzeit bearbeitet, geteilt, exportiert und gelöscht werden.

    " @@ -585,6 +587,9 @@ description: "Beschreibung" unknown: " - " visibility: "Sichtweite" + name: 'Name' + template: 'Vorlage' + organisation: 'Organisation' filter: placeholder: "Filter Pläne" submit: "Filter" diff --git a/config/locales/en-UK.yml b/config/locales/en-UK.yml index e3cc3b7..46f9938 100644 --- a/config/locales/en-UK.yml +++ b/config/locales/en-UK.yml @@ -338,9 +338,7 @@ about_us_label: "About" roadmap_label: "Future plans" help_label: "Help" - -#----- - publicly_available_label: "Public DMPs" + publicly_plans_label: "Public DMPs" contact_label: "Contact" jisc: "The %{organisation_abbreviation} is funded by" @@ -581,17 +579,13 @@ project_identifier_help_text: "A pertinent ID as determined by the funder and/or institution." project_static_info: "This plan is based on:" projects_title: "My plans" - default_visibility: "Organizational" - test_visibility: "Test" - public_visibility: "Public" - project_is_test: "Test or practice plan?" - project_is_test_help_text: "This plan is for testing or practice puposes. It will not be viewable by other users unless you explicitly share it with them (it will however be factored into site statistics)." - project_is_public: "Publicly available on the web?" - project_is_public_help_text: "Your plan will appear on the Public DMPs page of this site." -#----- - publicly_available_title: "Public DMPs" - publicly_available_text: "Public DMPs are plans created using %{app_name} and shared publicly by their owners. They are not vetted for quality, completeness, or adherence to funder guidelines." + visibility: "Visibility" + visibilities: + test: "Test or Practice Plan" + private: "Private (owners, co-owners, and admins only) See our Terms of Use." + organisational: "With others within your organization" + public: "Publicly on the web. Your DMP will appear on the Public DMPs page of this site." project_settings_text: "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box." project_text_when_no_project: "

    Welcome.
    You are now ready to create your first DMP.
    Click the 'Create plan' button below to begin.

    " @@ -646,9 +640,9 @@ description: "Description" unknown: " - " visibility: "Visibility" -#----- - template: "Template" - organisation: "Organisation" + name: 'Name' + template: 'Template' + organisation: 'Organization' filter: placeholder: "Filter plans" diff --git a/config/locales/en-US.yml b/config/locales/en-US.yml index b3acd75..2c719b6 100644 --- a/config/locales/en-US.yml +++ b/config/locales/en-US.yml @@ -327,6 +327,7 @@ roadmap_label: "Future plans" help_label: "Help" contact_label: "Contact" + public_plans_label: "Public DMPs" jisc: "The %{organisation_abbreviation} is funded by" format: "format" @@ -563,13 +564,14 @@ project_identifier_help_text: "A pertinent ID as determined by the funder and/or institution." project_static_info: "This plan is based on:" projects_title: "My plans" - default_visibility: "Organizational" - test_visibility: "Test" - public_visibility: "Public" - project_is_test: "Test or practice plan?" - project_is_test_help_text: "This plan is for testing or practice puposes. It will not be viewable by other users unless you explicitly share it with them (it will however be factored into site statistics)." - project_is_public: "Publicly available on the web?" - project_is_public_help_text: "Your plan will appear on the Public DMPs page of this site." + + visibility: "Visibility" + visibilities: + test: "Test or Practice Plan" + private: "Private (owners, co-owners, and admins only) See our Terms of Use." + organisational: "With others within your organization" + public: "Publicly on the web. Your DMP will appear on the Public DMPs page of this site." + project_settings_text: "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box." project_text_when_no_project: "

    Welcome.
    You are now ready to create your first DMP.
    Click the 'Create plan' button below to begin.

    " project_text_when_project: "

    The table below lists the plans that you have created, and any that have been shared with you by others.
    These can be edited, shared, exported or deleted at anytime.

    " @@ -623,6 +625,9 @@ description: "Description" unknown: " - " visibility: "Visibility" + name: 'Name' + template: 'Template' + organisation: 'Organization' filter: placeholder: "Filter plans" submit: "Filter" diff --git a/config/locales/es.yml b/config/locales/es.yml index 454f87e..1931b25 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -280,6 +280,7 @@ roadmap_label: "Hoja de ruta" help_label: "Ayuda" contact_label: "Contacto" + public_plans_label: "DMP públicos" jisc: "El DCC está financiado por" sign_in: "Conectar" @@ -453,13 +454,14 @@ project_identifier_help_text: "El ID tal como lo determinó la institución u organismo financiador." project_static_info: "Este plan está basado en:" projects_title: "Mis planes" - default_visibility: "Organizativo" - test_visibility: "Prueba" - public_visibility: "Público" - project_is_test: "¿Plan de prueba o práctica?" - project_is_test_help_text: "Este plan es para probar o hacer puposes. No será visible por otros usuarios a menos que explícitamente lo comparta con ellos (sin embargo, se tendrá en cuenta en las estadísticas del sitio)." - project_is_public: "¿Publicamente disponible en la web?" - project_is_public_help_text: "Su plan aparecerá en la página Public DMPs de este sitio." + + visibility: "Visibilidad" + visibilities: + test: "Plan de prueba o práctica" + private: "Privado (propietarios, copropietarios y administradores solamente) Consulte nuestras Condiciones de uso." + organisational: "Con otros miembros de su organización" + public: "Publicamente en la web. Su DMP aparecerá en la página Public DMPs de este sitio." + project_settings_text: "Los items que seleccione se mostarán en la siguiente tabla. Puede ordenar los datos según sus encabezados o filtrar tecleando textos en la caja de búsqueda." project_text_when_no_project: "

    Bienvenido.
    Ya está listo para crear su primer PGD.
    Haga clic en el botón 'Crear un plan' para comenzar.

    " project_text_when_project: "

    La siguiente tabla lista los planes que usted ha creado, así como los que otros investigadores hayan compartido con usted.
    Se pueden editar, compartir, exportar o borrar en cualquier momento.

    " @@ -512,6 +514,9 @@ data_contact: "Datos de contacto del plan" description: "Descripción" visibility: 'Visibilidad' + name: 'Nombre' + template: 'Plantilla' + organisation: 'Organización' filter: placeholder: "Filtro de planes" submit: "Filtrar" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 0569738..a5c34f2 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -281,6 +281,7 @@ roadmap_label: "Feuille de route" help_label: "Aide" contact_label: "Contact" + public_plans_label: "DMP Publics" jisc: "Le DCC est financé par" sign_in: "Connexion" @@ -458,13 +459,14 @@ project_identifier_help_text: "Un identifiant approprié conforme aux prescriptions de l'organisme financeur ou de l'établissement." project_static_info: "Ce plan s'inspire de :" projects_title: "Mes plans" - default_visibility: "Organisationnel" - test_visibility: "Tester" - public_visibility: "Public" - project_is_test: "Test ou un plan de pratique?" - project_is_test_help_text: "Ce plan est destiné aux essais ou à la pratique. Il ne sera pas visible par d'autres utilisateurs à moins que vous ne le partagiez explicitement avec eux (il sera cependant pris en compte dans les statistiques du site)." - project_is_public: "Publiquement disponible sur le web?" - project_is_public_help_text: "Votre plan apparaîtra sur la page Public DMPs de ce site." + + visibility: "Visibilité" + visibilities: + test: "Test ou plan de pratique" + private: "Privé (propriétaires, copropriétaires et administrateurs uniquement) Consultez nos Conditions d'utilisation." + organisational: "Avec d'autres membres de votre organisation" + public: "Publiquement sur le web. Votre DMP apparaîtra sur la page Public DMPs de ce site." + project_settings_text: "Les éléments que vous sélectionnez ici s'afficherontt dans le tableaiu ci-après. Vous pouvez trier les données à partir de chacune de ces en-tête ou les filtrer en tapant une chaîne de caractères dans la zone de recherche." project_text_when_no_project: "

    Bienvenue.
    Vous voilà prêt à créer votre premier DMP.
    Cliquez sur le bouton 'Créer un plan' ci-dessous pour commencer.

    " project_text_when_project: "

    Dans le tableau ci-dessous figurent les plans que vous avez créés, ainsi que ceux que vous partagez avec d'autres.
    Vous pouvez à tout moment les modifier, les partager, les exporter, les effacer...

    " @@ -517,12 +519,15 @@ data_contact: "Interlocuteur pour les données du plan" description: "Description" visibility: "Visibilité" + name: 'Prénom' + template: 'Modèle' + organisation: 'Organisation' filter: placeholder: "Filtrer les plans" submit: "Filtrer" cancel: "Annuler" no_matches: "Pas de plans pour '%{filter}'" - + plan: export: pdf: diff --git a/config/locales/static_pages/de.static.yml.example b/config/locales/static_pages/de.static.yml.example index af105a5..3bf5260 100644 --- a/config/locales/static_pages/de.static.yml.example +++ b/config/locales/static_pages/de.static.yml.example @@ -183,4 +183,9 @@

    Bei Benutzung dieser Anwendung stimmen Sie den Nutzungsbedingungen zu.

    -
    " \ No newline at end of file + " + + public_plans_page: + title: "Öffentliche DMPs" + no_plans_body_text_html: "Es wurden noch keine DMPs veröffentlicht." + body_text_html: "Öffentliche DMPs sind Pläne, die mit dem DMPTool erstellt und öffentlich von ihren Eigentümern veröffentlicht werden. Sie werden nicht auf Qualität, Vollständigkeit oder die Einhaltung der funder Richtlinien überprüft." diff --git a/config/locales/static_pages/en-UK.static.yml.example b/config/locales/static_pages/en-UK.static.yml.example index 9ed7419..54e5f2a 100644 --- a/config/locales/static_pages/en-UK.static.yml.example +++ b/config/locales/static_pages/en-UK.static.yml.example @@ -214,4 +214,9 @@
    -

    Use of the tool indicates that you understand and agree to these terms and conditions.

    " \ No newline at end of file +

    Use of the tool indicates that you understand and agree to these terms and conditions.

    " + + public_plans_page: + title: "Public DMPs" + no_plans_body_text_html: "No DMPs have been made public yet." + body_text_html: "Public DMPs are plans created using the DMPTool and shared publicly by their owners. They are not vetted for quality, completeness, or adherence to funder guidelines." diff --git a/config/locales/static_pages/en-US.static.yml.example b/config/locales/static_pages/en-US.static.yml.example index ffb60d4..fa41df8 100644 --- a/config/locales/static_pages/en-US.static.yml.example +++ b/config/locales/static_pages/en-US.static.yml.example @@ -215,3 +215,7 @@

    Use of the tool indicates that you understand and agree to these terms and conditions.

    " + + public_plans_page: + title: "Public DMPs" + body_text_html: "Public DMPs are plans created using the DMPTool and shared publicly by their owners. They are not vetted for quality, completeness, or adherence to funder guidelines." \ No newline at end of file diff --git a/config/locales/static_pages/fr.static.yml.example b/config/locales/static_pages/fr.static.yml.example index 11fdf18..b48a7c2 100644 --- a/config/locales/static_pages/fr.static.yml.example +++ b/config/locales/static_pages/fr.static.yml.example @@ -155,4 +155,9 @@
    -

    En utilisant l'outil, vous comprenez et acceptez ces conditions.

    " \ No newline at end of file +

    En utilisant l'outil, vous comprenez et acceptez ces conditions.

    " + + public_plans_page: + title: "DMP publics" + no_plans_body_text_html: "Aucun DMP n'a été rendu public." + body_text_html: "Les DMP publics sont des plans créés à l'aide de DMPTool et partagés publiquement par leurs propriétaires. Ils ne sont pas vérifiés pour la qualité, l'exhaustivité ou l'adhésion aux lignes directrices des bailleurs de fonds." diff --git a/config/routes.rb b/config/routes.rb index 59286ba..44a4334 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -47,8 +47,10 @@ get "help" => 'static_pages#help' get "roadmap" => 'static_pages#roadmap' get "terms" => 'static_pages#termsuse' + get "public_plans" => 'static_pages#public_plans' + get "public_export/:id" => 'static_pages#public_export', as: 'public_export' + get "existing_users" => 'existing_users#index' - get "public_plans" => 'projects#public_plans' #post 'contact_form' => 'contacts', as: 'localized_contact_creation' #get 'contact_form' => 'contacts#new', as: 'localized_contact_form' @@ -148,7 +150,6 @@ member do get 'share' get 'export' - get 'public_export' post 'invite' end collection do diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 55855ef..260bdb7 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -1,55 +1,6 @@ require 'test_helper' class ProjectsControllerTest < ActionDispatch::IntegrationTest - - include Devise::Test::IntegrationHelpers - - setup do - @project = Project.first - - @test_visibility = Visibility.find_by(name: 'test') - @public_visibility = Visibility.find_by(name: 'public') - end - - # ---------------------------------------------------------- - test "should export the publicly available plan" do - @project.visibility = @public_visibility - @project.save! - -# get public_export_project_path(locale: I18n.locale, id: @project) - - # Should be redirected to the plans controller's export function -# assert_redirected_to "#{export_project_plan_path(@project, @project.plans.first)}", "expected to be redirected to the exported plan" -# follow_redirect! - -# assert_redirected_to "blah" -# assert_response :success -# assert_equal Mime::PDF, response.content_type - end - - # ---------------------------------------------------------- - test "should NOT export a non-public plan to unauthorized users" do - # Set the is_public flag to false and try to access it when not logged in - @project.visibility = @test_visibility - @project.save! - - get public_export_project_path(locale: I18n.locale, id: @project) - - assert_redirected_to "#{root_path}?locale=#{I18n.locale}", "expected to be redirected to the home page!" - assert_equal I18n.t('helpers.settings.plans.errors.no_access_account'), flash[:notice], "Expected an unauthorized message when trying to export a plan (via the public_export route) when the plan is not actually public" - - # Set the is_public flag to false and assign ownership to a different user and then try to access it as a non-owner - @project.assign_creator(User.last) - @project.save! - - sign_in User.first - - get public_export_project_path(locale: I18n.locale, id: @project) - - assert_redirected_to "#{root_path}?locale=#{I18n.locale}", "expected to be redirected to the home page!" - assert_equal I18n.t('helpers.settings.plans.errors.no_access_account'), flash[:notice], "Expected an unauthorized message when trying to export a plan (via the public_export route) when the plan is not actually public" - end - =begin test "should get index" do diff --git a/test/routing_test.rb b/test/routing_test.rb index ac6f955..eeb10a6 100644 --- a/test/routing_test.rb +++ b/test/routing_test.rb @@ -29,18 +29,15 @@ target = {controller: "static_pages", action: "termsuse", locale: "#{I18n.locale}"} assert_routing terms_path(locale: I18n.locale), target end - - # Routing for Public DMPs - # ------------------------------------------------------------------- - test 'GET /public_plans should resolve to ProjectsController#public_plans' do - target = {controller: "projects", action: "public_plans", locale: "#{I18n.locale}"} + test 'GET /public_plans should resolve to StaticPagesController#public_plans' do + target = {controller: "static_pages", action: "public_plans", locale: "#{I18n.locale}"} assert_routing public_plans_path(locale: I18n.locale), target end - test 'GET /projects/[:project_id]/plans/[:id]/public_export should resolve to PlansController#public_export' do + test 'GET /public_export should resolve to StaticPagesController#public_export' do project = Project.includes(:plans).where.not(plans: {id: nil}).first - target = {controller: "projects", action: "public_export", locale: "#{I18n.locale}", id: project.id.to_s} + target = {controller: "static_pages", action: "public_export", locale: "#{I18n.locale}", id: project.id.to_s} - assert_routing public_export_project_path(locale: I18n.locale, id: project), target + assert_routing public_export_path(locale: I18n.locale, id: project), target end # OAuth - Based on providers identified in the en-UK locale file