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()
|
|
|
|
|
2013-10-21 06:07:16 -04:00
|
|
|
|
2013-05-14 05:46:41 -04:00
|
|
|
initEvents: ->
|
2013-05-02 07:36:53 -04:00
|
|
|
disableButtonIfEmptyField '#project_name', '.project-submit'
|
2013-10-21 06:07:16 -04:00
|
|
|
|
2013-05-02 07:36:53 -04: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')
|
|
|
|
|
2013-05-14 05:46:41 -04:00
|
|
|
|
2013-05-02 07:36:53 -04:00
|
|
|
@Project = Project
|
|
|
|
|
|
|
|
$ ->
|
|
|
|
# Git clone panel switcher
|
2013-10-21 06:07:16 -04:00
|
|
|
scope = $ '.git-clone-holder'
|
2013-05-02 07:36:53 -04:00
|
|
|
if scope.length > 0
|
|
|
|
$('a, button', scope).click ->
|
|
|
|
$('a, button', scope).removeClass 'active'
|
|
|
|
$(@).addClass 'active'
|
|
|
|
$('#project_clone', scope).val $(@).data 'clone'
|
2014-01-07 22:03:27 -05:00
|
|
|
$(".clone").text("").append $(@).data 'clone'
|
2013-05-02 07:36:53 -04:00
|
|
|
|
|
|
|
# Ref switcher
|
|
|
|
$('.project-refs-select').on 'change', ->
|
|
|
|
$(@).parents('form').submit()
|
2013-11-12 03:19:23 -05:00
|
|
|
|
|
|
|
$('.hide-no-ssh-message').on 'click', (e) ->
|
2013-11-12 03:36:09 -05:00
|
|
|
path = '/'
|
|
|
|
$.cookie('hide_no_ssh_message', 'false', { path: path })
|
2013-11-12 03:19:23 -05:00
|
|
|
$(@).parents('.no-ssh-key-message').hide()
|
|
|
|
e.preventDefault()
|