mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
/*global Ext*/
|
|
Ext.define('WebODFApp.controller.Files', {
|
|
extend: 'Ext.app.Controller',
|
|
|
|
config: {
|
|
refs: {
|
|
mainView: 'mainview',
|
|
filesList: 'fileslist list',
|
|
fileDetail: 'filedetail',
|
|
openButton: '#openButton',
|
|
odfView: 'odfview',
|
|
title: 'titlebar'
|
|
},
|
|
control: {
|
|
mainView: {
|
|
pop: 'pop',
|
|
push: 'push'
|
|
},
|
|
filesList: {
|
|
itemtap: 'show'
|
|
},
|
|
openButton: {
|
|
tap: 'open'
|
|
}
|
|
}
|
|
},
|
|
push: function (view, item) {
|
|
"use strict";
|
|
// alert(this.getMainView().getNavigationBar().xtype);
|
|
// view.navigationBar.setTitle(item.getTitle());
|
|
if (item.xtype === "filedetail") {
|
|
this.getOpenButton().show();
|
|
} else {
|
|
this.getOpenButton().hide();
|
|
}
|
|
},
|
|
pop: function (view, item) {
|
|
"use strict";
|
|
if (item.xtype === "odfview") { // going to filedetail
|
|
this.getOpenButton().show();
|
|
} else {
|
|
this.getOpenButton().hide();
|
|
}
|
|
},
|
|
show: function (list, index, target, record, e) {
|
|
"use strict";
|
|
if (!this.fileDetail) {
|
|
this.fileDetail = Ext.create('WebODFApp.view.FileDetail');
|
|
}
|
|
this.fileDetail.setRecord(record);
|
|
//this.getMainView().push({title: this.fileDetail.getTitle(),
|
|
// items: [this.fileDetail] });
|
|
this.getMainView().push(this.fileDetail);
|
|
},
|
|
open: function (options) {
|
|
"use strict";
|
|
if (!this.odfView) {
|
|
this.odfView = Ext.create('WebODFApp.view.OdfView');
|
|
}
|
|
this.odfView.setRecord(this.fileDetail.getRecord());
|
|
this.getMainView().push(this.odfView);
|
|
}
|
|
});
|