Add a search feature
[?]
Feb 22, 2013, 2:45 PM
UICHT2PSN2QOCHP6MGY5QQJUDU4IF6FBIOJLBA55QBJDK6ST566ACDependencies
- [2]
VH5ZABDRAdd a page to show the latest evaluations for the entire server - [3]
SBMOICGVEvil CSS hackery to prevent link targets from being under the navbar - [4]
7ZQAHJQMFix indentation - [5]
OEPUOUNBUsing twitter bootstrap for more consistent looks for Hydra - [6]
QBT7FA7RCompatibility with latest bootstrap - [7]
JZVRK5QJGroup some menu items together under a "Status" menu - [8]
G4X5IUYJRemove default logo, replaced by text for now. Hide template in jobset edit. - [9]
NOSDBMWDRemove comments, re-add logo. - [10]
QL55ECJ6- adapted ui for hydra, more in line with nixos.org website - [11]
HRAFVVOEmake logo configurable via HYDRA_LOGO env var - [*]
J5UVLXOK* Start of a basic Catalyst web interface. - [*]
D5QIOJGP* Move everything up one directory.
Change contents
- edit in src/lib/Hydra/Controller/Root.pm at line 300
}sub search :Local Args(0) {my ($self, $c) = @_;$c->stash->{template} = 'search.tt';my $query = trim $c->request->params->{"query"};error($c, "Query is empty.") if $query eq "";error($c, "Invalid character in query.")unless $query =~ /^[a-zA-Z0-9_\-]+$/;$c->stash->{projects} = [ $c->model('DB::Projects')->search({ -or => [ name => { ilike => "%$query%" }, displayName => { ilike => "%$query%" }, description => { ilike => "%$query%" } ] },{ order_by => ["name"] } ) ];$c->stash->{jobsets} = [ $c->model('DB::Jobsets')->search({ -or => [ name => { ilike => "%$query%" }, description => { ilike => "%$query%" } ] },{ order_by => ["project", "name"] } ) ];$c->stash->{jobs} = [ $c->model('DB::Jobs')->search({ name => { ilike => "%$query%" } },{ order_by => ["project", "jobset", "name"] } ) ]; - replacement in src/root/layout.tt at line 88
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse"> - replacement in src/root/layout.tt at line 100
<div class="nav-collapse collapse"><div class="nav-collapse collapse navbar-responsive-collapse"> - file addition: search.tt[14.1486]
[% WRAPPER layout.tt title="Search results" %][% PROCESS common.tt %][% IF projects.size > 0; matched = 1 %]<p>The following projects match your query:</p><table class="table table-striped table-condensed"><thead><tr><th>Project</th><th>Description</th></tr></thead><tbody>[% FOREACH p IN projects %]<tr><td>[% INCLUDE renderProjectName project=p.name %]</td><td>[% HTML.escape(p.description) %]</td></tr>[% END %]</tbody></table>[% END %][% IF jobsets.size > 0; matched = 1 %]<p>The following jobsets match your query:</p><table class="table table-striped table-condensed"><thead><tr><th>Jobset</th><th>Description</th></tr></thead><tbody>[% FOREACH j IN jobsets %]<tr><td>[% INCLUDE renderFullJobsetName project=j.get_column('project') jobset=j.name %]</td><td>[% HTML.escape(j.description) %]</td></tr>[% END %]</tbody></table>[% END %][% IF jobs.size > 0; matched = 1 %]<p>The following jobs match your query:</p><table class="table table-striped table-condensed"><thead><tr><th>Job</th></tr></thead><tbody>[% FOREACH j IN jobs %]<tr><td>[% INCLUDE renderFullJobName project=j.get_column('project') jobset=j.get_column('jobset') job=j.name %]</td></tr>[% END %]</tbody></table>[% END %][% IF !matched %]<div class="alert alert-warn">Sorry! Nothing matches yourquery.</div>[% END %][% END %] - replacement in src/root/topbar.tt at line 27
<ul class="nav" id="top-menu"><ul class="nav pull-left" id="top-menu"> - edit in src/root/topbar.tt at line 186
</ul> - replacement in src/root/topbar.tt at line 189
[% IF c.user_exists %][% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('logout')) title = "Sign out" %][% ELSE %][% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('login')) title = "Sign in" %][% END %]<div class="pull-right"> - replacement in src/root/topbar.tt at line 191
</ul>[3.15885]<form class="navbar-search" action="[% c.uri_for('/search') %]"><input name="query" type="text" class="search-query span2" placeholder="Search"></input></form><ul class="nav" id="top-menu">[% IF c.user_exists %][% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('logout')) title = "Sign out" %][% ELSE %][% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('login')) title = "Sign in" %][% END %]</ul></div>