Skip to content

Commit

Permalink
Merge pull request #2441 from DMPRoadmap/development
Browse files Browse the repository at this point in the history
Release Candidate v2.1.6
  • Loading branch information
briri committed Apr 3, 2020
2 parents 2aec36c + 47ab448 commit aaa6d98
Show file tree
Hide file tree
Showing 105 changed files with 1,231 additions and 433 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/brakeman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

# Will run Brakeman checks on dependencies
# https://github.com/marketplace/actions/brakeman-linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

# Will run ES Lint checks on javascript files
# https://github.com/marketplace/actions/run-eslint
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
# Checkout the repo
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 1

Expand Down Expand Up @@ -73,6 +73,16 @@ jobs:
${{ runner.os }}-yarn-
${{ runner.os }}-
# Figure out where wkhtmltopdf is installed
- name: 'Determine wkhtmltopdf location'
run: echo ::set-env name=WICKED_PDF_PATH::$(echo `bundle exec which wkhtmltopdf`)

# Startup MySQL
- name: 'Start MySQL'
run: sudo systemctl start mysql



# Install the JS dependencies
- name: 'Yarn Install'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ jobs:
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:@localhost:5432/roadmap_test
WICKED_PDF_PATH: vendor/bundle/bin/wkhtmltopdf

steps:
# Checkout the repo
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 1

Expand All @@ -44,6 +43,7 @@ jobs:
- name: 'Determine Ruby Version'
run: echo ::set-env name=RUBY_VERSION::$(echo `cat ./Gemfile.lock | grep -A 1 'RUBY VERSION' | grep 'ruby' | grep -oE '[0-9]\.[0-9]'`)


# Install Ruby - using the version found in the Gemfile.lock
- name: 'Install Ruby'
uses: actions/setup-ruby@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

# Extract the Ruby version from the Gemfile.lock
# - name: 'Determine Ruby Version'
Expand All @@ -31,4 +31,4 @@ jobs:
# additional-gems: 'rubocop-dmp_roadmap'

- name: 'Placeholder for Rubocop'
run: echo "Rubocop has been temporarily disabled"
run: echo "Rubocop has been temporarily disabled"
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ gem 'wicked_pdf', '~> 1.1.0'
# This simple gem allows you to create MS Word docx documents from simple html documents. This makes it easy to create dynamic reports and forms that can be downloaded by your users as simple MS Word docx files. (http://github.com/karnov/htmltoword)
gem 'htmltoword', '1.1.0'

# A feed fetching and parsing library (http://feedjira.com)
gem 'feedjira'

# Filename sanitization for Ruby. This is useful when you generate filenames for downloads from user input
gem 'zaru'

Expand Down Expand Up @@ -188,6 +185,9 @@ gem "dotenv-rails"

gem 'activerecord-session_store'

# -------------------------------------------------
# UTILITIES
gem 'parallel'

