Merge pull request #678 from kormoc/fix_abstract_word_count
Fix the abstrct count on the proposal create and edit pages
This commit is contained in:
commit
a35f98b1a3
1 changed files with 19 additions and 16 deletions
|
|
@ -157,24 +157,27 @@ function word_count(text, divId, maxcount) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Set the minimum and maximum proposal abstract word length */
|
/* Wait for the DOM to be ready before attaching events to the elements */
|
||||||
$("#event_event_type_id").change(function () {
|
$( document ).ready(function() {
|
||||||
var $selected = $("#event_event_type_id option:selected")
|
/* Set the minimum and maximum proposal abstract word length */
|
||||||
var max = $selected.data("max-words");
|
$("#event_event_type_id").change(function () {
|
||||||
var min = $selected.data("min-words");
|
var $selected = $("#event_event_type_id option:selected")
|
||||||
|
var max = $selected.data("max-words");
|
||||||
|
var min = $selected.data("min-words");
|
||||||
|
|
||||||
$("#abstract-maximum-word-count").text(max);
|
$("#abstract-maximum-word-count").text(max);
|
||||||
$("#abstract-minimum-word-count").text(min);
|
$("#abstract-minimum-word-count").text(min);
|
||||||
word_count($('#event_abstract').get(0), 'abstract-count', max);
|
word_count($('#event_abstract').get(0), 'abstract-count', max);
|
||||||
})
|
})
|
||||||
.trigger('change');
|
.trigger('change');
|
||||||
|
|
||||||
/* Count the proposal abstract length */
|
/* Count the proposal abstract length */
|
||||||
$("#event_abstract").bind('keyup', function() {
|
$("#event_abstract").bind('change keyup paste input', function() {
|
||||||
var $selected = $("#event_event_type_id option:selected")
|
var $selected = $("#event_event_type_id option:selected")
|
||||||
var max = $selected.data("max-words");
|
var max = $selected.data("max-words");
|
||||||
word_count(this, 'abstract-count', max);
|
word_count(this, 'abstract-count', max);
|
||||||
} );
|
} );
|
||||||
|
});
|
||||||
|
|
||||||
/* Set the defaults for DataTables initialisation */
|
/* Set the defaults for DataTables initialisation */
|
||||||
$.extend( true, $.fn.dataTable.defaults, {
|
$.extend( true, $.fn.dataTable.defaults, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue