Permalink
Browse files

mucho updates: icon changes, sortable columns

  • Loading branch information...
1 parent 10d5b7b commit 3cb1b19d3646d7844a57d7df6d9714555672243d @RsrchBoy committed Apr 16, 2010
@@ -7,6 +7,9 @@ BEGIN { extends 'Catalyst::Controller::REST' }
use DBIx::Class::ResultClass::HashRefInflator;
+# debugging...
+#use Smart::Comments '###';
+
##############################################################3
# Helpers
@@ -106,9 +109,9 @@ sub packages_GET {
my ($self, $c) = @_;
# FIXME need search bits here
- my $search = $self->query_to_dbic($c);
-
- my $rs = $c->model('Updates::Packages')->search($search, { order_by => 'me.name' });
+ #my $search = $self->query_to_dbic($c);
+ #my $rs = $c->model('Updates::Packages')->search($search, { order_by => 'me.name' });
+ my $rs = $c->model('Updates::Packages')->search($self->query_to_dbic($c));
my $transform_sub = sub { shift->all_versions };
return $self->handle_partial_request($c, $rs, $transform_sub)
@@ -121,10 +124,49 @@ sub query_to_dbic {
my ($self, $c) = @_;
# FIXME this needs refactoring... ew
+ #my %legal = map { $_ => 1 } qw{ name owner };
+ my %legal = (owner => 'owner_id', name => 'name');
+ my $params = $c->req->parameters;
+
+ ### $params
+
+ my ($search, $attrs) = ({}, { order_by => 'me.name' });
+
+ PARAM_LOOP:
+ for my $param (keys %$params) {
+
+ if ($legal{$param}) {
+
+ # if we're a wildcard search...
+ my $value = $params->{$param};
+ $value =~ s/\*/%/g;
+ $search->{"me.$legal{$param}"} = $value =~ /%/ ? { LIKE => $value } : $value;
+ next PARAM_LOOP;
+ }
+
+ next PARAM_LOOP unless $param =~ /^sort\(/;
+
+ # so, get our sort name and ASC/DESC
+ $param =~ s/^sort\(//;
+ $param =~ s/\)$//;
+
+ my $order = $param =~ /^-/ ? '-desc' : '-asc';
+ warn $param;
+ $param =~ s/^(-| )//;
+ warn $param;
+ next PARAM_LOOP unless $legal{$param};
+ $attrs->{order_by} = { $order => "me.$legal{$param}" };
+ }
+
+ ### $search
+ ### $attrs
+
+ return ($search, $attrs);
+
my $name = $c->req->parameters->{name};
my $owner = $c->req->parameters->{owner};
- my $search = {};
+ my ($search, $atts) = ({}, {});
if ($name =~ /\*/) {
@@ -145,6 +187,8 @@ sub query_to_dbic {
return $search;
}
+
+
__PACKAGE__->meta->make_immutable;
__END__
@@ -49,6 +49,8 @@ sub packages : Path('packages') Args(0) {
return;
}
+sub test : Local { }
+
sub end : ActionClass('RenderView') {}
__PACKAGE__->meta->make_immutable;
@@ -255,11 +255,11 @@ sub update_class {
#return 'attn' if $self->current lt $self->package->upstream_ga;
#return 'check'
- return 'error' if not defined $self->current;
- return 'check' if not defined $self->package->upstream_ga;
+ return 'ss_sprite ss_cross' if not defined $self->current;
+ return 'ss_sprite ss_accept' if not defined $self->package->upstream_ga;
return $self->current lt $self->package->upstream_ga
- ? 'attn'
- : 'check'
+ ? 'ss_sprite ss_error'
+ : 'ss_sprite ss_accept'
;
}
View
@@ -37,6 +37,8 @@
<script language="javascript">
+dojo.require("dojox.data.JsonQueryRestStore");
+
dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojox.grid.enhanced.plugins.DnD");
dojo.require("dojox.grid.enhanced.plugins.Menu");
@@ -68,6 +70,8 @@ function format_cell(dist, value) {
function format_rawhide(value) { format_cell('rawhide', value); }
+function no_sort(index) { return index < 3 }
+
</script>
<!-- begin packages -->
@@ -102,7 +106,7 @@ function format_rawhide(value) { format_cell('rawhide', value); }
<select dojoType="dijit.form.FilteringSelect" id="users_select" name="users_select">
<script type="dojo/method" event="onChange">
- packagesGrid.setQuery(dojo.fromJson(this.value));
+ packagesGrid.setQuery(dojo.fromJson(this.value));
</script>
<option value="{ owner: '*' }" selected >All Owners</option>
[% FOREACH user = users -%]
@@ -115,6 +119,7 @@ function format_rawhide(value) { format_cell('rawhide', value); }
dojoType="dojox.grid.EnhancedGrid"
store="packageStore"
query="{ name: 'perl-*' }"
+ canSort="no_sort"
jsId="packagesGrid"
rowsPerPage="150"
clientSort="true"
@@ -127,14 +132,18 @@ function format_rawhide(value) { format_cell('rawhide', value); }
<tr>
<th field="name" cellType="dojox.grid.cells._Widget" width="20em">Package</th>
<th field="owner" width="8em">Owner</th>
- <th field="upstream_ga" width="8em" >Upstream</th>
+ <th field="upstream_ga" sortable="false" width="8em" >Upstream</th>
[% FOREACH dist = dists -%]
<th field="[% dist %]-html" cellType="dojox.grid.cells._Widget" width="8em">[% dist %]</th>
[% END -%]
<tr>
</thead>
</table>
+<div dojoType="dijit.layout.ContentPane" splitter="true" region="right">
+<p>Hi there!</p>
+</div>
+
</div> [%# bordercontainer %]
<!-- end packages -->
View
@@ -0,0 +1,93 @@
+[%# /* vim: set filetype=tt2html : */ -%]
+[% META title = 'Package Listing' %]
+
+<link rel="stylesheet" type="text/css"
+ href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/Grid.css') %]" />
+<link rel="stylesheet" type="text/css"
+ href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/tundraGrid.css') %]" />
+<link rel="stylesheet" type="text/css"
+ href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/enhanced/resources/tundraEnhancedGrid.css') %]" />
+<link rel="stylesheet" type="text/css"
+ href="[% c.uri_for('/static/js/dojo/1.4/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css') %]" />
+
+<style type="text/css">
+ /*
+ @import "[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/Grid.css') %]";
+ @import "[% c.uri_for('/static/js/dojo/1.4/dojox/grid/resources/tundraGrid.css') %]";
+ @import "/static/js/dojo/1.4/dojox/grid/enhanced/resources/tundraEnhancedGrid.css";
+ @import "/static/js/dojo/1.4/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";
+ */
+
+ #grid1, #grid2, #grid3 {
+ width: 85.2em;
+ height: 50em;
+ }
+
+ /* .dojoxGrid td, .dojoxGrid th {
+ #gridDiv td, #gridDiv th { */
+ #content .dojoxGridCell {
+
+ border-color:transparent #D5CDB5 #D5CDB5 transparent;
+ }
+
+ /* this feels.... wrong. */
+ #content table.dojoxGridRowTable th, #content table.dojoxGridRowTable td { border-width: 0px; }
+</style>
+
+
+<script language="javascript">
+
+dojo.require("dojox.data.JsonQueryRestStore");
+
+dojo.require("dojox.grid.EnhancedGrid");
+dojo.require("dojox.grid.enhanced.plugins.DnD");
+dojo.require("dojox.grid.enhanced.plugins.Menu");
+dojo.require("dojox.grid.enhanced.plugins.NestedSorting");
+dojo.require("dojox.grid.enhanced.plugins.IndirectSelection");
+
+dojo.require("dijit.layout.BorderContainer");
+dojo.require("dijit.layout.ContentPane");
+
+dojo.require("dijit.form.FilteringSelect");
+
+dojo.ready(function() {
+
+ dojo.connect(dojo.byId("side_package_search"), "onchange",
+ function(value) {
+ pkgGrid.setQuery({ name: dijit.byId('side_package_search').value });
+ }
+ );
+
+});
+
+function format_cell(dist, value) {
+ var item = packagesStore.getItem(row.index);
+ if (item) {
+ var upstream = packagesStore.getValue(item, "upstream_ga", null);
+ var rawhide = packagesStore.getValue(item, "rawhide", null);
+ }
+}
+
+function format_rawhide(value) { format_cell('rawhide', value); }
+
+function no_sort(index) { return index < 3 }
+
+dojo.require("dojox.fx");
+dojo.require("dojox.widget.CalendarFx");
+dojo.require("dojox.widget.Calendar");
+dojo.require("dojox.widget.DailyCalendar");
+
+</script>
+
+<div dojoType="dojox.widget.DailyCalendar" id="calLimits" value="2008-12-25" constraints="{min:'2008-12-12',max:'2009-01-15'}">
+ <script type="dojo/connect" event="onValueSelected" args="value">
+ log("Date Value selected: " + value);
+ </script>
+</div>
+
+
+
+<!-- begin packages -->
+
+
+<!-- end packages -->
View
@@ -13,6 +13,10 @@
/* @import url("http://fedoraproject.org/static/css/fedora.css"); */
+div#head h1#page_title {
+ width: 100%;
+}
+
/* snagged from https://admin.fedoraproject.org/pkgdb/static/css/pkgdb.css */
a.bodhi

0 comments on commit 3cb1b19

Please sign in to comment.