Merge 933e14673c into 8c27a3dbac
This commit is contained in:
commit
96ae730955
40 changed files with 694 additions and 33 deletions
|
|
@ -41,6 +41,8 @@
|
|||
//= require osem-commercials
|
||||
//= require unobtrusive_flash
|
||||
//= require unobtrusive_flash_bootstrap
|
||||
//= require bootstrap-select
|
||||
//= require osem-survey
|
||||
|
||||
$(document).ready(function() {
|
||||
$('a[disabled=disabled]').click(function(event){
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
// get current_date
|
||||
var today = new Date().toISOString().slice(0, 10);
|
||||
$(function () {
|
||||
|
||||
$('.datetimepicker').datetimepicker({
|
||||
pickTime: true,
|
||||
useCurrent: false,
|
||||
sideBySide: true,
|
||||
format: 'YYYY-MM-DD HH:mm'
|
||||
});
|
||||
|
||||
$("#registration-arrival-datepicker").datetimepicker({
|
||||
pickTime: true,
|
||||
useCurrent: false,
|
||||
|
|
@ -12,7 +20,7 @@ $(function () {
|
|||
minDate : today,
|
||||
defaultDate : $("#registration-arrival-datepicker").attr('start_date'),
|
||||
});
|
||||
|
||||
|
||||
$("#registration-departure-datepicker").datetimepicker({
|
||||
pickTime: true,
|
||||
useCurrent: false,
|
||||
|
|
@ -23,7 +31,7 @@ $(function () {
|
|||
minDate : $("#registration-arrival-datepicker").attr('start_date'),
|
||||
defaultDate : $("#registration-arrival-datepicker").attr('end_date'),
|
||||
});
|
||||
|
||||
|
||||
$("#registration-arrival-datepicker").on("dp.change",function (e) {
|
||||
// departure_date > start_date,arrival_date
|
||||
if ((new Date(e.date).getTime()) > (new Date($("#registration-arrival-datepicker").attr('start_date')).getTime())){
|
||||
|
|
@ -52,7 +60,7 @@ $(function () {
|
|||
useCurrent: false,
|
||||
format: "YYYY-MM-DD",
|
||||
});
|
||||
|
||||
|
||||
// end_date_conference >= registration-period-Start_date >= Current_date
|
||||
// registration-period-Start_date <= registration-period-End_date <= End_date (of conference)
|
||||
$("#registration-period-start-datepicker").datetimepicker({
|
||||
|
|
@ -62,7 +70,7 @@ $(function () {
|
|||
minDate : today,
|
||||
maxDate : $("#registration-period-start-datepicker").attr('end_date'),
|
||||
});
|
||||
|
||||
|
||||
$("#registration-period-end-datepicker").datetimepicker({
|
||||
pickTime: false,
|
||||
useCurrent: false,
|
||||
|
|
@ -70,7 +78,7 @@ $(function () {
|
|||
minDate: today,
|
||||
maxDate : $("#registration-period-start-datepicker").attr('end_date'),
|
||||
});
|
||||
|
||||
|
||||
$("#conference-start-datepicker").on("dp.change",function (e) {
|
||||
$('#conference-end-datepicker').data("DateTimePicker").setMinDate(e.date);
|
||||
});
|
||||
|
|
|
|||
33
app/assets/javascripts/osem-survey.js
Normal file
33
app/assets/javascripts/osem-survey.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
$(function() {
|
||||
$('.selectpicker').on('changed.bs.select', function (e, clickedIndex) {
|
||||
$('.kinds').addClass('hidden');
|
||||
var selected = $('.selectpicker').find('option:selected').val();
|
||||
$('.' + selected).removeClass('hidden');
|
||||
|
||||
if (selected == 'choice') {
|
||||
$('.survey-possible-answers').removeClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.survey-possible-answers').addClass('hidden');
|
||||
}
|
||||
});
|
||||
$('#survey_question_title').on('keyup', function(){
|
||||
$('#survey_question_preview #title').text($(this).val())
|
||||
});
|
||||
|
||||
function render_possible_answers_preview() {
|
||||
var options_html = '';
|
||||
var options_array = $('#survey_question_possible_answers').val().split(',');
|
||||
var input_type = ($('#survey_question_min_choices').val() == 1 &&
|
||||
$('#survey_question_max_choices').val() == 1) ? 'radio' : 'checkbox';
|
||||
$.each(options_array, function(index, option) {
|
||||
options_html += '<input type="' + input_type + '" name="preview_option"/> ' + option.trim() + '<br/>';
|
||||
});
|
||||
$('#survey_question_preview .choice').html(options_html)
|
||||
};
|
||||
|
||||
$('#survey_question_possible_answers').on('keyup', render_possible_answers_preview);
|
||||
$('#survey_question_min_choices').on('change', render_possible_answers_preview);
|
||||
$('#survey_question_max_choices').on('change', render_possible_answers_preview);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue