Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added a bunch of basic functionality plus an initial design -- to be …

…redone :)
  • Loading branch information...
commit 3ba7f80af53fbd02cdb36231ec914b198639f75b 1 parent 9307130
@bricas authored
View
4 Makefile.PL
@@ -20,6 +20,10 @@ requires 'Net::OpenID::Consumer';
requires 'LWPx::ParanoidAgent';
requires 'Rose::HTML::Form';
+# for twitter feed
+requires 'XML::RSS';
+requires 'LWP::Simple';
+
catalyst;
install_script glob('script/*.pl');
View
1  lib/CPANHQ.pm
@@ -16,6 +16,7 @@ use Catalyst qw(
Static::Simple
);
+require LWP::Debug; # to satisfy LWPx::ParanoidAgent
our $VERSION = '0.01';
__PACKAGE__->config(
View
27 lib/CPANHQ/Controller/Root.pm
@@ -4,6 +4,8 @@ use strict;
use warnings;
use parent 'Catalyst::Controller';
+use XML::RSS;
+use LWP::Simple qw(get);
__PACKAGE__->config->{namespace} = '';
@@ -19,19 +21,36 @@ CPANHQ::Controller::Root - Root Controller for CPANHQ
=cut
+=head2 auto
+
+=cut
+
+sub auto : Private {
+ my( $self, $c ) = @_;
+ my $rss = XML::RSS->new;
+ $rss->parse( get( 'http://twitter.com/statuses/user_timeline/36758099.rss' ) );
+ $c->stash( tweets => $rss );
+ return 1;
+}
+
=head2 index
=cut
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
-
- # Hello World
- $c->response->body( $c->welcome_message );
+ return;
}
sub default :Path {
- my ( $self, $c ) = @_;
+ my ( $self, $c, @args ) = @_;
+
+ $args[ -1 ] .= '.tt';
+ if( -e $c->path_to( 'root', @args ) ) {
+ $c->stash( template => join( '/', @args ) );
+ return;
+ }
+
$c->response->body( 'Page not found' );
$c->response->status(404);
View
3  root/about.tt
@@ -0,0 +1,3 @@
+[% title = 'About' %]
+<h2>About CPANHQ</h2>
+<p><em>To be written...</em></p>
View
1  root/authenticate/login.tt
@@ -1 +1,2 @@
+<h2>Login via OpenID</h2>
[% form.render %]
View
2  root/author/show.tt
@@ -2,6 +2,6 @@
[% releases = author.releases_rs %]
<ul>
[% WHILE( release = releases.next ) %]
-<li><a href="[% c.uri_for( '/dist', release.distribution.name, release.version ) %]">[% release.name %]</a></li>
+<li><a href="[% c.uri_for( '/dist', release.distribution.name, release.version ) %]">[% release.name %]</a> on [% release.release_date.ymd %]</li>
[% END %]
</ul>
View
4 root/index.tt
@@ -0,0 +1,4 @@
+<h2>Introducing CPANHQ.</h2>
+<p>What is CPANHQ? In a nutshell, a community-driven, metadata-enhanced, search.cpan.org replacement.</p>
+<p><strong>The project is still in the early stages of development.</strong> Check out the <a href="[% c.uri_for( '/status' ) %]">status page</a> to see what we have done thus far.</p>
+<p>Still curious? <a href="[% c.uri_for( '/about' ) %]">Find out more...</a></p>
View
154 root/static/css/cpanhq.css
@@ -0,0 +1,154 @@
+body {
+ margin: 0;
+ padding: 0;
+ background: #f1e6b9 url(../images/bg-rep.png);
+ font-family: Helvetica,Arial,sans-serif;
+ font-size: medium;
+ color: #111;
+}
+
+#wrapper {
+ width: 1000px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+#header {
+ margin-top: 1em;
+ margin-bottom: 1em;
+ height: 90px;
+ padding-left: 334px;
+ background: url(../images/logo.png) no-repeat center left;
+ position: relative;
+}
+
+#header .login {
+ position: absolute;
+ top: -1.5em;
+ right: 0;
+ font-size: small;
+}
+
+#footer {
+ clear: both;
+}
+
+#content {
+ background: #fcf3ca;
+ border: 1px solid #cb9b71;
+ width: 675px;
+ float: left;
+ margin-right: 20px;
+ margin-bottom: 1em;
+ padding: 15px;
+}
+
+#sidebar {
+ float: left;
+ width: 273px;
+}
+
+#topmenu, #botmenu {
+ margin-left: 0;
+ padding-left: 0;
+ list-style-type: none;
+}
+
+#topmenu {
+ width: 500px;
+ float: right;
+ padding: 3px;
+ margin-top: 10px;
+}
+
+#topmenu a {
+ padding: 3px;
+ color: #444;
+ text-decoration: none;
+ font-size: x-large;
+ font-weight: bold;
+ border-bottom: 0;
+}
+
+#topmenu li {
+ float: left;
+ width: 100px;
+ text-align: right;
+}
+
+#botmenu li {
+ font-size: small;
+ display: inline;
+}
+
+#botmenu a {
+ border-bottom: 0;
+ padding: 3px 0;
+ color: #444;
+ text-decoration: none;
+}
+
+#sidebar h2 {
+ color: #f5f5f5;
+ background: #444;
+ padding: 3px 3px 3px 7px;
+ margin-top: 0;
+}
+
+#tweets {
+ margin: 0;
+ background: #ece3ba;
+ border: 1px solid #bb8b61;
+ list-style-type: none;
+ margin-left: 0;
+ padding-left: 0;
+}
+
+#tweets li {
+ font-style: italic;
+ margin: 5px 7px;
+ padding: 0;
+}
+
+#tweets .link {
+ font-size: small;
+}
+
+#tweets .link a {
+ color: #93a092;
+}
+
+a:link {
+ color: #738072;
+ border-bottom: 1px dotted #ccc;
+ text-decoration: none;
+}
+
+a:visited {
+ color: #536052;
+}
+
+h1 {
+ display: none;
+}
+
+h2 {
+ font-size: x-large;
+}
+
+#content h2 {
+ margin: 0 0 15px 0;
+}
+
+#botmenu li {
+ border-left: 1px solid #000;
+ margin-left: 10px;
+ padding-left: 14px;
+}
+
+#botmenu li.first {
+ border-left: 0;
+ margin-left: 0;
+ padding-left: 0;
+}
+
View
BIN  root/static/images/bg-rep.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  root/static/images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 root/status.tt
@@ -0,0 +1,8 @@
+[% title = 'Status' %]
+<h2>CPANHQ Status</h2>
+<ul>
+<li><a href="http://github.com/bricas/cpanhq/blob/36783b5bd8b56b0cc9b6b023ac7270cf2199f0cb/tmp/index.pl">Basic indexing</a> is complete</li>
+<li>View a list of <a href="[% c.uri_for( '/recent' ) %]">recent uploads</a></li>
+<li><a href="[% c.uri_for( '/author/BRICAS' ) %]">Author page</a> started</li>
+<li><a href="[% c.uri_for( '/dist/Image-TextMode' ) %]">Distribution page</a> started</li>
+<li><a href="[% c.uri_for( '/dist/Image-TextMode/0.05' ) %]">Specific version of a release</a> is also available</li>
View
39 root/wrapper.tt
@@ -3,8 +3,47 @@
<head>
<meta charset=utf-8>
<title>CPANHQ[% IF title; " - $title"; END %]</title>
+<link type="text/css" rel=stylesheet href="[% c.uri_for( '/static/css/cpanhq.css' ) %]">
</head>
<body>
+<div id=wrapper>
+ <div id=header>
+<h1>CPANHQ</h1>
+<ul id=topmenu>
+ <li><a href="[% c.uri_for('/') %]">Home</a></li>
+ <li><a href="[% c.uri_for('/about') %]">About</a></li>
+ <li><a href="http://github.com/bricas/cpanhq/">Code</a></li>
+ <li><a href="[% c.uri_for('/status') %]">Status</a></li>
+ <li><a href="http://github.com/bricas/cpanhq/issues">Issues</a></li>
+</ul>
+<p class="login">
+[% IF c.user_exists %]
+Logged in as [% c.user.display_name %] (<a href="[% c.uri_for('/logout') %]">Logout</a>)
+[% ELSE %]
+Not logged in (<a href="[% c.uri_for('/login') %]">Login</a>)
+[% END %]
+</p>
+ </div>
+ <div id=content>
[% content %]
+ </div>
+ <div id=sidebar>
+<h2>CPANHQ Updates</h2>
+<ul id=tweets>
+[% FOREACH tweet IN tweets.items %]
+ <li>[% tweet.description.remove( '^cpanhq: ' ) %] <span class="link">(<a href="[% tweet.link %]">link</a>)</span></li>
+[% END %]
+</ul>
+<p style="text-align: right;">Follow us on <a href="http://twitter.com/cpanhq">Twitter</a>.</p>
+ </div>
+ <div id=footer>
+<ul id=botmenu>
+ <li class=first><a href="[% c.uri_for('/about') %]">About CPANHQ</a></li>
+ <li>Licensed under the same terms as Perl itself</li>
+</ul>
+
+ </div>
+</div>
+
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.