Rendering admin/webmail path based on checkbox value

master
Ionut Filip 6 years ago
parent a46d0fe581
commit ffdef18bd6

@ -15,15 +15,14 @@ accessing messages for beginner users.</p>
<!-- {{ macros.radio("webmail_type", "rainloop", "Rainloop", "lightweight Webmail based on PHP, no database") }} --> <!-- {{ macros.radio("webmail_type", "rainloop", "Rainloop", "lightweight Webmail based on PHP, no database") }} -->
<!-- </div> --> <!-- </div> -->
<br/> <br/>
<select class="btn btn-primary dropdown-toggle" name="webmail_type"> <select class="btn btn-primary dropdown-toggle" name="webmail_type" id="webmail">
{% for webmailtype in ["none", "roundcube", "rainloop"] %} {% for webmailtype in ["none", "roundcube", "rainloop"] %}
<option value="{{ webmailtype }}" >{{ webmailtype }}</option> <option value="{{ webmailtype }}" >{{ webmailtype }}</option>
{% endfor %} {% endfor %}
</select> </select>
<p></p> <p></p>
<div class="input-group"> <div class="input-group">
<!-- <div class="input-group-addon"><input type="checkbox" name="webmail_enabled" value="true"></div> --> <input class="form-control" type="text" name="webmail_path" id="webmail_path" style="display: none">
<input class="form-control" type="text" name="webmail_path" value="/webmail">
</div> </div>
</div> </div>
@ -53,4 +52,27 @@ also disable the antivirus if required (it does use aroung 1GB of ram).</p>
</label> </label>
</div> </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type = "text/javascript" language = "javascript">
$(document).ready(function() {
if ($("#webmail").val() == 'none') {
$("#webmail_path").hide();
$("#webmail_path").attr("value", "");
} else {
$("#webmail_path").show();
$("#webmail_path").attr("value", "/webmail");
}
$("#webmail").click(function () {
if (this.value == 'none') {
$("#webmail_path").hide();
$("#webmail_path").attr("value", "");
} else {
$("#webmail_path").show();
$("#webmail_path").attr("value", "/webmail");
}
});
});
</script>
{% endcall %} {% endcall %}

@ -68,11 +68,29 @@ Or in plain english: if receivers start to classify your mail as spam, this post
manage your email domains, users, etc.</p> manage your email domains, users, etc.</p>
<div class="form-group"> <div class="form-group">
<label>Enable the admin UI (and path to the admin UI)</label> <input type="checkbox" name="admin_enabled" value="true" id="admin">
<div class="input-group"> <label>Enable the admin UI (and path to the admin UI)</label>
<div class="input-group-addon"><input type="checkbox" name="admin_enabled" value="true"></div> <input class="form-control" type="text" name="admin_path" id="admin_path" style="display: none">
<input class="form-control" type="text" name="admin_path" value="/admin">
</div>
</div> </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type = "text/javascript" language = "javascript">
$(document).ready(function() {
if ($('#admin').prop('checked')) {
$("#admin_path").show();
$("#admin_path").attr("value", "/admin");
}
$("#admin").change(function() {
if ($(this).is(":checked")) {
$("#admin_path").show();
$("#admin_path").attr("value", "/admin");
} else {
$("#admin_path").hide();
$("#admin_path").attr("value", "");
}
});
});
</script>
{% endcall %} {% endcall %}

@ -15,15 +15,14 @@ accessing messages for beginner users.</p>
<!-- {{ macros.radio("webmail_type", "rainloop", "Rainloop", "lightweight Webmail based on PHP, no database") }} --> <!-- {{ macros.radio("webmail_type", "rainloop", "Rainloop", "lightweight Webmail based on PHP, no database") }} -->
<!-- </div> --> <!-- </div> -->
<br/> <br/>
<select class="btn btn-primary dropdown-toggle" name="webmail_type"> <select class="btn btn-primary dropdown-toggle" name="webmail_type" id="webmail">
{% for webmailtype in ["none", "roundcube", "rainloop"] %} {% for webmailtype in ["none", "roundcube", "rainloop"] %}
<option value="{{ webmailtype }}" >{{ webmailtype }}</option> <option value="{{ webmailtype }}" >{{ webmailtype }}</option>
{% endfor %} {% endfor %}
</select> </select>
<p></p> <p></p>
<div class="input-group"> <div class="input-group">
<!-- <div class="input-group-addon"><input type="checkbox" name="webmail_enabled" value="true"></div> --> <input class="form-control" type="text" name="webmail_path" id="webmail_path" style="display: none">
<input class="form-control" type="text" name="webmail_path" value="/webmail">
</div> </div>
</div> </div>
@ -53,4 +52,27 @@ also disable the antivirus if required (it does use aroung 1GB of ram).</p>
</label> </label>
</div> </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type = "text/javascript" language = "javascript">
$(document).ready(function() {
if ($("#webmail").val() == 'none') {
$("#webmail_path").hide();
$("#webmail_path").attr("value", "");
} else {
$("#webmail_path").show();
$("#webmail_path").attr("value", "/webmail");
}
$("#webmail").click(function () {
if (this.value == 'none') {
$("#webmail_path").hide();
$("#webmail_path").attr("value", "");
} else {
$("#webmail_path").show();
$("#webmail_path").attr("value", "/webmail");
}
});
});
</script>
{% endcall %} {% endcall %}

Loading…
Cancel
Save