Cleanup the submission form, fix reset button

This commit is contained in:
Michael Ball 2021-03-23 23:06:34 -07:00
parent df0aa087fb
commit e810fd442f
5 changed files with 6 additions and 7 deletions

View file

@ -175,8 +175,7 @@ $( document ).ready(function() {
$("#submission-minimum-word-count").text(min);
word_count($('#event_abstract').get(0), 'abstract-count', max);
word_count($('#event_submission_text').get(0), 'submission-count', max);
})
.trigger('change');
}).trigger('change');
/* Count the proposal abstract length */
$("#event_abstract").bind('change keyup paste input', function() {
@ -193,7 +192,7 @@ $( document ).ready(function() {
});
/* Listen for reset template button, wait for confirm, and reset. */
$('#sub_text_reset').click((e) => {
$('.js-resetSubmissionText').click((e) => {
let $selected = $("#event_event_type_id option:selected");
let $this = $(e.target);
let affirm = confirm($this.data('confirm'));

View file

@ -68,7 +68,7 @@ module EventsHelper
data: {
min_words: type.minimum_abstract_length,
max_words: type.maximum_abstract_length,
help: type.submission_instructions
instructions: type.submission_instructions
}
]
end

View file

@ -25,7 +25,7 @@
%span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" }
= difficulty_level.description
= render 'submission_type_content_form', f: f, program: @program
= render 'proposals/submission_type_content_form', f: f, program: @program
- if @program.cfp&.enable_registrations?
= f.inputs 'Enable pre-registration' do

View file

@ -56,7 +56,7 @@
.panel-body
= markdown(event_type.submission_instructions)
.panel-footer
%button.btn.btn-warning.btn-xs{ type: 'button', id: 'sub_text_reset', data: { confirm: 'Do you really want to reset your submission text to the provided template?' } }
%button.btn.btn-warning.btn-xs.js-resetSubmissionText{ type: 'button', data: { confirm: 'Do you really want to reset your submission text to the provided template?' } }
Reset Submission to Template
%span.small You may want to use this if you have changed the submission type.

View file

@ -206,7 +206,7 @@ feature Event do
fill_in 'event_submission_text', with: 'Lorem ipsum example submission text'
accept_confirm do
click_button 'Reset to Template'
click_button 'Reset Submission to Template'
end
expect(page.find('#event_submission_text').value).to eq(event_type.submisson_instructions)