From: Stevan Little Date: Wed, 31 Mar 2010 20:07:31 +0000 (-0400) Subject: adding style sheets and using Resource::Pack X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3cb66fff740a050e82f24184189dbc6b78110de1;p=gitmo%2Fmoose-website.git adding style sheets and using Resource::Pack --- diff --git a/lib/Moose/Website.pm b/lib/Moose/Website.pm index c5dc12d..00722b7 100644 --- a/lib/Moose/Website.pm +++ b/lib/Moose/Website.pm @@ -5,7 +5,10 @@ use MooseX::Types::Path::Class; use Path::Class; use Template; use YAML::XS 'LoadFile'; + use Moose::Website::I18N; +use Moose::Website::Resource::Templates; +use Moose::Website::Resource::WebFiles; our $VERSION = '0.01'; our $AUTHORITY = 'cpan:STEVAN'; @@ -19,6 +22,12 @@ has 'outdir' => ( required => 1, ); +has 'locale' => ( + is => 'ro', + isa => 'Str', + default => sub { 'en' }, +); + has 'page_file' => ( is => 'ro', isa => 'Path::Class::File', @@ -28,24 +37,33 @@ has 'page_file' => ( } ); -has 'template_root' => ( - is => 'ro', - isa => 'Path::Class::Dir', - coerce => 1, - default => sub { - file(__FILE__)->parent->parent->parent->subdir('templates') +# .... + +has 'template_resource' => ( + traits => [ 'NoGetopt' ], + is => 'ro', + isa => 'Moose::Website::Resource::Templates', + lazy => 1, + default => sub { + Moose::Website::Resource::Templates->new + }, + handles => { + 'template_root' => 'dir' } ); -has 'locale' => ( +has 'web_file_resource' => ( + traits => [ 'NoGetopt' ], is => 'ro', - isa => 'Str', - default => sub { 'en' }, + isa => 'Moose::Website::Resource::WebFiles', + lazy => 1, + default => sub { + Moose::Website::Resource::WebFiles->new + }, ); -# .... - has 'i18n' => ( + traits => [ 'NoGetopt' ], is => 'ro', isa => 'Object', lazy => 1, @@ -105,6 +123,9 @@ sub run { $outfile ) || confess $self->tt->error; } + + $self->log( "Copying web resources to " . $self->outdir ); + $self->web_file_resource->copy( to => $self->outdir ); } sub build_template_params { diff --git a/lib/Moose/Website/I18N/po/en.po b/lib/Moose/Website/I18N/po/en.po index c6d2d3b..4445302 100644 --- a/lib/Moose/Website/I18N/po/en.po +++ b/lib/Moose/Website/I18N/po/en.po @@ -4,9 +4,6 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -msgid "global page title" -msgstr "Moose - A Post Modern Object System for Perl" - msgid "moose" msgstr "Moose" @@ -123,9 +120,13 @@ msgstr "Several companies and individuals provide Moose consulting, here are a f msgid "presentations header" msgstr "Presentations About Moose" +# footer +msgid "footer copyright" +msgstr "Copyright © 2006 — 2010 Infinity Interactive" - +msgid "footer terms" +msgstr "This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself." diff --git a/lib/Moose/Website/Resource/Templates.pm b/lib/Moose/Website/Resource/Templates.pm new file mode 100644 index 0000000..ba8dfa2 --- /dev/null +++ b/lib/Moose/Website/Resource/Templates.pm @@ -0,0 +1,58 @@ +package Moose::Website::Resource::Templates; +use Moose; + +our $VERSION = '0.01'; +our $AUTHORITY = 'cpan:STEVAN'; + +with 'Resource::Pack' => { + traits => [ + 'Resource::Pack::Dir' + ] +}; + +__PACKAGE__->meta->make_immutable; + +no Moose; 1; + +__END__ + +=pod + +=head1 NAME + +Moose::Website::Resource::Templates - A Moosey solution to this problem + +=head1 SYNOPSIS + + use Moose::Website::Resource::Templates; + +=head1 DESCRIPTION + +=head1 METHODS + +=over 4 + +=item B<> + +=back + +=head1 BUGS + +All complex software has bugs lurking in it, and this module is no +exception. If you find a bug please either email me, or add the bug +to cpan-RT. + +=head1 AUTHOR + +Stevan Little Estevan.little@iinteractive.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2010 Infinity Interactive, Inc. + +L + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/templates/about.tt b/lib/Moose/Website/Resource/Templates/about.tt similarity index 100% rename from templates/about.tt rename to lib/Moose/Website/Resource/Templates/about.tt diff --git a/templates/articles.tt b/lib/Moose/Website/Resource/Templates/articles.tt similarity index 100% rename from templates/articles.tt rename to lib/Moose/Website/Resource/Templates/articles.tt diff --git a/templates/download.tt b/lib/Moose/Website/Resource/Templates/download.tt similarity index 74% rename from templates/download.tt rename to lib/Moose/Website/Resource/Templates/download.tt index 83235b5..aa7066f 100644 --- a/templates/download.tt +++ b/lib/Moose/Website/Resource/Templates/download.tt @@ -2,9 +2,9 @@

[% loc('download header') %]

-

[% loc('download cpan header') %]

+

[% loc('download cpan header') %]

-

[% loc('downlaod cpan body') %]

+

[% loc('download cpan body') %]

    [% FOREACH module IN current_page.data.CPAN %] @@ -12,9 +12,9 @@ [% END %]
-

[% loc('download git header') %]

+

[% loc('download git header') %]

-

[% loc('downlaod git body') %]

+

[% loc('download git body') %]

  • [% loc('download git public') %] — [% current_page.data.git.public %]
  • diff --git a/lib/Moose/Website/Resource/Templates/index.tt b/lib/Moose/Website/Resource/Templates/index.tt new file mode 100644 index 0000000..b0ba550 --- /dev/null +++ b/lib/Moose/Website/Resource/Templates/index.tt @@ -0,0 +1,13 @@ +[% WRAPPER 'wrapper/root.tt' %] +

    [% loc('moose') %]

    +

    [% loc('moose subtitle') %]

    + [% INCLUDE 'shared/nav.tt' %] +
    +

    [% loc('about body') %]

    +
    +
    +
    + +[% END %] \ No newline at end of file diff --git a/templates/presentations.tt b/lib/Moose/Website/Resource/Templates/presentations.tt similarity index 100% rename from templates/presentations.tt rename to lib/Moose/Website/Resource/Templates/presentations.tt diff --git a/lib/Moose/Website/Resource/Templates/shared/footer.tt b/lib/Moose/Website/Resource/Templates/shared/footer.tt new file mode 100644 index 0000000..3da5c17 --- /dev/null +++ b/lib/Moose/Website/Resource/Templates/shared/footer.tt @@ -0,0 +1,2 @@ +

    [% loc('footer copyright') %]

    +

    [% loc('footer terms') %]

    \ No newline at end of file diff --git a/lib/Moose/Website/Resource/Templates/shared/nav.tt b/lib/Moose/Website/Resource/Templates/shared/nav.tt new file mode 100644 index 0000000..b3bc11a --- /dev/null +++ b/lib/Moose/Website/Resource/Templates/shared/nav.tt @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/templates/support.tt b/lib/Moose/Website/Resource/Templates/support.tt similarity index 100% rename from templates/support.tt rename to lib/Moose/Website/Resource/Templates/support.tt diff --git a/lib/Moose/Website/Resource/Templates/wrapper/root.tt b/lib/Moose/Website/Resource/Templates/wrapper/root.tt new file mode 100644 index 0000000..6b9c280 --- /dev/null +++ b/lib/Moose/Website/Resource/Templates/wrapper/root.tt @@ -0,0 +1,9 @@ + + +[% loc('moose') %] - [% loc('moose subtitle') %] + + + +[% content %] + + \ No newline at end of file diff --git a/lib/Moose/Website/Resource/Templates/wrapper/sub_page.tt b/lib/Moose/Website/Resource/Templates/wrapper/sub_page.tt new file mode 100644 index 0000000..339c337 --- /dev/null +++ b/lib/Moose/Website/Resource/Templates/wrapper/sub_page.tt @@ -0,0 +1,10 @@ +[% WRAPPER 'wrapper/root.tt' %] +

    [% loc('moose') %]

    + [% INCLUDE 'shared/nav.tt' %] +
    + [% content %] +
    + +[% END %] \ No newline at end of file diff --git a/lib/Moose/Website/Resource/WebFiles.pm b/lib/Moose/Website/Resource/WebFiles.pm new file mode 100644 index 0000000..ce7e6fb --- /dev/null +++ b/lib/Moose/Website/Resource/WebFiles.pm @@ -0,0 +1,58 @@ +package Moose::Website::Resource::WebFiles; +use Moose; + +our $VERSION = '0.01'; +our $AUTHORITY = 'cpan:STEVAN'; + +with 'Resource::Pack' => { + traits => [ + 'Resource::Pack::Dir' + ] +}; + +__PACKAGE__->meta->make_immutable; + +no Moose; 1; + +__END__ + +=pod + +=head1 NAME + +Moose::Website::Resource::WebFiles - A Moosey solution to this problem + +=head1 SYNOPSIS + + use Moose::Website::Resource::WebFiles; + +=head1 DESCRIPTION + +=head1 METHODS + +=over 4 + +=item B<> + +=back + +=head1 BUGS + +All complex software has bugs lurking in it, and this module is no +exception. If you find a bug please either email me, or add the bug +to cpan-RT. + +=head1 AUTHOR + +Stevan Little Estevan.little@iinteractive.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2010 Infinity Interactive, Inc. + +L + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Moose/Website/Resource/WebFiles/css/style.css b/lib/Moose/Website/Resource/WebFiles/css/style.css new file mode 100644 index 0000000..0f5133e --- /dev/null +++ b/lib/Moose/Website/Resource/WebFiles/css/style.css @@ -0,0 +1,130 @@ + +BODY { + font-family : Ariel, Helvetica, sans-serif; + font-size : 10pt; + margin : 0px; + color : #666666; +} + +h1 { + font-family : Arial Black; + font-size : 48pt; + margin : 0px; + line-height : 0.7em; + background : #336699; + color : #ffffff; + padding-left : 70px; + padding-top : 15px; +} + +h1.home { + font-size : 72pt; + padding-top : 70px; +} + +h2 { + font-size : 14pt; + margin : 0px; + line-height : 1em; + color : #336699; + padding-left : 75px; + padding-top : 25px; + padding-bottom : 20px; + background : #ffffff; + font-style : oblique; +} + +.nav { + border-bottom : 1px solid #6699CC; + border-top : 10px solid #6699CC; +} + +ul.menu { + padding-left : 70px; + margin-top : 0px; +} + +ul.menu > li { + list-style-type : none; + float : left; + padding-left : 12px; + padding-right : 12px; + padding-top : 10px; + padding-bottom : 10px; + font-size : 1.2em; +} + +ul.menu > li.active { + color : #003366; + background : #6699CC; +} + +ul.menu > li.inactive { + color : #336699; +} + +ul.menu > li a { + color : #336699; + text-decoration : none; +} + +ul.menu > li a:hover { + color : #003366; + text-decoration : underline; +} + +.content { + position : relative; + left : 75px; + padding-top : 20px; + width : 500px; +} + +.content h2 { + font-size : 16pt; + line-height : 1em; + color : #336699; + padding : 0px; + margin-bottom : 10px; + background : #ffffff; +} + +.content h3 { + font-size : 12pt; + margin : 0px; + color : #336699; + line-height : 1em; +} + +.home_content { + position : relative; + left : 75px; + padding-top : 10px; + width : 500px; + font-size : 1.2em; +} + +.home_footer { + position : relative; + left : 75px; + color : #aaaaaa; + font-size : 0.8em; + width : 500px; + border-top : 1px solid #aaaaaa; + padding-bottom : 40px; +} + +.footer { + margin-top : 20px; + border-top : 1px solid #aaaaaa; + padding-left : 75px; + color : #aaaaaa; + font-size : 0.8em; + padding-bottom : 40px; +} + +.clearfix { + clear: both; +} + + diff --git a/templates/index.tt b/templates/index.tt deleted file mode 100644 index 43b68b3..0000000 --- a/templates/index.tt +++ /dev/null @@ -1,7 +0,0 @@ -[% WRAPPER 'wrapper/root.tt' %] - -

    [% loc('moose') %]

    -

    [% loc('moose subtitle') %]

    - [% INCLUDE 'shared/nav.tt' %] - -[% END %] \ No newline at end of file diff --git a/templates/shared/nav.tt b/templates/shared/nav.tt deleted file mode 100644 index 13a8cbd..0000000 --- a/templates/shared/nav.tt +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/templates/wrapper/root.tt b/templates/wrapper/root.tt deleted file mode 100644 index 0ad1bf4..0000000 --- a/templates/wrapper/root.tt +++ /dev/null @@ -1,8 +0,0 @@ - - -[% loc('global page title') %] - - -[% content %] - - \ No newline at end of file diff --git a/templates/wrapper/sub_page.tt b/templates/wrapper/sub_page.tt deleted file mode 100644 index 1b76281..0000000 --- a/templates/wrapper/sub_page.tt +++ /dev/null @@ -1,4 +0,0 @@ -[% WRAPPER 'wrapper/root.tt' %] -[% INCLUDE 'shared/nav.tt' %] -[% content %] -[% END %] \ No newline at end of file