Sha256: 45556f1688592a64172302eae716a1f457249255140bdc925df0b2ed6860c503

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

Stored size: 1.3 KB

Contents

window.Alchemy = Alchemy || {}

Alchemy.FixedElements = {
  WRAPPER: '<sl-tab-group id="fixed-elements" />',
  TABS: '<sl-tab slot="nav" panel="main-content-elements">{{label}}</sl-tab>',

  // Builds fixed elements tabs
  buildTabs: function (label) {
    var $wrapper = $(this.WRAPPER),
      $tabs = $(this.TABS.replace(/{{label}}/, label))

    $("#main-content-elements").wrap($wrapper)
    $("#fixed-elements").prepend($tabs)
  },

  // Creates a fixed element tab.
  createTab: function (element_id, label) {
    var $fixed_elements = $("#fixed-elements")
    var panel_name = "fixed-element-" + element_id

    var $tab =
      '<sl-tab slot="nav" panel="' + panel_name + '">' + label + "</sl-tab>"
    $fixed_elements.append($tab)

    var $panel = $(
      '<sl-tab-panel name="' + panel_name + '" style="--padding: 0" />'
    )
    $fixed_elements.append($panel)
    window.requestAnimationFrame(function () {
      $fixed_elements.get(0).show(panel_name)
    })
  },

  removeTab: function (element_id) {
    var $fixed_elements = $("#fixed-elements")

    $fixed_elements
      .find('sl-tab[panel="fixed-element-' + element_id + '"]')
      .remove()
    $fixed_elements
      .find('sl-tab-panel[name="fixed-element-' + element_id + '"]')
      .remove()
    $fixed_elements.get(0).show("main-content-elements")
  }
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
alchemy_cms-7.1.12 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.11 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.10 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.9 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.8 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.7 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.6 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.5 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.4 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.3 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.2 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.1 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.0 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.0.pre.rc1 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.0.pre.b2 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.1.0.pre.b1 app/assets/javascripts/alchemy/alchemy.fixed_elements.js