* print ai buttons with links, comment on menuPrint config.
This commit is contained in:
+14
-1
@@ -56,7 +56,20 @@ $config->ai->targetFormVars['execution'] = array();
|
||||
|
||||
/* Menu printing configurations. */
|
||||
$config->ai->menuPrint = new stdclass();
|
||||
$config->ai->menuPrint->locations = array(); // Menu location definations, defines acceptable module-methods and on page menu locations.
|
||||
/**
|
||||
* Menu location definations, defines acceptable module-methods and on page menu locations, etc.
|
||||
*
|
||||
* @param string $module prompt module name (actual module could differ from prompt module name)
|
||||
* @param string $targetContainer injection target container selector
|
||||
* @param string $class class of menu or dropdown button
|
||||
* @param string $buttonClass specified class of action menu buttons
|
||||
* @param string $dropdownClass specified class of dropdown menu button
|
||||
* @param string $objectVarName object variable name of view
|
||||
* @param string $stylesheet stylesheet to be injected
|
||||
* @param string $injectMethod injection jQuery method, `append` by default
|
||||
* @see ./view/promptmenu.html.php
|
||||
*/
|
||||
$config->ai->menuPrint->locations = array();
|
||||
$config->ai->menuPrint->locations['story']['view'] = (object)array('module' => 'story', 'targetContainer' => '#mainContent .cell:first-of-type .detail:first-of-type .detail-title', 'class' => 'pull-right', 'stylesheet' => '#mainContent .cell:first-of-type .detail:first-of-type .detail-title>button {margin-left: 10px;} #mainContent .cell:first-of-type .detail:first-of-type .detail-content {margin-top: 12px;}');
|
||||
$config->ai->menuPrint->locations['projectstory']['view'] = $config->ai->menuPrint->locations['story']['view'];
|
||||
$config->ai->menuPrint->locations['execution']['storyView'] = $config->ai->menuPrint->locations['story']['view'];
|
||||
|
||||
@@ -26,16 +26,18 @@
|
||||
?>
|
||||
<?php
|
||||
$html = '';
|
||||
$objectVarName = empty($menuOptions->objectVarName) ? $menuOptions->module : $menuOptions->objectVarName;
|
||||
$currentObjectId = !empty($this->view->$objectVarName) ? $this->view->$objectVarName->id : 0;
|
||||
if(count($prompts) > 1)
|
||||
{
|
||||
$html .= '<div class="dropdown' . ((isset($menuOptions->class) ? ' ' . $menuOptions->class : '') . (isset($menuOptions->dropdownClass) ? ' ' . $menuOptions->dropdownClass : '')) . '"><button class="btn btn-link' . (isset($menuOptions->buttonClass) ? ' ' . $menuOptions->buttonClass : '') . '" type="button" data-toggle="dropdown">' . $lang->ai->promptMenu->dropdownTitle . ' <i class="icon-caret-down"></i></button><ul class="dropdown-menu">';
|
||||
foreach($prompts as $prompt) $html .= '<li>' . html::commonButton($prompt->name . ($prompt->status != 'active' ? '<span class="label label-info label-badge">' . $lang->ai->prompts->statuses[$prompt->status] . '</span>' : ''), "title='{$prompt->desc}' style='width: 100%;'", 'btn btn-link text-left') . '</li>';
|
||||
foreach($prompts as $prompt) $html .= '<li>' . html::linkButton($prompt->name . ($prompt->status != 'active' ? '<span class="label label-info label-badge">' . $lang->ai->prompts->statuses[$prompt->status] . '</span>' : ''), helper::createLink('ai', 'execute', "promptId=$prompt->id&objectId=$currentObjectId"), 'self', "title='{$prompt->desc}' style='width: 100%;'", 'btn btn-link text-left') . '</li>';
|
||||
$html .= '</ul></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$prompt = current($prompts);
|
||||
$html .= html::commonButton($prompt->name . ($prompt->status != 'active' ? '<span class="label label-info label-badge">' . $lang->ai->prompts->statuses[$prompt->status] . '</span>' : ''), "title='{$prompt->desc}'", 'btn btn-link' . ((isset($menuOptions->class) ? ' ' . $menuOptions->class : '') . (isset($menuOptions->buttonClass) ? ' ' . $menuOptions->buttonClass : '')));
|
||||
$html .= html::linkButton($prompt->name . ($prompt->status != 'active' ? '<span class="label label-info label-badge">' . $lang->ai->prompts->statuses[$prompt->status] . '</span>' : ''), helper::createLink('ai', 'execute', "promptId=$prompt->id&objectId=$currentObjectId"), 'self', "title='{$prompt->desc}'", 'btn btn-link' . ((isset($menuOptions->class) ? ' ' . $menuOptions->class : '') . (isset($menuOptions->buttonClass) ? ' ' . $menuOptions->buttonClass : '')));
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user