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:
|
if 'to_node' in self.fields:
|
||||||
self.fields['to_node'].widget = HiddenInput()
|
self.fields['to_node'].widget = HiddenInput()
|
||||||
|
|
||||||
|
if 'data' in self.fields:
|
||||||
|
self.initial['data'] = json.dumps(self.initial['data'])
|
||||||
|
|
||||||
def clean_redirect_slugs(self):
|
def clean_redirect_slugs(self):
|
||||||
old_redirect_slugs = set(self.redirect_slugs)
|
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)
|
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 {
|
nav.navbar .navbar-nav > li > a {
|
||||||
color:#666666;
|
color:#666666;
|
||||||
}
|
}
|
||||||
|
body.mobileclient .nomobileclient {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
/* sidebar contents */
|
/* sidebar contents */
|
||||||
#sidebar form.creation-lock [type=submit].btn.btn-primary,
|
#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;
|
display:none;
|
||||||
}
|
}
|
||||||
#sidebar h3 {
|
#sidebar h3 {
|
||||||
|
@ -334,13 +337,14 @@ body > .wificollector {
|
||||||
.wificollector:not(.empty) .btn.start,
|
.wificollector:not(.empty) .btn.start,
|
||||||
.wificollector:not(.running) .btn.stop,
|
.wificollector:not(.running) .btn.stop,
|
||||||
.wificollector:not(.done) .btn.reset,
|
.wificollector:not(.done) .btn.reset,
|
||||||
.wificollector.empty .count-line {
|
.wificollector.empty .count-line,
|
||||||
|
body:not(.mobileclient) .wificollector .btn {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.wificollector .btn {
|
.wificollector .btn {
|
||||||
margin: 0 5px 0 0;
|
margin: 0 5px 0 0;
|
||||||
}
|
}
|
||||||
.wificollector p {
|
.wificollector p:first-child {
|
||||||
height: 26px;
|
height: 26px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ editor = {
|
||||||
editor.map.doubleClickZoom.enable();
|
editor.map.doubleClickZoom.enable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (window.mobileclient) $('body').addClass('mobileclient');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fix scroll wheel zoom on precise scrolling devices
|
* Fix scroll wheel zoom on precise scrolling devices
|
||||||
*/
|
*/
|
||||||
|
@ -234,8 +236,13 @@ editor = {
|
||||||
var data_field = $('form [name=data]');
|
var data_field = $('form [name=data]');
|
||||||
if (data_field.length) {
|
if (data_field.length) {
|
||||||
data_field.hide();
|
data_field.hide();
|
||||||
data_field.after($('body .wificollector')[0].outerHTML);
|
var collector = $($('body .wificollector')[0].outerHTML);
|
||||||
data_field.closest('form').addClass('scan-lock');
|
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) {
|
_sidebar_error: function(data) {
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
<a class="btn btn-xs btn-danger reset">{% trans 'Reset scan results' %}</a>
|
<a class="btn btn-xs btn-danger reset">{% trans 'Reset scan results' %}</a>
|
||||||
<span class="count-line"><span class="count">0</span> scans</span>
|
<span class="count-line"><span class="count">0</span> scans</span>
|
||||||
</p>
|
</p>
|
||||||
|
<p class="nomobileclient"><em>
|
||||||
|
{% trans 'mobileclient not found. Please install the c3nav app for wifi scanning support.' %}
|
||||||
|
</em></p>
|
||||||
<table></table>
|
<table></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue