2014-10-20 20:48:07 +00:00
|
|
|
class @Project
|
2013-05-02 11:36:53 +00:00
|
|
|
constructor: ->
|
2015-11-25 01:38:36 +00:00
|
|
|
# Git protocol switcher
|
|
|
|
$('.js-protocol-switch').click ->
|
|
|
|
return if $(@).hasClass('active')
|
|
|
|
|
|
|
|
# Toggle 'active' for both buttons
|
|
|
|
$('.js-protocol-switch').toggleClass('active')
|
|
|
|
|
|
|
|
url = $(@).data('clone')
|
|
|
|
|
|
|
|
# Update the input field
|
|
|
|
$('#project_clone').val(url)
|
|
|
|
|
|
|
|
# Update the command line instructions
|
|
|
|
$('.clone').text(url)
|
2014-10-21 20:39:34 +00: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 })
|
2015-02-13 12:33:28 +00:00
|
|
|
$(@).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()
|
2014-10-21 20:39:34 +00:00
|
|
|
e.preventDefault()
|
2015-09-15 00:27:54 +00:00
|
|
|
|
|
|
|
$('.update-notification').on 'click', (e) ->
|
|
|
|
e.preventDefault()
|
2015-09-17 00:46:24 +00:00
|
|
|
notification_level = $(@).data 'notification-level'
|
|
|
|
$('#notification_level').val(notification_level)
|
2015-09-15 01:33:24 +00:00
|
|
|
$('#notification-form').submit()
|
2015-09-17 00:46:24 +00:00
|
|
|
label = null
|
|
|
|
switch notification_level
|
|
|
|
when 0 then label = ' Disabled '
|
|
|
|
when 1 then label = ' Participating '
|
|
|
|
when 2 then label = ' Watching '
|
|
|
|
when 3 then label = ' Global '
|
|
|
|
when 4 then label = ' On Mention '
|
|
|
|
$('#notifications-button').empty().append("<i class='fa fa-bell'></i>" + label + "<i class='fa fa-angle-down'></i>")
|
2015-09-15 01:50:13 +00:00
|
|
|
$(@).parents('ul').find('li.active').removeClass 'active'
|
2015-11-25 00:32:06 +00:00
|
|
|
$(@).parent().addClass 'active'
|