Much UI work, significant improvement.
This commit is contained in:
parent
9c3af4c936
commit
5356f65ca3
44 changed files with 1865 additions and 1213 deletions
|
|
@ -1,10 +1,12 @@
|
|||
{% extends "base.html" %}
|
||||
<!-- File form-followuprequests-Followuprequest.html generated 2018-07-09T20:55:34.512Z by adl.to-selmer-templates.
|
||||
<!-- File form-followuprequests-Followuprequest.html generated 2018-07-10T15:25:24.194Z by adl.to-selmer-templates.
|
||||
See [Application Description Language](https://github.com/simon-brooke/adl).-->
|
||||
|
||||
|
||||
{% block extra-head %}
|
||||
|
||||
{% script "/js/lib/node_modules/selectize/dist/js/standalone/selectize.min.js" %}
|
||||
{% style "/js/lib/node_modules/selectize/dist/css/selectize.css" %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div id='content' class='edit'>
|
||||
|
|
@ -16,14 +18,10 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
|
|||
Elector_id
|
||||
</label>
|
||||
{% if {{record.elector_id}} %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='electors' found='true'>
|
||||
<input name='elector_id_search_box' onchange='$.getJSON("/auto/json/seach-strings-electors?gender=" + elector_id_search_box.text + "&email=" + elector_id_search_box.text + "&name=" + elector_id_search_box.text + "&phone=" + elector_id_search_box.text, null, function (data) {updateMenuOptions("elector_id", "id", ["gender", "email", "name", "phone"], data);})'/>
|
||||
<br/>
|
||||
{% ifmemberof %}
|
||||
<select id='elector_id' name='elector_id'>
|
||||
{% for r in electors %}<option value='{{r.id}}' {% ifequal record.elector_id r.id%}selected{% endifequal %}>{{r.name}} {{r.phone}} {{r.email}} {{r.gender}}</option>{% endfor %}
|
||||
{% for option in elector_id %}<option value='{{option.id}}' {% ifequal record.elector_id option.id%}selected{% endifequal %}>{{option.name}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='elector_id' name='elector_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -36,14 +34,10 @@ You are not permitted to view elector_id of followuprequests
|
|||
{% endifmemberof %}
|
||||
{% endifmemberof %}
|
||||
{% else %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='electors' found='true'>
|
||||
<input name='elector_id_search_box' onchange='$.getJSON("/auto/json/seach-strings-electors?gender=" + elector_id_search_box.text + "&email=" + elector_id_search_box.text + "&name=" + elector_id_search_box.text + "&phone=" + elector_id_search_box.text, null, function (data) {updateMenuOptions("elector_id", "id", ["gender", "email", "name", "phone"], data);})'/>
|
||||
<br/>
|
||||
{% ifmemberof %}
|
||||
<select id='elector_id' name='elector_id'>
|
||||
{% for r in electors %}<option value='{{r.id}}' {% ifequal record.elector_id r.id%}selected{% endifequal %}>{{r.name}} {{r.phone}} {{r.email}} {{r.gender}}</option>{% endfor %}
|
||||
{% for option in elector_id %}<option value='{{option.id}}' {% ifequal record.elector_id option.id%}selected{% endifequal %}>{{option.name}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='elector_id' name='elector_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -62,14 +56,10 @@ You are not permitted to view elector_id of followuprequests
|
|||
Visit_id
|
||||
</label>
|
||||
{% if {{record.visit_id}} %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='visits' found='true'>
|
||||
<input name='visit_id_search_box' onchange='$.getJSON("/auto/json/seach-strings-visits?address_id=" + visit_id_search_box.text + "&date=" + visit_id_search_box.text, null, function (data) {updateMenuOptions("visit_id", "id", ["address_id", "date"], data);})'/>
|
||||
<br/>
|
||||
{% ifmemberof %}
|
||||
<select id='visit_id' name='visit_id'>
|
||||
{% for r in visits %}<option value='{{r.id}}' {% ifequal record.visit_id r.id%}selected{% endifequal %}>{{r.address_id}} {{r.date}}</option>{% endfor %}
|
||||
{% for option in visit_id %}<option value='{{option.id}}' {% ifequal record.visit_id option.id%}selected{% endifequal %}>{{option.address_id}} {{option.date}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='visit_id' name='visit_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -82,14 +72,10 @@ You are not permitted to view visit_id of followuprequests
|
|||
{% endifmemberof %}
|
||||
{% endifmemberof %}
|
||||
{% else %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='visits' found='true'>
|
||||
<input name='visit_id_search_box' onchange='$.getJSON("/auto/json/seach-strings-visits?address_id=" + visit_id_search_box.text + "&date=" + visit_id_search_box.text, null, function (data) {updateMenuOptions("visit_id", "id", ["address_id", "date"], data);})'/>
|
||||
<br/>
|
||||
{% ifmemberof %}
|
||||
<select id='visit_id' name='visit_id'>
|
||||
{% for r in visits %}<option value='{{r.id}}' {% ifequal record.visit_id r.id%}selected{% endifequal %}>{{r.address_id}} {{r.date}}</option>{% endfor %}
|
||||
{% for option in visit_id %}<option value='{{option.id}}' {% ifequal record.visit_id option.id%}selected{% endifequal %}>{{option.address_id}} {{option.date}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='visit_id' name='visit_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -108,12 +94,10 @@ You are not permitted to view visit_id of followuprequests
|
|||
Issue_id
|
||||
</label>
|
||||
{% if {{record.issue_id}} %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='issues' found='true'>
|
||||
{% ifmemberof %}
|
||||
<select id='issue_id' name='issue_id'>
|
||||
{% for r in issues %}<option value='{{r.id}}' {% ifequal record.issue_id r.id%}selected{% endifequal %}>{{r.id}}</option>{% endfor %}
|
||||
{% for option in issue_id %}<option value='{{option.id}}' {% ifequal record.issue_id option.id%}selected{% endifequal %}>{{option.id}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='issue_id' name='issue_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -126,12 +110,10 @@ You are not permitted to view issue_id of followuprequests
|
|||
{% endifmemberof %}
|
||||
{% endifmemberof %}
|
||||
{% else %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='issues' found='true'>
|
||||
{% ifmemberof %}
|
||||
<select id='issue_id' name='issue_id'>
|
||||
{% for r in issues %}<option value='{{r.id}}' {% ifequal record.issue_id r.id%}selected{% endifequal %}>{{r.id}}</option>{% endfor %}
|
||||
{% for option in issue_id %}<option value='{{option.id}}' {% ifequal record.issue_id option.id%}selected{% endifequal %}>{{option.id}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='issue_id' name='issue_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -150,12 +132,10 @@ You are not permitted to view issue_id of followuprequests
|
|||
Method_id
|
||||
</label>
|
||||
{% if {{record.method_id}} %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='followupmethods' found='true'>
|
||||
{% ifmemberof %}
|
||||
<select id='method_id' name='method_id'>
|
||||
{% for r in followupmethods %}<option value='{{r.id}}' {% ifequal record.method_id r.id%}selected{% endifequal %}>{{r.id}}</option>{% endfor %}
|
||||
{% for option in method_id %}<option value='{{option.id}}' {% ifequal record.method_id option.id%}selected{% endifequal %}>{{option.id}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='method_id' name='method_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -168,12 +148,10 @@ You are not permitted to view method_id of followuprequests
|
|||
{% endifmemberof %}
|
||||
{% endifmemberof %}
|
||||
{% else %}
|
||||
{% ifmemberof admin %}
|
||||
<span class='select-box' farside='followupmethods' found='true'>
|
||||
{% ifmemberof %}
|
||||
<select id='method_id' name='method_id'>
|
||||
{% for r in followupmethods %}<option value='{{r.id}}' {% ifequal record.method_id r.id%}selected{% endifequal %}>{{r.id}}</option>{% endfor %}
|
||||
{% for option in method_id %}<option value='{{option.id}}' {% ifequal record.method_id option.id%}selected{% endifequal %}>{{option.id}}</option>{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
{% else %}
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='method_id' name='method_id' class='pseudo-widget disabled'>
|
||||
|
|
@ -187,7 +165,7 @@ You are not permitted to view method_id of followuprequests
|
|||
{% endifmemberof %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% ifmemberof admin %}
|
||||
{% ifmemberof %}
|
||||
<p class='widget action-safe'>
|
||||
<label for='save-button' class='action-safe'>
|
||||
To save this followuprequests record
|
||||
|
|
@ -195,7 +173,7 @@ To save this followuprequests record
|
|||
<input id='save-button' name='save-button' class='action-safe' type='submit' value='Save!'/>
|
||||
</p>
|
||||
{% endifmemberof %}
|
||||
{% ifmemberof admin %}
|
||||
{% ifmemberof %}
|
||||
<p class='widget action-dangerous'>
|
||||
<label for='delete-button' class='action-dangerous'>
|
||||
To delete this followuprequests record
|
||||
|
|
@ -209,20 +187,63 @@ To delete this followuprequests record
|
|||
{% endblock %}
|
||||
{% block extra-tail %}
|
||||
<script type='text/javascript'>
|
||||
/**
|
||||
* update the select menu with id `wid` from this `data` whose fields include
|
||||
* this `entity_key` and these `fields`
|
||||
*/
|
||||
function updateMenuOptions(wid, entity_key, fields, data){
|
||||
$('#' + wid).children().filter(function(){
|
||||
return $(this).attr('selected') === undefined;
|
||||
}).remove().end();
|
||||
/**
|
||||
* selectize one select widget. Substitute the actual id of the widget for `elector_id`.
|
||||
*/
|
||||
$('#elector_id').selectize({
|
||||
valueField: 'id',
|
||||
labelField: 'name',
|
||||
searchField: 'name',
|
||||
options: [],
|
||||
create: false,
|
||||
|
||||
$.each(data, function(key, entry){
|
||||
$('#' + wid).append(
|
||||
$('<option></option>').attr('value', key).text(entry));
|
||||
});
|
||||
}
|
||||
load: function(query, callback) {
|
||||
console.log('Desperately seeking ' + query);
|
||||
if (query === null || !query.length) return callback();
|
||||
$.ajax({
|
||||
url: '/json/auto/search-strings-electors?name=' + query,
|
||||
type: 'GET',
|
||||
dataType: 'jsonp',
|
||||
error: function() {
|
||||
console.log( 'Query ' + query + ' failed.');
|
||||
callback();
|
||||
},
|
||||
success: function(res) {
|
||||
console.log('Received ' + res + ' records for ' + query);
|
||||
callback(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* selectize one select widget. Substitute the actual id of the widget for `visit_id`.
|
||||
*/
|
||||
$('#visit_id').selectize({
|
||||
valueField: 'id',
|
||||
labelField: 'name',
|
||||
searchField: 'name',
|
||||
options: [],
|
||||
create: false,
|
||||
|
||||
load: function(query, callback) {
|
||||
console.log('Desperately seeking ' + query);
|
||||
if (query === null || !query.length) return callback();
|
||||
$.ajax({
|
||||
url: '/json/auto/search-strings-electors?name=' + query,
|
||||
type: 'GET',
|
||||
dataType: 'jsonp',
|
||||
error: function() {
|
||||
console.log( 'Query ' + query + ' failed.');
|
||||
callback();
|
||||
},
|
||||
success: function(res) {
|
||||
console.log('Received ' + res + ' records for ' + query);
|
||||
callback(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue