Sha256: 344cff4cc4ab8701be0509bab8cfc0557d356f5513849bf427a27ecc3e9ce986

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

Ext.ns('Rwiki');

Rwiki.EditorWindow = Ext.extend(Ext.Window, {
  constructor: function(editorPanel) {
    Ext.apply(this, {
      maximizable: true,
      modal: true,
      width: 750,
      height: 500,
      minWidth: 300,
      minHeight: 200,
      layout: 'fit',
      plain: true,
      bodyStyle: 'padding: 5px;',
      buttonAlign: 'center',
      items: editorPanel,
      buttons: [
        {
          text: 'Save',
          scope: this,
          handler: this.onSaveButton,
          iconCls: 'icon-save'
        },
        {
          text: 'Save and continue',
          scope: this,
          handler: this.onSaveAndContinueButton,
          iconCls: 'icon-save'
        },
        {
          text: 'Cancel',
          scope: this,
          handler: this.onCancelButton,
          iconCls: 'icon-cancel'
        }
      ]
    });

    Rwiki.EditorWindow.superclass.constructor.apply(this, arguments);
    this.editorPanel = editorPanel;
  },

  setPagePath: function(path) {
    this.pagePath = path;
    this.setTitle('Editing page ' + path);
  },

  show: function() {
    Rwiki.NodeManager.getInstance().loadPage(this.pagePath);
    Rwiki.EditorWindow.superclass.show.apply(this, arguments);
  },

  onSaveButton: function() {
    Rwiki.NodeManager.getInstance().savePage(this.pagePath, this.editorPanel.getRawContent());
    this.hide();
  },

  onSaveAndContinueButton: function() {
    Rwiki.NodeManager.getInstance().savePage(this.pagePath, this.editorPanel.getRawContent());
  },

  onCancelButton: function() {
    this.hide();
  },

  close: function() {
    this.hide();
  }
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rwiki-0.2.3 public/javascripts/Rwiki/EditorWindow.js
rwiki-0.2.2 public/javascripts/Rwiki/EditorWindow.js