Commit 845b0d3b authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

Merge "Bug 1729079: Add manual help icon for blocktype config"

parents 1da878f8 1e233849
......@@ -1049,3 +1049,37 @@ Number.isInteger = Number.isInteger || function(value) {
isFinite(value) &&
Math.floor(value) === value;
};
/**
* Wire up the 'help' footer link so it opens help in a new window/tab
*/
jQuery(document).ready(function($) {
if ($('#footerhelp').length > 0) {
var link = $('#footerhelp');
link.off('click');
link.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
var newWnd = window;
newWnd.opener = null;
newWnd.open(link.prop('href'), '_blank');
});
}
});
/**
* Wire up the 'help' in blocks edit page so it opens help in a new window/tab
*/
jQuery(document).ready(function($) {
if ($('#blockshelp').length > 0) {
var link = $('#blockshelp');
link.off('click');
link.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
var newWnd = window;
newWnd.opener = null;
newWnd.open(link.prop('href'), '_blank');
});
}
});
......@@ -342,6 +342,7 @@ $string['columnlayout'] = 'Column layout';
$string['layoutpreview'] = 'Layout preview';
$string['layoutpreviewimage'] = 'Layout preview image';
$string['Help'] = 'Help';
$string['blockhelp'] = 'Block help';
$string['by'] = 'by';
$string['viewtitleby'] = '%s by <a href="%s">%s</a>';
......
......@@ -20,6 +20,26 @@ defined('INTERNAL') || die();
*/
function get_manual_help_link($keys) {
$data = get_manual_help_link_array($keys);
$manuallink = sprintf('<a id="footerhelp" href="%s/%s/%s/%s">' . get_string('Help') . '</a>',
$data['prefix'],
$data['language'],
$data['version'],
$data['suffix']
);
return $manuallink;
}
/**
* Get link information in array format.
* Useful for json data return
*
* @param array $keys An array of keys that indicate what help file we want
*
* @return array
*/
function get_manual_help_link_array($keys) {
if (!is_array($keys)) {
$keys = (array)$keys;
}
......@@ -31,13 +51,12 @@ function get_manual_help_link($keys) {
else {
$prefix = _get_manual_link_prefix();
}
$manuallink = sprintf('<a rel="noopener" target="_blank" href="%s/%s/%s/%s">' . get_string('Help') . '</a>',
$prefix,
_get_manual_language(),
_get_mahara_version(),
_get_manual_help_link_suffix($keys)
$data = array('prefix' => $prefix,
'language' => _get_manual_language(),
'version' => _get_mahara_version(),
'suffix' => _get_manual_help_link_suffix($keys)
);
return $manuallink;
return $data;
}
/**
......@@ -122,6 +141,7 @@ $manual_link_map = array(
"" => "", // default - means go to manual homepage
"adminhome|home" => "administration/overview.html#admin-home",
"adminhome|registersite" => "administration/overview.html#register-your-mahara-site",
"blocktype|blocks" => "blocks/blocks.html",
"configextensions|cleanurls" => "administration/extensions.html#clean-urls",
"configextensions|filters" => "administration/extensions.html#html-filters",
"configextensions|frameworks" => "administration/smartevidence.html#smartevidence-admin",
......
......@@ -1737,12 +1737,14 @@ class View {
// Because of the reference in the above loop, $cat refers to the last item
$cat['class'] = (isset($cat['class'])) ? $cat['class'] . ' last' : 'last';
$helplink = get_manual_help_link_array(array('blocktype', 'blocks'));
$manualhelplink = $helplink['prefix'] . '/' . $helplink['language'] . '/' . $helplink['version'] . '/' . $helplink['suffix'];
$blocktypelist = $this->build_blocktype_list($category);
$smarty = smarty_core();
$smarty->assign('categories', $categories);
$smarty->assign('selectedcategory', $category);
$smarty->assign('blocktypelist', $blocktypelist);
$smarty->assign('manualhelpblock', $manualhelplink);
$smarty->assign('viewid', $this->get('id'));
$smarty->assign('new', $new);
return $smarty->fetch('view/blocktypecategorylist.tpl');
......
......@@ -293,6 +293,11 @@ td.action-list-copy {
}
}
//page builder collapsible
.btn-accordion.ui-accordion {
&.btn-help {
padding-left: 27px;
}
}
.btn-accordion.ui-accordion .ui-accordion-content {
@include box-sizing(border-box);
border-radius: 0;
......
......@@ -18,6 +18,10 @@
</div>
{/if}
{/foreach}
<a id="blockshelp" class="text-left blocktypelink btn btn-help hide-title-collapsed btn-default btn-accordion" href="{$manualhelpblock}">
<span class="icon icon-question-circle-o block-icon" role="presentation" aria-hidden="true"></span>
<span class="title">{str tag=blockhelp section=view}</span>
</a>
<div class="btn btn-primary text-right last collapse-expand" aria-hidden="true" data-trigger="col-collapse">
<span class="icon icon-angle-double-left" role="presentation" aria-hidden="true"></span>
......
......@@ -35,7 +35,6 @@
<button class="deletebutton btn btn-inverse btn-xs" name="action_removeblockinstance_id_{$id}" alt="{str tag=Close}" data-id="{$id}">
<span class="icon icon-trash text-danger icon-lg" role="presentation" aria-hidden="true"></span>
</button>
</button>
{else}
<button class="deletebutton btn btn-inverse btn-xs" name="action_removeblockinstance_id_{$id}" alt="{$strremovetitletext}" data-id="{$id}">
<span class="icon icon-trash text-danger icon-lg" role="presentation" aria-hidden="true"></span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment