Commit 81f640e0 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add link on my tags page to edit the currently selected tag


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 0e24596c
......@@ -40,6 +40,7 @@ $owner = (object) array('type' => 'user', 'id' => $USER->get('id'));
$data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort, $type);
build_portfolio_search_html($data);
$data->tagdisplay = hsc(str_shorten_text($tag, 50));
$data->tagurl = urlencode($tag);
json_reply(false, array('data' => $data));
?>
......@@ -89,7 +89,7 @@ $string['mytags'] = 'My Tags';
$string['Tag'] = 'Tag';
$string['itemstaggedwith'] = 'Items tagged with "%s"';
$string['numitems'] = '%s items';
$string['searchresultsfor'] = 'Search results for:';
$string['searchresultsfor'] = 'Search results for';
$string['sortalpha'] = 'Sort tags alphabetically';
$string['sortfreq'] = 'Sort tags by frequency';
$string['sortresultsby'] = 'Sort results by:';
......@@ -103,6 +103,7 @@ $string['tagfilter_view'] = 'Views';
$string['edittags'] = 'Edit Tags';
$string['selectatagtoedit'] = 'Select a tag to edit';
$string['edittag'] = 'Edit Tag "%s"';
$string['editthistag'] = 'Edit This Tag';
$string['edittagdescription'] = 'All items in your portfolio tagged "%s" will be updated';
$string['deletetag'] = 'Delete Tag "%s"';
$string['confirmdeletetag'] = 'Do you really want to delete this tag from everything in your portfolio?';
......
......@@ -34,15 +34,13 @@ define('TITLE', get_string('mytags'));
$tagsort = param_alpha('ts', null) != 'freq' ? 'alpha' : 'freq';
$tags = get_my_tags(null, false, $tagsort);
$tag = param_variable('tag', null);
$js = '';
$tag = param_variable('tag', null);
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$sort = param_alpha('sort', 'name');
$type = param_alpha('type', null);
$owner = (object) array('type' => 'user', 'id' => $USER->get('id'));
$owner = (object) array('type' => 'user', 'id' => $USER->get('id'));
$data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort, $type);
build_portfolio_search_html($data);
......@@ -135,9 +133,13 @@ function rewriteTagLink(elem, keep, replace) {
// Replace the tag in the Search Results heading
var heading_tag = getFirstElementByTagAndClassName('a', 'tag', 'results_heading');
if (heading_tag) {
heading_tag.href = href;
setNodeAttribute(heading_tag, 'href', href);
heading_tag.innerHTML = data.data.tagdisplay;
}
var edit_tag_link = getFirstElementByTagAndClassName('a', 'edit-tag', 'results_container');
if (edit_tag_link) {
setNodeAttribute(edit_tag_link, 'href', config.wwwroot + 'edittags.php?tag=' + data.data.tagurl);
}
removeElementClass('results_container', 'hidden');
params.tag = data.data.tag;
......
......@@ -16,8 +16,9 @@
<div>{str tag=youhavenottaggedanythingyet}</div>
{/if}
<div id="results_container" class="tag-results{if !$tag} hidden{/if}">
<div id="results_container" class="rel tag-results{if !$tag} hidden{/if}">
<h2 id="results_heading">{str tag=searchresultsfor} <a class="tag" href="{$WWWROOT}tags.php?tag={$tag|urlencode}">{$tag|str_shorten_text:50|escape}</a></h2>
<div class="rbuttons"><a class="edit-tag" href="{$WWWROOT}edittags.php?tag={$tag|urlencode}">{str tag=editthistag}</a></div>
<div id="results_sort">{str tag=sortresultsby}
{foreach from=$results->sortcols item=sortfield name=sortcols}
<a href="{$results->baseurl}&type={$results->filter}&sort={$sortfield}"{if $results->sort == $sortfield} class="selected"{/if}>{str tag=$sortfield}</a>{if !$smarty.foreach.sortcols.last} | {/if}
......
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