Welcome to mirror list, hosted at ThFree Co, Russian Federation.

toggler_behavior.coffee « behaviors « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d06cb116dfed8ae3421a3fabbff941df9e9e4f32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ ->
  $("body").on "click", ".js-toggler-target", ->
    container = $(@).closest(".js-toggler-container")
    container.toggleClass("on")

  # Toggle button. Show/hide content inside parent container.
  # Button does not change visibility. If button has icon - it changes chevron style.
  #
  # %div.js-toggle-container
  #   %a.js-toggle-button
  #   %div.js-toggle-content
  #
  $("body").on "click", ".js-toggle-button", (e) ->
    $(@).find('i').
      toggleClass('icon-chevron-down').
      toggleClass('icon-chevron-up')
    $(@).closest(".js-toggle-container").find(".js-toggle-content").toggle()
    e.preventDefault()