Merge pull request #133 from snap-cloud/rails-updates-enhanced-template
Rails updates enhanced template
This commit is contained in:
commit
5fe94c99af
4 changed files with 82 additions and 69 deletions
6
.github/workflows/spec.yml
vendored
6
.github/workflows/spec.yml
vendored
|
|
@ -9,6 +9,7 @@ on:
|
|||
|
||||
jobs:
|
||||
linters:
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
OSEM_RUBY_VERSION: 2.6.6
|
||||
|
|
@ -16,11 +17,12 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
ruby-version: 2.6.6
|
||||
bundler-cache: true
|
||||
- run: bundle exec rubocop
|
||||
- run: bundle exec haml-lint app/views
|
||||
spec:
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-latest
|
||||
name: spec
|
||||
env:
|
||||
|
|
@ -34,7 +36,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
ruby-version: 2.6.6
|
||||
bundler-cache: true
|
||||
- name: Prepare spec
|
||||
run: |
|
||||
|
|
|
|||
4
Gemfile
4
Gemfile
|
|
@ -138,8 +138,8 @@ gem 'prawn-rails'
|
|||
gem 'rqrcode'
|
||||
|
||||
# to render XLS spreadsheets
|
||||
gem 'axlsx', git: 'https://github.com/randym/axlsx.git'
|
||||
gem 'axlsx_rails'
|
||||
gem 'caxlsx'
|
||||
gem 'caxlsx_rails'
|
||||
|
||||
gem 'sentry-delayed_job'
|
||||
gem 'sentry-rails'
|
||||
|
|
|
|||
112
Gemfile.lock
112
Gemfile.lock
|
|
@ -1,37 +1,27 @@
|
|||
GIT
|
||||
remote: https://github.com/randym/axlsx.git
|
||||
revision: c593a08b2a929dac7aa8dc418b55e26b4c49dc34
|
||||
specs:
|
||||
axlsx (3.0.0.pre)
|
||||
htmlentities (~> 4.3, >= 4.3.4)
|
||||
mimemagic (~> 0.3)
|
||||
nokogiri (~> 1.8, >= 1.8.2)
|
||||
rubyzip (~> 1.2, >= 1.2.1)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
remote: https://rails-assets.org/
|
||||
specs:
|
||||
Ascii85 (1.0.3)
|
||||
actioncable (5.2.4.5)
|
||||
actionpack (= 5.2.4.5)
|
||||
actioncable (5.2.5)
|
||||
actionpack (= 5.2.5)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.4.5)
|
||||
actionpack (= 5.2.4.5)
|
||||
actionview (= 5.2.4.5)
|
||||
activejob (= 5.2.4.5)
|
||||
actionmailer (5.2.5)
|
||||
actionpack (= 5.2.5)
|
||||
actionview (= 5.2.5)
|
||||
activejob (= 5.2.5)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.4.5)
|
||||
actionview (= 5.2.4.5)
|
||||
activesupport (= 5.2.4.5)
|
||||
actionpack (5.2.5)
|
||||
actionview (= 5.2.5)
|
||||
activesupport (= 5.2.5)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.4.5)
|
||||
activesupport (= 5.2.4.5)
|
||||
actionview (5.2.5)
|
||||
activesupport (= 5.2.5)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
|
|
@ -41,20 +31,20 @@ GEM
|
|||
activemodel (>= 4.1, < 6.2)
|
||||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
activejob (5.2.4.5)
|
||||
activesupport (= 5.2.4.5)
|
||||
activejob (5.2.5)
|
||||
activesupport (= 5.2.5)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.4.5)
|
||||
activesupport (= 5.2.4.5)
|
||||
activerecord (5.2.4.5)
|
||||
activemodel (= 5.2.4.5)
|
||||
activesupport (= 5.2.4.5)
|
||||
activemodel (5.2.5)
|
||||
activesupport (= 5.2.5)
|
||||
activerecord (5.2.5)
|
||||
activemodel (= 5.2.5)
|
||||
activesupport (= 5.2.5)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.4.5)
|
||||
actionpack (= 5.2.4.5)
|
||||
activerecord (= 5.2.4.5)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.4.5)
|
||||
activestorage (5.2.5)
|
||||
actionpack (= 5.2.5)
|
||||
activerecord (= 5.2.5)
|
||||
marcel (~> 1.0.0)
|
||||
activesupport (5.2.5)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
|
@ -82,9 +72,6 @@ GEM
|
|||
awesome_nested_set (3.4.0)
|
||||
activerecord (>= 4.0.0, < 7.0)
|
||||
aws_cf_signer (0.1.3)
|
||||
axlsx_rails (0.5.2)
|
||||
actionpack (>= 3.1)
|
||||
axlsx (>= 2.0.1)
|
||||
bcrypt (3.1.16)
|
||||
bindex (0.6.0)
|
||||
bootstrap-sass (3.4.1)
|
||||
|
|
@ -118,6 +105,14 @@ GEM
|
|||
fastimage
|
||||
case_transform (0.2)
|
||||
activesupport
|
||||
caxlsx (3.1.0)
|
||||
htmlentities (~> 4.3, >= 4.3.4)
|
||||
marcel (~> 1.0)
|
||||
nokogiri (~> 1.10, >= 1.10.4)
|
||||
rubyzip (>= 1.3.0, < 3)
|
||||
caxlsx_rails (0.6.2)
|
||||
actionpack (>= 3.1)
|
||||
caxlsx (>= 3.0)
|
||||
chartkick (3.4.2)
|
||||
childprocess (3.0.0)
|
||||
chronic (0.10.2)
|
||||
|
|
@ -249,7 +244,7 @@ GEM
|
|||
httparty (0.18.1)
|
||||
mime-types (~> 3.0)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.8.9)
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n_data (0.8.0)
|
||||
icalendar (2.7.1)
|
||||
|
|
@ -293,18 +288,19 @@ GEM
|
|||
lumberjack (1.0.12)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
marcel (1.0.0)
|
||||
method_source (0.8.2)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2021.0225)
|
||||
mimemagic (0.3.6)
|
||||
mimemagic (0.4.3)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mina (1.2.3)
|
||||
open4 (~> 1.3.4)
|
||||
rake
|
||||
mini_magick (4.9.5)
|
||||
mini_mime (1.0.2)
|
||||
mini_mime (1.0.3)
|
||||
mini_portile2 (2.5.0)
|
||||
minitest (5.14.4)
|
||||
momentjs-rails (2.20.1)
|
||||
|
|
@ -324,7 +320,7 @@ GEM
|
|||
nenv (0.3.0)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.7)
|
||||
nokogiri (1.11.1)
|
||||
nokogiri (1.11.2)
|
||||
mini_portile2 (~> 2.5.0)
|
||||
racc (~> 1.4)
|
||||
notiffany (0.1.1)
|
||||
|
|
@ -430,18 +426,18 @@ GEM
|
|||
ruby-openid (>= 2.1.8)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.4.5)
|
||||
actioncable (= 5.2.4.5)
|
||||
actionmailer (= 5.2.4.5)
|
||||
actionpack (= 5.2.4.5)
|
||||
actionview (= 5.2.4.5)
|
||||
activejob (= 5.2.4.5)
|
||||
activemodel (= 5.2.4.5)
|
||||
activerecord (= 5.2.4.5)
|
||||
activestorage (= 5.2.4.5)
|
||||
activesupport (= 5.2.4.5)
|
||||
rails (5.2.5)
|
||||
actioncable (= 5.2.5)
|
||||
actionmailer (= 5.2.5)
|
||||
actionpack (= 5.2.5)
|
||||
actionview (= 5.2.5)
|
||||
activejob (= 5.2.5)
|
||||
activemodel (= 5.2.5)
|
||||
activerecord (= 5.2.5)
|
||||
activestorage (= 5.2.5)
|
||||
activesupport (= 5.2.5)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.4.5)
|
||||
railties (= 5.2.5)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-assets-bootstrap (3.3.6)
|
||||
rails-assets-jquery (>= 1.9.1, < 3)
|
||||
|
|
@ -475,9 +471,9 @@ GEM
|
|||
rails-i18n (5.1.3)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 5.0, < 6)
|
||||
railties (5.2.4.5)
|
||||
actionpack (= 5.2.4.5)
|
||||
activesupport (= 5.2.4.5)
|
||||
railties (5.2.5)
|
||||
actionpack (= 5.2.5)
|
||||
activesupport (= 5.2.5)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
|
|
@ -678,8 +674,6 @@ DEPENDENCIES
|
|||
annotate
|
||||
autoprefixer-rails
|
||||
awesome_nested_set
|
||||
axlsx!
|
||||
axlsx_rails
|
||||
bootstrap-sass (~> 3.4.0)
|
||||
bootstrap-switch-rails (~> 3.0.0)
|
||||
bootstrap3-datetimepicker-rails (~> 4.17.47)
|
||||
|
|
@ -688,6 +682,8 @@ DEPENDENCIES
|
|||
capybara
|
||||
carrierwave
|
||||
carrierwave-bombshelter
|
||||
caxlsx
|
||||
caxlsx_rails
|
||||
chartkick
|
||||
climate_control
|
||||
cloudinary
|
||||
|
|
|
|||
|
|
@ -149,13 +149,23 @@ function word_count(text, divId, maxcount) {
|
|||
});
|
||||
};
|
||||
|
||||
function fill_if_empty(text_area, filler) {
|
||||
let area = $('#' + text_area);
|
||||
function replace_defaut_submission_text(input_selector, new_text, valid_defaults) {
|
||||
let $area = $(input_selector);
|
||||
let current_text = $area.val();
|
||||
|
||||
if (!area.val()) {
|
||||
area.val(filler);
|
||||
area.trigger('change');
|
||||
if (!current_text) {
|
||||
$area.val(new_text);
|
||||
$area.trigger('change');
|
||||
return;
|
||||
}
|
||||
|
||||
valid_defaults.some(default_text => {
|
||||
if (current_text == default_text) {
|
||||
$area.val(new_text);
|
||||
$area.trigger('change');
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Wait for the DOM to be ready before attaching events to the elements */
|
||||
|
|
@ -166,8 +176,13 @@ $( document ).ready(function() {
|
|||
var max = $selected.data("max-words");
|
||||
var min = $selected.data("min-words");
|
||||
|
||||
// Set the filler text for the submission text
|
||||
fill_if_empty('event_submission_text', $selected.data("instructions"));
|
||||
// We replace the default text only if the current field is empty,
|
||||
// or is set to the default text of another event type.
|
||||
replace_defaut_submission_text(
|
||||
'#event_submission_text',
|
||||
$selected.data("instructions"),
|
||||
$("#event_event_type_id option").toArray().map(e => $(e).data('instructions'))
|
||||
);
|
||||
|
||||
$("#abstract-maximum-word-count").text(max);
|
||||
$("#submission-maximum-word-count").text(max);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue