Sha256: 6f12dcfae87d696bbd8f633c1d00774650e1a1f41ee4b97ad43a3ad29add351c

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

# Tabs

enable_redactor = ->
  # Workaround for redactor and easytabs integration,
  # the problem is that not current redactors are not
  # clickable after init.
  
  unless window.redactor_settings
    window.redactor_settings = {}

  window.redactor_settings["buttons"] = [ 'html', '|',
                                          'formatting', '|',
                                          'bold', 'italic', 'deleted', '|',
                                          'unorderedlist', 'orderedlist', 'outdent', 'indent', '|',
                                          'image', 'video', 'file', 'table', 'link', '|',
                                          'alignleft', 'aligncenter', 'alignright', 'justify', '|',
                                          'fullscreen' ]

  # after tab was clicked there is a workaround to turn on redactor
  $('#settings_tabs').bind 'easytabs:after', (event, $clicked, $targetPanel, settings) ->
    text_input = $targetPanel.find('.settings-redactor')
    if text_input.css("display") != "none"
      text_input.redactor window.redactor_settings

  # init redactor for the first visible tab
  $('#settings_tabs .settings-redactor:visible').redactor window.redactor_settings

$ ->
  $('#settings_tabs').easytabs
    animate:true
    animationSpeed:0
    tabActiveClass:"selected"

  enable_redactor()

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-settings-0.3.1 vendor/assets/javascripts/activeadmin_settings/tabs.js.coffee
activeadmin-settings-0.3.0 vendor/assets/javascripts/activeadmin_settings/tabs.js.coffee