app/assets/javascripts/chr/view_tabs.coffee in chr-0.5.7 vs app/assets/javascripts/chr/view_tabs.coffee in chr-0.5.8
- old
+ new
@@ -20,18 +20,18 @@
# ...
# -----------------------------------------------------------------------------
@viewTabs =
# PRIVATE ===================================================================
_build_tabs: ->
- @$title.addClass 'title-with-tabs'
+ @$title.addClass "title-with-tabs"
@_create_tabs()
@_activate_tab(0)
_create_tabs: ->
@tabGroups = []
- groupsHash = {}
+ groupsHash = {}
for g in @form.groups
groupsHash[g.klassName] = g
@$tabs =$ "<aside class='header-tabs'></aside>"
@@ -40,21 +40,22 @@
for tab_id, tab_title of @config.viewTabs
@tabGroups.push(groupsHash[tab_id])
@$tabs.append(@_create_button(tab_title))
_create_button: (name) ->
- $tabButton =$ "<a href='#'>#{ name }</a>"
- $tabButton.on 'click', (e) =>
+ $tabButton =$ "<button>#{ name }</button>"
+ $tabButton.on "click", (e) =>
@_on_tab_click($(e.currentTarget))
- e.preventDefault()
return $tabButton
_on_tab_click: ($link) ->
index = @$tabs.children().index($link)
@_activate_tab(index)
+ @$content.scrollTop(0)
+ @$content.trigger("scroll")
_activate_tab: (index) ->
- @$tabs.children().removeClass('active')
+ @$tabs.children().removeClass("active")
@$tabs.find(":nth-child(#{ index + 1 })").addClass('active')
for g in @tabGroups
g.$el.hide()