2020-10-04 17:56:02 -04:00
|
|
|
const Mn = require('backbone.marionette');
|
|
|
|
const moment = require('moment');
|
|
|
|
const App = require('../../../main');
|
|
|
|
const template = require('./item.ejs');
|
|
|
|
const dns_providers = require('../../../../../../utils/certbot-dns-plugins')
|
2018-08-02 05:48:47 -04:00
|
|
|
|
|
|
|
module.exports = Mn.View.extend({
|
|
|
|
template: template,
|
|
|
|
tagName: 'tr',
|
|
|
|
|
|
|
|
ui: {
|
2019-05-08 01:25:48 -04:00
|
|
|
host_link: '.host-link',
|
|
|
|
renew: 'a.renew',
|
|
|
|
delete: 'a.delete'
|
2018-08-02 05:48:47 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
events: {
|
2019-05-08 01:25:48 -04:00
|
|
|
'click @ui.renew': function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
App.Controller.showNginxCertificateRenew(this.model);
|
|
|
|
},
|
|
|
|
|
2018-08-02 05:48:47 -04:00
|
|
|
'click @ui.delete': function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
App.Controller.showNginxCertificateDeleteConfirm(this.model);
|
2019-05-08 01:25:48 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
'click @ui.host_link': function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
let win = window.open($(e.currentTarget).attr('rel'), '_blank');
|
|
|
|
win.focus();
|
2018-08-02 05:48:47 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
templateContext: {
|
2018-08-07 06:27:20 -04:00
|
|
|
canManage: App.Cache.User.canManage('certificates'),
|
|
|
|
isExpired: function () {
|
|
|
|
return moment(this.expires_on).isBefore(moment());
|
2020-10-04 17:56:02 -04:00
|
|
|
},
|
|
|
|
dns_providers: dns_providers
|
2018-08-02 05:48:47 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
this.listenTo(this.model, 'change', this.render);
|
|
|
|
}
|
|
|
|
});
|