summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/admin.js.coffee
blob: 90c09619f8c94ee0787059f6ddcc92e088fef45d (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class @Admin
  constructor: ->
    $('input#user_force_random_password').on 'change', (elem) ->
      elems = $('#user_password, #user_password_confirmation')

      if $(@).attr 'checked'
        elems.val('').attr 'disabled', true
      else
        elems.removeAttr 'disabled'

    $('body').on 'click', '.js-toggle-colors-link', (e) ->
      e.preventDefault()
      $('.js-toggle-colors-container').toggle()

    $('.log-tabs a').click (e) ->
      e.preventDefault()
      $(this).tab('show')

    $('.log-bottom').click (e) ->
      e.preventDefault()
      visible_log = $(".file-content:visible")
      visible_log.animate({ scrollTop: visible_log.find('ol').height() }, "fast")

    modal = $('.change-owner-holder')

    $('.change-owner-link').bind "click", (e) ->
      e.preventDefault()
      $(this).hide()
      modal.show()

    $('.change-owner-cancel-link').bind "click", (e) ->
      e.preventDefault()
      modal.hide()
      $('.change-owner-link').show()

    $('li.project_member').bind 'ajax:success', ->
      Turbolinks.visit(location.href)

    $('li.group_member').bind 'ajax:success', ->
      Turbolinks.visit(location.href)

    showBlacklistType = ->
      if $("input[name='blacklist_type']:checked").val() == 'file'
        $('.blacklist-file').show()
        $('.blacklist-raw').hide()
      else
        $('.blacklist-file').hide()
        $('.blacklist-raw').show()

    $("input[name='blacklist_type']").click showBlacklistType
    showBlacklistType()