diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-11 15:15:08 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-11 15:15:08 +0200 |
commit | 7157f79caa88689f1b8989d183ef20fbc942bd0f (patch) | |
tree | 91af9f2e55ae1590eed375ee740e6d3756dc5a42 /app/assets | |
parent | 9f405068cdfeb185cd3762f0ae5df6d87f6e31ba (diff) | |
download | gitlab-ce-7157f79caa88689f1b8989d183ef20fbc942bd0f.tar.gz |
Refactor js behaviours helpers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/behaviors/details_behavior.coffee | 12 | ||||
-rw-r--r-- | app/assets/javascripts/behaviors/toggler_behavior.coffee | 15 | ||||
-rw-r--r-- | app/assets/javascripts/main.js.coffee | 9 | ||||
-rw-r--r-- | app/assets/stylesheets/generic/common.scss | 4 |
4 files changed, 19 insertions, 21 deletions
diff --git a/app/assets/javascripts/behaviors/details_behavior.coffee b/app/assets/javascripts/behaviors/details_behavior.coffee index 7ad5c818946..decab3e1bed 100644 --- a/app/assets/javascripts/behaviors/details_behavior.coffee +++ b/app/assets/javascripts/behaviors/details_behavior.coffee @@ -1,5 +1,15 @@ $ -> $("body").on "click", ".js-details-target", -> container = $(@).closest(".js-details-container") - container.toggleClass("open") + + # Show details content. Hides link after click. + # + # %div + # %a.js-details-expand + # %div.js-details-content + # + $("body").on "click", ".js-details-expand", (e) -> + $(@).next('.js-details-content').removeClass("hide") + $(@).hide() + e.preventDefault() diff --git a/app/assets/javascripts/behaviors/toggler_behavior.coffee b/app/assets/javascripts/behaviors/toggler_behavior.coffee index 5afb656e696..d06cb116dfe 100644 --- a/app/assets/javascripts/behaviors/toggler_behavior.coffee +++ b/app/assets/javascripts/behaviors/toggler_behavior.coffee @@ -1,17 +1,18 @@ $ -> $("body").on "click", ".js-toggler-target", -> container = $(@).closest(".js-toggler-container") - container.toggleClass("on") - $("body").on "click", ".js-toggle-visibility-link", (e) -> + # 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') - container = $(".js-toggle-visibility-container") - container.toggleClass("hide") - e.preventDefault() - - $("body").on "click", ".js-toggle-button", (e) -> $(@).closest(".js-toggle-container").find(".js-toggle-content").toggle() e.preventDefault() diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee index 69c731ff1a1..70e8972d24d 100644 --- a/app/assets/javascripts/main.js.coffee +++ b/app/assets/javascripts/main.js.coffee @@ -62,11 +62,6 @@ $ -> $('.remove-row').bind 'ajax:success', -> $(this).closest('li').fadeOut() - # Click a .appear-link, appear-data fadeout - $(".appear-link").on 'click', (e) -> - $('.appear-data').fadeIn() - e.preventDefault() - # Initialize select2 selects $('select.select2').select2(width: 'resolve', dropdownAutoWidth: true) @@ -121,10 +116,6 @@ $ -> $(@).next('table').show() $(@).remove() - $(".diff-content").on "click", ".js-details-expand", -> - $(@).next('.js-details-contain').removeClass("hide") - $(@).remove() - (($) -> # Disable an element and add the 'disabled' Bootstrap class $.fn.extend disable: -> diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss index 6183cefa594..b5ccaed0401 100644 --- a/app/assets/stylesheets/generic/common.scss +++ b/app/assets/stylesheets/generic/common.scss @@ -298,10 +298,6 @@ img.emoji { width: 20px; } -.appear-data { - display: none; -} - .chart { overflow: hidden; height: 220px; |