Add ability to specify which actions are available for the no results placeholder

This commit is contained in:
Nathan Gray 2013-03-20 23:09:04 +00:00
parent ca5d97f85c
commit f4fe5cf8b6
2 changed files with 13 additions and 2 deletions

View File

@ -73,6 +73,7 @@
* 'favorites' => // I boolean|array True to enable favorites, or an array of additional, app specific settings to include * 'favorites' => // I boolean|array True to enable favorites, or an array of additional, app specific settings to include
* in the saved filters (eg: pm_id) * in the saved filters (eg: pm_id)
* 'placeholder' => // I String Optional text to display in the empty row placeholder. If not provided, it's "No matches found." * 'placeholder' => // I String Optional text to display in the empty row placeholder. If not provided, it's "No matches found."
* 'placeholder_actions' => // I String Optional list of actions allowed on the placeholder. If not provided, it's ["add"].
*/ */
class etemplate_widget_nextmatch extends etemplate_widget class etemplate_widget_nextmatch extends etemplate_widget
{ {
@ -354,7 +355,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
} }
}*/ }*/
} }
foreach($result as $name => $value) if ($name != 'readonlys') error_log(__METHOD__."() result['$name']=".array2string($name == 'data' ? array_keys($value) : $value)); //foreach($result as $name => $value) if ($name != 'readonlys') error_log(__METHOD__."() result['$name']=".array2string($name == 'data' ? array_keys($value) : $value));
egw_json_response::get()->data($result); egw_json_response::get()->data($result);
} }

View File

@ -210,7 +210,17 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
} }
// No UID, so return a filtered list of actions that doesn't need a UID // No UID, so return a filtered list of actions that doesn't need a UID
var links = ["add"]; var links = [];
try {
links = this._widget.options.settings.placeholder_actions;
} catch (e) {
}
// Default
if(typeof links == "undefined")
{
links = ["add"];
}
return links; return links;
}, },