admin.js.coffee 1.46 KB
Newer Older
1
class @Admin
2
  constructor: ->
3 4
    $('input#user_force_random_password').on 'change', (elem) ->
      elems = $('#user_password, #user_password_confirmation')
5

6 7 8 9
      if $(@).attr 'checked'
        elems.val('').attr 'disabled', true
      else
        elems.removeAttr 'disabled'
randx's avatar
randx committed
10

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

15 16 17
    $('.log-tabs a').click (e) ->
      e.preventDefault()
      $(this).tab('show')
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
18

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

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

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

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

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

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

    showBlacklistType = ->
43
      if $("input[name='blacklist_type']:checked").val() == 'file'
44 45 46 47 48 49
        $('.blacklist-file').show()
        $('.blacklist-raw').hide()
      else
        $('.blacklist-file').hide()
        $('.blacklist-raw').show()

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