Browse Source

Remove unused code, add comment

topic-sass
Jason Denney 11 years ago
parent
commit
16cda6aa86
  1. 133
      app/assets/javascripts/custom_netzke_helpers.js

133
app/assets/javascripts/custom_netzke_helpers.js

@ -3,138 +3,7 @@ Ext.Ajax.on('requestexception', function(conn, response, options) {
if (response.status === 401) { window.location = '/users/sign_in'; }
}, this);
Ext.define('app.view.form.field.TimeField', {
extend:'Ext.form.FieldContainer',
mixins:{
field:'Ext.form.field.Field'
},
alias: 'widget.xampmtime',
layout: 'hbox',
format: 'H:i:s',
submitFormat: 'H:i:s',
hourField: null,
minuteField: null,
ampmField: null,
/* custom configs & callbacks */
getValue: function(v){
hour = this.hourField.getValue();
minute = this.minuteField.getValue();
ampm = this.ampmField.getValue();
value = Ext.Date.parse(hour + " " + minute + " " + ampm, 'g i A');
value = Ext.Date.format(value, this.submitFormat);
return value;
},
getSubmitValue: function(value){
/* override function getValue() */
return this.getValue(value);
},
setValue: function(value){
if (Ext.isString(value) || Ext.isDate(value) ){
var dt = null;
if( Ext.isString ) {
dt = new Date(value);
}else{
dt = value;
}
hour = Ext.Date.format(dt, 'g');
minute = Ext.Date.format(dt, 'i');
ampm = Ext.Date.format(dt, 'A');
this.hourField.setValue(hour);
this.minuteField.setRawValue(minute);
this.ampmField.setValue(ampm);
}
/* override function setValue() */
},
initComponent: function(){
/* further code on event initComponent */
var me = this
me.items = me.items || [];
me.hourField = Ext.create('Ext.form.field.Number', {
// maxWidth: 20,
allowBlank: false,
allowOnlyWhitespace: false,
blankText: "Hour cannot be blank.",
allowDecimals: false,
maxValue: 12,
minValue: 1,
maxLength: 2,
enforceMaxLength: 2,
hideTrigger: true,
submitValue:false,
flex:1,
//fieldStyle: "text-align:right;",
isFormField:false, //exclude from field query's
});
me.items.push(me.hourField);
me.colon = Ext.create('Ext.draw.Text', {
text: ':',
padding: '3 3 0 3'
});
me.items.push(me.colon);
me.minuteField = Ext.create('Ext.form.field.Number', {
// maxWidth: 20,
allowBlank: false,
allowOnlyWhitespace: false,
blankText: "Minutes cannot be blank.",
allowDecimals: false,
maxValue: 59,
minValue: 0,
maxLength: 2,
enforceMaxLength: 2,
hideTrigger: true,
submitValue:false,
flex:1,
isFormField:false, //exclude from field query's
});
me.items.push(me.minuteField);
me.ampmField = Ext.create('Ext.form.ComboBox', {
//maxWidth: 25,
value: 'PM',
store: ['AM', 'PM'],
forceSelection: true,
flex:1,
editable: false
});
me.items.push(me.ampmField);
me.callParent();
// this dummy is necessary because Ext.Editor will not check whether an inputEl is present or not
this.inputEl = {
dom: document.createElement('div'),
swallowEvent:function(){}
};
me.initField();
},
focus:function(){
this.callParent(arguments);
this.hourField.focus();
},
});
//Override default netzke time entry field
Ext.define('Ext.ux.form.field.DateTime', {
extend:'Ext.form.FieldContainer',
mixins:{

Loading…
Cancel
Save