Last active
August 29, 2015 14:26
-
-
Save ezhlobo/ca690f1df81cdb4ec9db to your computer and use it in GitHub Desktop.
Code examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import 'merge'; | |
.filter__control-text { | |
font-family: inherit; | |
font-size: 14px; | |
color: $color--text--gray; | |
text-decoration: none; | |
cursor: pointer; | |
@at-root button#{&} { | |
padding: 0; | |
border: 0; | |
background-color: transparent; | |
appearance: none; | |
} | |
&--right { | |
float: right; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.Modules.create({ | |
body: function(app, $) { | |
return { | |
constructor: function() { | |
this.init(); | |
}, | |
init: function() { | |
$('.form__range').each(this.initByOne.bind(this)); | |
}, | |
initByOne: function(index, item) { | |
var $range = $(item); | |
var $parent = $range.parent(); | |
var $form = $range.closest('form'); | |
var $from = $($range.attr('data-node-from')).hide(); | |
var $to = $($range.attr('data-node-to')).hide(); | |
var defaultMinMaxValues = [200, 6000]; | |
$range.ionRangeSlider({ | |
type: 'double', | |
min: defaultMinMaxValues[0], | |
max: defaultMinMaxValues[1], | |
from: $from.val(), | |
to: $to.val(), | |
hide_min_max: true, | |
hide_from_to: false, | |
grid: false, | |
prefix: '$', | |
onChange: function(data) { | |
this.updateField($from, data.from); | |
this.updateField($to, data.to); | |
}.bind(this), | |
onFinish: function(data) { | |
$form.trigger('change'); | |
}.bind(this) | |
}); | |
var rangeSlider = $range.data('ionRangeSlider'); | |
// Add form reset supporting | |
// @TODO Need to optimize events firing | |
$form.on('reset', function() { | |
this.trackInput($range, $parent); | |
rangeSlider.reset(); | |
this.dontTrackInput($range, $form); | |
}.bind(this)); | |
this.dontTrackInput($range, $form); | |
}, | |
// Fix for triggering form#onchange, fire onchange manually | |
// instead of it | |
dontTrackInput: function($range, $form) { | |
return $range.insertAfter($form).hide(); | |
}, | |
trackInput: function($range, $parent) { | |
return $range.insertAfter($parent.children().last()).show(); | |
}, | |
updateField: function($field, value) { | |
if ($field.val() !== value) { | |
$field.val(value); | |
} | |
} | |
}; | |
}, | |
onDocumentReady: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.Modules.create({ | |
body: function(app, $) { | |
return { | |
constructor: function() { | |
var module = this; | |
$.document.on(window.eventName.click, '.js-modalwin-close', function(event) { | |
event.preventDefault(); | |
module.hide(); | |
}); | |
}, | |
open: function() { | |
app.utils.status.set('modalwin--shown'); | |
$.window.on('keydown.module-modalwin', this.hideByKeyword.bind(this)); | |
}, | |
hide: function() { | |
app.utils.status.drop('modalwin--shown'); | |
$.window.off('.module-modalwin'); | |
}, | |
hideByKeyword: function(event) { | |
if (event.keyCode === app.utils.key.Esc) { | |
this.hide(); | |
} | |
} | |
}; | |
}, | |
export: { | |
open_modal_window: 'open', | |
hide_modal_windows: 'hide' | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment