parent
9e499d2a5e
commit
c995f57877
3 changed files with 23 additions and 32 deletions
|
|
@ -173,6 +173,24 @@ function word_count(text, divId, maxcount) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Set the minimum and maximum proposal abstract word length */
|
||||||
|
$("#event_event_type_id").change(function () {
|
||||||
|
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-minimum-word-count").text(min);
|
||||||
|
word_count($('#event_abstract').get(0), 'abstract-count', max);
|
||||||
|
})
|
||||||
|
.trigger('change');
|
||||||
|
|
||||||
|
/* Count the proposal abstract length */
|
||||||
|
$("#event_abstract").bind('keyup', function() {
|
||||||
|
var $selected = $("#event_event_type_id option:selected")
|
||||||
|
var max = $selected.data("max-words");
|
||||||
|
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, {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
module ProposalHelper
|
|
||||||
def generate_abstract_length_js(conference)
|
|
||||||
str = ''
|
|
||||||
conference.event_types.map do |t|
|
|
||||||
str += "if ($('select option:selected').text() == '#{t.title}') {\n"
|
|
||||||
str += "str = '#{t.maximum_abstract_length}';\n"
|
|
||||||
str += "min_str = '#{t.minimum_abstract_length}';\n"
|
|
||||||
str += "maxcount = #{t.maximum_abstract_length};\n"
|
|
||||||
str += "}\n\n"
|
|
||||||
end.join("\n")
|
|
||||||
str
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -10,7 +10,10 @@
|
||||||
= f.input :subtitle, :as => :string
|
= f.input :subtitle, :as => :string
|
||||||
%section#details
|
%section#details
|
||||||
- if can? :update, @event or can? :create, @event
|
- if can? :update, @event or can? :create, @event
|
||||||
= f.input :event_type_id,:as => :select, :collection => @conference.event_types.map {|x| ["#{x.title} - #{show_time(x.length)}", x.id]}, :include_blank => false, :label => "Session Type"
|
= f.input :event_type_id, as: :select,
|
||||||
|
collection: @conference.event_types.map {|x| ["#{x.title} - #{show_time(x.length)}", x.id,
|
||||||
|
data: { min_words: x.minimum_abstract_length, max_words: x.maximum_abstract_length }]},
|
||||||
|
include_blank: false, label: 'Session Type'
|
||||||
- else
|
- else
|
||||||
Event type: #{@event.event_type.title}
|
Event type: #{@event.event_type.title}
|
||||||
%br
|
%br
|
||||||
|
|
@ -45,20 +48,3 @@
|
||||||
words. Biographies are limited to 150 words.
|
words. Biographies are limited to 150 words.
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"}
|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"}
|
||||||
|
|
||||||
:javascript
|
|
||||||
var maxcount = 0;
|
|
||||||
|
|
||||||
$("#event_event_type_id").change(function () {
|
|
||||||
var str = "";
|
|
||||||
var min_str = ""
|
|
||||||
#{generate_abstract_length_js @conference}
|
|
||||||
$("#abstract-maximum-word-count").text(str);
|
|
||||||
$("#abstract-minimum-word-count").text(min_str);
|
|
||||||
word_count($('#event_abstract').get(0), 'abstract-count', maxcount);
|
|
||||||
})
|
|
||||||
.trigger('change');
|
|
||||||
|
|
||||||
$("#event_abstract").bind('keyup', function() {
|
|
||||||
word_count(this, 'abstract-count', maxcount);
|
|
||||||
} );
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue