Changeset 119 in bookmarks for trunk


Ignore:
Timestamp:
02/22/16 17:30:47 (8 years ago)
Author:
peter
Message:

#15: Use Plack::Middleware::Static to serve static assets.

Moved the CSS and Javascript for creating the popup window into external static assets.

Location:
trunk/lib
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Bookmarks/bookmark.tt

    r95 r119  
    22  <head> 
    33    <title>Bookmark: [% bookmark.title or bookmark.uri %]</title> 
    4     <style type="text/css"> 
    5 body, th, td { 
    6     font-size: .875em; 
    7 } 
    8 h1 { 
    9   font-size: 1.25em; 
    10 } 
    11 li { 
    12     margin-bottom: .5em; 
    13 } 
    14 th { 
    15     text-align: right; 
    16     font-weight: normal; 
    17 } 
    18     </style> 
     4    <link rel="stylesheet" type="text/css" href="assets/bookmark.css"/> 
    195  </head> 
    206  <body> 
  • trunk/lib/Bookmarks/list.tt

    r111 r119  
    33    <title>[% title %]</title> 
    44    <base href="[% base_url %]"/> 
    5     <style type="text/css"> 
    6 a:hover { 
    7     text-decoration: none; 
    8 } 
    9 .edit { 
    10     font-size: .85em; 
    11 } 
    12 input, select { 
    13     font-size: .875em; 
    14     font-family: 'DejaVu Sans', sans-serif; 
    15 } 
    16 body, th, td { 
    17     margin: 0; 
    18     font-size: .75em; 
    19     font-family: 'DejaVu Sans', sans-serif; 
    20 } 
    21 ul { 
    22     margin: 0; 
    23     padding: 0; 
    24 } 
    25 ul.main { 
    26     height: 60%; 
    27     border-top: 6px solid #eee; 
    28     border-bottom: 6px solid #eee; 
    29 } 
    30 .alternate-links { 
    31     margin: .5em .25em; 
    32 } 
    33 .alternate-links li { 
    34     display: inline; 
    35 } 
    36 .alternate-links li+li:before { 
    37     content: ' | '; 
    38     color: #ccc; 
    39 } 
    40 .refine { 
    41     height: 15%; 
    42 } 
    43 .refine form { 
    44     margin: 0; 
    45 } 
    46 .buttons { 
    47     margin: .5em; 
    48 } 
    49 .cotags { 
    50     height: 75%; 
    51     border-top: 1px dotted #999; 
    52     border-bottom: 1px dotted #999; 
    53 } 
    54 ul.main, ul.cotags { 
    55     overflow-y: scroll !important; 
    56 } 
    57 li { 
    58     padding: .25em 0 0 .25em; 
    59     color: #999; 
    60     white-space: nowrap; 
    61     list-style-type: none; 
    62 } 
    63 th { 
    64     text-align: right; 
    65     font-weight: normal; 
    66 } 
    67 form { 
    68     margin: .5em; 
    69 } 
    70 p { 
    71     margin: .5em; 
    72 } 
    73 .tags a { 
    74     color: #999; 
    75     text-decoration: none; 
    76 } 
    77 .tags a:hover { 
    78     text-decoration: underline; 
    79 } 
    80 .tags { 
    81     color: #999; 
    82     margin-top: .125em; 
    83     margin-left: 3em; 
    84     font-size: .875em; 
    85 } 
    86 .pagination { 
    87     margin: .5em; 
    88 } 
    89     </style> 
     5    <link rel="stylesheet" type="text/css" href="assets/list.css"/> 
    906  </head> 
    917  <body> 
     
    16177      </p> 
    16278    </div> 
     79    <script src="assets/list.js"></script> 
    16380  </body> 
    16481</html> 
  • trunk/lib/Bookmarks/list_core.tt

    r111 r119  
    33    <li> 
    44      <span class="edit"> 
    5         (<a href="[% resource.id %]" onclick="window.open(this.href, 'edit_bookmark', 'width=800,height=250').focus(); return false;">Edit</a>) 
     5        (<a href="[% resource.id %]" class="edit-bookmark">Edit</a>) 
    66      </span> 
    77      <a href="[% resource.uri | html %]" title="[% resource.title | html %] ([% resource.tags.join(', ') %])">[% resource.title or resource.uri %]</a> 
  • trunk/lib/BookmarksApp.pm

    r118 r119  
    4242use Plack::Request; 
    4343use Router::Resource; 
     44use File::Basename qw{dirname}; 
     45use File::Spec::Functions qw{catfile}; 
    4446 
    4547use Bookmarks::Controller; 
     
    156158                }, 
    157159            ) if $config->{auth}; 
     160            enable 'Static', ( 
     161                path => qr{^/assets/}, 
     162                root => catfile(dirname(__FILE__), 'htdocs'), 
     163            ); 
    158164            sub { $router->dispatch(shift); }; 
    159165        } 
Note: See TracChangeset for help on using the changeset viewer.