2012-09-04 11:36:14 -04:00
|
|
|
window.Projects = ->
|
2012-09-06 05:44:44 -07:00
|
|
|
$('#project_name').on 'change', ->
|
|
|
|
slug = slugify $(@).val()
|
2012-09-06 07:56:33 -07:00
|
|
|
$('#project_code, #project_path').val slug
|
2012-03-26 21:41:58 +03:00
|
|
|
|
2012-09-06 05:44:44 -07:00
|
|
|
$('.new_project, .edit_project').on 'ajax:before', ->
|
|
|
|
$('.project_new_holder, .project_edit_holder').hide()
|
|
|
|
$('.save-project-loader').show()
|
2012-03-26 21:41:58 +03:00
|
|
|
|
2012-09-06 05:44:44 -07:00
|
|
|
$('form #project_default_branch').chosen()
|
2012-09-09 05:40:22 -04:00
|
|
|
disableButtonIfEmptyField '#project_name', '.project-submit'
|
2012-08-30 22:15:34 +03:00
|
|
|
|
2012-09-04 11:36:14 -04:00
|
|
|
$ ->
|
2012-09-16 12:07:57 -04:00
|
|
|
# Git clone panel switcher
|
2012-09-06 05:44:44 -07:00
|
|
|
scope = $ '.project_clone_holder'
|
2012-09-04 11:36:14 -04:00
|
|
|
if scope.length > 0
|
|
|
|
$('a, button', scope).click ->
|
2012-09-06 05:44:44 -07:00
|
|
|
$('a, button', scope).removeClass 'active'
|
|
|
|
$(@).addClass 'active'
|
|
|
|
$('#project_clone', scope).val $(@).data 'clone'
|
2012-09-16 12:07:57 -04:00
|
|
|
|
|
|
|
# Ref switcher
|
|
|
|
$('.project-refs-select').on 'change', ->
|
|
|
|
$(@).parents('form').submit()
|