2016-07-24 16:45:11 -04:00
|
|
|
(function() {
|
|
|
|
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
|
|
|
|
|
|
|
this.ProjectNew = (function() {
|
|
|
|
function ProjectNew() {
|
|
|
|
this.toggleSettings = bind(this.toggleSettings, this);
|
2016-09-02 09:51:36 -04:00
|
|
|
this.$selects = $('.features select');
|
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
$('.project-edit-container').on('ajax:before', (function(_this) {
|
|
|
|
return function() {
|
|
|
|
$('.project-edit-container').hide();
|
|
|
|
return $('.save-project-loader').show();
|
|
|
|
};
|
|
|
|
})(this));
|
|
|
|
this.toggleSettings();
|
|
|
|
this.toggleSettingsOnclick();
|
|
|
|
}
|
|
|
|
|
|
|
|
ProjectNew.prototype.toggleSettings = function() {
|
2016-09-02 09:51:36 -04:00
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this.$selects.each(function () {
|
|
|
|
var $select = $(this),
|
|
|
|
className = $select.data('field').replace(/_/g, '-')
|
|
|
|
.replace('access-level', 'feature');
|
|
|
|
self._showOrHide($select, '.' + className);
|
|
|
|
});
|
2016-07-24 16:45:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
ProjectNew.prototype.toggleSettingsOnclick = function() {
|
2016-09-02 09:51:36 -04:00
|
|
|
this.$selects.on('change', this.toggleSettings);
|
2016-07-24 16:45:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
ProjectNew.prototype._showOrHide = function(checkElement, container) {
|
2016-09-02 09:51:36 -04:00
|
|
|
var $container = $(container);
|
|
|
|
|
2016-09-02 07:03:49 -04:00
|
|
|
if ($(checkElement).val() !== '0') {
|
2016-07-24 16:45:11 -04:00
|
|
|
return $container.show();
|
|
|
|
} else {
|
|
|
|
return $container.hide();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return ProjectNew;
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
}).call(this);
|