diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-02 15:36:53 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-02 15:36:53 +0400 |
commit | 0b981eb9b3fbef8f34b9be37a2484c96189ea417 (patch) | |
tree | dc3de45fc520d902a1e58cd01f01b1f6ce558a60 /app/assets/javascripts/project.js.coffee | |
parent | 37f3d0f25b7188312e5d781514245a2853054e4b (diff) |
coffescript refactoring pt.1
Diffstat (limited to 'app/assets/javascripts/project.js.coffee')
-rw-r--r-- | app/assets/javascripts/project.js.coffee | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee new file mode 100644 index 00000000000..f926188d23f --- /dev/null +++ b/app/assets/javascripts/project.js.coffee @@ -0,0 +1,37 @@ +class Project + constructor: -> + $('.new_project, .edit_project').on 'ajax:before', -> + $('.project_new_holder, .project_edit_holder').hide() + $('.save-project-loader').show() + + $('form #project_default_branch').chosen() + disableButtonIfEmptyField '#project_name', '.project-submit' + + $('#project_issues_enabled').change -> + if ($(this).is(':checked') == true) + $('#project_issues_tracker').removeAttr('disabled') + else + $('#project_issues_tracker').attr('disabled', 'disabled') + + $('#project_issues_tracker').change() + + $('#project_issues_tracker').change -> + if ($(this).val() == gon.default_issues_tracker || $(this).is(':disabled')) + $('#project_issues_tracker_id').attr('disabled', 'disabled') + else + $('#project_issues_tracker_id').removeAttr('disabled') + +@Project = Project + +$ -> + # Git clone panel switcher + scope = $ '.project_clone_holder' + if scope.length > 0 + $('a, button', scope).click -> + $('a, button', scope).removeClass 'active' + $(@).addClass 'active' + $('#project_clone', scope).val $(@).data 'clone' + + # Ref switcher + $('.project-refs-select').on 'change', -> + $(@).parents('form').submit() |