summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/project.js.coffee
blob: 94380ccac7b0956de0ccf9d8cd3b85c8138cffe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class @Project
  constructor: ->
    # Git clone panel switcher
    cloneHolder = $('.git-clone-holder')
    if cloneHolder.length
      $('a, button', cloneHolder).click ->
        $('a, button', cloneHolder).removeClass 'active'
        $(@).addClass 'active'
        $('#project_clone', cloneHolder).val $(@).data 'clone'
        $(".clone").text("").append $(@).data 'clone'

    # 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').remove()
      e.preventDefault()

    $('.hide-no-password-message').on 'click', (e) ->
      path = '/'
      $.cookie('hide_no_password_message', 'false', { path: path })
      $(@).parents('.no-password-message').remove()
      e.preventDefault()

    $('.update-notification').on 'click', (e) ->
      e.preventDefault()
      level = $(this).data('notification-level')
      $('#notification_level').val(level)
      $('#notification-form').submit()