Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New maDMP Research Outputs tab #2992

Merged
merged 32 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b52f735
added research outputs to plan
briri Aug 3, 2021
548dbee
added feature test for the new modal search dialog
briri Aug 6, 2021
d584f4f
fixed issues with rubocop and tests
briri Aug 9, 2021
aa7ca94
fix for failing repository model test
briri Aug 9, 2021
bb1f334
made rubocop happy and fixed overwritten funding presenter spec
briri Aug 9, 2021
834fe69
appeasing rubocop
briri Aug 9, 2021
df6e8a2
appeasing rubocop
briri Aug 9, 2021
abbea08
Merge branch 'development' into madmp-research-outputs
briri Aug 18, 2021
3ee100f
Merge branch 'development' into madmp-research-outputs
briri Aug 19, 2021
9519b6d
Merge branch 'development' into madmp-research-outputs
briri Aug 24, 2021
44b661a
Merge branch 'development' of github.com:DMPRoadmap/roadmap into madm…
briri Sep 21, 2021
abb35b7
Merge branch 'madmp-research-outputs' of github.com:DMPRoadmap/roadma…
briri Sep 21, 2021
8d5b954
hopeful fix for randomly failing spec
briri Sep 21, 2021
33b8b1b
Merge branch 'development' into madmp-research-outputs
briri Feb 2, 2022
8a9cd8f
fixed rubocop
briri Feb 2, 2022
2c047b1
Merge branch 'development' into madmp-research-outputs
briri Feb 2, 2022
4aa76f8
revert change to plans factory
briri Feb 2, 2022
e5b4ca0
Merge branch 'development' into madmp-research-outputs
briri Feb 25, 2022
3065ea4
Merge branch 'development' into madmp-research-outputs
briri Mar 3, 2022
6b11cac
Merge branch 'development' into madmp-research-outputs
briri Mar 7, 2022
fefe46b
Merge branch 'development' into madmp-research-outputs
briri Mar 11, 2022
379f70d
add validation to new madmp models
nicolasfranck Mar 29, 2022
36fc51b
Merge branch 'development' into madmp-research-outputs
briri Mar 31, 2022
a7a2d83
added node_modules to ignored source paths for translation.io ... sho…
briri Mar 31, 2022
6b18c4c
Merge branch 'madmp-research-outputs' of github.com:DMPRoadmap/roadma…
briri Mar 31, 2022
306a608
fixed typo in test
briri Mar 31, 2022
661a952
Merge branch 'madmp-research-outputs' into madmp-research-outputs_val…
briri Mar 31, 2022
8015bb1
fixed rubocop complaints
briri Mar 31, 2022
3bc7561
Merge branch 'nicolasfranck-madmp-research-outputs_validation' into m…
briri Mar 31, 2022
74076b2
updated rspec test for re3data service to use controlled list of term…
briri Apr 5, 2022
f7ef1f4
Merge branch 'development' into madmp-research-outputs
briri Apr 5, 2022
e93dbb9
Merge branch 'development' into madmp-research-outputs
raycarrick-ed Apr 6, 2022
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
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ gem 'httparty'
# Autoload dotenv in Rails. (https://github.com/bkeepers/dotenv)
gem 'dotenv-rails'

gem 'activerecord_json_validator'

