Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = *.css*,*.pdf,.git,locales,locale,*.lock,db,language_presenter.rb,locale
# ignore-words-list =
19 changes: 19 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v1
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ This version includes changes from [DMPRoadmap release v4.0.2](https://github.co
- Froze mail gem version [#3254](https://github.com/DMPRoadmap/roadmap/issues/3254)
- Fixed an issue with the Rails 6 keyword arguments change that was causing the `paginable_sort_link` to fail
- Updated sans-serif font used in PDF downloads to Roboto since Google API no longer offers Helvetica
- Fixed discrepencies with default/max per_page values for API and UI pagination
- Fixed discrepancies with default/max per_page values for API and UI pagination
- Updated the CSV export so that it now includes research outputs

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ gem 'jbuilder'
gem 'bootsnap', require: false

# GEMS ADDED TO HELP HANDLE RAILS MIGRATION FROM 3.x to 4.2
# THESE GEMS HELP SUPPORT DEPRACATED FUNCTIONALITY AND WILL LOSE SUPPORT IN
# THESE GEMS HELP SUPPORT DEPRECATED FUNCTIONALITY AND WILL LOSE SUPPORT IN
# FUTURE VERSIONS WE SHOULD CONSIDER BRINGING THE CODE UP TO DATE INSTEAD

# A set of Rails responders to dry up your application
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ If you would like to install and run this application, we encourage you to start

If the basic DMPRoadmap system does not provide the functionality you require please review the list of customizations that we have made below. If our additional changes do not meet your needs, you are encouraged to fork the DMPRoadmap codebase and customize it to your needs. If you do customize it please contact the DMPRoadmap team to let the community know about the additional functionality you plan to offer. It may be useful to the larger community.

If DMPTool meets your organization's needs, you should install it following the [installation instructions on our wiki](https://github.com/CDLUC3/dmptool/wiki/installation) then perform the folowing tasks:
If DMPTool meets your organization's needs, you should install it following the [installation instructions on our wiki](https://github.com/CDLUC3/dmptool/wiki/installation) then perform the following tasks:

- **Homepage images:** While you are free to use the images provided along with this repository, it is advisable to replace them with ones more relevant to your user base. The system randomly serves up one of five images that are located in `app/assets/images/homepage/`. Follow the image sizes in the provided examples for your images. You must also retain the file names as the `app/assets/stylesheets/dmptool/blocks/_home_welcome.scss` references them by name
- **Rotating news on the homepage:** Update the blog url value in `config/dmproadmap.yml` with the address of your blog's RSS feed.
- **Styles:** The system loads the base DMPRoadmap stylesheet first then the DMPTool stylesheet. We recommend that you add your own additional stylesheet if your changes are extensive or update `app/assets/stylesheets/dmptool/**/*.scss` directly. Do not make changes to the other stylesheets as they are managed as part of the DMPRoadmap project.
- **Static Content:** Update the files in `app/views/branded/static_pages/` so that they are appropriate for your installation.
- **Shibboleth:** Setting up your own Shibboleth service provider (SP) is beyond the scope of this application. If you have an SP available and want to use it, make sure that you enable the shibboleth settings in `config/dmproadmap.yml` and then add your organization's entity id (found in your Shib SP's list of registered IdPs) within the UI. Then log out and log back in via your institution's credentials to test that things are working properly. Note that the DMPTool only allows users to authenticate via Shibboleth if the organization is regsitered within the system (meaning that it appears in the application's `orgs` table)
- **Shibboleth:** Setting up your own Shibboleth service provider (SP) is beyond the scope of this application. If you have an SP available and want to use it, make sure that you enable the shibboleth settings in `config/dmproadmap.yml` and then add your organization's entity id (found in your Shib SP's list of registered IdPs) within the UI. Then log out and log back in via your institution's credentials to test that things are working properly. Note that the DMPTool only allows users to authenticate via Shibboleth if the organization is registered within the system (meaning that it appears in the application's `orgs` table)

## Variations between DMPRoadmap and DMPTool

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CSS Blocks

Blocks refer to reusable units within the CSS files. Where practicable, we should always try to define a general block or UX concept, rather than styling indivudual elements.
Blocks refer to reusable units within the CSS files. Where practicable, we should always try to define a general block or UX concept, rather than styling individual elements.

