partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

SystemNoticeEditor.js (1979B)


      1 /**
      2  * Represents the system notice editor
      3  */
      4 Ext.define('PartKeepr.SystemNoticeEditor', {
      5     extend: 'PartKeepr.Editor',
      6     alias: 'widget.SystemNoticeEditor',
      7 
      8     // Various style configurations
      9     saveText: i18n("Save System Notice"),
     10     defaults: {
     11         anchor: '100%',
     12         labelWidth: 110
     13     },
     14     layout: {
     15         type: 'vbox',
     16         align: 'stretch',
     17         pack: 'start'
     18     },
     19     enableButtons: false,
     20 
     21     /**
     22      * Initializes the component
     23      */
     24     initComponent: function ()
     25     {
     26 
     27         this.acknowledgeButton = Ext.create("Ext.button.Button", {
     28             text: i18n("Acknowledge Notice"),
     29             iconCls: 'web-icon accept'
     30         });
     31 
     32         this.acknowledgeButton.on("click", this.onAcknowledgeClick, this);
     33 
     34         this.bottomToolbar = Ext.create("Ext.toolbar.Toolbar", {
     35             enableOverflow: true,
     36             margin: '10px',
     37             defaults: {minWidth: 100},
     38             dock: 'bottom',
     39             ui: 'footer',
     40             items: [this.acknowledgeButton]
     41         });
     42 
     43         this.dockedItems = new Array(this.bottomToolbar);
     44 
     45         this.items = [
     46             {
     47                 xtype: 'textfield',
     48                 readOnly: true,
     49                 name: 'title',
     50                 fieldLabel: i18n("Title")
     51             }, {
     52                 xtype: 'textarea',
     53                 readOnly: true,
     54                 flex: 1,
     55                 name: 'description',
     56                 fieldLabel: i18n("Description")
     57             }, {
     58                 xtype: 'datefield',
     59                 readOnly: true,
     60                 hideTrigger: true,
     61                 name: 'date',
     62                 fieldLabel: i18n("Date")
     63             }
     64         ];
     65 
     66         this.callParent();
     67     },
     68     onAcknowledgeClick: function ()
     69     {
     70         this.record.callPutAction("acknowledge", [], Ext.bind(this.onAcknowledged, this));
     71     },
     72     onAcknowledged: function ()
     73     {
     74         this.fireEvent("editorClose", this);
     75         this.store.load();
     76     }
     77 });