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

49 lines
1.4 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'
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-02 07:36:53 -04:00
@Project = Project
$ ->
# Git clone panel switcher
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'
$(".clone").text("").append $(@).data 'clone'
2013-05-02 07:36:53 -04:00
# Ref switcher
$('.project-refs-select').on 'change', ->
$(@).parents('form').submit()
$('.hide-no-ssh-message').on 'click', (e) ->
path = '/'
$.cookie('hide_no_ssh_message', 'false', { path: path })
$(@).parents('.no-ssh-key-message').hide()
e.preventDefault()