2013-05-02 07:36:53 -04:00
|
|
|
class Project
|
|
|
|
constructor: ->
|
2013-05-14 05:46:41 -04:00
|
|
|
$('.project-edit-container').on 'ajax:before', =>
|
|
|
|
$('.project-edit-container').hide()
|
2013-05-02 07:36:53 -04:00
|
|
|
$('.save-project-loader').show()
|
|
|
|
|
2013-05-14 05:46:41 -04:00
|
|
|
@initEvents()
|
|
|
|
|
|
|
|
|
|
|
|
initEvents: ->
|
2013-05-02 07:36:53 -04:00
|
|
|
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')
|
|
|
|
|
2013-05-14 05:46:41 -04:00
|
|
|
|
2013-05-02 07:36:53 -04:00
|
|
|
@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'
|
2013-09-13 04:12:42 -04:00
|
|
|
$(".clone").text("").append 'git remote add origin ' + $(@).data 'clone'
|
2013-05-02 07:36:53 -04:00
|
|
|
|
|
|
|
# Ref switcher
|
|
|
|
$('.project-refs-select').on 'change', ->
|
|
|
|
$(@).parents('form').submit()
|