debian-mirror-gitlab/app/assets/javascripts/behaviors/toggler_behavior.coffee

15 lines
496 B
CoffeeScript
Raw Normal View History

2014-09-02 18:07:02 +05:30
$ ->
# 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').
2015-04-26 12:48:37 +05:30
toggleClass('fa fa-chevron-down').
toggleClass('fa fa-chevron-up')
2014-09-02 18:07:02 +05:30
$(@).closest(".js-toggle-container").find(".js-toggle-content").toggle()
e.preventDefault()