parent
a7d3d15b0e
commit
79b8e9860e
12 changed files with 246 additions and 67 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,129 @@ |
|||||||
|
var EXPO = EXPO || {}; //isolated namespace
|
||||||
|
EXPO.registration = EXPO.registration || {}; |
||||||
|
if (EXPO.registration.completion) { |
||||||
|
console.warn('WARNING: EXPO.registration..completion is already defined!'); |
||||||
|
} else { |
||||||
|
EXPO.registration.completion = (function () { |
||||||
|
/** |
||||||
|
* private (visible inside this module only) variables |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* @type {Object} - module API interafce realization |
||||||
|
*/ |
||||||
|
var that = {}, |
||||||
|
/** |
||||||
|
* fires when data is sended and response recieved |
||||||
|
* @param {Object} data - data recieved from server |
||||||
|
*/ |
||||||
|
registrationSuccess = function (data) { |
||||||
|
|
||||||
|
if (data.success) { |
||||||
|
location.reload(); |
||||||
|
} |
||||||
|
else { |
||||||
|
console.log(data); |
||||||
|
} |
||||||
|
}, |
||||||
|
placeInput = function (width) { |
||||||
|
$('#id_country').val('159').select2({ |
||||||
|
placeholder: "Ваша страна", |
||||||
|
width: width |
||||||
|
}); |
||||||
|
|
||||||
|
$('#id_city').select2({ |
||||||
|
placeholder: "Ваш город", |
||||||
|
width: width, |
||||||
|
ajax: { |
||||||
|
|
||||||
|
url: "/city/get-city/", |
||||||
|
dataType: "json", |
||||||
|
quietMillis: 200, |
||||||
|
|
||||||
|
data: function(term, page, country){ |
||||||
|
var country = $('#id_country').val() |
||||||
|
return {term: term, |
||||||
|
page: page, |
||||||
|
country: country}; |
||||||
|
}, |
||||||
|
|
||||||
|
results: function (data) { |
||||||
|
var results = []; |
||||||
|
$.each(data, function(index, item){ |
||||||
|
results.push({ |
||||||
|
id: item.id, |
||||||
|
text: item.label |
||||||
|
}); |
||||||
|
}); |
||||||
|
return {results: results}; |
||||||
|
} |
||||||
|
}, |
||||||
|
initSelection : function(element, callback) { |
||||||
|
var id= $(element).val(); |
||||||
|
var text = $(element).attr('data-init-text'); |
||||||
|
callback({id: id, text:text}); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
}; |
||||||
|
/** |
||||||
|
* @type {Object} default setting |
||||||
|
*/ |
||||||
|
that.opt = {}; |
||||||
|
/** |
||||||
|
* dependencies.Place where you can switch on dependencies for module |
||||||
|
* @type {EXPO.common|*} - mostly used in project functions and data (block.common.js) |
||||||
|
*/ |
||||||
|
var com = EXPO.common; |
||||||
|
|
||||||
|
$(function () { |
||||||
|
$('body').addClass('body-fixed').append('<div class="modal-wrapper"/>'); |
||||||
|
placeInput('100%'); |
||||||
|
$('#id_code_country').select2({ |
||||||
|
width: '95px' |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
$.fancybox.open([ |
||||||
|
{ |
||||||
|
href: '#end-reg' |
||||||
|
} |
||||||
|
], { |
||||||
|
closeBtn: false, // hide close button
|
||||||
|
closeClick: false, // prevents closing when clicking INSIDE fancybox
|
||||||
|
modal: true, |
||||||
|
scrolling: 'no', |
||||||
|
helpers: { |
||||||
|
// prevents closing when clicking OUTSIDE fancybox
|
||||||
|
overlay: {closeClick: false} |
||||||
|
}, |
||||||
|
keys: { |
||||||
|
// prevents closing when press ESC button
|
||||||
|
close: null |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
$('#end-reg-form').on('submit', function (e) { |
||||||
|
e.preventDefault(); |
||||||
|
var url = $(this).attr('action'); |
||||||
|
var formData = $(this).serialize(); |
||||||
|
$.post(url, formData, registrationSuccess) |
||||||
|
}); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
/** |
||||||
|
* current module general initialization |
||||||
|
* @param {Object} options - options recieved from web page view |
||||||
|
*/ |
||||||
|
that.init = function (options) { |
||||||
|
// settings extending
|
||||||
|
$.extend(this.opt, options); |
||||||
|
// begin of initialization
|
||||||
|
|
||||||
|
}; |
||||||
|
return that; |
||||||
|
}()); |
||||||
|
} |
||||||
@ -1,45 +0,0 @@ |
|||||||
function registrationSuccess(data){ |
|
||||||
|
|
||||||
if (data.success){ |
|
||||||
location.reload(); |
|
||||||
} |
|
||||||
else{ |
|
||||||
console.log(data); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
$(document).ready(function () { |
|
||||||
|
|
||||||
placeInput('100%'); |
|
||||||
$('#id_code_country').select2({ |
|
||||||
width: '95px' |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
$.fancybox.open([ |
|
||||||
{ |
|
||||||
href : '#end-reg' |
|
||||||
} |
|
||||||
], { |
|
||||||
padding : 0, |
|
||||||
fitToView: false, |
|
||||||
closeBtn : false, // hide close button
|
|
||||||
closeClick : false, // prevents closing when clicking INSIDE fancybox
|
|
||||||
helpers : { |
|
||||||
// prevents closing when clicking OUTSIDE fancybox
|
|
||||||
overlay : {closeClick: false} |
|
||||||
}, |
|
||||||
keys : { |
|
||||||
// prevents closing when press ESC button
|
|
||||||
close : null |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
$('#end-reg-form').on('submit', function(e){ |
|
||||||
e.preventDefault(); |
|
||||||
var url = $(this).attr('action'); |
|
||||||
var formData = $(this).serialize(); |
|
||||||
$.post(url, formData, registrationSuccess) |
|
||||||
}); |
|
||||||
|
|
||||||
}); |
|
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||||
|
var EXPO=EXPO||{};EXPO.registration=EXPO.registration||{},EXPO.registration.completion?console.warn("WARNING: EXPO.registration..completion is already defined!"):EXPO.registration.completion=function(){var t={},e=function(t){t.success?location.reload():console.log(t)},i=function(t){$("#id_country").val("159").select2({placeholder:"Ваша страна",width:t}),$("#id_city").select2({placeholder:"Ваш город",width:t,ajax:{url:"/city/get-city/",dataType:"json",quietMillis:200,data:function(t,e,i){var i=$("#id_country").val();return{term:t,page:e,country:i}},results:function(t){var e=[];return $.each(t,function(t,i){e.push({id:i.id,text:i.label})}),{results:e}}},initSelection:function(t,e){var i=$(t).val(),n=$(t).attr("data-init-text");e({id:i,text:n})}})};t.opt={};EXPO.common;return $(function(){$("body").addClass("body-fixed").append('<div class="modal-wrapper"/>'),i("100%"),$("#id_code_country").select2({width:"95px"}),$.fancybox.open([{href:"#end-reg"}],{closeBtn:!1,closeClick:!1,modal:!0,scrolling:"no",helpers:{overlay:{closeClick:!1}},keys:{close:null}}),$("#end-reg-form").on("submit",function(t){t.preventDefault();var i=$(this).attr("action"),n=$(this).serialize();$.post(i,n,e)})}),t.init=function(t){$.extend(this.opt,t)},t}(); |
||||||
@ -1 +1 @@ |
|||||||
var EXPO=EXPO||{};EXPO.about?console.warn("WARNING: EXPO.eventsFeed is already defined!"):EXPO.about=function(){var t={};t.opt={};var s=(EXPO.common,function(t){this.opt=t;var s=this,i=this.opt,a=(i.tabClass,i.activeClass);this.$tabsList=$("#"+i.listId),this.$tabs=$("#"+i.tabsId),this.$tabsOpenings=$("#"+i.tabsOpeningId),$("a",this.$tabsList).on("click",function(){$(this).parent("li").addClass(a).siblings().removeClass(a);var t=$(this).attr("href");return t=t.replace("#",""),s.setActive(t),!1})});return s.prototype={setActive:function(t){var s=this.opt.activeClass,i=this.opt.tabClass,a=this.opt.postfix;this.$tabs.children("."+i).hide().removeClass(s),this.$tabs.children("#"+t).fadeIn(function(){$(this).addClass(s)}),this.$tabsOpenings.children("."+i).removeClass(s),this.$tabsOpenings.children("#"+t+a).addClass(s)}},t.init=function(t){$.extend(this.opt,t);this.tabs=new s(this.opt.tabs)},t}(); |
var EXPO=EXPO||{};EXPO.about?console.warn("WARNING: EXPO.about is already defined!"):EXPO.about=function(){var t={};t.opt={};var s=(EXPO.common,function(t){this.opt=t;var s=this,i=this.opt,a=(i.tabClass,i.activeClass);this.$tabsList=$("#"+i.listId),this.$tabs=$("#"+i.tabsId),this.$tabsOpenings=$("#"+i.tabsOpeningId),$("a",this.$tabsList).on("click",function(){$(this).parent("li").addClass(a).siblings().removeClass(a);var t=$(this).attr("href");return t=t.replace("#",""),s.setActive(t),!1})});return s.prototype={setActive:function(t){var s=this.opt.activeClass,i=this.opt.tabClass,a=this.opt.postfix;this.$tabs.children("."+i).hide().removeClass(s),this.$tabs.children("#"+t).fadeIn(function(){$(this).addClass(s)}),this.$tabsOpenings.children("."+i).removeClass(s),this.$tabsOpenings.children("#"+t+a).addClass(s)}},t.init=function(t){$.extend(this.opt,t);this.tabs=new s(this.opt.tabs)},t}(); |
||||||
@ -1 +1 @@ |
|||||||
var EXPO=EXPO||{};EXPO.organizer=EXPO.organizer||{},EXPO.organizer.add?console.warn("WARNING: EXPO.eventsFeed is already defined!"):EXPO.organizer.add=function(){var e={};e.opt={};EXPO.common;return e.init=function(e){$.extend(this.opt,e);var d=this;$(function(){$("#"+d.opt.steps[0].id+" ."+d.opt.steps[0].typeClass).each(function(){function e(){var e=a.filter(":checked").length>0,d=t.find("input, select, textarea, button"),s=t.find("div.c-select-box");e?(t.removeClass("disabled"),s.removeClass("disabled"),d.prop("disabled",!1)):(t.addClass("disabled"),s.addClass("disabled"),d.prop("disabled",!0))}var s=$(this),a=s.find('input[type="radio"]'),t=a.closest("form").children("."+d.opt.steps[0].formBodyClass);e(),a.on("change",e)})})},e}(); |
var EXPO=EXPO||{};EXPO.organizer=EXPO.organizer||{},EXPO.organizer.add?console.warn("WARNING: EXPO.eventsFeed is already defined!"):EXPO.organizer.add=function(){var e={};e.opt={};EXPO.common;return e.init=function(e){$.extend(this.opt,e);var s=this;$(function(){$("#"+s.opt.steps[0].id).each(function(){function e(){var e=a.filter(":checked").length>0,s=o.find("input, select, textarea, button"),t=o.find("div.c-select-box");e?(o.removeClass("disabled"),t.removeClass("disabled"),s.prop("disabled",!1)):(o.addClass("disabled"),t.addClass("disabled"),s.prop("disabled",!0))}var t=$(this),a=t.find("."+s.opt.steps[0].typeClass+' input[type="radio"]'),o=$("."+s.opt.steps[0].formBodyClass,t);e(),a.on("change",e);for(var d=0;d<s.opt.steps[0].dateClasses.length;d++)$("."+s.opt.steps[0].dateClasses[d],t).datepicker({dateFormat:"dd.mm.yy",showOn:"button",showOtherMonths:!0,constrainInput:!0,onClose:function(e){var a;$(this).hasClass("dateFrom")?(a=$(this).closest(".period").find("."+s.opt.steps[0].dateClasses[1]),a.datepicker("option","minDate",e)):$(this).hasClass("dateTo")?(a=$(this).closest(".period").find("."+s.opt.steps[0].dateClasses[0]),a.datepicker("option","maxDate",e)):$(this).hasClass("dateFromLast")&&(a=t.find(".date-to-date").find("."+s.opt.steps[0].dateClasses[1]),a.datepicker("option","minDate",e))}})})})},e}(); |
||||||
Loading…
Reference in new issue