Fix some bugs with tile view in favorite + home changed this.et2 variable

This commit is contained in:
Nathan Gray 2015-01-14 20:55:03 +00:00
parent 9bd29925cd
commit bc793ad039

View File

@ -123,16 +123,20 @@ app.classes.filemanager = AppJS.extend(
state = JSON.parse(state); state = JSON.parse(state);
} }
} }
var result = this._super.call(this,state);
// This has to happen after the parent, changing to tile recreates
// nm controller
if(typeof state == "object" && state.state && state.state.view) if(typeof state == "object" && state.state && state.state.view)
{ {
var et2 = etemplate2.getById('filemanager-index'); var et2 = etemplate2.getById('filemanager-index');
if(et2) if(et2)
{ {
var nm = et2.widgetContainer.getWidgetById('nm'); this.et2 = et2.widgetContainer;
nm.set_view(state.state.view); this.change_view(state.state.view);
} }
} }
return this._super.call(this,state); return result;
}, },
/** /**
@ -685,7 +689,12 @@ app.classes.filemanager = AppJS.extend(
*/ */
change_view: function(view, button_widget) change_view: function(view, button_widget)
{ {
var nm = this.et2.getWidgetById('nm'); var et2 = etemplate2.getById('filemanager-index');
var nm = false;
if(et2 && et2.widgetContainer.getWidgetById('nm'))
{
nm = et2.widgetContainer.getWidgetById('nm');
}
if(!nm) if(!nm)
{ {
egw.debug('warn', 'Could not find nextmatch to change view'); egw.debug('warn', 'Could not find nextmatch to change view');
@ -716,7 +725,7 @@ app.classes.filemanager = AppJS.extend(
nm.activeFilters.view = view; nm.activeFilters.view = view;
// Change template to match // Change template to match
this.et2.getWidgetById('nm').set_template(view == nm.controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile'); nm.set_template(view == nm.controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile');
}, },
/** /**