Permalink
Browse files

Merge branch 'MDL-61388-master' of git://github.com/damyon/moodle

  • Loading branch information...
dmonllao committed Oct 22, 2018
2 parents 7e5f0fa + ede1e4a commit 64a00dffbd94fe4d530ac8754ea7b0600ed9e557
@@ -1951,12 +1951,23 @@ public function confirm($message, $continue, $cancel) {
throw new coding_exception('The cancel param to $OUTPUT->confirm() must be either a URL (string/moodle_url) or a single_button instance.');
}
$output = $this->box_start('generalbox modal modal-dialog modal-in-page show', 'notice');
$attributes = [
'role'=>'alertdialog',
'aria-labelledby'=>'modal-header',
'aria-describedby'=>'modal-body',
'aria-modal'=>'true'
];
$output = $this->box_start('generalbox modal modal-dialog modal-in-page show', 'notice', $attributes);
$output .= $this->box_start('modal-content', 'modal-content');
$output .= $this->box_start('modal-header p-x-1', 'modal-header');
$output .= html_writer::tag('h4', get_string('confirm'));
$output .= $this->box_end();
$output .= $this->box_start('modal-body', 'modal-body');
$attributes = [
'role'=>'alert',
'data-aria-autofocus'=>'true'
];
$output .= $this->box_start('modal-body', 'modal-body', $attributes);
$output .= html_writer::tag('p', $message);
$output .= $this->box_end();
$output .= $this->box_start('modal-footer', 'modal-footer');
@@ -148,6 +148,7 @@
$string['discussionpin'] = 'Pin';
$string['discussionpinned'] = 'Pinned';
$string['discussionpinned_help'] = 'Pinned discussions will appear at the top of a forum.';
$string['discussionsplit'] = 'Discussion has been split';
$string['discussionsubscribestop'] = 'I don\'t want to be notified of new posts in this discussion';
$string['discussionsubscribestart'] = 'Send me notifications of new posts in this discussion';
$string['discussionsubscription'] = 'Discussion subscription';
@@ -349,7 +349,13 @@
$event->add_record_snapshot('forum_discussions', $discussion);
$event->trigger();
redirect(new moodle_url('/mod/forum/view.php', ['f' => $discussion->forum]));
$message = get_string('eventdiscussiondeleted', 'forum');
redirect(
new moodle_url('/mod/forum/view.php', ['f' => $discussion->forum]),
$message,
null,
\core\output\notification::NOTIFY_SUCCESS
);
} else if (forum_delete_post($post, has_capability('mod/forum:deleteanypost', $modcontext),
$course, $cm, $forum)) {
@@ -363,7 +369,13 @@
$discussionurl = new moodle_url("/mod/forum/discuss.php", array('d' => $discussion->id));
}
redirect(forum_go_back_to($discussionurl));
$message = get_string('eventpostdeleted', 'forum');
redirect(
forum_go_back_to($discussionurl),
$message,
null,
\core\output\notification::NOTIFY_SUCCESS
);
} else {
print_error('errorwhiledelete', 'forum');
}
@@ -506,8 +518,13 @@
$event->add_record_snapshot('forum_discussions', $discussion);
$event->trigger();
redirect(forum_go_back_to(new moodle_url("/mod/forum/discuss.php", array('d' => $newid))));
$message = get_string('discussionsplit', 'forum');
redirect(
forum_go_back_to(new moodle_url("/mod/forum/discuss.php", array('d' => $newid))),
$message,
null,
\core\output\notification::NOTIFY_SUCCESS
);
} else {
// Display the prune form.
$course = $DB->get_record('course', array('id' => $forum->course));

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -183,6 +183,17 @@ define(['jquery'], function($) {
shiftFocus(trigger);
}
});
// After page load, focus on any element with special autofocus attribute.
$(function() {
window.setTimeout(function() {
var alerts = $('[role="alert"][data-aria-autofocus="true"]');
if (alerts.length > 0) {
$(alerts[0]).attr('tabindex', '0');
$(alerts[0]).focus();
}
}, 300);
});
}
};
});
@@ -40,7 +40,7 @@
<hr>
</div>
{{#error}}
<div class="alert alert-danger" role="alert">
<div class="alert alert-danger" role="alert" data-aria-autofocus="true">
{{{error}}}
</div>
{{/error}}
@@ -112,7 +112,7 @@
{{#error}}
<div class="loginerrors mt-3">
<a href="#" id="loginerrormessage" class="accesshide">{{error}}</a>
<div class="alert alert-danger" role="alert">{{error}}</div>
<div class="alert alert-danger" role="alert" data-aria-autofocus="true">{{error}}</div>
</div>
{{/error}}
@@ -37,7 +37,7 @@
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
}}
<div class="alert alert-danger alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert"{{/ announce }}{{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
@@ -37,7 +37,7 @@
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
}}
<div class="alert alert-info alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert"{{/ announce }}{{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
@@ -37,7 +37,7 @@
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
}}
<div class="alert alert-success alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert"{{/ announce }}{{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
@@ -37,8 +37,8 @@
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
}}
<div class="alert alert-warning alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert"{{/ announce }}{{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
</div>
</div>

0 comments on commit 64a00df

Please sign in to comment.