mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-28195 confirm_action should allow the button labels to be customised
This commit is contained in:
parent
81f8e0f8a0
commit
8f78cd5abc
@ -275,8 +275,17 @@ M.util.show_confirm_dialog = function(e, args) {
|
||||
}
|
||||
};
|
||||
|
||||
var buttons = [ {text: M.str.moodle.cancel, handler: handle_cancel, isDefault: true},
|
||||
{text: M.str.moodle.yes, handler: handle_yes} ];
|
||||
if (!args.cancellabel) {
|
||||
args.cancellabel = M.str.moodle.cancel;
|
||||
}
|
||||
if (!args.continuelabel) {
|
||||
args.continuelabel = M.str.moodle.yes;
|
||||
}
|
||||
|
||||
var buttons = [
|
||||
{text: args.cancellabel, handler: handle_cancel, isDefault: true},
|
||||
{text: args.continuelabel, handler: handle_yes}
|
||||
];
|
||||
|
||||
simpledialog.cfg.queueProperty('buttons', buttons);
|
||||
|
||||
|
@ -85,8 +85,10 @@ class component_action {
|
||||
* Confirm action
|
||||
*/
|
||||
class confirm_action extends component_action {
|
||||
public function __construct($message, $callback=null) {
|
||||
parent::__construct('click', 'M.util.show_confirm_dialog', array('message' => $message, 'callback' => $callback));
|
||||
public function __construct($message, $callback = null, $continuelabel = null, $cancellabel = null) {
|
||||
parent::__construct('click', 'M.util.show_confirm_dialog', array(
|
||||
'message' => $message, 'callback' => $callback,
|
||||
'continuelabel' => $continuelabel, 'cancellabel' => $cancellabel));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ class single_button implements renderable {
|
||||
* @return void
|
||||
*/
|
||||
public function add_confirm_action($confirmmessage) {
|
||||
$this->add_action(new component_action('click', 'M.util.show_confirm_dialog', array('message' => $confirmmessage)));
|
||||
$this->add_action(new confirm_action($confirmmessage));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user