mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
set default expand behaviour
This commit is contained in:
parent
44a75c1291
commit
f3e05cd08a
@ -273,8 +273,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="section-content" style="display:none; padding: 12px">
|
<div class="section-content" style="display:none; padding: 12px">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-config-input-willTopic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
<label for="node-config-input-closeTopic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
||||||
<input type="text" id="node-config-input-willTopic" style="width:300px" data-i18n="[placeholder]mqtt.placeholder.close-topic">
|
<input type="text" id="node-config-input-closeTopic" style="width:300px" data-i18n="[placeholder]mqtt.placeholder.close-topic">
|
||||||
|
|
||||||
<i class="fa fa-history"></i> <span data-i18n="mqtt.label.retain"></span> <select id="node-config-input-closeRetain" style="float:right; width:75px !important">
|
<i class="fa fa-history"></i> <span data-i18n="mqtt.label.retain"></span> <select id="node-config-input-closeRetain" style="float:right; width:75px !important">
|
||||||
<option value="false" data-i18n="mqtt.false"></option>
|
<option value="false" data-i18n="mqtt.false"></option>
|
||||||
@ -283,7 +283,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-config-input-closePayload"><i class="fa fa-envelope"></i> <span data-i18n="common.label.payload"></span></label>
|
<label for="node-config-input-closePayload"><i class="fa fa-envelope"></i> <span data-i18n="common.label.payload"></span></label>
|
||||||
<input type="text" id="node-config-input-willPayload" style="width:300px" data-i18n="[placeholder]common.label.payload">
|
<input type="text" id="node-config-input-closePayload" style="width:300px" data-i18n="[placeholder]common.label.payload">
|
||||||
|
|
||||||
<i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
<i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
||||||
<select id="node-config-input-closeQos" style="float:right; width:75px !important">
|
<select id="node-config-input-closeQos" style="float:right; width:75px !important">
|
||||||
@ -392,22 +392,31 @@
|
|||||||
label: this._("mqtt.tabs-label.messages")
|
label: this._("mqtt.tabs-label.messages")
|
||||||
});
|
});
|
||||||
|
|
||||||
function setUpSection(sectionId) {
|
function setUpSection(sectionId, isExpanded) {
|
||||||
var birthMessageSection = $(sectionId);
|
var birthMessageSection = $(sectionId);
|
||||||
var paletteHeader = birthMessageSection.find('.palette-header');
|
var paletteHeader = birthMessageSection.find('.palette-header');
|
||||||
|
var twistie = paletteHeader.find('i');
|
||||||
var sectionContent = birthMessageSection.find('.section-content');
|
var sectionContent = birthMessageSection.find('.section-content');
|
||||||
|
|
||||||
|
function toggleSection(expanded) {
|
||||||
|
twistie.toggleClass('expanded', expanded);
|
||||||
|
sectionContent.toggle(expanded);
|
||||||
|
}
|
||||||
paletteHeader.click(function(e) {
|
paletteHeader.click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var twistie = $(this).find('i');
|
|
||||||
var isExpanded = twistie.hasClass('expanded');
|
var isExpanded = twistie.hasClass('expanded');
|
||||||
sectionContent.toggle(!isExpanded);
|
toggleSection(!isExpanded);
|
||||||
twistie.toggleClass('expanded',!isExpanded);
|
|
||||||
});
|
});
|
||||||
|
toggleSection(isExpanded);
|
||||||
}
|
}
|
||||||
setUpSection('#mqtt-broker-section-birth');
|
// show first section if none are set so the user gets the idea
|
||||||
setUpSection('#mqtt-broker-section-will');
|
var showBirthSection = this.birthTopic !== ""
|
||||||
setUpSection('#mqtt-broker-section-close');
|
|| this.willTopic === ""
|
||||||
|
&& this.birthTopic === ""
|
||||||
|
&& this.closeTopic == "";
|
||||||
|
setUpSection('#mqtt-broker-section-birth', showBirthSection);
|
||||||
|
setUpSection('#mqtt-broker-section-will', this.willTopic !== "");
|
||||||
|
setUpSection('#mqtt-broker-section-close', this.closeTopic !== "");
|
||||||
|
|
||||||
setTimeout(function() { tabs.resize(); },0);
|
setTimeout(function() { tabs.resize(); },0);
|
||||||
if (typeof this.cleansession === 'undefined') {
|
if (typeof this.cleansession === 'undefined') {
|
||||||
|
Loading…
Reference in New Issue
Block a user