Changeset 22 in bookmarks
- Timestamp:
- 05/22/13 16:08:09 (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BookmarkApp.pm
r21 r22 136 136 $base_url .= '/' if $base_url =~ m{/bookmarks$}; 137 137 138 my @links = ( 139 { 140 text => 'Link', 141 type => 'text/html', 142 rel => 'self', 143 query => { 144 tag => \@tags, 145 }, 146 }, 147 { 148 text => 'JSON', 149 type => 'application/json', 150 rel => 'alternate', 151 query => { 152 tag => \@tags, 153 format => 'json', 154 }, 155 }, 156 { 157 text => 'XBEL', 158 type => 'application/xml', 159 rel => 'alternate', 160 query => { 161 tag => \@tags, 162 format => 'xbel', 163 }, 164 }, 165 { 166 text => 'Atom', 167 type => 'application/atom+xml', 168 rel => 'alternate', 169 path => 'feed', 170 query => { 171 tag => \@tags, 172 }, 173 }, 174 ); 175 for my $link (@links) { 176 $link->{href} = URI->new_abs($link->{path} || '', $base_uri); 177 $link->{href}->query_form($link->{query}); 178 } 179 138 180 return $self->tt_process( 139 181 'list.tt', … … 142 184 selected_tag => $tag, 143 185 search_tags => \@tags, 144 tag_query => join('&', map { "tag=$_" } @tags),186 links => \@links, 145 187 all_tags => \@all_tags, 146 188 cotags => \@cotags, -
trunk/list.tt
r21 r22 27 27 border-top: 6px solid #eee; 28 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; 29 39 } 30 40 .refine { … … 101 111 [% END %] 102 112 </ul> 103 [% IF search_tags.size %] 104 <!-- TODO: well-formatted query strings if there is no tag query --> 105 <p> 106 <a href="?[% tag_query %]">Link</a> · 107 <a href="?[% tag_query %]&format=json" type="application/json">JSON</a> · 108 <a href="?[% tag_query %]&format=xbel" type="application/xml">XBEL</a> · 109 <a href="feed?[% tag_query %]" type="application/atom+xml">Atom</a> 110 </p> 111 [% END %] 113 <ul class="alternate-links"> 114 [% FOREACH link IN links %] 115 <li> 116 <a href="[% link.href.canonical %]" type="[% link.type %]" rel="[% link.rel %]">[% link.text %]</a> 117 </li> 118 [% END %] 119 </ul> 112 120 <div class="refine"> 113 121 <form method="get" action="">
Note: See TracChangeset
for help on using the changeset viewer.