Add button to add custom certificate in certificate list

This commit is contained in:
Julian Gassner
2025-01-22 15:33:02 +00:00
parent 9687e9e450
commit e6f61e297f
9 changed files with 58 additions and 35 deletions

View File

@ -6,6 +6,10 @@ if (subtitle) { %>
<p class="h4 text-muted font-weight-normal mb-7"><%- subtitle %></p>
<% }
if (link) { %>
<a class="btn btn-<%- btn_color %>" href="#"><%- link %></a>
if (links && links.length) { %>
<% links.forEach(function(link, index) { %>
<div style="margin-bottom: 10px;">
<a class="btn btn-<%- btn_color %>" href="#" data-index="<%- index %>"><%- link %></a>
</div>
<% }); %>
<% } %>

View File

@ -6,7 +6,9 @@ module.exports = Mn.View.extend({
template: template,
options: {
btn_color: 'teal'
btn_color: 'teal',
links: [], // Added to accept multiple links
actions: [] // Added to accept multiple actions
},
ui: {
@ -16,17 +18,19 @@ module.exports = Mn.View.extend({
events: {
'click @ui.action': function (e) {
e.preventDefault();
this.getOption('action')();
const index = $(e.currentTarget).data('index');
this.getOption('actions')[index]();
}
},
templateContext: function () {
return {
title: this.getOption('title'),
subtitle: this.getOption('subtitle'),
link: this.getOption('link'),
action: typeof this.getOption('action') === 'function',
btn_color: this.getOption('btn_color')
title: this.getOption('title'),
subtitle: this.getOption('subtitle'),
links: this.getOption('links'), // Changed to array
actions: this.getOption('actions'), // Changed to array
hasActions: this.getOption('actions').length > 0,
btn_color: this.getOption('btn_color')
};
}