Example:

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/dmptool/_label.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
label {
font-weight: 600;

// Add a space to the front of links that appear within a label becuase the white space
// Add a space to the front of links that appear within a label because the white space
// is getting collapsed
a {
padding-left: 3px;
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/answers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def permitted_params

def check_answered(section, q_array, all_answers)
n_qs = section.questions.select { |question| q_array.include?(question.id) }.length
n_ans = all_answers.select { |ans| q_array.include?(ans.question.id) and ans.answered? }.length
[n_qs, n_ans]
n_answers = all_answers.select { |answer| q_array.include?(answer.question.id) and answer.answered? }.length
[n_qs, n_answers]
end
end
2 changes: 1 addition & 1 deletion app/controllers/concerns/conditional_user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module ConditionalUserMailer
#
# recipients - User or Enumerable object or any object that includes Enumerable class
# key - A key (dot notation) whose value is true/false and belongs to
# prefences.email (see dmproadmap.rb initializer)
# preferences.email (see dmproadmap.rb initializer)
#
# Returns Boolean
def deliver_if(key:, recipients: [], &block)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/paginable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def refine_query(scope)

# Can raise ActiveRecord::StatementInvalid (e.g. column does not
# exist, ambiguity on column, etc)
# how we contruct scope depends on whether sort field is in the
# how we construct scope depends on whether sort field is in the
# main table or in a related table
scope_table = scope.klass.name.underscore
parts = @args[:sort_field].partition('.')
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/versionable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Versionable
private

# Takes in a Template, phase, Section, Question, or Annotaion
# Takes in a Template, phase, Section, Question, or Annotation
# IF the template is published, generates a new template
# finds the passed object in the new template
#
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/dmptool/public_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def process_sort_by
end
end

# Proces the search term
# Process the search term
def process_search
public_plans_params[:search].present? ? "%#{public_plans_params[:search]}%" : '%'
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module OrgAdmin
# Controller that handles transfering parent template changes to a customized template
# Controller that handles transferring parent template changes to a customized template
class TemplateCustomizationTransfersController < ApplicationController
include Versionable

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def duplicate
end
# rubocop:enable Metrics/AbcSize

# TODO: This should probablly just be merged with the update route
# TODO: This should probably just be merged with the update route
# POST /plans/:id/visibility
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def visibility
Expand Down Expand Up @@ -406,7 +406,7 @@ def visibility
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength

# TODO: This should probablly just be merged with the update route
# TODO: This should probably just be merged with the update route
# POST /plans/:id/set_test
def set_test
plan = Plan.find(params[:id])
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/public_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def template_export
# only export live templates, id passed is family_id
@template = Template.live(params[:id])
# covers authorization for this action.
# Pundit dosent support passing objects into scoped policies
# Pundit doesn't support passing objects into scoped policies
unless PublicPagePolicy.new(current_user, @template).template_export?
msg = 'You are not authorized to export that template'
redirect_to public_templates_path, notice: msg and return
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def after_sign_in_path_for(resource)
elsif resource.language_id.present?
session[:locale] = resource.language.abbreviation
end
# Change the locale if the user has a prefered language
# Change the locale if the user has a preferred language

(oauth_path.presence || plans_path)
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/authentication_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def process_oauth
# have the full name
client = ApiClient.where(uid: @pre_auth.client.uid).first

# Stash the info into a session variable so that the info is retained accross the sign in
# Stash the info into a session variable so that the info is retained across the sign in
# workflow
session['oauth-referer'] = ApplicationService.encrypt(payload: { client_id: client.id,
path: oauth_path })
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/super_admin/api_client_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def label_for_scope(scope)
def tooltip_for_scope(scope)
case scope
when 'read_dmps'
_("Access to all publicly visible plans and, if associated with an org, the organisationally visible plans. They can also access a user's plans through OAuth autorization.")
_("Access to all publicly visible plans and, if associated with an org, the organisationally visible plans. They can also access a user's plans through OAuth authorization.")
when 'edit_dmps'
_("Edit any plans created through the API and edit a user's plan after gaining OAuth authorization from the user")
when 'create_dmps'
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/answers/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $(() => {
* form with class form-answer. The key represents a question id and the value holds
* the debounced function for a given input, textarea or select. Note, this map is
* populated on demand, i.e. the first time a change is made at a given input, textarea
* or select within the form, a new key-value should be created. Succesive times, the
* or select within the form, a new key-value should be created. Successive times, the
* debounced function should be retrieved instead.
*/
const debounceMap = {};
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/src/answers/rdaMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ $(() => {

function waitAndUpdate() {
if (noWaiting > 0) {
// if we are waiting on api responces, call this function in 1 seccond
// if we are waiting on api responses, call this function in 1 second
setTimeout(waitAndUpdate, 1000);
} else {
// update all the dropdowns/ standards explore box (calling on subject
Expand Down Expand Up @@ -183,7 +183,7 @@ $(() => {
// update the standards display selector
$('.rda_metadata .sub-subject select').change();
} else {
// show the sub-subject incase it was previously hidden
// show the sub-subject in case it was previously hidden
subSubject.closest('div').show();
// update the sub-subject display selector
subSubject.find('option').remove();
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/shared/createAccountForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $(() => {

switch (field.attr('id')) {
case 'org_index_name': {
// We need to detemine if the user selected an item from the Org autocomplete
// We need to determine if the user selected an item from the Org autocomplete
// or provided a manually entered Org name
const userEnteredField = form.find('#org_index_user_entered_name');
const warningBlock = form.find('.autocomplete-warning');
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/usage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $(() => {
};

// attach listener to separator select menu
// on change look for "stat" elements and chnage their query param
// on change look for "stat" elements and change their query param
const fieldSep = document.getElementById('csv-field-sep');
if (fieldSep !== null) {
fieldSep.addEventListener('click', (e) => {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/utils/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* <a href="#" data-toggle-direction="hide"><%= _('collapse all') %></a>
* </div>
*
* Your accordion should follow the Boostrap 3.x layout:
* Your accordion should follow the Bootstrap 3.x layout:
* ------------------------------------------------------------
* <div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
* <div class="panel panel-default">
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/utils/autoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const getId = (context, attrName) => {
return '';
};

// Determine which warning message to display based on the precense of the
// Determine which warning message to display based on the presence of the
// :not_in_list checkbox
const invalidSelectionMessage = (id) => {
let msg = getConstant('AUTOCOMPLETE_ARIA_HELPER_EMPTY_WITHOUT_CUSTOM');
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/utils/sectionUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export const updateSectionProgress = (id, numSecAnswers, numSecQuestions) => {
};

// given a question id find the containing div
// used inconditional questions
// used unconditional questions
export const getQuestionDiv = (id) => $(`#answer-form-${id}`).closest('.question-body');
2 changes: 1 addition & 1 deletion app/javascript/src/utils/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const Tinymce = {
},
/*
Destroy an editor instance whose target element/textarea has HTML id passed. This method
executes tinymce.Editor.destroy (e.g. https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#destroy) for a successfull id found.
executes tinymce.Editor.destroy (e.g. https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#destroy) for a successful id found.
@return undefined
*/
destroyEditorById(id) {
Expand Down
4 changes: 2 additions & 2 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def permissions_change_notification(role, user)
@role = role
@plan_title = @role.plan.title
@user = user
@recepient = @role.user
@recipient = @role.user
@messaging = role_text(@role)
@helpdesk_email = helpdesk_email(org: @user.org)

I18n.with_locale I18n.default_locale do
mail(to: @recepient.email,
mail(to: @recipient.email,
subject: format(_('Changed permissions on a Data Management Plan in %{tool_name}'),
tool_name: tool_name))
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/external_api_access_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# Model representing an OAuth access token to an external system like ORCID
class ExternalApiAccessToken < ApplicationRecord
# This class works in conjunction with Devise OmniAuth providers. If a provider returns an
# acess token along with the :uid, then the access token gets stored in this table. It expects
# access token along with the :uid, then the access token gets stored in this table. It expects
# the following to be passed back as part of the "omniauth.auth" response:
#
# "credentials": {
Expand Down
2 changes: 1 addition & 1 deletion app/models/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def settings(key)
# none exists.
#
# qid - The id for the question to find the answer for
# create_if_missing - If true, will genereate a default answer
# create_if_missing - If true, will generate a default answer
# to the question (defaults: true).
#
# Returns Answer
Expand Down
2 changes: 1 addition & 1 deletion app/models/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Role < ApplicationRecord
# Return ActiveRecord::Relation
scope :with_access_flags, lambda { |*flags|
bad_flag = flags.detect { |flag| !flag.in?(flag_mapping['access'].keys) }
raise ArgumentError, "Unkown access flag '#{bad_flag}'" if bad_flag
raise ArgumentError, "Unknown access flag '#{bad_flag}'" if bad_flag

access_values = flags.map { |flag| sql_in_for_flag(flag.to_sym, 'access') }
.flatten
Expand Down
2 changes: 1 addition & 1 deletion app/models/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def deep_copy(**options)
copy
end

# Can't be modified as it was duplicatd over from another Phase.
# Can't be modified as it was duplicated over from another Phase.
def unmodifiable?
!modifiable?
end
Expand Down
6 changes: 3 additions & 3 deletions app/models/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -459,17 +459,17 @@ def publishability
unless latest?
error += _('You can not publish a historical version of this template. ')
publishable = false
# all templates have atleast one phase
# all templates have at least one phase
end
if phases.count <= 0
error += _('You can not publish a template without phases. ')
publishable = false
# all phases must have atleast 1 section
# all phases must have at least 1 section
end
unless phases.map { |p| p.sections.count.positive? }.reduce(true) { |fin, val| fin && val }
error += _('You can not publish a template without sections in a phase. ')
publishable = false
# all sections must have atleast one question
# all sections must have at least one question
end
unless sections.map { |s| s.questions.count.positive? }.reduce(true) { |fin, val| fin && val }
error += _('You can not publish a template without questions in a section. ')
Expand Down
10 changes: 5 additions & 5 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ class User < ApplicationRecord
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
# devise :invitable, :database_authenticatable, :registerable, :recoverable,
# :rememberable, :trackable, :validatable, :omniauthable,
# :memorable, :trackable, :validatable, :omniauthable,
# omniauth_providers: %i[shibboleth orcid]

# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable, :recoverable, :rememberable,
devise :database_authenticatable, :registerable, :recoverable, :memorable,
:trackable, :validatable,
:omniauthable, omniauth_providers: %i[shibboleth orcid]

Expand Down Expand Up @@ -144,7 +144,7 @@ class User < ApplicationRecord
#
# validates :org, presence: { message: PRESENCE_MESSAGE }

# Validations to support ouur sign in / sign up workflow
# Validations to support our sign in / sign up workflow
validates :institution, presence: { message: PRESENCE_MESSAGE }
validates :accept_terms, inclusion: { in: [true, nil], message: _('and conditions') }

Expand Down Expand Up @@ -301,15 +301,15 @@ def identifier_for(scheme)
identifiers.by_scheme_name(scheme, 'User')&.first
end

# Checks if the user is a super admin. If the user has any privelege which requires
# Checks if the user is a super admin. If the user has any privilege which requires
# them to see the super admin page then they are a super admin.
#
# Returns Boolean
def can_super_admin?
can_add_orgs? || can_grant_api_to_orgs? || can_change_org?
end

# Checks if the user is an organisation admin if the user has any privlege which
# Checks if the user is an organisation admin if the user has any privilege which
# requires them to see the org-admin pages then they are an org admin.
#
# Returns Boolean
Expand Down
2 changes: 1 addition & 1 deletion app/policies/api/v1/plans_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PlansPolicy < ApplicationPolicy
# NOTE: @user is either a User or an ApiClient

# A helper method that takes the current client and returns the plans they
# have acess to
# have access to
class Scope
## return the visible plans (via the API) to a given client
# ALL can view: public
Expand Down
2 changes: 1 addition & 1 deletion app/policies/template_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def unpublish?
# - The template which they are modifying belongs to their org
##

# Anyone with an account should be able to get templates for the sepecified research_org + funder
# Anyone with an account should be able to get templates for the specified research_org + funder
# This policy is applicable to the Create Plan page
def template_options?
@user.present?
Expand Down
Loading