diff --git a/.gitignore b/.gitignore index f5f202d..9bc8727 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,10 @@ public/system/* public/videos/* +# Ignore PO/POT backups +*.po.bak +*.pot.bak + # Ignore branded content #app/views/branded/* app/assets diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8071ec0..27731cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,66 +3,154 @@ These guidelines are an attempt to ensure that we are able to provide the community with a reliable system, stable APIs, a clear roadmap, and a predictable release schedule. -* If you would like to contribute to the project, please follow these steps to submit a contribution: - * Comment on the Github issue (or create one if one does not exist) and let us know that you're working on it. - * Fork the project (if you have not already) or rebase your fork so that it is up to date with the current repository's **`contributions`** branch - * Create a new branch in your fork. This will ensure that you are able to work at your own pace and continue to pull in any updates made to this project. - * Make your changes in the new branch. When you have finished your work (e.g. 3 commits), squash all the commits on the branch that you are working on: - ```bash - git rebase -i HEAD~n # Where n is the number of commits you want to squash - ``` - This command's output will look similar to this: - ``` - pick 819b37a First commit in the feature branch. - pick 8634c87 More changes in the feature branch. - pick 59df9aa Third commit in feature branch. - - # Rebase 6c51182..59df9aa onto 6c51182 - ``` - Leave the first commit as `pick` and change `pick` to `squash` for all following commits (to squash them into the single first commit), like so: - ``` - pick 819b37a First commit in the feature branch. - squash 8634c87 More changes in the feature branch. - squash 59df9aa Third commit in feature branch. - - # Rebase 6c51182..59df9aa onto 6c51182 - ``` - Then, change `pick` to `squash` for the 2nd and 3rd commits (to squash them into the single first commit). - * To make sure that your version of the **`contributions`** branch is still up to date with this project, switch to it and synchronise: - ```bash - git checkout contributions - git pull origin contributions - ``` - * Switch back to your feature branch and rebase: - ```bash - git checkout - git rebase contributions - ``` - * Fix merge conflicts (if any encountered) and then push to your fork: - ```bash - git push origin - ``` - * Then create a new Pull Request (PR) to this project's **`contributions`** branch on GitHub. - * The project team will then review your PR and communicate with you to convey any additional changes that would ensure that your work adheres to our guidelines. - * Delete your feature branch if it is not required anymore. - -Table of contents: -* [Github Workflow](#github-workflow) -* [Pull Requests](#pull-requests) -* [Testing Guidelines](#testing-guidelines) -* [Coding Style/Guidelines](#coding-style) - -## GitHub Workflow A contribution consists of any work that is voluntarily submitted to the project. This includes bug fixes, enhancements and documentation that is intended as an improvement to the DMP Roadmap system. -Any individual with a GitHub account may propose a Contribution by submitting a Pull Request (PR) to this project's **`contributions`** branch. The project team will evaluate each PR as time permits and communicate with the contributor via comments on the PR. We will not accept a contribution until it adheres to the guidelines outlined in this document. If your contribution fits well with the project roadmap, the team will merge it into the project and schedule it for the next upcoming release. +### Let us know that you'll be working on the issue! -![GitHub Workflow ](https://github.com/DMPRoadmap/roadmap/blob/master/public/github-contributor-infographic-final.png) +If you would like to contribute a feature or bug fix, let us know by commenting on the ticket. We can track the ticket and ensure that no one else is working on it at the same time. -## Pull Requests -Please use these checklists to help you prepare your Pull Request for submission. +### Forking the repository -ALL Pull Requests MUST be made to the **`contributions`** branch! +If you would like to contribute to the project and have not yet forked the codebase, click on the 'Fork' button in the upper right hand corner of this page. This will create a copy of the DMPRoadmap repository for you to work with. + +Once the fork has been created, clone the repository onto your machine. See Github's (documentation on cloning)[https://help.github.com/articles/cloning-a-repository/]. + +On your local machine, add a remote that points to the original DMPRoadmap codebase. This will allow you to pull down the latest changes and sync up your forked repository + +Run the following from your local clone of the repository to setup a remote that will allow you to pull down the latest changes from DMPRoadmap. Then pull down the contributions branch: +```bash +git remote add upstream https://github.com/DMPRoadmap/roadmap.git +git fetch contributions +``` + +### Pulling down the latest changes from DMPRoadmap into your fork + +If you've already forked the project, you should make sure you pull down the latest changes before working on yoour feature, bug fix or translations. + + + +### Create a new feature/bug fix/translations branch + +You should always base your new branch off of the contributions branch. We keep this branch up to date with the latest release. Checkout the contributions branch, sync it with DMPRoadmap and then push the latest up to your own fork: + +```bash +git checkout contributions +git pull upstream contributions +git push origin contributions +git checkout -b [my-branch] +``` + +The name of the branch is up to you. Once your branch has been created you can start making changes. + +Please refer to the pull request checklists below to make sure you've included everything we require in your PR! + +### Rebase your commits + +This is only necessary if you have made more than one git commit on your feature branch. + +When you are finished making changes, we ask that all contributors squash their commits into a single git commit. This helps us keep the git history clean and makes it easier to revert any changes if necessary. + +_Note that if this is your first time rebasing a branch we recommend making a buckup of the branch first since a rebase creates the potential for you to lose your changes if its done incorrectly: `git checkout -b [feature branch]-bak && git checkout [feature branch]`_ + +To rebase your feature branch you should follow this example: + +First locate the last commit that occurred before your changes were made in the feature branch by using `git log`. Here is an of a recent bug fix branch: +```bash +commit c74a4ecdb37c0d4396e97db019f35d8a5000d069 (HEAD -> issue1603) +Author: John Doe +Date: Fri Jun 15 13:33:27 2018 -0700 + + added isActiveTab for profile and reference pages + +commit 2b003da459cc5d605dda534898ea4bf89b4f2172 +Author: John Doe +Date: Fri Jun 15 13:26:40 2018 -0700 + + fixed issue with active tabs + +commit bd9b31d8ca1dcee5e82639dfd9b41a4e2618e2bc (upstream/development, development) +Merge: f4d058df 7ca739e3 +Author: Another Developer +Date: Fri Jun 14 09:20:41 2018 +0100 + + Merge pull request #1610 from CDLUC3/issue1333 +``` + +In the git log above, the developer has made two commits ('fixed issue with active tabs' and 'added isActiveTab for profile and reference pages'). Before they contribute this bug fix back to the core codebase they need to squash those 2 commits into one. To do that, they should copy the last commit id for the commit that happened before they started making changes. In this case they would copy 'bd9b31d8ca1dcee5e82639dfd9b41a4e2618e2bc' from the 'Merge pull request #1610 from CDLUC3/issue1333' commit. + +Once you've identified the correct commit id run the rebase command with the '-i' flag: ` git rebase -i bd9b31d8ca1dcee5e82639dfd9b41a4e2618e2bc` + +This will open an editor window that will ask you to pick/squash your commits. You should always 'pick' the first one in the list and 'squash' all others. So in our example: +```bash +pick 2b003da4 fixed issue with active tabs +pick c74a4ecd added isActiveTab for profile and reference pages <--- Change this one to 'squash' + +# Rebase bd9b31d8..c74a4ecd onto bd9b31d8 (2 commands) +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup = like "squash", but discard this commit's log message +# x, exec = run command (the rest of the line) using shell +# d, drop = remove commit +# +# These lines can be re-ordered; they are executed from top to bottom. +# +# If you remove a line here THAT COMMIT WILL BE LOST. +# +# However, if you remove everything, the rebase will be aborted. +# +# Note that empty commits are commented out +``` + +After you have saved your options, a second merge window will open. This is a normal merge/rebase message. You can adjust the comments in this second window if you like and save. + +Now your code changes have been rebased into a single commit. To verify that things worked properly do another `git log`. You should see all of your commit messages under a single commit now. For our example, we will now see: + +```bash +commit c691ed712a5d09cf1a9adb8b4e0be92f2bf94641 (HEAD -> issue1603) +Author: John Doe +Date: Fri Jun 15 13:26:40 2018 -0700 + + fixed issue with active tab <--- Our first commit (the one we picked) + + added isActiveTab for profile and reference pages + +commit bd9b31d8ca1dcee5e82639dfd9b41a4e2618e2bc (upstream/development, development) +Merge: f4d058df 7ca739e3 +Author: Another Developer +Date: Fri Jun 14 09:20:41 2018 +0100 + + Merge pull request #1610 from CDLUC3/issue1333 +``` + +### Push your branch up to your fork and send us a Pull Request (PR) + +Once your changes are complete, push your branch up to your fork, `git push origin [my-branch]` + +Then login to Github and go to your fork. Select your branch from the list and click 'New Pull Request'. On the page that opens, select the 'contributions' branch on the DMPRoadmap section. + +Then review your code and provide us with detailed comments about what the changes are doing (e.g. adding a new feature, fixing a recorded bug, etc.). If you are working off of one of our Github issues, then please note that in the PR message with a `Fixes #1234`. + +The project team will evaluate each PR as time permits and communicate with the contributor via comments on the PR. We will not accept a contribution until it adheres to the guidelines outlined in this document. If your contribution fits well with the project roadmap, the team will merge it into the project and schedule it for the next upcoming release. + +### Code review + +Once we receive your PR, at lest one member of the core development team will review the code and provide you with feedback through GitHub PR review feature. If any changes are requested, you should follow the process above to commit your additional changes, rebase again, and push your changes back up to Github. You do not need to close the PR and open another if you are working with the same branch. Note that if you rebase again you will need to force the push: `git push -f origin [my-branch]` + +### Acceptence of your PR + +Once your code has been approved a member of the core development team will merge it into the contributions branch and then into development when we are ready to include it in a sprint. + +At this point its a good idea to delete the branch from your fork in Github and also delete it from your local machine via: +```bash +git checkout contributions +git branch -D [my-branch] +``` + +### Pull Request Checklists #### Checklist for changes to a database table and/or its corresponding model * Did you include the appropriate database migration? ```> rails g migration AddTwitterIdToUsers``` @@ -82,80 +170,3 @@ * Did you update the corresponding controller? * Did you manually test the change in multiple browsers? * Did your change require modifications to the CSS, JS or image files? If so did you include them in your branded file locations or in the core system files? For example: lib/assets/javascripts is the default javascript directory. app/assets/javascripts are specific to your local installation. (See [Branding](https://github.com/DMPRoadmap/roadmap/wiki/Branding) for more information) - -## Testing Guidelines -First and foremost, all of the existing tests must pass before we accept your contribution. If your work has made a change to an object that results in failed tests then you should update those tests so that they are accurate. - -To run the tests: -```shell -# Make sure that your test DB has all of the current database migrations: -> rake db:migrate RAILS_ENV=test - -# To run all of the tests: -> rake test -# To run all of a specific type of tests: -> rake test test/unit/ -# To run a specific test: -> rake test test/unit/users_test.rb -``` - -If you are adding a new feature to the system you must build out the appropriate tests before we will accept your contribution. For example, if I add a new field to the User table that stores the user's Twitter id, I should update the test/unit/users_test.rb Unit test. If my contribution included changes to the User Profile page that allowed the user to enter this new Twitter id then I should update the test/functional/registrations_controller_test.rb Functional controller test. - -DMP Roadmap uses the Travis CI framework to verify that are tests are passing. When you create your PR you will see a note stating that the tests are pending. Check back after a few minutes to give the Travis system time to run its tests. - -**Please Note:** We will not review your PR until the tests are passing and GitHub notes that there are no merge conflicts - -The original DMP Roadmap codebase did not include a full suite of tests. The project team has been busy adding them in when we can but we still have a long way to go. The requirements mentioned above are in place for pieces of the system that already have tests. For example, if your work involves an enhancement to an existing controller that has no functional test in the current codebase, we do not expect you to write tests for the entire controller (although we would welcome the help!). In cases like this, we only ask that you write tests for the endpoints that you have updated. - -We do not currently have testing for the UI components. We plan to add tests for these in the near future using a headless browser like PhantomJS. We welcome any contributors who are willing to begin work in this area! - -#### Unit tests: -* The model can be Created, Read/Loaded, Updated and Deleted (CRUD) -* Required fields are required and that the model cannot be saved without those fields -* Any other validations are working as expected (e.g. email address is in the email format) -* Associations are functioning properly. Use the helper methods in test/test_helper.rb -* All other functions that are defined within the model are tested -* You should update or create the corresponding fixtures for the model you are testing - -#### Functional Controller tests: -* The correct HTTP response was received (200 success, 302 redirect, 401 unauthorized, etc.) -* The user was redirected to the correct page (if applicable) -* All of the instance variables set within the controller were properly defined -* All flash messaging is correct - -#### Integration tests: -* Complex workflows that involve multiple pieces of the system should have an integration test. This can include interaction with gem dependencies or external services. For example email, login/logout, etc. - -#### Helper/Service tests: -* Each method within the helper or service should be tested for both success and failure conditions - -#### Routing tests: -New controller/API endpoints should have tests within the test/routing_test.rb - -#### General Notes and Advice: -* You should use the Rails URL and Path helpers instead of hard-coding them in your tests. (e.g. edit_plans_path(@plan) instead of '/plans/123/edit' -* You should use the I18n.t method to validate flash messaging rather than hard-coding messages in your tests -* You should include assertions that test both success and failure conditions - -## Coding style -We realize that every developer has their own style and we encourage a bit of individuality. However, we do impose some of the following rules to contributions to this project. - -* We quite like the principle of [DRY (Don't Repeat Yourself)](https://en.wikipedia.org/wiki/Don't_repeat_yourself) so please always look through the existing code to make sure you are not reinventing something that has already been done. Also clever bits of code or reuse of existing ones to avoid copying and pasting is always appreciated. -* Include database migrations when you are altering the database model. Use the following command to create a new migration and be specific about what it does in the name of the file - - ```shell - > rails g migration AddTwitterIdToUsers - ``` -* You do not need to comment every line of your code but we do expect to see inline comments explaining the intent of your if blocks and loops. -* We do not want to see Tab characters. Tabs should be converted to a double space. If you are working on a file that has Tabs already, please convert them for us before making your Pull Request -* If a line is going to go beyond 100 characters please break it out onto multiple lines. For example: - - ```ruby - # This is preferable - users = [{email: @user.email, password: 'bAd_pas$word1', remember_me: true}, - {email: 'unknown@institution.org', password: 'password123', remember_me: true}] - - # to this long line that requires scrolling - users = [{email: @user.email, password: 'bAd_pas$word1', remember_me: true}, {email: 'unknown@institution.org', password: 'password123', remember_me: true}] - ``` -* Finally, please make sure your code is properly indented as this enhances readability. diff --git a/Gemfile b/Gemfile index 9a2e7b1..f771b53 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,6 @@ gem 'contact_us' # COULD BE EASILY REPLACED WITH OUR OWN CODE gem 'recaptcha' gem 'dragonfly' # LOGO UPLOAD -gem 'formtastic' # ------------------------------------------------ # EXPORTING diff --git a/Gemfile.lock b/Gemfile.lock index 2c2ea35..29f1a92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,8 +84,6 @@ loofah (>= 2.0) sax-machine (>= 1.0) flag_shih_tzu (0.3.19) - formtastic (3.1.5) - actionpack (>= 3.2.13) gettext (3.2.9) locale (>= 2.0.5) text (>= 1.3.0) @@ -257,7 +255,6 @@ dragonfly feedjira flag_shih_tzu - formtastic gettext gettext_i18n_rails gettext_i18n_rails_js diff --git a/README.md b/README.md index d439328..b697a06 100644 --- a/README.md +++ b/README.md @@ -10,20 +10,18 @@ 4. To allow collaborative work when creating Data Management Plans. #### Current Release -Official release coming soon! +[v1.1.3](https://github.com/DMPRoadmap/roadmap/releases/tag/v1.1.3) [![Build Status](https://travis-ci.org/DMPRoadmap/roadmap.svg)](https://travis-ci.org/DMPRoadmap/roadmap) -#### Summary - #### Pre-requisites -Roadmap is a Ruby on Rails application and you will need to have: -* Ruby >= 2.2.2 +Roadmap is a Ruby on Rails application and you will need to have: +* Ruby >= 2.4.4 * Rails >= 4.2 * MySQL >= 5.0 OR PostgreSQL Further detail on how to install Ruby on Rails applications are available from the Ruby on Rails site: http://rubyonrails.org -Further details on how to install MySQL and create your first user and database. Be sure to follow the instructions for your particular environment. +Further details on how to install MySQL and create your first user and database. Be sure to follow the instructions for your particular environment. * Install: http://dev.mysql.com/downloads/mysql/ * Create a user: http://dev.mysql.com/doc/refman/5.7/en/create-user.html * Create the database: http://dev.mysql.com/doc/refman/5.7/en/creating-database.html @@ -34,45 +32,7 @@ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/ #### Installation -* Create your database. Select UTF-8 Unicode encoding (`utf8mb4` if using MySQL). -* Clone this repository (or Fork the repository first if you plan on contributing) - -> > git clone https://github.com/[your organization]/roadmap.git - -> > cd roadmap - -* Make copies of the yaml configuration files and update the values for your installation - -> > cp config/database_example.yml config/database.yml -> > cp config/secrets_example.yml config/secrets.yml - -* Make copies of the example gem initializer files and update the values for your installation - -> > cp config/initializers/devise.rb.example config/initializers/devise.rb -> > cp config/initializers/recaptcha.rb.example config/initializers/recaptcha.rb -> > cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb -> > cp config/locales/*.static.yml.example config/locales/*.static.yml - -* Create an environment variable for your instance's secret (as defined in config/secrets.yml). You should use the following command to generate secrets for each of your environments, storing the production one in the environment variable: - -> > rake secret - -* Run bundler and perform the DB migrations - -> > gem install bundler (if bundler is not yet installed) - -> > bundle install - -> > rake db:schema:load - -> > rake db:seed (Unless you are migrating data from an old DMPOnline system) - -* Start the application - -> > rails server - -* Verify that the site is running properly by going to http://localhost:3000 -* Login as the default administrator: 'super_admin@example.com' - 'password123' +See the [Installation Guide](https://github.com/DMPRoadmap/roadmap/wiki/Installation) on the Wiki #### Troubleshooting See the [Troubleshooting Guide](https://github.com/DMPRoadmap/roadmap/wiki/Troubleshooting) on the Wiki @@ -88,7 +48,7 @@ * Create a new branch in your fork. This will ensure that you are able to work at your own pace and continue to pull in any updates made to this project. * Make your changes in the new branch * When you have finished your work, make sure that your version of the '_**development**_' branch is still up to date with this project. Then merge your new branch into your '_**development**_' branch. -* Then create a new Pull Request (PR) to this project's '_**contributions**_' branch in GitHub +* Then create a new Pull Request (PR) to this project's '_**contributions**_' branch in GitHub * The project team will then review your PR and communicate with you to convey any additional changes that would ensure that your work adheres to our guidelines. See the [Contribution Guide](https://github.com/DMPRoadmap/roadmap/wiki/Contributing) on the Wiki for more details diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index 07e82cd..28b3fe3 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -10,8 +10,7 @@ p = Plan.find(p_params[:plan_id]) if !p.question_exists?(p_params[:question_id]) render(status: :not_found, json: - { msg: _("There is no question with id %{question_id} associated to plan id %{plan_id}"\ - "for which to create or update an answer") %{ :question_id => p_params[:question_id], :plan_id => p_params[:plan_id] }}) + { msg: _("There is no question with id %{question_id} associated to plan id %{plan_id} for which to create or update an answer") % { :question_id => p_params[:question_id], :plan_id => p_params[:plan_id] }}) return end rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/concerns/paginable.rb b/app/controllers/concerns/paginable.rb index d07f4d4..0c58199 100644 --- a/app/controllers/concerns/paginable.rb +++ b/app/controllers/concerns/paginable.rb @@ -55,7 +55,7 @@ # Generates an HTML link to sort given a sort field. # sort_field {String} - Represents the column name for a table def paginable_sort_link(sort_field) - return link_to(sort_link_name(sort_field), sort_link_url(sort_field), 'data-remote': true, class: 'paginable-action') + return link_to(sort_link_name(sort_field), sort_link_url(sort_field), 'data-remote': true, class: 'paginable-action', "aria-label": "#{sort_field}") end # Determines whether or not the latest request included the search functionality def searchable? diff --git a/app/controllers/org_admin/questions_controller.rb b/app/controllers/org_admin/questions_controller.rb index 58a6ce5..555b105 100644 --- a/app/controllers/org_admin/questions_controller.rb +++ b/app/controllers/org_admin/questions_controller.rb @@ -70,6 +70,8 @@ # modifiable (versioned) question attrs = question_params attrs = transfer_associations(question) if question.id != params[:id] + # If the user unchecked all of the themes set the association to an empty array + attrs[:theme_ids] = [] unless attrs[:theme_ids].present? if question.update!(attrs) flash[:notice] = success_message(_('question'), _('updated')) else diff --git a/app/controllers/org_admin/templates_controller.rb b/app/controllers/org_admin/templates_controller.rb index 826dcd1..56ff633 100644 --- a/app/controllers/org_admin/templates_controller.rb +++ b/app/controllers/org_admin/templates_controller.rb @@ -16,7 +16,7 @@ title: _('All Templates'), templates: templates.includes(:org), action: 'index', - query_params: { sort_field: :title, sort_direction: :asc }, + query_params: { sort_field: 'templates.title', sort_direction: 'asc' }, all_count: templates.length, published_count: published.present? ? published : 0, unpublished_count: published.present? ? (templates.length - published): templates.length @@ -36,7 +36,7 @@ title: title, templates: templates, action: 'organisational', - query_params: { sort_field: :title, sort_direction: :asc }, + query_params: { sort_field: 'templates.title', sort_direction: 'asc' }, all_count: templates.length, published_count: published.present? ? published : 0, unpublished_count: published.present? ? (templates.length - published): templates.length @@ -60,7 +60,7 @@ templates: funder_templates, customizations: customizations, action: 'customisable', - query_params: { sort_field: :title, sort_direction: :asc }, + query_params: { sort_field: 'templates.title', sort_direction: 'asc' }, all_count: funder_templates.length, published_count: published.present? ? published : 0, unpublished_count: published.present? ? (customizations.length - published): customizations.length, @@ -181,6 +181,7 @@ templates = Template.where(family_id: template.family_id) render 'history', locals: { templates: templates, + query_params: { sort_field: 'templates.version', sort_direction: 'desc' }, referrer: template.customization_of.present? ? customisable_org_admin_templates_path : organisational_org_admin_templates_path, current: templates.maximum(:version) } diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index 82c83a8..ccc0c8d 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -77,11 +77,11 @@ # POST /orgs/shibboleth_ds # ---------------------------------------------------------------- def shibboleth_ds_passthru - if !params[:org_name].blank? - session['org_id'] = params[:org_name] + if !params['shib-ds'][:org_name].blank? + session['org_id'] = params['shib-ds'][:org_name] scheme = IdentifierScheme.find_by(name: 'shibboleth') - shib_entity = OrgIdentifier.where(org_id: params[:org_name], identifier_scheme: scheme) + shib_entity = OrgIdentifier.where(org_id: params['shib-ds'][:org_id], identifier_scheme: scheme) if !shib_entity.empty? # Force SSL diff --git a/app/controllers/paginable/plans_controller.rb b/app/controllers/paginable/plans_controller.rb index 31f920c..2588117 100644 --- a/app/controllers/paginable/plans_controller.rb +++ b/app/controllers/paginable/plans_controller.rb @@ -18,8 +18,10 @@ end # GET /paginable/plans/publicly_visible/:page def publicly_visible - paginable_renderise(partial: 'publicly_visible', - scope: Plan.publicly_visible) + paginable_renderise( + partial: 'publicly_visible', + scope: Plan.publicly_visible + ) end # GET /paginable/plans/org_admin/:page def org_admin diff --git a/app/controllers/public_pages_controller.rb b/app/controllers/public_pages_controller.rb index 70920d4..b411803 100644 --- a/app/controllers/public_pages_controller.rb +++ b/app/controllers/public_pages_controller.rb @@ -82,6 +82,7 @@ # GET /plans_index # ------------------------------------------------------------------------------------ def plan_index - @plans = Plan.publicly_visible.order(:title => :asc).page(1) + @plans = Plan.publicly_visible.page(1) + render 'plan_index', locals: { query_params: { sort_field: 'plans.updated_at', sort_direction: 'desc' } } end end diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index eb7baf2..3d69e9e 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -55,7 +55,7 @@ deliver_if(recipients: @role.user, key: 'users.added_as_coowner') do |r| UserMailer.permissions_change_notification(@role, current_user).deliver_now end - render json: {code: 1, msg: "Successfully changed the permissions for #{@role.user.email}. They have been notified via email."} + render json: {code: 1, msg: _("Successfully changed the permissions for #{@role.user.email}. They have been notified via email.")} else render json: {code: 0, msg: flash[:alert]} end diff --git a/app/controllers/super_admin/users_controller.rb b/app/controllers/super_admin/users_controller.rb index 051ce42..c0640a3 100644 --- a/app/controllers/super_admin/users_controller.rb +++ b/app/controllers/super_admin/users_controller.rb @@ -41,7 +41,7 @@ private def user_params - params.require(:super_admin_user).permit(:email, :firstname, :surname, :org_id, :language_id) + params.require(:user).permit(:email, :firstname, :surname, :org_id, :language_id, :other_organisation) end end end \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5482157..b35f965 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -161,7 +161,7 @@ private def org_swap_params - params.require(:superadmin_user).permit(:org_id, :org_name) + params.require(:user).permit(:org_id, :org_name) end ## diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 992c6ab..a2a6012 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,4 +37,8 @@ def fingerprinted_asset(name) Rails.env.production? ? "#{name}-#{ASSET_FINGERPRINT}" : name end + + def title(page_title) + content_for(:title) { page_title } + end end diff --git a/app/models/concerns/exportable_plan.rb b/app/models/concerns/exportable_plan.rb index ef9dab8..f4cec41 100644 --- a/app/models/concerns/exportable_plan.rb +++ b/app/models/concerns/exportable_plan.rb @@ -23,7 +23,7 @@ phase[:sections].each do |section| section[:questions].each do |question| answer = self.answer(question[:id], false) - answer_text = answer.present? ? answer.text : (unanswered ? 'Not Answered' : '') + answer_text = answer.present? ? answer.text : (unanswered ? _('Not Answered') : '') flds = (hash[:phases].length > 1 ? [phase[:title]] : []) if headings if question[:text].is_a? String diff --git a/app/models/exported_plan.rb b/app/models/exported_plan.rb index fc29f16..969f532 100644 --- a/app/models/exported_plan.rb +++ b/app/models/exported_plan.rb @@ -145,7 +145,7 @@ def as_txt(sections, unanswered_questions, question_headings, details) output = "#{self.plan.title}\n\n#{self.plan.template.title}\n" - output += "\n"+_('Details')+"\n\n" + output += "\n"+ _('Details') +"\n\n" if details self.admin_details.each do |at| value = self.send(at) @@ -171,7 +171,7 @@ output += "\n* #{qtext}" end if answer.nil? - output += _('Question not answered.')+ "\n" + output += _('Question not answered.') + "\n" else q_format = question.question_format if q_format.option_based? diff --git a/app/models/org.rb b/app/models/org.rb index 80cf63d..d095160 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -34,7 +34,6 @@ :feedback_enabled, :feedback_email_subject, :feedback_email_msg ## # Validators -# validates :contact_email, email: true, allow_nil: true validates :name, presence: {message: _("can't be blank")}, uniqueness: {message: _("must be unique")} # allow validations for logo upload dragonfly_accessor :logo do diff --git a/app/models/plan.rb b/app/models/plan.rb index 41a2adb..79c50b6 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -175,23 +175,23 @@ end return ggroups.uniq end - + ## # Sets up the plan for feedback: # emails confirmation messages to owners - # emails org admins and org contact + # emails org admins and org contact # adds org admins to plan with the 'reviewer' Role def request_feedback(user) Plan.transaction do begin val = Role.access_values_for(:reviewer, :commenter).min self.feedback_requested = true - + # Share the plan with each org admin as the reviewer role admins = user.org.org_admins admins.each do |admin| self.roles << Role.new(user: admin, access: val) - end + end if self.save! # Send an email confirmation to the owners and co-owners @@ -199,12 +199,10 @@ deliver_if(recipients: owners, key: 'users.feedback_requested') do |r| UserMailer.feedback_confirmation(r, self, user).deliver_now end - # Send an email to all of the org admins as well as the Org's administrator email - if user.org.contact_email.present? && !admins.collect{ |u| u.email }.include?(user.org.contact_email) - admins << User.new(email: user.org.contact_email, firstname: user.org.contact_name) - end - deliver_if(recipients: admins, key: 'admins.feedback_requested') do |r| - UserMailer.feedback_notification(r, self, user).deliver_now + # Send an email to the org-admin contact + if user.org.contact_email.present? + contact = User.new(email: user.org.contact_email, firstname: user.org.contact_name) + UserMailer.feedback_notification(contact, self, user).deliver_now end true else @@ -226,11 +224,11 @@ Plan.transaction do begin self.feedback_requested = false - - # Remove the org admins reviewer role from the plan + + # Remove the org admins reviewer role from the plan vals = Role.access_values_for(:reviewer) self.roles.delete(Role.where(plan: self, access: vals)) - + if self.save! # Send an email confirmation to the owners and co-owners owners = User.joins(:roles).where('roles.plan_id =? AND roles.access IN (?)', self.id, Role.access_values_for(:administrator)) @@ -260,12 +258,12 @@ def guidance_by_question_as_hash # Get all of the selected guidance groups for the plan guidance_groups_ids = self.guidance_groups.collect(&:id) - guidance_groups = GuidanceGroup.joins(:org).where("guidance_groups.published = ? AND guidance_groups.id IN (?)", + guidance_groups = GuidanceGroup.joins(:org).where("guidance_groups.published = ? AND guidance_groups.id IN (?)", true, guidance_groups_ids) # Gather all of the Themes used in the plan as a hash # { - # QUESTION: [THEME, THEME], + # QUESTION: [THEME, THEME], # QUESTION: [THEME] # } question_themes = {} @@ -279,7 +277,7 @@ # Gather all of the Guidance available for the themes used in the plan as a hash # { # THEME: { - # GUIDANCE_GROUP: [GUIDANCE, GUIDANCE], + # GUIDANCE_GROUP: [GUIDANCE, GUIDANCE], # GUIDANCE_GROUP: [GUIDANCE] # } # } @@ -287,12 +285,12 @@ GuidanceGroup.includes(guidances: :themes).joins(:guidances). where('guidance_groups.published = ? AND guidances.published = ? AND themes.title IN (?) AND guidance_groups.id IN (?)', true, true, themes_used, guidance_groups.collect(&:id)). pluck('guidance_groups.name', 'themes.title', 'guidances.text').each do |tg| - + theme_guidance[tg[1]] = {} unless theme_guidance[tg[1]].present? theme_guidance[tg[1]][tg[0]] = [] unless theme_guidance[tg[1]][tg[0]].present? theme_guidance[tg[1]][tg[0]] << tg[2] unless theme_guidance[tg[1]][tg[0]].include?(tg[2]) end - + # Generate a hash for the view that contains all of a question guidance # { # QUESTION: { @@ -310,11 +308,11 @@ question_themes[question].each do |theme| groups << theme_guidance[theme].keys if theme_guidance[theme].present? end - + # Loop through all of the applicable guidance groups and collect their themed guidance groups.flatten.uniq.each do |guidance_group| guidances_by_theme = {} - + # Collect all of the guidances for each theme used by the question question_themes[question].each do |theme| if theme_guidance[theme].present? && theme_guidance[theme][guidance_group].present? @@ -325,10 +323,10 @@ ggs[guidance_group] = guidances_by_theme unless ggs[guidance_group] end - + question_guidance[question] = ggs end - + question_guidance end @@ -350,8 +348,8 @@ def readable_by?(user_id) user = user_id.is_a?(User) ? user_id : User.find(user_id) owner_orgs = self.owner_and_coowners.collect(&:org) - - # Super Admins can view plans read-only, Org Admins can view their Org's plans + + # Super Admins can view plans read-only, Org Admins can view their Org's plans # otherwise the user must have the commenter role (user.can_super_admin? || user.can_org_admin? && owner_orgs.include?(user.org) || @@ -650,7 +648,7 @@ ## # returns the shared roles of a plan, excluding the creator def shared - role_values = Role.where(plan: self).where(Role.not_creator_condition).any? + role_values = Role.where(plan: self).where(Role.not_creator_condition).any? end ## @@ -768,7 +766,7 @@ .includes({ question: :question_format }, :question_options) .where(id: answer_ids) num_answers = pre_fetched_answers.reduce(0) do |m, a| - if a.is_valid? + if a.is_valid? m+=1 end m diff --git a/app/views/contact_us/contacts/new.html.erb b/app/views/contact_us/contacts/new.html.erb index f98ec59..5fd93e4 100644 --- a/app/views/contact_us/contacts/new.html.erb +++ b/app/views/contact_us/contacts/new.html.erb @@ -1,3 +1,4 @@ +<% title _('Contact Us') %>

<%= _("Contact Us") %>

diff --git a/app/views/devise/invitations/edit.html.erb b/app/views/devise/invitations/edit.html.erb index 255dcfd..9698605 100644 --- a/app/views/devise/invitations/edit.html.erb +++ b/app/views/devise/invitations/edit.html.erb @@ -1,3 +1,4 @@ +<% title _('Create an account to view the plan') %>

<%= _("Create an account to view the plan") %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index cabaa15..e7788b9 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,3 +1,4 @@ +<% title _('Change your password') %>

<%= _('Change your password') %>

diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index a4bfb2e..3b08103 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,3 +1,4 @@ +<% title _('Forgot your password?') %>
<% unless @user.errors[:email].empty? %> diff --git a/app/views/devise/registrations/_personal_details.html.erb b/app/views/devise/registrations/_personal_details.html.erb index 7ab72c1..19c1d10 100644 --- a/app/views/devise/registrations/_personal_details.html.erb +++ b/app/views/devise/registrations/_personal_details.html.erb @@ -1,7 +1,6 @@ -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put, id: 'personal_details_registration_form' }) do |f| %> +<%= form_for(resource, namespace: current_user.id, as: resource_name, url: registration_path(resource_name), html: {method: :put, id: 'personal_details_registration_form' }) do |f| %>

- <%= raw _("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.") %> + <%= raw _("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.") %>

<%= _('You can edit any of the details below.') %>

@@ -25,7 +24,7 @@ <% org_admin = (current_user.can_org_admin? && !current_user.can_super_admin?) %>
> - <%= render partial: "shared/my_org", locals: {f: f, default_org: @default_org, orgs: @orgs, allow_other_orgs: true} %> + <%= render partial: "shared/my_org", locals: {f: f, default_org: @default_org, orgs: @orgs, allow_other_orgs: true, required: true} %>
<% if org_admin %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 75e0d7f..5885361 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,3 +1,4 @@ +<% title _('Edit profile') %>

<%= _('Edit profile') %>

diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb index 1730ddd..ec5def9 100644 --- a/app/views/guidance_groups/admin_edit.html.erb +++ b/app/views/guidance_groups/admin_edit.html.erb @@ -1,7 +1,10 @@ +<% title _('Guidance group') %>

<%= _('Guidance group') %>

- <%= link_to _('View all guidance'), admin_index_guidance_path(current_user.org_id), class: 'btn btn-default pull-right' %> +
@@ -11,7 +14,7 @@
<%= f.label _('Name'), for: :name, class: "control-label" %> - <%= f.text_field :name, as: :string, class: "form-control", 'data-toggle': 'tooltip', title: _('Add an appropriate name for your guidance group. This name will tell the end user where the guidance has come from. We suggest you use the organisation or department name e.g. "OU" or "Maths & Stats"') %> + <%= f.text_field :name, as: :string, class: "form-control", 'aria-required': true, 'data-toggle': 'tooltip', title: _('Add an appropriate name for your guidance group. This name will tell the end user where the guidance has come from. We suggest you use the organisation or department name e.g. "OU" or "Maths & Stats"') %>
diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb index 2a65260..e76c43c 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -1,3 +1,4 @@ +<% title _('Guidance group') %>

<%= _('Guidance group') %>

@@ -7,10 +8,10 @@
- <%= form_for :guidance_group, url: {action: "admin_create"}, id: 'admin_create_guidance_group_form' do |f| %> + <%= form_for :guidance_group, url: {action: "admin_create"}, html: {id: 'admin_create_guidance_group_form'} do |f| %>
<%= f.label _('Name'), for: :name, class: "control-label" %> - <%= f.text_field :name, as: :string, class: "form-control", 'data-toggle': 'tooltip', title: _('Add an appropriate name for your guidance group. This name will tell the end user where the guidance has come from. We suggest you use the organisation or department name e.g. "OU" or "Maths & Stats"') %> + <%= f.text_field :name, as: :string, class: "form-control", 'aria-required': true, 'data-toggle': 'tooltip', title: _('Add an appropriate name for your guidance group. This name will tell the end user where the guidance has come from. We suggest you use the organisation or department name e.g. "OU" or "Maths & Stats"') %>
diff --git a/app/views/guidances/admin_index.html.erb b/app/views/guidances/admin_index.html.erb index b2500e8..56190a3 100644 --- a/app/views/guidances/admin_index.html.erb +++ b/app/views/guidances/admin_index.html.erb @@ -1,3 +1,4 @@ +<% title _('Guidance') %>

<%= _('Guidance') %>

@@ -20,7 +21,9 @@ scope: @guidance_groups, query_params: { sort_field: 'guidance_groups.name', sort_direction: :asc }) %>

<%= _('Guidance list') %>

@@ -41,7 +44,9 @@ query_params: { sort_field: 'guidances.text', sort_direction: :asc }) %>
diff --git a/app/views/guidances/new_edit.html.erb b/app/views/guidances/new_edit.html.erb index 8b38a7d..f635228 100644 --- a/app/views/guidances/new_edit.html.erb +++ b/app/views/guidances/new_edit.html.erb @@ -1,8 +1,11 @@ +<% title _('Guidance') %> <%# locals: { guidance, themes, guidance_groups, options } %>

<%= _('Guidance') %>

- <%= link_to _('View all guidance'), admin_index_guidance_path(current_user.org_id), class: 'btn btn-default pull-right' %> +
@@ -10,11 +13,11 @@ <%= form_for(guidance, url: options[:url], html: { method: options[:method] , id: 'new_edit_guidance'}) do |f| %>
<%= f.label :text, class: 'control-label' %> - <%= text_area_tag("guidance-text", guidance.text, class: "tinymce form-control", 'aria-required': true, rows: 10) %> + <%= text_area_tag("guidance-text", guidance.text, class: "form-control", 'aria-required': true, rows: 10) %>
- <%= render partial: 'org_admin/shared/theme_selector', - locals: { f: f, all_themes: themes, - popover_message: _('Select one or more themes that are relevant to this guidance. This will display your generic organisation-level guidance, as well as that from other sources e.g. the %{org_name} guidance or any Schools/Departments that you provide guidance for.') % { org_name: (current_user.org.abbreviation.present? ? current_user.org.abbreviation : current_user.org.name ) } } %> + <%= render partial: 'org_admin/shared/theme_selector', + locals: { f: f, all_themes: themes, as_radio: true, required: true, + popover_message: _('Select one theme that is relevant to this guidance. This will display your generic organisation-level guidance, or any Schools/Departments for which you create guidance groups, across all templates that have questions with the corresponding theme tags.') } %>
<%= f.label _('Guidance group'), for: :guidance_group_id, class: 'control-label' %> <%= f.collection_select(:guidance_group_id, guidance_groups, @@ -25,7 +28,9 @@
<%= f.submit _('Save'), name: "edit_guidance_submit", class: "btn btn-primary" %> - <%= link_to _('Cancel'), admin_index_guidance_path, class: "btn btn-primary", role: 'button' %> +
<%end%>
diff --git a/app/views/home/_welcome.html.erb b/app/views/home/_welcome.html.erb index 6348ccd..7d5ce6a 100644 --- a/app/views/home/_welcome.html.erb +++ b/app/views/home/_welcome.html.erb @@ -1,5 +1,6 @@ +<% title _("Welcome to #{Rails.configuration.branding[:application][:name]}.") %>
-

<%= _('Welcome.')%>

+

<%= _("Welcome to #{Rails.configuration.branding[:application][:name]}.")%>

<%= raw _('

%{application_name} has been developed by the %{organisation_name} to help you write data management plans.

') % {:application_name => Rails.configuration.branding[:application][:name], :organisation_name => Rails.configuration.branding[:organisation][:name]} %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index d5f5b8a..455be9e 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -3,7 +3,7 @@ <%= render partial: "layouts/navigation" %>
- <% if user_signed_in? && !current_user.org.nil? && !current_user.org.is_other %> + <% if user_signed_in? && !current_user.org.nil? && (!current_user.org.is_other || current_user.can_super_admin?) %> <%= render partial: "layouts/branding" , locals: {max_number_links: MAX_NUMBER_LINKS_FUNDER,} %> <% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 21a535a..2e50441 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,10 +1,9 @@ - - <%= _('%{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %> + <title><%= content_for?(:title) ? yield(:title) : _('%{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %> - <%= favicon_link_tag "favicon.ico" %> + <%= favicon_link_tag "favicon.ico" %>
<%= render partial: "layouts/header" %> @@ -54,7 +55,7 @@ %> -
+
<% modifiable = template.latest? && !template.customization_of.present? && template.id.present? && (template.org_id = current_user.org.id) %>
diff --git a/app/views/org_admin/phases/preview.html.erb b/app/views/org_admin/phases/preview.html.erb index cf2638d..051e4b4 100644 --- a/app/views/org_admin/phases/preview.html.erb +++ b/app/views/org_admin/phases/preview.html.erb @@ -1,3 +1,4 @@ +<% title "#{template.title}" %> <% modifiable = template.latest? && !template.customization_of.present? && template.id.present? && (template.org_id = current_user.org.id) %>
diff --git a/app/views/org_admin/plans/index.html.erb b/app/views/org_admin/plans/index.html.erb index cd2ff28..277db0c 100644 --- a/app/views/org_admin/plans/index.html.erb +++ b/app/views/org_admin/plans/index.html.erb @@ -1,3 +1,4 @@ +<% title "#{current_user.org.name} Plans" %>

<%= _('%{org_name} Plans') % { org_name: current_user.org.name } %>

@@ -34,7 +35,9 @@
<% end %> <% if @plans.length > 0 %> - <%= link_to _('Download plans'), org_admin_download_plans_path(format: :csv), target: '_blank', class: 'btn btn-default pull-right' %> + <%= paginable_renderise( partial: '/paginable/plans/org_admin', controller: 'paginable/plans', diff --git a/app/views/org_admin/questions/_form.html.erb b/app/views/org_admin/questions/_form.html.erb index 1c0b621..ccf2757 100644 --- a/app/views/org_admin/questions/_form.html.erb +++ b/app/views/org_admin/questions/_form.html.erb @@ -61,7 +61,7 @@
<%= render partial: 'org_admin/shared/theme_selector', - locals: { f: f, all_themes: Theme.all.order("title"), + locals: { f: f, all_themes: Theme.all.order("title"), as_radio: false, popover_message: _('Select one or more themes that are relevant to this question. This will allow similarly themed organisation-level guidance to appear alongside your question.') } %>
diff --git a/app/views/org_admin/questions/_show.html.erb b/app/views/org_admin/questions/_show.html.erb index 14b11c6..05adce1 100644 --- a/app/views/org_admin/questions/_show.html.erb +++ b/app/views/org_admin/questions/_show.html.erb @@ -54,7 +54,7 @@ <% themes_q = question.themes %> <% if !themes_q.nil? %>
<%= _('Themes')%>
-
<%= themes_q.join(', ') %>
+
<%= themes_q.length <= 0 ? _('No themes selected') : themes_q.join(', ') %>
<% end %>
diff --git a/app/views/org_admin/sections/_form.html.erb b/app/views/org_admin/sections/_form.html.erb index 77ae12c..9c207d1 100644 --- a/app/views/org_admin/sections/_form.html.erb +++ b/app/views/org_admin/sections/_form.html.erb @@ -1,7 +1,7 @@ <%= form_for(section, url: url, namespace: section.id.present? ? section.id : 'new_section', html: { method: method }) do |f| %>
<%= f.label(:title, _('Title') ,class: "control-label") %> - <%= f.text_field(:title, { class: "form-control", 'aria-required': false, placeholder: _('Enter a title for the section'), 'data-toggle': 'tooltip', title: _('Enter a title for the section'), 'aria-required': true} ) %> + <%= f.text_field(:title, { class: "form-control", placeholder: _('Enter a title for the section'), 'data-toggle': 'tooltip', title: _('Enter a title for the section'), 'aria-required': true} ) %>
diff --git a/app/views/org_admin/shared/_theme_selector.html.erb b/app/views/org_admin/shared/_theme_selector.html.erb index 397bc3b..37cae13 100644 --- a/app/views/org_admin/shared/_theme_selector.html.erb +++ b/app/views/org_admin/shared/_theme_selector.html.erb @@ -1,5 +1,11 @@ -<%# locals: all_themes & popover_message %> +<%# locals: all_themes, as_radio & popover_message %> +<% as_radio ||= false %> +<% required ||= false %> +
+ <% if required %> + * + <% end %> <%= f.label _('Themes'), for: :theme_ids, class: 'control-label' %> <%= render partial: 'shared/popover', locals: { message: popover_message, placement: 'right' }%> @@ -24,7 +30,8 @@ <% id = f.object.id.present? ? f.object.id : 'new' %> value="<%= theme.id %>"<%= f.object.themes.include?(theme) ? ' checked="checked"' : '' %>> <%= theme.title %>
diff --git a/app/views/org_admin/templates/_form.html.erb b/app/views/org_admin/templates/_form.html.erb index 429e15e..81af474 100644 --- a/app/views/org_admin/templates/_form.html.erb +++ b/app/views/org_admin/templates/_form.html.erb @@ -51,7 +51,7 @@ <% end %> <% if template.org.funder? %> -
+
<%= render(partial: '/shared/links', locals: { context: 'funder', @@ -60,7 +60,7 @@ max_number_links: MAX_NUMBER_LINKS_FUNDER, tooltip: _('Add links to funder websites that provide additional information about the requirements for this template') }) %>
-
+
<%= render(partial: '/shared/links', locals: { context: 'sample_plan', diff --git a/app/views/org_admin/templates/container.html.erb b/app/views/org_admin/templates/container.html.erb index 11d7914..ff6136e 100644 --- a/app/views/org_admin/templates/container.html.erb +++ b/app/views/org_admin/templates/container.html.erb @@ -1,3 +1,4 @@ +<% title template.id.present? ? template.title : "New Template" %> <% modifiable = template.latest? && !template.customization_of.present? && template.id.present? && (template.org_id = current_user.org.id) %>
diff --git a/app/views/org_admin/templates/history.html.erb b/app/views/org_admin/templates/history.html.erb index 10dd783..864db55 100644 --- a/app/views/org_admin/templates/history.html.erb +++ b/app/views/org_admin/templates/history.html.erb @@ -18,7 +18,7 @@ partial: '/paginable/templates/history', controller: 'paginable/templates', action: 'history', - query_params: { sort_field: 'templates.version', sort_direction: 'desc' }, + query_params: query_params, scope: templates, locals: local_assigns ) %> <% else %> diff --git a/app/views/org_admin/templates/index.html.erb b/app/views/org_admin/templates/index.html.erb index 3c9d569..6dc4fc4 100644 --- a/app/views/org_admin/templates/index.html.erb +++ b/app/views/org_admin/templates/index.html.erb @@ -1,3 +1,4 @@ +<% title 'Templates' %>

<%= _('Templates') %>

@@ -68,15 +69,16 @@ controller: 'paginable/templates', action: action, scope: templates, - query_params: { sort_field: 'templates.title', sort_direction: :asc }, + query_params: query_params, locals: local_assigns) %>
- - <%= _('Create a template') %> - +
\ No newline at end of file diff --git a/app/views/orgs/_feedback_form.html.erb b/app/views/orgs/_feedback_form.html.erb index 9c2043a..30df386 100644 --- a/app/views/orgs/_feedback_form.html.erb +++ b/app/views/orgs/_feedback_form.html.erb @@ -1,3 +1,4 @@ +<% title _('Request Feedback') %> <%= form_for(org, url: url, html: { multipart: true, method: method, id: "edit_org_feedback_form" } ) do |f| %>

<%= _('Request Feedback') %>

@@ -12,11 +13,11 @@
<%= f.label :feedback_email_subject, _('Subject'), class: "control-label" %> - <%= f.text_field :feedback_email_subject, class: "form-control", placeholder: _(feedback_confirmation_default_subject) % { application_name: Rails.configuration.branding[:application][:name] } %> + <%= f.text_field :feedback_email_subject, class: "form-control", placeholder: feedback_confirmation_default_subject.gsub('%{application_name}', Rails.configuration.branding[:application][:name]) %>
- <% tip = _(feedback_confirmation_default_message) %> + <% tip = feedback_confirmation_default_message.gsub('%{organisation_email}', org.contact_email.present? ? org.contact_email : '%{organisation_email}') %>
<%= f.label :feedback_email_msg, _('Message'), class: "control-label" %> <%= f.text_area :feedback_email_msg, class: "form-control" %> diff --git a/app/views/orgs/_profile_form.html.erb b/app/views/orgs/_profile_form.html.erb index fc4bd65..fa75c43 100644 --- a/app/views/orgs/_profile_form.html.erb +++ b/app/views/orgs/_profile_form.html.erb @@ -31,7 +31,7 @@
-
+
<%= render(partial: '/shared/links', locals: { context: 'org', @@ -51,7 +51,7 @@
<%= f.label :contact_email, _('Contact email'), class: "control-label" %> - <%= f.text_field :contact_email, class: "form-control" %> + <%= f.email_field :contact_email, class: "form-control", 'aria-required': true %>
<%= f.label :contact_name, _('Link text'), class: "control-label" %> @@ -104,7 +104,7 @@
- <%= f.button(_('Save'), id:"save_org_submit", class: "btn btn-primary", type: "submit") %> + <%= f.button(_('Save'), id:"save_org_details_submit", class: "btn btn-primary", type: "submit") %>
<% end %> \ No newline at end of file diff --git a/app/views/orgs/admin_edit.html.erb b/app/views/orgs/admin_edit.html.erb index 0a5164e..bf3e7fa 100644 --- a/app/views/orgs/admin_edit.html.erb +++ b/app/views/orgs/admin_edit.html.erb @@ -1,3 +1,4 @@ +<% title org.id.present? ? _('Organisation details') : _('New organisation') %>

<%= org.id.present? ? _('Organisation details') : _('New organisation') %>

@@ -19,18 +20,29 @@ <% end %> - -
-
- <%= render partial: 'orgs/profile_form', locals: local_assigns %> -
- <% if org.id.present? %> -
- <%= render partial: 'orgs/feedback_form', locals: local_assigns %> + +
+
+
+
+
+ <%= render partial: 'orgs/profile_form', locals: local_assigns %> +
+
- <% end %> +
+
+
+
+ <% if org.id.present? %> +
+ <%= render partial: 'orgs/feedback_form', locals: local_assigns %> +
+ <% end %> +
+
+
- diff --git a/app/views/orgs/shibboleth_ds.html.erb b/app/views/orgs/shibboleth_ds.html.erb index 615127a..6ff81a3 100644 --- a/app/views/orgs/shibboleth_ds.html.erb +++ b/app/views/orgs/shibboleth_ds.html.erb @@ -1,3 +1,4 @@ +<% title _('Find your organisation to sign in') %>

<%= _('Find your organisation to sign in') %>

@@ -6,7 +7,7 @@
- <%= form_for 'shibboleth_ds', url: shibboleth_ds_path, html: {id: 'shibboleth_ds'} do |f| %> + <%= form_for 'shibboleth_ds', url: shibboleth_ds_path, namespace: 'shib-ds', html: {id: 'shibboleth_ds'} do |f| %>
<%= f.label(:org_name, _('Look up your organisation here'), class: "control-label") %> @@ -18,8 +19,8 @@ <% else %> <%= render partial: "shared/accessible_combobox", - locals: {name: 'org_name', - id: 'org_name', + locals: {name: "shib-ds[org_name]", + id: 'shib-ds_org_name', default_selection: nil, models: @orgs, attribute: 'name', @@ -33,14 +34,14 @@

- <%= _('or') %> -
- <%= _('See the full list of participating organisations') %> + <%= _('See the full list of participating institutions') %>

<% end %>
<% end %> -