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;
}
};
info!("Parsed domain data:\n{:#?}", &data);
if data.records.len() > MAX_RECORDS {
show_warning(web_view, "Too many records. Mining more than 30 records not allowed.");
let _ = web_view.eval("domainMiningUnavailable();");
+24 -3
View File
@@ -255,10 +255,31 @@
<div class="modal-background"></div>
<div class="modal-content">
<div class="box">
<div class="field">
<label class="label">Domain owner contacts</label>
<label class="label">One</label>
<div class="field is-grouped">
<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>
<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;
}
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);
refreshRecordsList();
@@ -268,12 +273,16 @@ function createDomain() {
function getContacts() {
var result = [];
var text = document.getElementById("contacts_text").value;
if (text != "") {
var lines = text.split("\n");
lines.forEach(function(value, index, array) {
result.push(value);
});
for (var x = 1; x <= 3; x++) {
var name = document.getElementById("contact" + x + "_name").value;
var value = document.getElementById("contact" + x + "_value").value;
if (name == "" || value == "") {
continue;
}
var obj = {};
obj.name = encodeURIComponent(name.trim());
obj.value = encodeURIComponent(value.trim());
result.push(obj);
}
return result;
}