summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects.js.coffee
blob: d03a487c453c069a7abe2e150c4e0b79d4672aa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
window.Projects = ->
  $('.new_project, .edit_project').on 'ajax:before', ->
    $('.project_new_holder, .project_edit_holder').hide()
    $('.save-project-loader').show()

  $('form #project_default_branch').chosen()
  disableButtonIfEmptyField '#project_name', '.project-submit'

$ ->
  # 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'

  # Ref switcher
  $('.project-refs-select').on 'change', ->
    $(@).parents('form').submit()