view release on metacpan or search on metacpan
Added wordpress widget style example
0.03 21/02/2013
Added some details in POD SYNOPSIS
Added new get_day method to Model::Calendar
Added test for new method
Added examples
0.02 20/01/2013
Fixed schoolboy error in working out weeks/rows
Added methods for last day in calendar and day as DateTime
0.01 18/01/2013
First version, released on an unsuspecting world.
lib/Calendar/Model.pm
lib/Calendar/Model/Day.pm
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/01-build.t
t/manifest.t
t/pod-coverage.t
t/pod.t
examples/calendar.pl
examples/templates/calendar.tt
examples/templates/includes/footer.tt
examples/templates/includes/header.tt
examples/templates/sidebar_calendar.tt
examples/calendar2.pl
examples/js/bootstrap.js
examples/js/bootstrap.min.js
examples/css/bootstrap.css
examples/css/bootstrap.min.css
examples/css/bootstrap-responsive.css
examples/css/bootstrap-responsive.min.css
examples/css/calendar.css
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
"I18N::Langinfo" : "0",
"Moose" : "2",
"MooseX::Role::Pluggable" : "0.02",
"perl" : "5.006"
}
}
},
"release_status" : "stable",
"resources" : {
"repository" : {
"url" : "https://github.com/hashbangperl/perl-calendar-model"
}
},
"version" : "0.04"
}
- inc
requires:
Calendar::List: 0.26
Date::Holidays: 0.15
DateTime: 0
I18N::Langinfo: 0
Moose: 2
MooseX::Role::Pluggable: 0.02
perl: 5.006
resources:
repository: https://github.com/hashbangperl/perl-calendar-model
version: 0.04
Makefile.PL view on Meta::CPAN
Moose => 2,
'MooseX::Role::Pluggable' => 0.02,
'Calendar::List' => 0.26,
'Date::Holidays' => 0.15,
'I18N::Langinfo' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Calendar-Model-*' },
META_MERGE => {
resources => {
repository => 'https://github.com/hashbangperl/perl-calendar-model',
},
},
($ExtUtils::MakeMaker::VERSION >= 6.3002 ? ('LICENSE' => 'perl', ) : ()),
);
examples/calendar.pl view on Meta::CPAN
'2012-12-19' => 'Anniversary of Penlee Lifeboat Disaster',
};
my $holidays = {
'2012-12-25' => 'Christmas Day',
'2012-12-26' => 'Boxing Day',
};
my $template = Template->new({ INCLUDE_PATH => 'templates', POST_CHOMP=> 1,});
# process fullpage template, with events
$template->process('calendar.tt', {cal => $cal, events => $events, holidays => $holidays })
|| die $template->error();
examples/calendar2.pl view on Meta::CPAN
use Calendar::Model;
my $cal = Calendar::Model->new(selected_date=>DateTime->new(day=>5, month=>12, year=>2012));
my $events = {
'2012-12-16' => 'Mousehole Lights',
'2012-12-19' => 'Anniversary of Penlee Lifeboat Disaster',
};
# process sidebar template
my $template->process('sidebar_calendar.tt', {cal => $cal, events => $events })
|| die $template->error();
examples/css/bootstrap.css view on Meta::CPAN
}
.icon-eye-close {
background-position: -120px -120px;
}
.icon-warning-sign {
background-position: -144px -120px;
}
.icon-plane {
background-position: -168px -120px;
}
.icon-calendar {
background-position: -192px -120px;
}
.icon-random {
background-position: -216px -120px;
}
.icon-comment {
background-position: -240px -120px;
}
.icon-magnet {
background-position: -264px -120px;
examples/css/bootstrap.min.css view on Meta::CPAN
.icon-minus{background-position:-433px -96px;}
.icon-asterisk{background-position:-456px -96px;}
.icon-exclamation-sign{background-position:0 -120px;}
.icon-gift{background-position:-24px -120px;}
.icon-leaf{background-position:-48px -120px;}
.icon-fire{background-position:-72px -120px;}
.icon-eye-open{background-position:-96px -120px;}
.icon-eye-close{background-position:-120px -120px;}
.icon-warning-sign{background-position:-144px -120px;}
.icon-plane{background-position:-168px -120px;}
.icon-calendar{background-position:-192px -120px;}
.icon-random{background-position:-216px -120px;}
.icon-comment{background-position:-240px -120px;}
.icon-magnet{background-position:-264px -120px;}
.icon-chevron-up{background-position:-288px -120px;}
.icon-chevron-down{background-position:-313px -119px;}
.icon-retweet{background-position:-336px -120px;}
.icon-shopping-cart{background-position:-360px -120px;}
.icon-folder-close{background-position:-384px -120px;}
.icon-folder-open{background-position:-408px -120px;}
.icon-resize-vertical{background-position:-432px -119px;}
examples/css/calendar.css view on Meta::CPAN
/* calendar for bootstrap css by *
* David Christiansen *
* http://www.techdarkside.com/creating-a-calendar-with-twitter-bootstrap-without-tables */
.calendar_grid {
border: 1px solid gray;
margin-bottom: 30px;
align: center;
background-image:url('file:///home/teejay/development/startup_ideas/flyhalf/root/static/images/gray_jean.png');
}
.month_header {
background-color: gray;
.span1 {
padding-top: 5px;
examples/css/calendar.css view on Meta::CPAN
.month.today {
background-color: rgba(250,250,246,0.7);
border: 2px solid #D7F2FF;
}
.month {
background-color: rgba(250,250,246,0.5);
border: 1px solid whitesmoke;
}
.calendar_header {
color: #FFFFFF;
display: block;
float: left;
font-size: 15px;
font-weight: 200;
line-height: 1;
background-color: #333333;
text-align: center;
}
.calendar_header .span1 {
padding: 8px 2px 8px 2px;
margin:4px;
}
.calendar_container {
width: 85%;
margin-left: auto;
margin-right: auto;
}
.row-fluid > [class*="span"] {
float: left;
margin-left: 2px;
}
examples/templates/calendar.tt view on Meta::CPAN
[% INCLUDE includes/header.tt %]
<div class="calendar_container">
<h2>Example Bootstrap Calendar</h2>
<div class="navbar">
<div class="navbar-inner">
<div class="container-fluid">
<a href="#" class="brand">[% cal.month_name() %] [% cal.year() %]</a>
<ul class="nav pull-right dropdown">
<li><a href="/plan?month=1&year=[% cal.year() %]">[% cal.month_name('next') %] ></a></li>
</ul>
examples/templates/calendar.tt view on Meta::CPAN
<option selected="selected" value="12">December</option>
</select>
<input id="goto_date_3i" name="goto[date(3i)]" type="hidden" value="1" />
<input class="btn" name="commit" type="submit" value="Go"/>
</form>
<ul class="nav pull-right dropdown"><li><a href="/plan?month=1&year=[% cal.year() %]">< [% cal.month_name('previous') %]</a></li></ul>
</div>
</div>
</div>
<div class="calendar_grid">
<div class="month_header row-fluid calendar_header">
<div class="span3"> </div>
[% FOREACH column IN cal.columns() %]
<div class="span1">[% column %]</div>
[% END %]
<div class="span2"> </div>
</div>
[% FOREACH week IN cal.weeks %]
<div class="row-fluid week">
<div class="span3"> </div>
[% FOREACH day IN week %]
examples/templates/includes/header.tt view on Meta::CPAN
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example Calendar with Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/calendar.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
</head>
examples/templates/sidebar_calendar.tt view on Meta::CPAN
<html>
<head>
<title>Wordpress style sidebar calendar</title>
<style>
/* Sidebar
---------------------------
*/
#sidebar {
float: left;
font-size: 11px;
text-align: left;
}
examples/templates/sidebar_calendar.tt view on Meta::CPAN
margin: 5px 0 5px 0;
}
#sidebar li.widget {
overflow: hidden;
word-wrap: break-word;
}
/* Widgets */
#wp-calendar {
padding: 10px 0 0 0;
}
#wp-calendar caption {
text-align: left;
padding: 0 0 3px 0;
}
#wp-calendar tr th,
#wp-calendar tr td {
padding: 0 4px 0 0 ;
text-align: right;
}
#wp-calendar td a {
font-weight: bold;
}
#wp-calendar td a:hover {
font-weight: bold;
}
</style>
</head>
<body>
<div id="sidebar">
<div id="calendar_wrap"><table id="wp-calendar">
<caption>[% cal.month_name() %] [% cal.year() %]</caption>
<thead>
<tr>
[% FOREACH column IN cal.columns() %]
<th title="[% column %]" scope="col">[% column.substr(0,1) %]</th>
[% END %]
</tr>
</thead>
<tfoot>
lib/Calendar/Model.pm view on Meta::CPAN
=head1 METHODS
=head2 new
Class constructor method, returns a Calendar::Model object based on the arguments :
=over 4
=item selected_date - optional, defaults to current local/system date, otherwise provide a DateTime object
=item window - optional, defaults to current month + next/previous days to complete calendar rows,
otherwise provide number of days before selected date to show at start.
=back
=head2 BUILD
Std Moose initialisation hook called by constructor method
=cut
lib/Calendar/Model.pm view on Meta::CPAN
unless ($self->rows) {
# build rows of days
my $day_plugins = [];
# foreach my $plugin ( @{ $self->plugin_list } ) {
# push if ( $plugin->can( 'init' ));
# }
my $dow = 1;
$self->{rows} = [[
map { Calendar::Model::Day->new({ dmy => $_, dow_name => $self->days_of_week->[$dow], day_of_week => $dow++, }) }
calendar_list('DD-MM-YYYY',{start => $self->first_entry_day->dmy, "options" => 7})
]];
foreach (1..4) {
$dow = 1;
my $last_day = $self->{rows}->[-1][-1];
my (undef,@days) = calendar_list('DD-MM-YYYY',{start => $last_day->dmy, "options" => 8} );
push (
@{$self->{rows}},
[ map { Calendar::Model::Day->new({ dmy => $_, dow_name => $self->days_of_week->[$dow],
day_of_week => $dow++, }) } @days ]
);
}
}
# natatime is iterator accessor for ArrayRef accessor in moose - built in, would be nice to wrap it
return $self->rows;
}
=head2 as_list
Object method returns all Calendar::Model::Day objects for calendar
=cut
sub as_list {
my $self = shift;
return [ map { @$_ } @{$self->weeks} ];
}
=head2 month_name
lib/Calendar/Model.pm view on Meta::CPAN
die 'unrecognised month delta - needs to be undef, next or previous';
}
} else {
$monthname = $self->months_of_year()->[$self->month];
}
return $monthname;
}
=head2 last_entry_day
Get last day in calendar as a DateTime object
=cut
sub last_entry_day {
my $self = shift;
my $last_day = $self->weeks->[-1][-1];
$self->_set_last_entry_day($last_day->to_DateTime);
lib/Calendar/Model.pm view on Meta::CPAN
no Moose;
__PACKAGE__->meta->make_immutable;
=head1 AUTHOR
Aaron Trevena, C<< <teejay at cpan.org> >>
=head1 BUGS
Please report any bugs or feature requests to C<bug-calendar-model at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Calendar-Model>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Calendar::Model