1 |
package Frey::Designer; |
package Frey::Designer; |
2 |
|
|
3 |
use Moose; |
use Moose; |
4 |
use Moose::Util::TypeConstraints; |
use Frey::Types; |
5 |
|
#use MooseX::Types::URI qw(Uri FileUri DataUri); |
|
use URI (); |
|
|
|
|
|
subtype 'Uri' |
|
|
=> as 'Object' |
|
|
=> where { $_->isa('URI') }; |
|
|
|
|
|
coerce 'Uri' |
|
|
=> from 'Object' |
|
|
=> via { $_->isa('URI') |
|
|
? $_ |
|
|
: Params::Coerce::coerce( 'URI', $_ ) } |
|
|
=> from 'Str' |
|
|
=> via { URI->new( $_ ) }; |
|
6 |
|
|
7 |
has 'uri' => ( |
has 'uri' => ( |
8 |
is => 'rw', |
is => 'rw', |
9 |
isa => 'Uri', |
isa => 'Uri', coerce => 1, |
|
coerce => 1, |
|
10 |
required => 1, |
required => 1, |
11 |
); |
); |
12 |
|
|
53 |
|
|
54 |
my $path = template_path( $c->req->path ); |
my $path = template_path( $c->req->path ); |
55 |
|
|
56 |
|
if ( $path =~ m{/__bookmarklet} ) { |
57 |
|
$c->res->content_type( "text/html" ); |
58 |
|
my $js = read_file( 'static/xpath.js' ); |
59 |
|
$js =~ s{//.*}{}gm; # remove comments so that compaction below doesn't screw code |
60 |
|
$js =~ s/\s\s+/ /gs; |
61 |
|
$c->res->body(qq{ |
62 |
|
drag this look to bookmark <a href="javascript:void($js);">xpath?</a> to install XPATH inspector |
63 |
|
<p><a href="http://www.google.com/">link test</a> |
64 |
|
}); |
65 |
|
return; |
66 |
|
} |
67 |
|
|
68 |
$path .= '.html' if $path !~ m/\.\w+$/; |
$path .= '.html' if $path !~ m/\.\w+$/; |
69 |
|
|
70 |
my $url = $self->uri; |
my $url = $self->uri; |