2012-09-04 17:36:14 +02:00
|
|
|
window.Projects = ->
|
2012-09-06 14:44:44 +02:00
|
|
|
$('.new_project, .edit_project').on 'ajax:before', ->
|
|
|
|
$('.project_new_holder, .project_edit_holder').hide()
|
|
|
|
$('.save-project-loader').show()
|
2012-03-26 20:41:58 +02:00
|
|
|
|
2012-09-06 14:44:44 +02:00
|
|
|
$('form #project_default_branch').chosen()
|
2012-09-09 11:40:22 +02:00
|
|
|
disableButtonIfEmptyField '#project_name', '.project-submit'
|
2012-08-30 21:15:34 +02:00
|
|
|
|
2012-09-04 17:36:14 +02:00
|
|
|
$ ->
|
2012-09-16 18:07:57 +02:00
|
|
|
# Git clone panel switcher
|
2012-09-06 14:44:44 +02:00
|
|
|
scope = $ '.project_clone_holder'
|
2012-09-04 17:36:14 +02:00
|
|
|
if scope.length > 0
|
|
|
|
$('a, button', scope).click ->
|
2012-09-06 14:44:44 +02:00
|
|
|
$('a, button', scope).removeClass 'active'
|
|
|
|
$(@).addClass 'active'
|
|
|
|
$('#project_clone', scope).val $(@).data 'clone'
|
2012-09-16 18:07:57 +02:00
|
|
|
|
|
|
|
# Ref switcher
|
|
|
|
$('.project-refs-select').on 'change', ->
|
|
|
|
$(@).parents('form').submit()
|
2013-02-19 13:43:24 +01:00
|
|
|
|
|
|
|
$('#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')
|
|
|
|
|