Skip to content

Commit 1b189cd

Browse files
committed
Add "message_extra" to input options
1 parent 8804955 commit 1b189cd

File tree

6 files changed

+52
-0
lines changed

6 files changed

+52
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ sudo service mycodoflask restart
4242
- Add Function: Camera: rpicam ([#1487](https://github.com/kizniche/Mycodo/pull/1487))
4343
- Add Input: VEML7700 Ambient Light Sensor ([#1491](https://github.com/kizniche/Mycodo/pull/1491))
4444
- Add Input: LTR390 UV Light Sensor ([#1432](https://github.com/kizniche/Mycodo/pull/1432))
45+
- Add "message_extra" to input options
4546

4647
### Miscellaneous
4748

mycodo/inputs/examples/example_all_options_temperature.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ def constraints_pass_measure_range(mod_input, value):
9999
# This will be displayed at the top of the options when the user expands the input with the "+" icon.
100100
'message': "Don't forget to do x and y before activating this Input",
101101

102+
# Add an additional message that's hidden behind a collapsible accordion
103+
'message_extra': 'Some additional information:'
104+
'<table class="table"><tr><td>asdf</td><td>qwer</td></tr><tr><td>xcvb</td><td>tyui</td></tr></table>'
105+
'<strong>testing</strong>'
106+
'<br/><a href="startpage.com">This is a link</a>'
107+
'<p>Here is additional information that may be too long to include in the "message", and can be hidden behind a collapsable menu.</p>',
108+
102109
# Python module dependencies
103110
# This must be a module that is able to be installed with pip or apt (pypi, git, and apt examples below)
104111
# Leave the list empty if there are no dependencies

mycodo/inputs/examples/example_all_options_temperature_with_channel_options.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ def constraints_pass_measure_range(mod_input, value):
114114
# This will be displayed at the top of the options when the user expands the input with the "+" icon.
115115
'message': "You must set the Measurement Unit for each measurement prior to activating.",
116116

117+
# Add an additional message that's hidden behind a collapsible accordion
118+
'message_extra': 'Some additional information:'
119+
'<table class="table"><tr><td>asdf</td><td>qwer</td></tr><tr><td>xcvb</td><td>tyui</td></tr></table>'
120+
'<strong>testing</strong>'
121+
'<br/><a href="startpage.com">This is a link</a>'
122+
'<p>Here is additional information that may be too long to include in the "message", and can be hidden behind a collapsable menu.</p>',
123+
117124
# Python module dependencies
118125
# This must be a module that is able to be installed with pip or apt (pypi, git, and apt examples below)
119126
# Leave the list empty if there are no dependencies

mycodo/inputs/examples/minimal_humidity_temperature.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343

4444
'message': "Note: This is just an informative note to the user.",
4545

46+
'message_extra': 'Some additional information:'
47+
'<table class="table"><tr><td>asdf</td><td>qwer</td></tr><tr><td>xcvb</td><td>tyui</td></tr></table>'
48+
'<strong>testing</strong>'
49+
'<br/><a href="startpage.com">This is a link</a>'
50+
'<p>Here is additional information that may be too long to include in the "message", and can be hidden behind a collapsable menu.</p>',
51+
4652
'options_enabled': [
4753
'measurements_select',
4854
'period',

mycodo/mycodo_flask/templates/pages/data_options/input_options.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,36 @@
104104
</div>
105105
{% endif %}
106106

107+
{% if 'message_extra' in dict_inputs[each_input.device] %}
108+
<div class="accordion" id="accordion_{{unique_id}}" style="padding-top: 0.3em">
109+
<div class="card border-0">
110+
<div class="card-header bg-transparent p-0 border-0" id="heading_{{unique_id}}">
111+
<button
112+
class="btn btn-link text-decoration-none p-0 d-flex align-items-center"
113+
type="button"
114+
data-toggle="collapse"
115+
data-target="#message_extra_{{unique_id}}"
116+
aria-expanded="false"
117+
aria-controls="message_extra_{{unique_id}}">
118+
119+
<span class="mr-1 mt-n1"></span>
120+
<strong>Additional Information</strong>
121+
</button>
122+
</div>
123+
124+
<div
125+
id="message_extra_{{unique_id}}"
126+
class="collapse"
127+
aria-labelledby="heading_{{unique_id}}"
128+
data-parent="#accordion_{{unique_id}}">
129+
<div class="card-body">
130+
{{dict_inputs[each_input.device]['message_extra']|safe}}
131+
</div>
132+
</div>
133+
</div>
134+
</div>
135+
{% endif %}
136+
107137
<div id="return_text_{{each_input.unique_id}}" class="col-12"></div>
108138

109139
</div>

mycodo/utils/inputs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ def dict_has_value(dict_inp, input_cus, key, force_type=None):
228228
dict_inputs = dict_has_value(dict_inputs, input_custom, 'do_not_run_periodically')
229229
dict_inputs = dict_has_value(dict_inputs, input_custom, 'edge_input')
230230
dict_inputs = dict_has_value(dict_inputs, input_custom, 'message')
231+
dict_inputs = dict_has_value(dict_inputs, input_custom, 'message_extra')
231232

232233
dict_inputs = dict_has_value(dict_inputs, input_custom, 'url_datasheet', force_type='list')
233234
dict_inputs = dict_has_value(dict_inputs, input_custom, 'url_manufacturer', force_type='list')

0 commit comments

Comments
 (0)