Commit af265aa1 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1487299: Edit/delete buttons contain title in sr-only"

parents 3e65b7be 0457e857
......@@ -22,6 +22,7 @@ $string['institutionblogs'] = 'Institution journals';
$string['groupblogs'] = 'Group journals';
$string['addblog'] = 'Create journal';
$string['addpost'] = 'New entry';
$string['addpostspecific'] = 'New entry "%s"';
$string['alignment'] = 'Alignment';
$string['allowcommentsonpost'] = 'Allow comments on your entry.';
$string['allposts'] = 'All entries';
......@@ -104,8 +105,10 @@ $string['nposts'] = array(
);
$string['publish'] = 'Publish';
$string['publishspecific'] = 'Publish "%s"';
$string['publishit'] = 'Publish it.';
$string['unpublish'] = 'Unpublish';
$string['unpublishspecific'] = 'Unpublish "%s"';
$string['publishfailed'] = 'An error occurred. Your entry was not published.';
$string['publishblogpost?'] = 'Are you sure you want to publish this entry?';
$string['published'] = 'Published';
......
......@@ -555,7 +555,7 @@ class ArtefactTypeBlog extends ArtefactType {
'alt' => get_string('deletespecific', 'mahara', $title),
'elementtitle' => get_string('delete'),
'confirm' => $confirm,
'value' => '<span class="icon icon-trash icon-lg text-danger" role="presentation" aria-hidden="true"></span><span class="sr-only">' . get_string('delete') . '</span>',
'value' => '<span class="icon icon-trash icon-lg text-danger" role="presentation" aria-hidden="true"></span><span class="sr-only">' . get_string('deletespecific', 'mahara', $title) . '</span>',
),
'delete' => array(
'type' => 'hidden',
......@@ -1009,7 +1009,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
// Format dates properly
if (is_null($viewoptions)) {
// My Blogs area: create forms for changing post status & deleting posts.
$post->changepoststatus = ArtefactTypeBlogpost::changepoststatus_form($post->id, $post->published);
$post->changepoststatus = ArtefactTypeBlogpost::changepoststatus_form($post->id, $post->published, $post->title);
$post->delete = ArtefactTypeBlogpost::delete_form($post->id, $post->title);
}
else {
......@@ -1121,17 +1121,18 @@ class ArtefactTypeBlogPost extends ArtefactType {
return true;
}
public static function changepoststatus_form($id, $published = null) {
public static function changepoststatus_form($id, $published = null, $title = null) {
//Get current post status from database
if ($published === null) {
if ($published === null || $title === null) {
$post = new ArtefactTypeBlogPost($id);
$published = $post->published;
$published = empty($published) ? $post->published : $published;
$title = empty($title) ? $post->title : $title;
}
if ($published) {
$strchangepoststatus = '<span class="icon icon-times icon-lg left text-danger" role="presentation" aria-hidden="true"></span> ' .get_string('unpublish', 'artefact.blog');
$strchangepoststatus = '<span class="icon icon-times icon-lg left text-danger" role="presentation" aria-hidden="true"></span><span class="sr-only">' . get_string('unpublishspecific', 'artefact.blog', $title) . '</span> ' . get_string('unpublish', 'artefact.blog');
}
else {
$strchangepoststatus = '<span class="icon icon-check icon-lg left text-success" role="presentation" aria-hidden="true"></span> ' . get_string('publish', 'artefact.blog');
$strchangepoststatus = '<span class="icon icon-check icon-lg left text-success" role="presentation" aria-hidden="true"></span><span class="sr-only"> ' . get_string('publishspecific', 'artefact.blog', $title) . '</span> ' . get_string('publish', 'artefact.blog');
}
return pieform(array(
'name' => 'changepoststatus_' . $id,
......@@ -1178,7 +1179,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
'class' => 'btn-default btn-sm',
'elementtitle' => get_string('delete'),
'confirm' => get_string('deleteblogpost?', 'artefact.blog'),
'value' => '<span class="icon icon-trash icon-lg text-danger" role="presentation" aria-hidden="true"></span><span class="sr-only">' .get_string('delete') . '</span>',
'value' => '<span class="icon icon-trash icon-lg text-danger" role="presentation" aria-hidden="true"></span><span class="sr-only">' . get_string('deletespecific', 'mahara', $title) . '</span>',
),
),
));
......
......@@ -160,13 +160,15 @@ function changepoststatus_success(form, data) {
removeElementClass($('posttitle_' + data.id), 'draft');
addElementClass($('posttitle_' + data.id), 'published');
$('poststatus' + data.id).innerHTML = {$strpublished};
$('changepoststatus_' + data.id + '_submit').innerHTML = '<span class="icon icon-times icon-lg left text-danger" role="presentation" aria-hidden="true"></span> ' + {$strchangepoststatusunpublish};
$('changepoststatus_' + data.id + '_submit').innerHTML = '<span class="icon icon-times icon-lg left text-danger" role="presentation" aria-hidden="true"></span> ' + {$strchangepoststatusunpublish} +
'<span class="sr-only">' + {$strchangepoststatusunpublish} + ' "' + data.title + '"</span>';
}
else {
removeElementClass($('posttitle_' + data.id), 'published');
addElementClass($('posttitle_' + data.id), 'draft');
$('poststatus' + data.id).innerHTML = {$strdraft};
$('changepoststatus_' + data.id + '_submit').innerHTML = '<span class="icon icon-check icon-lg left text-success" role="presentation" aria-hidden="true"></span>' + {$strchangepoststatuspublish};
$('changepoststatus_' + data.id + '_submit').innerHTML = '<span class="icon icon-check icon-lg left text-success" role="presentation" aria-hidden="true"></span>' + {$strchangepoststatuspublish} +
'<span class="sr-only">' + {$strchangepoststatuspublish} + ' "' + data.title + '"</span>';
}
}
function delete_success(form, data) {
......@@ -230,6 +232,7 @@ function changepoststatus_submit(Pieform $form, $values) {
'message' => $strmessage,
'goto' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $blogpost->get('parent'),
'id' => $values['changepoststatus'],
'title' => $blogpost->get('title'),
));
}
......
......@@ -81,7 +81,9 @@ $string['goalandskillsaved'] = 'Saved successfully';
$string['resume'] = 'Résumé';
$string['current'] = 'Current';
$string['moveup'] = 'Move up';
$string['moveupspecific'] = 'Move up "%s"';
$string['movedown'] = 'Move down';
$string['movedownspecific'] = 'Move down "%s"';
$string['viewyourresume'] = 'View your résumé';
$string['resumeofuser'] = 'Résumé of %s';
$string['employeraddress'] = 'Employer address';
......
......@@ -1080,7 +1080,9 @@ EOF;
$deljsstr = json_encode(get_string('deletespecific', 'mahara', '%s')) . ".replace('%s', {$titlestring})";
$upstr = get_string('moveup', 'artefact.resume');
$upjsstr = json_encode(get_string('moveupspecific', 'artefact.resume', '%s')) . ".replace('%s', {$titlestring})";
$downstr = get_string('movedown', 'artefact.resume');
$downjsstr = json_encode(get_string('movedownspecific', 'artefact.resume', '%s')) . ".replace('%s', {$titlestring})";
$js = call_static_method(generate_artefact_class_name($compositetype), 'get_composite_js');
......@@ -1099,7 +1101,7 @@ EOF;
var up =
A({'href': '', 'class': 'moveup'},
SPAN({'class': 'icon icon-long-arrow-up','role':'presentation'}),
SPAN({'class': 'sr-only'}, '{$upstr}'));
SPAN({'class': 'sr-only'}, {$upjsstr}));
connect(up, 'onclick', function (e) {
e.stop();
return moveComposite(d.type, r.id, r.artefact, 'up');
......@@ -1110,7 +1112,7 @@ EOF;
var down =
A({'href': '', 'class':'movedown'},
SPAN({'class': 'icon icon-long-arrow-down', 'role':'presentation'}),
SPAN({'class': 'sr-only'}, '{$downstr}'));
SPAN({'class': 'sr-only'}, {$downjsstr}));
connect(down, 'onclick', function (e) {
e.stop();
return moveComposite(d.type, r.id, r.artefact, 'down');
......@@ -1129,7 +1131,7 @@ EOF;
var editlink =
A({'href': 'editcomposite.php?id=' + r.id + '&artefact=' + r.artefact, 'title': {$editstr}, 'class': 'btn btn-default btn-xs'},
SPAN({'class': 'icon icon-pencil icon-lg', 'role':'presentation'}),
SPAN({'class': 'sr-only'}, {$editstr}));
SPAN({'class': 'sr-only'}, {$editjsstr}));
var dellink =
A({'href': '', 'title': {$delstr}, 'class': 'btn btn-default btn-xs'},
SPAN({'class': 'icon icon-trash text-danger icon-lg','role':'presentation'}),
......
......@@ -25,6 +25,7 @@
<div class="panel-footer has-form">
<a href="{$WWWROOT}artefact/blog/post.php?blog={$blog->id}" class="btn btn-default btn-sm">
<span class="icon icon-plus icon-lg left" role="presentation" aria-hidden="true"></span>
<span class="sr-only">{str tag=addpostspecific arg1=$blog->title section=artefact.blog |escape:html|safe}</span>
{str tag=addpost section=artefact.blog}
</a>
<div class="btn-group pull-right">
......@@ -33,7 +34,7 @@
{else}
<a href="{$WWWROOT}artefact/blog/settings/index.php?id={$blog->id}" title="{str(tag=settingsspecific arg1=$blog->title)|escape:html|safe}" class="btn btn-default btn-sm btn-group-item">
<span class="icon icon-pencil icon-lg" role="presentation" aria-hidden="true"></span>
<span class="sr-only">{str tag=edit}</span>
<span class="sr-only">{str tag=editspecific arg1=$blog->title}</span>
</a>
{$blog->deleteform|safe}
{/if}
......
......@@ -31,7 +31,7 @@
<input type="hidden" name="id" value="{$post->id}">
<button type="submit" class="submit btn btn-default btn-sm" title="{str(tag=edit)|escape:html|safe}">
<span class="icon icon-pencil icon-lg" role="presentation" aria-hidden="true"></span>
<span class="sr-only">{str(tag=edit)|escape:html|safe}</span>
<span class="sr-only">{str tag=editspecific arg1=$post->title |escape:html|safe}</span>
</button>
</form>
{$post->delete|safe}
......
Supports Markdown
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