Sha256: 44f537aaa7a8a28cf83f542010b83e38e83623dd1324a4edcaed32a5bd02d018

Contents?: true

Size: 1.29 KB

Versions: 59

Compression:

Stored size: 1.29 KB

Contents

window.Alchemy = Alchemy || {};

Alchemy.FixedElements = {
  WRAPPER: '<div id="fixed-elements"></div>',
  TABS: '<ul><li><a href="#main-content-elements">{{label}}</a></li></ul>',

  // 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).tabs().tabs('paging', {
      follow: true,
      followOnSelect: true
    });
  },

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

    $('> ul', $fixed_elements).append('<li><a href="#fixed-element-' + element_id + '">' + label + '</a></li>');
    $tab = $('<div id="fixed-element-' + element_id + '" class="sortable-elements" />');
    $fixed_elements.append($tab);
    $fixed_elements.tabs().tabs('refresh');
    $fixed_elements.tabs('option', 'active', $('#fixed-elements > div').index($tab));
  },

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

    $fixed_elements.find('a[href="#fixed-element-' + element_id + '"]').parent().remove();
    $fixed_elements.find('div#fixed-element-' + element_id).remove();
    $fixed_elements.tabs().tabs('refresh');
  }
};

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
alchemy_cms-7.0.0.pre.rc1 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.1.6 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.0.0.pre.c app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.0.0.pre.b app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.1.5 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.14 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.1.4 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-7.0.0.pre.a app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.13 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.1.3 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.1.2 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.1.1 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.1.0 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.12 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.11 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.10 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.9 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.8 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.7 app/assets/javascripts/alchemy/alchemy.fixed_elements.js
alchemy_cms-6.0.6 app/assets/javascripts/alchemy/alchemy.fixed_elements.js