gitlab-org--gitlab-foss/app/assets/javascripts/project.js.coffee

43 lines
1.2 KiB
CoffeeScript
Raw Normal View History

2013-05-02 07:36:53 -04:00
class Project
constructor: ->
$('.project-edit-container').on 'ajax:before', =>
$('.project-edit-container').hide()
2013-05-02 07:36:53 -04:00
$('.save-project-loader').show()
@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-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()