Skip to content

Commit

Permalink
changed the layout a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
beppu committed Apr 10, 2011
1 parent 42e53c0 commit dd1c0f6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
32 changes: 26 additions & 6 deletions lib/Rhetoric.pm
Expand Up @@ -42,9 +42,25 @@ sub service {
$v->{menu} = $s->menu;
$v->{request_path} = $c->env->{REQUEST_PATH};
$v->{time_format} = $CONFIG{time_format};
if (exists $CONFIG{relocated}) {
for (@{ $v->menu }) {
$_->url($CONFIG{relocated} . $_->url);
}
}
$class->next::method($c, @args);
}

sub init {
my ($class) = @_;
# TODO - Make absolutely sure the Page controller is at $C[-1].
if ($Rhetoric::Controllers::C[-1]->name ne 'Page') {
# find index of Page controller
# splice it out
# push it back on to the end
}
$class->next::method();
}

memoize('storage');
# Return an object that handles the storage for blog data based on
# what $CONFIG{storage} dictates.
Expand All @@ -53,11 +69,7 @@ sub storage {
my $impl = shift || $Rhetoric::CONFIG{'storage'};
my $path = "Rhetoric/Storage/$impl.pm";
my $package = "Rhetoric::Storage::$impl";
try {
require($path);
} catch {
warn "$package could not be loaded: $_";
};
require($path); # let it die if it fails.
return ${"${package}::storage"};
}

Expand Down Expand Up @@ -154,7 +166,15 @@ our @C = (
}
),

C(
Theme => [ '/theme' ],
get => method {
return $self->env->{HTTP_HOST} . " => $CONFIG{theme}\n";
}
),

# Everything else that's not static is a page to be rendered through the view.
# This controller has to be last!
C(
Page => [ '/(.*)' ],
get => method($path) {
Expand All @@ -176,7 +196,7 @@ use Template;
use Data::Dump 'pp';

our $tt = Template->new({
INCLUDE_PATH => './share/theme/BrownStone',
INCLUDE_PATH => [ '.', './share/theme/BrownStone' ],
POST_CHOMP => 1,
});

Expand Down
2 changes: 0 additions & 2 deletions share/theme/BrownStone/about.html
@@ -1,8 +1,6 @@

<div id="content">
<h1>About</h1>
<p>
This is where you can tell the world about yourself.
</p>
</div>

3 changes: 0 additions & 3 deletions share/theme/BrownStone/index.html
@@ -1,4 +1,3 @@
<div id="content">
[% FOREACH post = posts %]
<div class="post">
<h2 class="title"><a href="[% R('Post', post.year, post.month, post.slug) %]">[% post.title %]</a></h2>
Expand All @@ -10,5 +9,3 @@ <h2 class="title"><a href="[% R('Post', post.year, post.month, post.slug) %]">[%
</div>
</div>
[% END %]
<div style="clear: both;">&nbsp;</div>
</div>
5 changes: 4 additions & 1 deletion share/theme/BrownStone/layout.html
Expand Up @@ -24,7 +24,10 @@
<div id="page-bgtop">
<div id="page-bgbtm">

[% content %]
<div id="content">
[% content %]
<div style="clear: both;">&nbsp;</div>
</div>

<div id="sidebar">
<div id="logo">
Expand Down
2 changes: 0 additions & 2 deletions share/theme/BrownStone/links.html
@@ -1,8 +1,6 @@

<div id="content">
<h1>Links</h1>
<ul>
<li><a href="http://towr.of.bavl.org">towr.of.bavl.org</a></li>
</ul>
</div>

2 changes: 0 additions & 2 deletions share/theme/BrownStone/post.html
@@ -1,4 +1,3 @@
<div id="content">
<div class="post">
<h2 class="title"><a href="[% R('Post', post.year, post.month, post.slug) %]">[% post.title %]</a></h2>
<p class="meta"><span class="date">[% post.posted_on.strftime(time_format) %]</span><span class="posted">Posted by <a href="#">[% post.author || "beppu" %]</a></span></p>
Expand Down Expand Up @@ -43,4 +42,3 @@ <h3>Comment</h3>
</div>
</form>
</div>
</div>

0 comments on commit dd1c0f6

Please sign in to comment.