diff options
Diffstat (limited to 'modules-available/locationinfo/templates/page-config-panel-summary.html')
-rw-r--r-- | modules-available/locationinfo/templates/page-config-panel-summary.html | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/modules-available/locationinfo/templates/page-config-panel-summary.html b/modules-available/locationinfo/templates/page-config-panel-summary.html new file mode 100644 index 00000000..2a968fc2 --- /dev/null +++ b/modules-available/locationinfo/templates/page-config-panel-summary.html @@ -0,0 +1,208 @@ +<h2> + {{#new}}{{lang_createPanel}}{{/new}} + {{^new}}{{lang_editPanel}}{{/new}} +</h2> + +<p>{{lang_editSummaryPanelHints}}</p> + +<form method="post" action="?do=locationinfo" id="config-form"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="writePanelConfig"> + <input type="hidden" name="ptype" value="SUMMARY"> + <input type="hidden" name="uuid" value="{{uuid}}"> + + <div class="row"> + + <div class="col-md-6"> + <div class="modify-inputs panel panel-default"> + <div class="panel-heading">{{lang_display}}</div> + <div class="panel-body"> + <div class="list-group"> + + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="panel-title">{{lang_displayName}}</label> + </div> + <div class="col-sm-7"> + <input class="form-control" name="name" id="panel-title" type="text" value="{{panelname}}"> + </div> + <div class="col-sm-2"> + <a class="btn btn-default helptext" title="{{lang_displayNameTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </a> + </div> + </div> + </div> + + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="language">{{lang_language}}</label> + </div> + <div class="col-sm-7"> + <select class="form-control" name="language" id="language"> + {{#languages}} + <option value="{{cc}}" id="lang-{{cc}}" {{selected}}>{{name}}</option> + {{/languages}} + </select> + </div> + <div class="col-sm-2"> + <a class="btn btn-default helptext" title="{{lang_languageTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </a> + </div> + </div> + </div> + + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="input-eco">{{lang_ecoMode}}</label> + </div> + <div class="col-sm-7"> + <input id="input-eco" type="checkbox" name="eco" {{eco_checked}}> + </div> + <div class="col-sm-2"> + <a class="btn btn-default helptext" title="{{lang_ecoTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </a> + </div> + </div> + </div> +<!-- + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="input-prettytime">{{lang_prettytime}}</label> + </div> + <div class="col-sm-7"> + <input id="input-prettytime" type="checkbox" name="prettytime" {{prettytime_checked}}> + </div> + <div class="col-sm-2"> + <a class="btn btn-default helptext" title="{{lang_prettytimeTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </a> + </div> + </div> + </div> +--> + </div> + </div> + </div> + </div> + </div> + + <div class="modify-inputs"> + <div class="row"> + + <div class="col-md-6"> + <div class="panel panel-default"> + <div class="panel-heading">{{lang_locations}}</div> + <div class="panel-body"> + <input type="hidden" name="locationids" value="{{locationids}}" id="locationids"> + <p>{{lang_fourLocsHint}}</p> + <ul id="selected-locations" class="list-unstyled"> + + </ul> + <div class="dropdown pull-right"> + <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown"> + <span class="glyphicon glyphicon-plus"></span> + </button> + <ul class="dropdown-menu" id="location-list"> + {{#locations}} + <li><a href="#" data-lid="{{locationid}}">{{locationpad}} <span class="name">{{locationname}}</span></a></li> + {{/locations}} + </ul> + </div> + <div class="clearfix"></div> + </div> + </div> + </div> + + </div> + </div> + <button type="submit" class="btn btn-primary">{{lang_save}}</button> + <a href="?do=locationinfo&show=panels" class="btn btn-default">{{lang_cancel}}</a> +</form> + +<div class="modal fade" id="no-locations-message" tabindex="-1" role="dialog"> + <div class="modal-dialog"> <!--style="min-width:600px;width:70%"--> + + <div class="modal-content"> + <div class="modal-header">{{lang_error}}</div> + <div class="modal-body"> + {{lang_noLocationsWarning}} + </div> + <div class="modal-footer"> + <a class="btn btn-primary pull-right" data-dismiss="modal">{{lang_close}}</a> + <div class="clearfix"></div> + </div> + </div> + + </div> +</div> + +<script type="text/javascript"><!-- + +document.addEventListener("DOMContentLoaded", function () { + var $selLocs = $('#selected-locations'); + var $locList = $('#location-list'); + var $locInput = $('#locationids'); + + // Initialize fancy tooltips + $('a.helptext').tooltip(); + // Add listener to range sliders so their label can be updated + $('input[type="range"]').change(function () { + $(this).siblings().find('.range-display').text($(this).val()); + }); + // Set state of input controls that aren't statically initialized server side + $('.modify-inputs input[type="checkbox"]') + .bootstrapSwitch({size: 'small'}); + + var lids = $locInput.val().split(','); + $selLocs.empty(); + for (var i = 0; i < lids.length; ++i) { + var $name = $locList.find('a[data-lid="' + lids[i] + '"] .name'); + if ($name.length === 0) continue; + addLocation(lids[i], $name.text()); + } + + // Adding/removing locations + $locList.find('a').click(function(ev) { + ev.preventDefault(); + var $this = $(this); + var name = $this.find('.name').text(); + var id = $this.data('lid'); + addLocation(id, name); + serializeLocs(); + }); + + $('#config-form').submit(function(ev) { + if ($locInput.val().length > 0) + return; + ev.preventDefault(); + $('#no-locations-message').modal('show'); + }); + + function addLocation(id, name) { + $selLocs.find('li[data-lid="' + id + '"]').remove(); + var delButton = $('<button class="btn btn-danger btn-xs" type="button">').append($('<span class="glyphicon glyphicon-remove">')).click(delParent); + $selLocs.append($('<li>').attr('data-lid', id).text(name).prepend(delButton)); + } + + function delParent() { + $(this).parent().remove(); + serializeLocs(); + } + + function serializeLocs() { + var res = $selLocs.find('li[data-lid]').map( function() { + return $(this).data('lid'); + }).get().join(','); + $locInput.val(res); + } + +}); + +//--></script> |