-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brian Duggan
committed
May 27, 2015
1 parent
f93d1a3
commit 4f1871f
Showing
9 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
=head1 NAME | ||
Tuba::RoleType : Controller class for roles. | ||
=cut | ||
|
||
package Tuba::RoleType; | ||
use Mojo::Base qw/Tuba::Controller/; | ||
use Tuba::DB::Objects qw/-nicknames/; | ||
|
||
sub _default_list_order { | ||
return "identifier"; | ||
} | ||
|
||
=head1 show | ||
Show metadata about a role. | ||
=cut | ||
|
||
sub show { | ||
my $c = shift; | ||
my $identifier = $c->stash('role_type_identifier'); | ||
my $meta = RoleType->meta; | ||
my $object = RoleType->new( identifier => $identifier ) | ||
->load( speculative => 1 ) or return $c->reply->not_found; | ||
$c->stash(object => $object); | ||
$c->stash(meta => $meta); | ||
my $stats = $c->dbs->query(<<SQL,$identifier)->hashes->[0]; | ||
select | ||
count(nullif(person_id is null,true)) as people, | ||
count(nullif(person_id is null,false)) as orgs | ||
from contributor | ||
where role_type_identifier = ? | ||
SQL | ||
$c->stash(stats => $stats); | ||
$c->SUPER::show(@_); | ||
} | ||
|
||
|
||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
% layout 'default', title => "Role ".$role_type->label; | ||
|
||
<center> | ||
<h2><%= $role_type->label %></h2> | ||
</center> | ||
|
||
% if (user_can('update')) { | ||
%= include 'history_modal'; | ||
|
||
<span style='float:right;'> | ||
<%= link_to obj_uri_for($object,'update_form') => class => "btn" => begin %>edit<%= end %> | ||
<a href="#myModal" role="button" class="btn" data-toggle="modal">history</a> | ||
</span> | ||
% } | ||
|
||
<div class='row-fluid'> | ||
<div class='well span6 offset3'> | ||
<center><b>role identifier: <%= $role_type->identifier %></b></center> | ||
Organizations: | ||
<%= link_to url_for('list_organization')->query(role => $role_type_identifier) => begin %> | ||
<%= $stats->{orgs} %><br> | ||
<%= end %> | ||
People: | ||
<%= link_to url_for('list_person')->query(role => $role_type_identifier) => begin %> | ||
<%= $stats->{people} %><br> | ||
<%= end %> | ||
</div> | ||
</div> | ||
|
||
<%= include 'h/other_formats'; =%> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
% layout 'default'; | ||
|
||
<center> | ||
<h2> | ||
Role Types | ||
</h2> | ||
</center> | ||
|
||
%= include 'list_formats'; | ||
|
||
% if (my $page = stash 'page') { | ||
%= include 'pager', page => $page; | ||
% } | ||
<table class='table table-condensed table-bordered table-striped'> | ||
<caption> | ||
</caption> | ||
<tr> | ||
<th>Identifier</th> | ||
<th>Label</th> | ||
</th> | ||
</tr> | ||
% for my $o (@$objects) { | ||
<tr> | ||
<td> | ||
%= link_to $o->uri($self) => begin | ||
<%= $o->identifier %> | ||
%= end | ||
</td> | ||
<td><%= $o->label %></td> | ||
</tr> | ||
% } | ||
</table> | ||
% if (my $page = stash 'page') { | ||
%= include 'pager', page => $page, bottom => 1; | ||
% } | ||
|