Sha256: aea714f64a02b14bee4084aa060d6cd27bbde1aad31ae2f4d8d110cc8d6ab9a9

Contents?: true

Size: 934 Bytes

Versions: 7

Compression:

Stored size: 934 Bytes

Contents

// set or delete a cookie value to remember the folders view state
function set_component_view_state(elem) {
  var key = elem.getAttribute('id');
  var current_folders = jar.get('component_folders') || {};
  
  if (elem.next('ul').visible())
    current_folders[key] = true;
  else
    delete current_folders[key];

  jar.put('component_folders', current_folders);
}

function toggle_component() {
  $(this).next('ul').toggle();
  set_component_view_state(this);
}

function asset_preview_toggle() {
  var previews = $$('.asset_details');

  if (previews.length > 0) {
    previews.invoke('toggle');
    jar.put('toggle', {on:previews.first().visible()});
  }
}

$(document).observe('dom:loaded', function() {
  $$('#components .folder').each(function(elem) {
    elem.observe('click', toggle_component);
  });
});

var cookie_expiry = 60 * 60 * 24 * 30 * 3; // 3 months
var jar = new CookieJar({expires:cookie_expiry, path:'/cms'});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
liquid_cms-0.2.1.1 generators/liquid_cms/templates/public/cms/javascripts/cms.js
liquid_cms-0.3.1.0 lib/generators/liquid_cms/templates/public/cms/javascripts/cms.js
liquid_cms-0.2.1.0 generators/liquid_cms/templates/public/cms/javascripts/cms.js
liquid_cms-0.2.0.13 generators/liquid_cms/templates/public/cms/javascripts/cms.js
liquid_cms-0.3.0.10 lib/generators/liquid_cms/templates/public/cms/javascripts/cms.js
liquid_cms-0.3.0.9 lib/generators/liquid_cms/templates/public/cms/javascripts/cms.js
liquid_cms-0.2.0.12 generators/liquid_cms/templates/public/cms/javascripts/cms.js