# ------------------------------------------------
# ENVIRONMENT SPECIFIC DEPENDENCIES
Expand Down
8 changes: 2 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ GEM
faraday (0.17.1)
multipart-post (>= 1.2, < 3)
fast_gettext (2.0.1)
feedjira (3.1.0)
loofah (>= 2.3.1)
sax-machine (>= 1.0)
ffi (1.11.3)
flag_shih_tzu (0.3.23)
fog-aws (3.5.2)
Expand Down Expand Up @@ -245,7 +242,7 @@ GEM
mysql2 (0.4.10)
nenv (0.3.0)
nio4r (2.5.2)
nokogiri (1.10.7)
nokogiri (1.10.8)
mini_portile2 (~> 2.4.0)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down Expand Up @@ -404,7 +401,6 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
sax-machine (1.3.2)
selenium-webdriver (3.142.6)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
Expand Down Expand Up @@ -498,7 +494,6 @@ DEPENDENCIES
dragonfly-s3_data_store
factory_bot_rails
faker
feedjira
flag_shih_tzu (~> 0.3.23)
font-awesome-sass (~> 4.2.0)
fuubar
Expand All @@ -518,6 +513,7 @@ DEPENDENCIES
omniauth-orcid
omniauth-rails_csrf_protection
omniauth-shibboleth
parallel
pg (~> 0.19.0)
progress_bar
puma
Expand Down
12 changes: 6 additions & 6 deletions app/assets/stylesheets/blocks/_new_window_popup.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
a.has-new-window-popup-info,
button.has-new-window-popup-info {

position:relative;
z-index:24;

& > span.new-window-popup-info {
position: absolute;
left: -9000px;
Expand All @@ -14,9 +14,9 @@ button.has-new-window-popup-info {
&:hover,
&:focus,
&:active {

z-index:25;

& > span.new-window-popup-info {
display:block;
position:absolute;
Expand All @@ -29,7 +29,7 @@ button.has-new-window-popup-info {
color:#000;
text-align: center;
}

}

}
6 changes: 3 additions & 3 deletions app/assets/stylesheets/blocks/_readonly_textarea.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* For display of readonly textarea content without the TinyMCE editor */
.display-readonly-textarea-content {
// Replicating some TinyMCE styling of textarea
overflow-y: hidden;
overflow: visible;
padding-left: 1px;
padding-right: 1px;
padding-bottom: 10px;

// Ensure table borders are not lost
table {
td {
border: 1px solid black;
}

td, tr {
padding: 10px;
}
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/blocks/_usage.sccs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.single-char-input {
display: inline;
width: 20px;
}
5 changes: 5 additions & 0 deletions app/assets/stylesheets/utils/_colours.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.red {
color: $color-text-red;
}

//default colour used on headings
.color-heading-text{
color: $color-heading-text;
}
18 changes: 18 additions & 0 deletions app/assets/stylesheets/utils/_font_size.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

//similar font size as an h2 tag
.fontsize-h2{
font-size: 24 px;

}

//similar font size as an h3 tag
.fontsize-h3{
font-size: 18.72 px;

}

//similar font size as an h4 tag
.fontsize-h4{
font-size: 16 px;

}
6 changes: 6 additions & 0 deletions app/assets/stylesheets/utils/_margins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
.mb-10 {
margin-bottom: 10px;
}
.mt-5 {
margin-top: 5px;
}
.mt-10 {
margin-top: 10px;
}
.mt-20 {
margin-top: 20px;
}
6 changes: 0 additions & 6 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
class StaticPagesController < ApplicationController

def about_us
dcc_news_feed_url = "http://www.dcc.ac.uk/news/dmponline-0/feed"
@dcc_news_feed = Feedjira::Feed.fetch_and_parse dcc_news_feed_url
respond_to do |format|
format.rss { redirect_to dcc_news_feed_url }
format.html
end
end

def contact_us
Expand Down
35 changes: 30 additions & 5 deletions app/controllers/usage_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def index
plan_data(args: args, as_json: true)
total_plans(args: min_max_dates(args: args))
total_users(args: min_max_dates(args: args))
#TODO: pull this in from branding.yml
@separators = [",", "|", "#"]
@funder = current_user.org.funder?
end

# POST /usage_plans_by_template
Expand All @@ -35,7 +38,19 @@ def global_statistics
authorize :usage

data = Org::TotalCountStatService.call
data_csvified = Csvable.from_array_of_hashes(data)
sep = sep_param
data_csvified = Csvable.from_array_of_hashes(data, true, sep)

send_data(data_csvified, filename: "totals.csv")
end

# GET
def org_statistics
authorize :usage

data = Org::MonthlyUsageService.call
sep = sep_param
data_csvified = Csvable.from_array_of_hashes(data, true, sep)

send_data(data_csvified, filename: "totals.csv")
end
Expand Down Expand Up @@ -71,7 +86,8 @@ def yearly_users
authorize :usage

user_data(args: default_query_args)
send_data(CSV.generate do |csv|
sep = sep_param
send_data(CSV.generate({:col_sep => sep}) do |csv|
csv << [_("Month"), _("No. Users joined")]
total = 0
@users_per_month.each do |data|
Expand All @@ -89,7 +105,8 @@ def yearly_plans
authorize :usage

plan_data(args: default_query_args)
send_data(CSV.generate do |csv|
sep = sep_param
send_data(CSV.generate({:col_sep => sep}) do |csv|
csv << [_("Month"), _("No. Completed Plans")]
total = 0
@plans_per_month.each do |data|
Expand All @@ -108,9 +125,11 @@ def all_plans_by_template

args = default_query_args
args[:start_date] = first_plan_date
sep = sep_param
{:col_sep => sep}

plan_data(args: args, sort: :desc)
data_csvified = StatCreatedPlan.to_csv(@plans_per_month, details: { by_template: true })
data_csvified = StatCreatedPlan.to_csv(@plans_per_month, details: { by_template: true, sep: sep })
send_data(data_csvified, filename: "created_plan_by_template.csv")
end

Expand Down Expand Up @@ -153,6 +172,11 @@ def default_query_args
}
end

# set the csv separator or default to comma
def sep_param
params["sep"] || ','
end

def min_max_dates(args:)
args[:start_date] = first_plan_date.strftime("%Y-%m-%d")
args[:end_date] = Date.today.strftime("%Y-%m-%d")
Expand Down Expand Up @@ -181,7 +205,8 @@ def total_users(args:)
end

def first_plan_date
StatCreatedPlan.all.order(:date).limit(1).pluck(:date).first
StatCreatedPlan.all.order(:date).limit(1).pluck(:date).first \
|| Date.today.last_month.end_of_month
end

end
4 changes: 2 additions & 2 deletions app/helpers/usage_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def prep_data_for_yearly_plans_chart(data:)
# appropriately by passing along the labels for the Y axis and the datasets
# for the X axis
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def prep_data_for_template_plans_chart(data:)
def prep_data_for_template_plans_chart(data:, subset: "by_template")
last_month = Date.today.last_month.end_of_month.strftime('%b-%y')
return { labels: [last_month], datasets: [] }.to_json if data.blank? || data.empty?

Expand All @@ -29,7 +29,7 @@ def prep_data_for_template_plans_chart(data:)
# Loop through the data and organize the datasets by template instead of date
data.each do |rec|
date = prep_date_for_charts(date: rec["date"])
rec["by_template"].each do |template|
rec[subset].each do |template|
# We need a placeholder for each month/year - template combo. The
# default is to assume that there are zero plans for that month/year + template
dflt = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'tinymce/plugins/paste';
import 'tinymce/plugins/advlist';
// Other dependencies
import { isObject, isString } from './isType';
// Pull in the rails helper functions
<% helpers = ActionController::Base.helpers %>

// // Configuration extracted from
// // https://www.tinymce.com/docs/advanced/usage-with-module-loaders/
Expand Down Expand Up @@ -42,7 +44,7 @@ export const defaultOptions = {
// editorManager.baseURL is not resolved properly for IE since document.currentScript
// is not supported, see issue https://github.com/tinymce/tinymce/issues/358
skin_url: '/tinymce/skins/lightgray',
content_css: ['/assets/blocks/_tinymce_content.css'],
content_css: ['<%= helpers.asset_path "/assets/blocks/_tinymce_content.css" %>'],
};
/*
This function is invoked anytime a new editor is initialised (e.g. Tinymce.init())
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/views/answers/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
isNumber,
isString,
} from '../../utils/isType';
import { Tinymce } from '../../utils/tinymce';
import { Tinymce } from '../../utils/tinymce.js.erb';
import debounce from '../../utils/debounce';
import datePicker from '../../utils/datePicker';
import TimeagoFactory from '../../utils/timeagoFactory';
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/views/guidances/new_edit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tinymce } from '../../utils/tinymce';
import { Tinymce } from '../../utils/tinymce.js.erb';

$(() => {
Tinymce.init({ selector: '#guidance-text' });
Expand Down
Loading

0 comments on commit aaa6d98

Please sign in to comment.