Skip to content
This repository has been archived by the owner on Jul 9, 2020. It is now read-only.

Commit

Permalink
[admin] Added links to netjsonconfig docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Feb 15, 2017
1 parent 61fdb1c commit 6ddc95f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ a:focus, a:hover {
#changelist-filter li.selected a{
color: #df5d43 !important
}

#netjsonconfig-hint, #netjsonconfig-hint a,
#container .field-backend a{ color: #df5d43 }
3 changes: 2 additions & 1 deletion django_netjsonconfig/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class BaseConfig(models.Model):
backend = models.CharField(_('backend'),
choices=app_settings.BACKENDS,
max_length=128,
help_text=_('Select netjsonconfig backend'))
help_text=_('Select <a href="http://netjsonconfig.openwisp.org/en/'
'stable/" target="_blank">netjsonconfig</a> backend'))
config = JSONField(_('configuration'),
default=dict,
help_text=_('configuration in NetJSON DeviceConfiguration format'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@
.field-vpn, .field-auto_cert{
display: none;
}
#container .help{ margin-top: 2px; font-size: 13px }
#container .help a,
#netjsonconfig-hint a{ text-decoration: underline }
#netjsonconfig-hint{ width: auto }
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
id = field.attr('id') + '_jsoneditor',
initialField = $('#initial-' + field.attr('id')),
container = field.parents('.form-row').eq(0),
labelText = container.find('label').text(),
labelText = container.find('label:not(#netjsonconfig-hint)').text(),
startval = $.isEmptyObject(value) ? null : value,
editorContainer = $('#' + id),
html, editor, options, wrapper, header,
Expand Down
5 changes: 5 additions & 0 deletions django_netjsonconfig/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def render(self, name, value, attrs={}):
<input class="button json-editor-btn-edit normal-mode" type="button" value="{0}">
<input class="button json-editor-btn-edit advanced-mode" type="button" value="{1}">
<script>django._netjsonconfigSchemaUrl = "{2}";</script>
<label id="netjsonconfig-hint">
Want learn to use the advanced mode? Consult the
<a href="http://netjsonconfig.openwisp.org/en/stable/general/basics.html"
target="_blank">netjsonconfig documentation</a>.
</label>
"""
html = html.format(_('Normal mode'),
_('Advanced mode (raw JSON)'),
Expand Down

0 comments on commit 6ddc95f

Please sign in to comment.