Sha256: 3104fc3e89bbc2d2d20303d5d2103592549f1a9541c9809e5846cc760a54d040

Contents?: true

Size: 1.47 KB

Versions: 11

Compression:

Stored size: 1.47 KB

Contents

if (typeof(Alchemy) === 'undefined') {
  var Alchemy = {};
}

Alchemy.loadAlchemyMenuBar = function(options) {

  Alchemy.Menubar = {

    init: function ($) {
      var self = Alchemy.Menubar;
      self._$ = $;
      self.show();
    },

    show: function() {
      var self = Alchemy.Menubar;
      self._$('body').prepend(Alchemy.Menubar.build());
    },

    build: function() {
      var self = Alchemy.Menubar;
      var bar = self._$('<div id="alchemy_menubar"/>').append('<ul/>');
      bar.find('ul').append('<li><a href="' + options.route + '/admin">' + Alchemy.Menubar.t("to_alchemy") + '</a></li>').append('<li><a href="' + options.route + '/admin/pages/' + options.page_id + '/edit">' + Alchemy.Menubar.t("edit_page") + '</a></li>').append('<li><a href="' + options.route + '/admin/logout">' + Alchemy.Menubar.t("logout") + '</a></li>');
      return bar;
    },

    translations: {
      'to_alchemy': {
        'de': 'zu Alchemy',
        'en': 'To Alchemy'
      },
      'edit_page': {
        'de': 'Seite bearbeiten',
        'en': 'Edit Page'
      },
      'logout': {
        'de': 'abmelden',
        'en': 'Log out'
      }
    },

    t: function(id) {
      var translation = Alchemy.Menubar.translations[id];
      if (translation) {
        return translation[options.locale];
      } else {
        return id;
      }
    }

  };

  if (typeof(jQuery) === 'undefined') {
    Alchemy.loadjQuery(Alchemy.Menubar.init);
  } else {
    Alchemy.Menubar.init(jQuery);
  }

};

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
alchemy_cms-2.5.0.rc3 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.5.0.b9 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.3.2 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.4.1 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.5.0.b5 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.5.0.b2 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.4.0 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.4.rc4 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.4.rc2 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.4.rc1 app/assets/javascripts/alchemy/alchemy.menubar.js
alchemy_cms-2.3.1 app/assets/javascripts/alchemy/alchemy.menubar.js