summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/project_new.js
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-07-24 23:45:11 +0300
committerFatih Acet <acetfatih@gmail.com>2016-07-24 23:45:11 +0300
commitaaa9509d120524573085e94af9de5cdde83e3271 (patch)
tree3824cffd4cdd132ee9cf75a00a7624f5ccc0dabd /app/assets/javascripts/project_new.js
parent56b79181adc0bd6e9abef97ea075c14be971a01a (diff)
downloadgitlab-ce-aaa9509d120524573085e94af9de5cdde83e3271.tar.gz
ES6ify all the things!
Diffstat (limited to 'app/assets/javascripts/project_new.js')
-rw-r--r--app/assets/javascripts/project_new.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/assets/javascripts/project_new.js b/app/assets/javascripts/project_new.js
new file mode 100644
index 00000000000..798f15e40a0
--- /dev/null
+++ b/app/assets/javascripts/project_new.js
@@ -0,0 +1,40 @@
+(function() {
+ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ this.ProjectNew = (function() {
+ function ProjectNew() {
+ this.toggleSettings = bind(this.toggleSettings, this);
+ $('.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() {
+ this._showOrHide('#project_builds_enabled', '.builds-feature');
+ return this._showOrHide('#project_merge_requests_enabled', '.merge-requests-feature');
+ };
+
+ ProjectNew.prototype.toggleSettingsOnclick = function() {
+ return $('#project_builds_enabled, #project_merge_requests_enabled').on('click', this.toggleSettings);
+ };
+
+ ProjectNew.prototype._showOrHide = function(checkElement, container) {
+ var $container;
+ $container = $(container);
+ if ($(checkElement).prop('checked')) {
+ return $container.show();
+ } else {
+ return $container.hide();
+ }
+ };
+
+ return ProjectNew;
+
+ })();
+
+}).call(this);