Reworked domain contacts.

This commit is contained in:
Revertron
2021-05-07 10:14:14 +02:00
parent 148b4b31ac
commit 01e97ed7a0
3 changed files with 41 additions and 10 deletions
+1
View File
@@ -369,6 +369,7 @@ fn action_create_domain(context: Arc<Mutex<Context>>, miner: Arc<Mutex<Miner>>,
return; return;
} }
}; };
info!("Parsed domain data:\n{:#?}", &data);
if data.records.len() > MAX_RECORDS { if data.records.len() > MAX_RECORDS {
show_warning(web_view, "Too many records. Mining more than 30 records not allowed."); show_warning(web_view, "Too many records. Mining more than 30 records not allowed.");
let _ = web_view.eval("domainMiningUnavailable();"); let _ = web_view.eval("domainMiningUnavailable();");
+24 -3
View File
@@ -255,10 +255,31 @@
<div class="modal-background"></div> <div class="modal-background"></div>
<div class="modal-content"> <div class="modal-content">
<div class="box"> <div class="box">
<div class="field"> <label class="label">One</label>
<label class="label">Domain owner contacts</label> <div class="field is-grouped">
<div class="control"> <div class="control">
<textarea class="textarea" id="contacts_text" maxlength="250"></textarea> <input class="input" type="text" placeholder="Name" id="contact1_name">
</div>
<div class="control is-expanded">
<input class="input is-expanded" type="text" placeholder="Text or link" id="contact1_value">
</div>
</div>
<label class="label">Two</label>
<div class="field is-grouped">
<div class="control">
<input class="input" type="text" placeholder="Name" id="contact2_name">
</div>
<div class="control is-expanded">
<input class="input is-expanded" type="text" placeholder="Text or link" id="contact2_value">
</div>
</div>
<label class="label">Three</label>
<div class="field is-grouped">
<div class="control">
<input class="input" type="text" placeholder="Name" id="contact3_name">
</div>
<div class="control is-expanded">
<input class="input is-expanded" type="text" placeholder="Text or link" id="contact3_value">
</div> </div>
</div> </div>
<p class="help mb-3">You can add some contacts to your domain if you wish to be contacted in regards of your services. <p class="help mb-3">You can add some contacts to your domain if you wish to be contacted in regards of your services.
+16 -7
View File
@@ -167,7 +167,12 @@ function editDomain(domain, event) {
document.getElementById("info_text").value = domain_data.info; document.getElementById("info_text").value = domain_data.info;
} }
if (typeof domain_data.contacts !== 'undefined') { if (typeof domain_data.contacts !== 'undefined') {
document.getElementById("contacts_text").value = domain_data.contacts.join("\n"); var count = 1;
domain_data.contacts.forEach(function(v, i, a) {
document.getElementById("contact" + count + "_name").value = decodeURIComponent(v.name);
document.getElementById("contact" + count + "_value").value = decodeURIComponent(v.value);
count = count + 1;
});
} }
changeZone(domain_data.zone, event); changeZone(domain_data.zone, event);
refreshRecordsList(); refreshRecordsList();
@@ -268,12 +273,16 @@ function createDomain() {
function getContacts() { function getContacts() {
var result = []; var result = [];
var text = document.getElementById("contacts_text").value; for (var x = 1; x <= 3; x++) {
if (text != "") { var name = document.getElementById("contact" + x + "_name").value;
var lines = text.split("\n"); var value = document.getElementById("contact" + x + "_value").value;
lines.forEach(function(value, index, array) { if (name == "" || value == "") {
result.push(value); continue;
}); }
var obj = {};
obj.name = encodeURIComponent(name.trim());
obj.value = encodeURIComponent(value.trim());
result.push(obj);
} }
return result; return result;
} }