Skip to content

Instantly share code, notes, and snippets.

View lislon's full-sized avatar

Igor Golovin lislon

View GitHub Profile
var controller = new Controller({
loanCalcRegion: app.getRegion('loanCalc'),
loanOrder: window.__DATA.order,
yaCounter: window.yaCounter23682952,
});
app.Router = new Marionette.AppRouter({
routes: {
'order': function() {
app.on('start', function() {
if (Backbone.history) {
var state = Backbone.history.start({
pushState: false,
});
console.log("history started?");
}
})
Marionette.Module.extend = Marionette.extend;
// Extend the Module prototype with events / listenTo, so that the module
// can be used as an event aggregator or pub/sub.
_.extend(Marionette.Module.prototype, Backbone.Events, {
// Initialize is an empty function by default. Override it with your own
// initialization logic when extending Marionette.Module.
initialize: function(){},
Behaviors.Dialog = Marionette.Behavior.extend({
tiggers: {
'click .js-close-dialog': 'dialog:close'
},
events: {
'click .js-close-dialog': 'closeDialog'
},
initialize: function (opts) {
this.$overlay = $(document).find('#modal-overlay')
this.$content = $(document).find('#modal-content')
create: function (options) {
var c = this;
console.log("Layout created");
c.loanOrder.set('loan', options); // Set options from loan calc to loan order
c.layout = new views.Layout();
c.layout.on('render', function() {
c.infoPanel = new views.Panel({model: c.loanOrder});
c.layout.getRegion('infoPanel').show(c.infoPanel);
c.renderStageForm();
service.updateJob = function (orderId, attributes, done) {
service.jobFieldsValidation.check(attributes).then(function (attributes){
var Order = derp.db.model('Order');
service.getById(orderId, {
where: {
stage: {
$gte: Order.STAGE.PASSPORT,
$lt: Order.STAGE.MISC_AND_CONFIRM
}
}
schema.path('passport.series').validate(function (value) {
return /^\d{4}$/.test(value)
}, 'Серия указана неверно')
@lislon
lislon / views.js
Last active August 29, 2015 14:16
StageOne: Marionette.ItemView.extend({
template: 'tpl-loan-form-1',
behaviors: {
Loadable: {},
Formable: {
fields: {
firstname: {},
middlename: {},
lastname: {},
gender: {
renderFirstStage: function () {
var c = this;
// Set default city, if we are not proceed to step2 (loan.office != null)
var loan = c.loanOrder.get('loan');
if (!loan.office) {
loan.city = shared.me.get('city').id;
c.loanOrder.set('loan', loan);
}
script(type="text/html", id="tpl-localSet-item")
button.clear
span {{ title }}
span {{ showMetro }}
{{#if hours}}
{{#if isEveryday }}
div.time
span Ежедневно
span {{ hours.workdays }}