Skip to content

Commit

Permalink
Merge branch 'MDL-69262-master-2' of git://github.com/junpataleta/moo…
Browse files Browse the repository at this point in the history
…dle into master
  • Loading branch information
stronk7 committed Sep 7, 2020
2 parents dfc09fc + 6d0a555 commit afb05bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
10 changes: 7 additions & 3 deletions lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -4682,6 +4682,12 @@ class action_menu_link extends action_link implements renderable {
*/
public $actionmenu = null;

/**
* The number of instances of this action menu link (and its subclasses).
* @var int
*/
protected static $instance = 1;

/**
* Constructs the object.
*
Expand All @@ -4705,10 +4711,8 @@ public function __construct(moodle_url $url, pix_icon $icon = null, $text, $prim
* @return stdClass
*/
public function export_for_template(renderer_base $output) {
static $instance = 1;

$data = parent::export_for_template($output);
$data->instance = $instance++;
$data->instance = self::$instance++;

// Ignore what the parent did with the attributes, except for ID and class.
$data->attributes = [];
Expand Down
9 changes: 8 additions & 1 deletion lib/templates/action_menu_link.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
}
}}
{{^disabled}}
<a href="{{url}}" class="aabtn {{classes}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}{{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#showtext}}<span class="menu-action-text" id="actionmenuaction-{{instance}}">{{{text}}}</span>{{/showtext}}</a>
<a href="{{url}}" class="{{$actionmenulinkclasses}}aabtn {{classes}}{{/actionmenulinkclasses}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}{{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>
{{#icon}}
{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}
{{/icon}}
{{#showtext}}
<span class="menu-action-text" id="actionmenuaction-{{instance}}">{{{text}}}</span>
{{/showtext}}
</a>
{{/disabled}}
{{#disabled}}
<span class="currentlink" role="menuitem">{{#icon}}{{#pix}}{{key}},{{component}},{{title}}{{/pix}}{{/icon}}{{{text}}}</span>
Expand Down
13 changes: 3 additions & 10 deletions lib/templates/action_menu_trigger.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,9 @@
<div class="dropdown-menu dropdown-menu-right {{classes}}"{{#attributes}} {{name}}="{{value}}"{{/attributes}}>
{{#items}}
{{#actionmenulink}}
<a href="{{url}}" class="dropdown-item {{classes}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}{{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>
{{#icon}}
{{#pix}}{{key}},{{component}},{{title}}{{/pix}}
{{/icon}}
{{#showtext}}
<span class="menu-action-text" id="actionmenuaction-{{instance}}">
{{{text}}}
</span>
{{/showtext}}
</a>
{{< core/action_menu_link}}
{{$actionmenulinkclasses}}dropdown-item {{classes}}{{/actionmenulinkclasses}}
{{/ core/action_menu_link}}
{{/actionmenulink}}
{{#actionmenufiller}}
<div class="dropdown-divider" role="presentation"><span class="filler">&nbsp;</span></div>
Expand Down

0 comments on commit afb05bf

Please sign in to comment.