3 |
|
|
4 |
extends 'Frey'; |
extends 'Frey'; |
5 |
with 'Frey::Web'; |
with 'Frey::Web'; |
|
#with 'Frey::Storage'; |
|
6 |
|
|
7 |
use lib 'lib'; |
use lib 'lib'; |
8 |
use App::RoomReservation::Room; |
use App::RoomReservation::Room; |
24 |
sub as_markup { |
sub as_markup { |
25 |
my ($self) = @_; |
my ($self) = @_; |
26 |
|
|
27 |
App::RoomReservation::Room->new->room_markup |
|
28 |
. qq|<a target="App::RoomReservation::Reservation" href="/App::RoomReservation::Reservation/create_as_markup">seat reservation</a>| |
my $url = $self->url_for( 'Reservation/create_as_markup' ); |
29 |
; |
|
30 |
|
return |
31 |
|
App::RoomReservation::Room->new->room_markup |
32 |
|
. qq|<a target="App::RoomReservation::Reservation" href="$url">seat reservation</a>| |
33 |
|
; |
34 |
} |
} |
35 |
|
|
36 |
|
# my $url = $self->uri_for( 'Reservation/create_as_makrup' ); |
37 |
|
|
38 |
|
sub url_for { |
39 |
|
my ( $self, $to ) = @_; |
40 |
|
my $app = ref($self); |
41 |
|
$app =~ s{^(App::[^:]+)::.+$}{$1}; |
42 |
|
$app .= '::' . $to; |
43 |
|
|
44 |
|
my ( $class, $method ) = split(m{/}, $app); |
45 |
|
$method =~ s{\?.+$}{}; # remove arguments |
46 |
|
Class::MOP::load_class( $class ); |
47 |
|
die "$class doesn't implement $method" unless $class->meta->has_method($method); |
48 |
|
|
49 |
|
return "http://192.168.1.13:3000/$app"; |
50 |
|
} |
51 |
|
|
52 |
|
__PACKAGE__->meta->make_immutable; |
53 |
|
no Moose; |
54 |
|
|
55 |
1; |
1; |