Sha256: 66c11a7e4ec762e4b7c0d05b8c5219ac19ffb6cb777a94f2935497c6f62448a8

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

spud.admin.cms.pages = {};

(function(){
  var pages = spud.admin.cms.pages;


  pages.initFormTabs = function(){
    var tabNames = [];

    $('.formtabs .formtab').each(function(tabind) {
      if(tabind === 0) {
        $(this).addClass('active');
      }
      this.id = 'tab-' + tabind;
      tabNames.push($('.tab_name',this).first().val());
    });

    var tabButtons = $('.formtabs .formtab_buttons').first();
    for(var x=0;x<tabNames.length;x++)
    {
      var tabButton = $('<li><a class="spud-page-tab-button" href="#tab-' + x + '" data-toggle="tab">' + tabNames[x] + '</a></li>');
      if(x === 0) {
        tabButton.addClass('active');
      }
      tabButtons.append(tabButton);

    }
    pages.tabMonitor();
  };
  pages.tabMonitor = function() {
    $('a.spud-page-tab-button[data-toggle="tab"]').on('shown', function (e) {
      var editors = $(e.target).find('.spud-formatted-editor');
      spud.admin.editor.unload();//'.formtab [code-mirror-id]'
      spud.admin.editor.init(editors);
    })
  };
})();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spud_cms-1.0.0.rc1.4 app/assets/javascripts/spud/admin/cms/pages.js
spud_cms-1.0.0.rc1.3 app/assets/javascripts/spud/admin/cms/pages.js