make editing wifi measurements work and show error without mobileclient
This commit is contained in:
parent
8f36b70f64
commit
cb5cde542d
4 changed files with 22 additions and 5 deletions
|
@ -136,6 +136,9 @@ class EditorFormBase(I18nModelFormMixin, ModelForm):
|
|||
if 'to_node' in self.fields:
|
||||
self.fields['to_node'].widget = HiddenInput()
|
||||
|
||||
if 'data' in self.fields:
|
||||
self.initial['data'] = json.dumps(self.initial['data'])
|
||||
|
||||
def clean_redirect_slugs(self):
|
||||
old_redirect_slugs = set(self.redirect_slugs)
|
||||
new_redirect_slugs = set(s for s in (s.strip() for s in self.cleaned_data['redirect_slugs'].split(',')) if s)
|
||||
|
|
|
@ -72,10 +72,13 @@ body:not(.map-enabled) #sidebar {
|
|||
nav.navbar .navbar-nav > li > a {
|
||||
color:#666666;
|
||||
}
|
||||
body.mobileclient .nomobileclient {
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* sidebar contents */
|
||||
#sidebar form.creation-lock [type=submit].btn.btn-primary,
|
||||
#sidebar form.scan-lock [type=submit].btn.btn-primary{
|
||||
#sidebar form.scan-lock [type=submit].btn.btn-primary {
|
||||
display:none;
|
||||
}
|
||||
#sidebar h3 {
|
||||
|
@ -334,13 +337,14 @@ body > .wificollector {
|
|||
.wificollector:not(.empty) .btn.start,
|
||||
.wificollector:not(.running) .btn.stop,
|
||||
.wificollector:not(.done) .btn.reset,
|
||||
.wificollector.empty .count-line {
|
||||
.wificollector.empty .count-line,
|
||||
body:not(.mobileclient) .wificollector .btn {
|
||||
display: none;
|
||||
}
|
||||
.wificollector .btn {
|
||||
margin: 0 5px 0 0;
|
||||
}
|
||||
.wificollector p {
|
||||
.wificollector p:first-child {
|
||||
height: 26px;
|
||||
margin: 0;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ editor = {
|
|||
editor.map.doubleClickZoom.enable();
|
||||
});
|
||||
|
||||
if (window.mobileclient) $('body').addClass('mobileclient');
|
||||
|
||||
/*
|
||||
* Fix scroll wheel zoom on precise scrolling devices
|
||||
*/
|
||||
|
@ -234,8 +236,13 @@ editor = {
|
|||
var data_field = $('form [name=data]');
|
||||
if (data_field.length) {
|
||||
data_field.hide();
|
||||
data_field.after($('body .wificollector')[0].outerHTML);
|
||||
data_field.closest('form').addClass('scan-lock');
|
||||
var collector = $($('body .wificollector')[0].outerHTML);
|
||||
if (data_field.val()) {
|
||||
collector.removeClass('empty').addClass('done').find('.count').text(JSON.parse(data_field.val()).length);
|
||||
} else {
|
||||
data_field.closest('form').addClass('scan-lock');
|
||||
}
|
||||
data_field.after(collector);
|
||||
}
|
||||
},
|
||||
_sidebar_error: function(data) {
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
<a class="btn btn-xs btn-danger reset">{% trans 'Reset scan results' %}</a>
|
||||
<span class="count-line"><span class="count">0</span> scans</span>
|
||||
</p>
|
||||
<p class="nomobileclient"><em>
|
||||
{% trans 'mobileclient not found. Please install the c3nav app for wifi scanning support.' %}
|
||||
</em></p>
|
||||
<table></table>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue