issuable_context.js.coffee 957 Bytes
Newer Older
1 2 3 4 5 6 7
#= require jquery.waitforimages

class @IssuableContext
  constructor: ->
    new UsersSelect()
    $('select.select2').select2({width: 'resolve', dropdownAutoWidth: true})

8
    $(".issuable-sidebar .inline-update").on "change", "select", ->
9
      $(this).submit()
10
    $(".issuable-sidebar .inline-update").on "change", ".js-assignee", ->
11 12 13
      $(this).submit()

    $('.issuable-details').waitForImages ->
14 15 16 17 18
      $('.issuable-affix').on 'affix.bs.affix', ->
        $(@).width($(@).outerWidth())
      .on 'affixed-top.bs.affix affixed-bottom.bs.affix', ->
        $(@).width('')

19 20
      $('.issuable-affix').affix offset:
        top: ->
21
          @top = ($('.issuable-affix').offset().top - 70)
22 23
        bottom: ->
          @bottom = $('.footer').outerHeight(true)
24 25 26 27 28 29

    $(".edit-link").click (e) ->
      block = $(@).parents('.block')
      block.find('.selectbox').show()
      block.find('.value').hide()
      block.find('.js-select2').select2("open")