Skip to content

Commit 015167f

Browse files
committed
Allow inputs to update
1 parent 74010ac commit 015167f

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

frontend/js/app/nginx/certificates/form.ejs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<div class="form-label"><%- i18n('certificates', 'other-certificate-key') %><span class="form-required">*</span></div>
4343
<div class="custom-file">
4444
<input type="file" class="custom-file-input" name="meta[other_certificate_key]" id="other_certificate_key" required>
45-
<label class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
45+
<label id="other_certificate_key_label" class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
4646
</div>
4747
</div>
4848
</div>
@@ -51,7 +51,7 @@
5151
<div class="form-label"><%- i18n('certificates', 'other-certificate') %><span class="form-required">*</span></div>
5252
<div class="custom-file">
5353
<input type="file" class="custom-file-input" name="meta[other_certificate]" id="other_certificate">
54-
<label class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
54+
<label id="other_certificate_label" class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
5555
</div>
5656
</div>
5757
</div>
@@ -60,7 +60,7 @@
6060
<div class="form-label"><%- i18n('certificates', 'other-intermediate-certificate') %></div>
6161
<div class="custom-file">
6262
<input type="file" class="custom-file-input" name="meta[other_intermediate_certificate]" id="other_intermediate_certificate">
63-
<label class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
63+
<label id="other_intermediate_certificate_label" class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
6464
</div>
6565
</div>
6666
</div>

frontend/js/app/nginx/certificates/form.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ module.exports = Mn.View.extend({
1919
cancel: 'button.cancel',
2020
save: 'button.save',
2121
other_certificate: '#other_certificate',
22+
other_certificate_label: '#other_certificate_label',
2223
other_certificate_key: '#other_certificate_key',
23-
other_intermediate_certificate: '#other_intermediate_certificate'
24+
other_certificate_key_label: '#other_certificate_key_label',
25+
other_intermediate_certificate: '#other_intermediate_certificate',
26+
other_intermediate_certificate_label: '#other_intermediate_certificate_label'
2427
},
25-
28+
2629
events: {
2730
'click @ui.save': function (e) {
2831
e.preventDefault();
@@ -120,9 +123,20 @@ module.exports = Mn.View.extend({
120123
alert(err.message);
121124
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
122125
});
126+
},
127+
'change @ui.other_certificate_key': function(e){
128+
this.setFileName("other_certificate_key_label", e)
129+
},
130+
'change @ui.other_certificate': function(e){
131+
this.setFileName("other_certificate_label", e)
132+
},
133+
'change @ui.other_intermediate_certificate': function(e){
134+
this.setFileName("other_intermediate_certificate_label", e)
123135
}
124136
},
125-
137+
setFileName(ui, e){
138+
this.getUI(ui).text(e.target.files[0].name)
139+
},
126140
templateContext: {
127141
getLetsencryptEmail: function () {
128142
return typeof this.meta.letsencrypt_email !== 'undefined' ? this.meta.letsencrypt_email : App.Cache.User.get('email');

0 commit comments

Comments
 (0)