diff options
author | Phil Hughes <me@iamphill.com> | 2016-09-02 14:03:49 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-09-02 14:03:49 +0300 |
commit | 4da474ca928fff916a1e8ac3bb42d81df2364431 (patch) | |
tree | 29bc134a1416ccdda3b18fe683b46eaf6f040568 /app | |
parent | fd1741b47970fc52d994367ba38b5d1353d94725 (diff) |
Hides merge request section in edit project when disabled
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/project_new.js | 8 | ||||
-rw-r--r-- | app/views/projects/_merge_request_settings.html.haml | 25 |
2 files changed, 18 insertions, 15 deletions
diff --git a/app/assets/javascripts/project_new.js b/app/assets/javascripts/project_new.js index 798f15e40a0..06034574c8a 100644 --- a/app/assets/javascripts/project_new.js +++ b/app/assets/javascripts/project_new.js @@ -15,18 +15,18 @@ } ProjectNew.prototype.toggleSettings = function() { - this._showOrHide('#project_builds_enabled', '.builds-feature'); - return this._showOrHide('#project_merge_requests_enabled', '.merge-requests-feature'); + this._showOrHide('#project_project_feature_attributes_builds_access_level', '.builds-feature'); + this._showOrHide('#project_project_feature_attributes_merge_requests_access_level', '.merge-requests-feature'); }; ProjectNew.prototype.toggleSettingsOnclick = function() { - return $('#project_builds_enabled, #project_merge_requests_enabled').on('click', this.toggleSettings); + $('#project_project_feature_attributes_builds_access_level, #project_project_feature_attributes_merge_requests_access_level').on('change', this.toggleSettings); }; ProjectNew.prototype._showOrHide = function(checkElement, container) { var $container; $container = $(container); - if ($(checkElement).prop('checked')) { + if ($(checkElement).val() !== '0') { return $container.show(); } else { return $container.hide(); diff --git a/app/views/projects/_merge_request_settings.html.haml b/app/views/projects/_merge_request_settings.html.haml index 19b4249374b..14eb47089b1 100644 --- a/app/views/projects/_merge_request_settings.html.haml +++ b/app/views/projects/_merge_request_settings.html.haml @@ -1,11 +1,14 @@ -%fieldset.builds-feature - %h5.prepend-top-0 - Merge Requests - .form-group - .checkbox - = f.label :only_allow_merge_if_build_succeeds do - = f.check_box :only_allow_merge_if_build_succeeds - %strong Only allow merge requests to be merged if the build succeeds - .help-block - Builds need to be configured to enable this feature. - = link_to icon('question-circle'), help_page_path('workflow/merge_requests', anchor: 'only-allow-merge-requests-to-be-merged-if-the-build-succeeds') +.merge-requests-feature + %fieldset.builds-feature + %hr + %h5.prepend-top-0 + Merge Requests + .form-group + .checkbox + = f.label :only_allow_merge_if_build_succeeds do + = f.check_box :only_allow_merge_if_build_succeeds + %strong Only allow merge requests to be merged if the build succeeds + %br + %span.descr + Builds need to be configured to enable this feature. + = link_to icon('question-circle'), help_page_path('workflow/merge_requests', anchor: 'only-allow-merge-requests-to-be-merged-if-the-build-succeeds') |