# ================================= #
# ENVIRONMENT SPECIFIC DEPENDENCIES #
# ================================= #
Expand Down
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ GEM
activemodel (= 5.2.6.2)
activesupport (= 5.2.6.2)
arel (>= 9.0)
activerecord_json_validator (2.1.0)
activerecord (>= 4.2.0, < 8)
json_schemer (~> 0.2.18)
activestorage (5.2.6.2)
actionpack (= 5.2.6.2)
activerecord (= 5.2.6.2)
Expand Down Expand Up @@ -130,6 +133,8 @@ GEM
dragonfly-s3_data_store (1.3.0)
dragonfly (~> 1.0)
fog-aws
ecma-re-validator (0.4.0)
regexp_parser (~> 2.2)
erubi (1.10.0)
excon (0.91.0)
execjs (2.8.1)
Expand Down Expand Up @@ -207,6 +212,7 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
hana (1.3.7)
hashdiff (1.0.1)
hashie (5.0.0)
highline (2.0.3)
Expand All @@ -223,6 +229,11 @@ GEM
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.6.1)
json_schemer (0.2.19)
ecma-re-validator (~> 0.3)
hana (~> 1.3)
regexp_parser (~> 2.0)
uri_template (~> 0.7)
jwt (2.3.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
Expand Down Expand Up @@ -474,6 +485,7 @@ GEM
thread_safe (~> 0.1)
unicode-display_width (2.1.0)
uniform_notifier (1.14.2)
uri_template (0.7.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (3.7.0)
Expand Down Expand Up @@ -515,6 +527,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
activerecord_json_validator
annotate
annotate_gem
api-pagination
Expand Down
75 changes: 75 additions & 0 deletions app/assets/stylesheets/blocks/_modal_search.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.modal-search-block {
border: 1px solid $color-grey;
margin-bottom: 10px;
padding: 10px 5px;
}

.modal-search .modal-dialog {
/* Make the dialog 80% of the screen height/width */
width: 80%;
// height: 80%;
}
.modal-search .modal-body {
/* 100% = dialog height, 50px = header (27.5px) + footer (21px) */
// max-height: calc(80% - 50px);
max-height: 450px;
overflow-y: scroll;
}

.modal-search-results-pagination {
margin-bottom: 10px;
}

.modal-search-result {
margin-top: 5px;
padding-bottom: 5px;

.modal-search-result-label {
font-size: 1.6rem;
font-weight: 500;
}

.tags > .tag {
display: inline-block;
margin: 5px 2px;
}
.tags .facet {
border: 1px solid $color-blue;
border-radius: 25px;
padding: 2px 5px;
}

div {
margin-bottom: 5px;
}

dl {
margin-left: 20px;

dd {
margin-bottom: 5px;
}
}
}

.modal-search-results .modal-search-result {
border-bottom: 1px solid $color-grey;
}

/* the 'Select' button displayed in the modal dialog */
.modal-search-result .modal-search-result-selector,
.modal-search-result .modal-search-result-unselector {
display: inline-block;
background-color: $color-white;
border-radius: 25px;
padding: 2px 5px;
font-size: 1.3rem;
}
.modal-search-result .modal-search-result-selector {
background-color: $color-green;
color: $color-white;
}
.modal-search-result .modal-search-result-unselector {
border: 1px solid $color-red;
color: $color-red;
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/variables/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$color-black: #000;
$color-white: #FFF;
$color-red: #b94a48;
$color-green: #4c8d3f;
$color-grey: #4F5253;
$color-grey-darkest: #222;
$color-grey-darker: #333;
Expand Down
15 changes: 10 additions & 5 deletions app/controllers/plan_exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class PlanExportsController < ApplicationController

include ConditionsHelper

# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
# rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
def show
@plan = Plan.includes(:answers, { template: { phases: { sections: :questions } } })
.find(params[:plan_id])
Expand All @@ -17,6 +18,7 @@ def show
@show_sections_questions = export_params[:question_headings].present?
@show_unanswered = export_params[:unanswered_questions].present?
@show_custom_sections = export_params[:custom_sections].present?
@show_research_outputs = export_params[:research_outputs].present?
@public_plan = false

elsif publicly_authorized?
Expand All @@ -25,6 +27,7 @@ def show
@show_sections_questions = true
@show_unanswered = true
@show_custom_sections = true
@show_research_outputs = @plan.research_outputs&.any? || false
@public_plan = true

else
Expand All @@ -49,7 +52,8 @@ def show
format.json { show_json }
end
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
# rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity

private

Expand Down Expand Up @@ -124,8 +128,9 @@ def privately_authorized?
end

def export_params
params.require(:export).permit(:form, :project_details, :question_headings,
:unanswered_questions, :custom_sections,
:formatting)
params.require(:export)
.permit(:form, :project_details, :question_headings, :unanswered_questions,
:custom_sections, :research_outputs,
formatting: [:font_face, :font_size, { margin: %i[top right bottom left] }])
end
end
28 changes: 1 addition & 27 deletions app/controllers/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,7 @@ def update
funder_attrs[:org_id] = plan_params[:funder][:id]
funder = org_from_params(params_in: funder_attrs)
@plan.funder_id = funder&.id
attrs.delete(:funder)

process_grant(grant_params: plan_params[:grant])
@plan.grant = plan_params[:grant]
attrs.delete(:grant)
attrs = remove_org_selection_params(params_in: attrs)

Expand Down Expand Up @@ -537,29 +535,5 @@ def render_phases_edit(plan, phase, guidance_groups)
guidance_presenter: GuidancePresenter.new(plan)
})
end

# Update, destroy or add the grant
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def process_grant(grant_params:)
return false unless grant_params.present?

grant = @plan.grant

# delete it if it has been blanked out
if grant_params[:value].blank? && grant.present?
grant.destroy
@plan.grant = nil
elsif grant_params[:value] != grant&.value
if grant.present?
grant.update(value: grant_params[:value])
elsif grant_params[:value].present?
@plan.grant = Identifier.new(identifier_scheme: nil, identifiable: @plan,
value: grant_params[:value])
end
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
end
# rubocop:enable Metrics/ClassLength
Loading