diff --git a/app/javascript/controllers/encryption_controller.js b/app/javascript/controllers/encryption_controller.js index 6cd94b61..b977a5f5 100644 --- a/app/javascript/controllers/encryption_controller.js +++ b/app/javascript/controllers/encryption_controller.js @@ -38,6 +38,7 @@ export default class extends Controller { } updateEncryptionStatus() { + if (!this.hasEncryptButtonTarget) return; if (this.fieldTarget.selectionStart < this.fieldTarget.selectionEnd) { this.encryptButtonTarget.classList.remove("disabled"); } else { diff --git a/app/views/keys/_form.html.erb b/app/views/keys/_form.html.erb index 8458af01..0b6e43f7 100644 --- a/app/views/keys/_form.html.erb +++ b/app/views/keys/_form.html.erb @@ -1,34 +1,33 @@ -<% if !file.writable? %> -
<%= value&.value %>-<% else %> - <% hierarchy = file.hierarchy %> - <%# <%= form_with url: environment_node_key_path(@environment, @node, @key), %> - <%= form_with url: environment_node_key_hierarchy_data_file_value_path(@environment, @node, @key, hierarchy, file), - method: :patch, local: true, - data: ({ - controller: "encryption", - action: "reset->encryption#reset", - encryption_decrypt_url_value: environment_hierarchy_decrypted_values_path(@environment, hierarchy), - encryption_encrypt_url_value: environment_hierarchy_encrypted_values_path(@environment, hierarchy) - } if hierarchy.encryption_possible?) do |f| %> - <%= hidden_field_tag :hierarchy, hierarchy.name %> - <%= hidden_field_tag :path, file.path %> - <%= text_area_tag :value, value&.value, rows: 4, class: "form-control", - data: { - encryption_target: "field", - action: "select->encryption#updateEncryptionStatus" - } - %> -