refactor sidebar inclusion

This commit is contained in:
Oliver Gorwits
2012-02-02 15:06:52 +00:00
parent fe1f1fa2fd
commit fc9b86e852
9 changed files with 25 additions and 41 deletions

View File

@@ -1,4 +1,9 @@
#!/usr/bin/env perl
# use lib '/root/perl-profiles/netdisco-web/lib/perl5';
use local::lib '/srv/www/vhosts/netdisco.ecmwf.int/perl-profiles/netdisco-web';
use lib '/srv/www/vhosts/netdisco.ecmwf.int/Netdisco/lib';
use Dancer;
use Netdisco::Web;
dance;

View File

@@ -7,20 +7,21 @@
<img class="sidebar_toggle" id="sidebar_toggle_img_in"
src="[% uri_base %]/images/splashyfish_right.png"
rel="twipsy" data-placement="left" data-offset="5" title="Hide Sidebar"/>
<h3 class="device_label">[% d.ip %]</h3>
[% IF d.dns %]
<p class="device_label">[% d.dns.remove(settings.domain_suffix) %]</p>
[% END %]
<div class="tab-content">
[% FOREACH tab IN vars.tabs %]
<div id="[% tab.id %]_search" class="tab-pane [% 'active' IF params.tab == tab.id %]">
[% TRY %]
[% INCLUDE "sidebar/device/${tab.id}.tt" %]
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script>
[% CATCH %]
<!-- no "[% tab.id %]" search options -->
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script>
[% END %]
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="[% uri_for('/device') %]">
<input name="tab" value="[% tab.id %]" type="hidden"/>
[% TRY %]
[% INCLUDE "sidebar/device/${tab.id}.tt" %]
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script>
[% CATCH %]
<!-- no "[% tab.id %]" search options -->
<input name="ip" value="[% params.ip %]" type="hidden"/>
<input name="q" value="[% params.q %]" type="hidden"/>
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script>
[% END %]
</form>
</div> <!-- /tab-pane -->
[% END %]
</div> <!-- /tab-content -->

View File

@@ -11,14 +11,13 @@
[% FOREACH tab IN vars.tabs %]
<div id="[% tab.id %]_search" class="tab-pane [% 'active' IF params.tab == tab.id %]">
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="[% uri_for('/search') %]">
<input name="q" value="[% params.q %]" type="hidden"/>
<input name="tab" value="[% tab.id %]" type="hidden"/>
[% TRY %]
[% INCLUDE "sidebar/search/${tab.id}.tt" %]
<button id="[% tab.id %]_submit" type="submit" class="btn info span3">Search Again</button>
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script>
[% CATCH %]
<!-- no "[% tab.id %]" search options -->
<input name="q" value="[% params.q %]" type="hidden"/>
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script>
[% END %]
</form>

View File

@@ -1,6 +0,0 @@
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="[% uri_for('/device') %]">
<input name="tab" value="[% tab.id %]" type="hidden"/>
<input name="ip" value="[% params.ip %]" type="hidden"/>
<input name="q" value="[% params.q %]" type="hidden"/>
</form>

View File

@@ -1,6 +0,0 @@
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="[% uri_for('/device') %]">
<input name="tab" value="[% tab.id %]" type="hidden"/>
<input name="ip" value="[% params.ip %]" type="hidden"/>
<input name="q" value="[% params.q %]" type="hidden"/>
</form>

View File

@@ -1,6 +0,0 @@
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="[% uri_for('/device') %]">
<input name="tab" value="[% tab.id %]" type="hidden"/>
<input name="ip" value="[% params.ip %]" type="hidden"/>
<input name="q" value="[% params.q %]" type="hidden"/>
</form>

View File

@@ -1,10 +1,9 @@
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="[% uri_for('/device') %]">
<input name="tab" value="[% tab.id %]" type="hidden"/>
<p><em>Port Filter Options</em></p>
<input name="ip" value="[% params.ip %]" type="hidden"/>
<div class="clearfix">
<a class="field_clear_icon" href="#"
rel="twipsy" data-placement="left" data-offset="3" title="Show all Ports">
rel="twipsy" data-placement="above" data-offset="3" title="Show all Ports">
<img src="[% uri_base %]/images/tango_sweep.png"/></a>
<input class="nd_port_query span3" placeholder="Port, Name or VLAN"
name="q" value="[% params.q %]" type="text"
@@ -96,10 +95,4 @@
</ul>
</div>
</div>
<div class="nd_search clearfix">
<button id="[% tab.id %]_submit" type="submit" class="btn info">Update View</button>
<a id="[% tab.id %]_bookmark" href="#"
rel="twipsy" data-placement="left" data-offset="5" title="Bookmark these Settings">
<img class="nd_bookmark" src="[% uri_base %]/images/glyphicons_072_bookmark.png"></a>
</div>
</form>
<button id="[% tab.id %]_submit" type="submit" class="btn info span3">Update View</button>

View File

@@ -1,5 +1,6 @@
<p><em>Device Search Options</em></p>
<input name="q" value="[% params.q %]" type="hidden"/>
<div class="clearfix">
<input class="span3" placeholder="System Name"
type="text" name="name" value="[% params.name %]"
@@ -60,3 +61,4 @@
<span class="nd_searchcheckbox uneditable-input">Match All Options</span>
</label>
</div>
<button id="[% tab.id %]_submit" type="submit" class="btn info span3">Search Again</button>

View File

@@ -1,5 +1,6 @@
<p><em>Node Search Options</em></p>
<input name="q" value="[% params.q %]" type="hidden"/>
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="stamps" name="stamps"[% ' checked="checked"' IF params.stamps %]/>
@@ -34,3 +35,4 @@
</label>
</div>
[% END %]
<button id="[% tab.id %]_submit" type="submit" class="btn info span3">Search Again</button>