summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2005-11-09 21:44:02 +0000
committerdakkar <dakkar@luxion>2005-11-09 21:44:02 +0000
commit2690b8a0d7019b68509897881cd152717cb41ed0 (patch)
tree8e53fec264ceba6fdf4189f7696aa1c82e3e405c
parentaggiunta l'icona di default, e corretto il codice icone in generale (diff)
downloadBookmarks-2690b8a0d7019b68509897881cd152717cb41ed0.tar.gz
Bookmarks-2690b8a0d7019b68509897881cd152717cb41ed0.tar.bz2
Bookmarks-2690b8a0d7019b68509897881cd152717cb41ed0.zip
un po' di stylesheet
-rw-r--r--lib/Bookmarks.pm2
-rw-r--r--lib/Bookmarks/C/Main.pm7
-rw-r--r--lib/Bookmarks/M/DB/Tags.pm2
-rw-r--r--root/add_form48
-rw-r--r--root/closewin7
-rw-r--r--root/links103
-rw-r--r--root/notag12
-rw-r--r--root/style.css129
-rw-r--r--root/tags28
9 files changed, 256 insertions, 82 deletions
diff --git a/lib/Bookmarks.pm b/lib/Bookmarks.pm
index 810a64f..63d6578 100644
--- a/lib/Bookmarks.pm
+++ b/lib/Bookmarks.pm
@@ -1,7 +1,7 @@
package Bookmarks;
use strict;
-use Catalyst qw/-Debug Prototype DefaultEnd/;
+use Catalyst qw/-Debug Prototype DefaultEnd Static::Simple/;
use HTML::Element;
our $VERSION = '0.01';
diff --git a/lib/Bookmarks/C/Main.pm b/lib/Bookmarks/C/Main.pm
index 244abab..b272c64 100644
--- a/lib/Bookmarks/C/Main.pm
+++ b/lib/Bookmarks/C/Main.pm
@@ -192,6 +192,13 @@ sub new {
return bless {c=>$c,base=>$c->req->base()},$class;
}
+sub stylesheet {
+ my ($self)=@_;
+ return URI->new(
+ $self->{base} . 'style.css'
+ )->as_string();
+}
+
sub tag_info {
my ($self, $tag)=@_;
return URI->new(
diff --git a/lib/Bookmarks/M/DB/Tags.pm b/lib/Bookmarks/M/DB/Tags.pm
index cc675f7..4ca832a 100644
--- a/lib/Bookmarks/M/DB/Tags.pm
+++ b/lib/Bookmarks/M/DB/Tags.pm
@@ -18,7 +18,7 @@ __PACKAGE__->set_sql('popularity', <<'END_SQL');
SELECT tags.pk, COUNT(links_tags.link) AS how_many
FROM tags, links_tags
WHERE tags.pk = links_tags.tag
-GROUP BY links_tags.tag
+GROUP BY tags.pk
ORDER BY how_many DESC
END_SQL
diff --git a/root/add_form b/root/add_form
index ce0d181..b031299 100644
--- a/root/add_form
+++ b/root/add_form
@@ -1,18 +1,34 @@
<html>
-<head>
-<title>[% IF mode=='edit'; 'Edit link'; ELSE; 'Add link'; END %]</title>
-[% c.prototype.auto_complete_stylesheet() %]
-[% c.prototype.define_javascript_functions() %]
-</head>
-<body>
-<form action="[% href.add_action() %]" method="post">
-<p>Link: <input name="url" type="text" value="[% link.url %]" /></p>
-<p>Title: <input name="title" type="text" value="[% link.title %]" /></p>
-<p>Description: <input name="descr" type="text" value="[% link.descr %]" /></p>
-<p>Tags: <input autocomplete="off" id="tag_field" name="tag" type="text" value="[% tags.join(' ') %]" /></p>
-<div id="tag_field_auto_complete" class="auto_complete"></div>
-<script type="text/javascript">new Ajax.Autocompleter('tag_field', 'tag_field_auto_complete', '[% href.tag_autocomplete() %]', { tokens: ' ' })</script>
-<input type="submit" name="add" value="Submit" /> [% IF mode=='edit' %]<input type="submit" name="delete" value="Delete" />[% END %]
-</form>
-</body>
+ <head>
+ <title>[% IF mode=='edit'; 'Edit link'; ELSE; 'Add link'; END %]</title>
+ [% c.prototype.auto_complete_stylesheet() %]
+ [% c.prototype.define_javascript_functions() %]
+ <link rel="stylesheet" href="[% href.stylesheet() %]" type="text/css" />
+ </head>
+ <body>
+ <form action="[% href.add_action() %]" method="post">
+ <p>
+ <label for="url">Link:</label>
+ <input id="url" name="url" type="text" value="[% link.url %]" />
+ </p>
+ <p>
+ <label for="title">Title:</label>
+ <input id="title" name="title" type="text" value="[% link.title %]" />
+ </p>
+ <p>
+ <label for="descr">Description:</label>
+ <input id="descr" name="descr" type="text" value="[% link.descr %]" />
+ </p>
+ <p>
+ <label for="tag_field">Tags:</label>
+ <input autocomplete="off" id="tag_field" name="tag" type="text" value="[% tags.join(' ') %]" />
+ </p>
+ <div id="tag_field_auto_complete" class="auto_complete"></div>
+ <script type="text/javascript">new Ajax.Autocompleter('tag_field', 'tag_field_auto_complete', '[% href.tag_autocomplete() %]', { tokens: ' ' })</script>
+ <input type="submit" name="add" value="Submit" />
+ [% IF mode=='edit' -%]
+ <input type="submit" name="delete" value="Delete" />
+ [%- END %]
+ </form>
+ </body>
</html> \ No newline at end of file
diff --git a/root/closewin b/root/closewin
index 2e1d5eb..7fcc514 100644
--- a/root/closewin
+++ b/root/closewin
@@ -1 +1,6 @@
-close this window
+<html>
+ <head>
+ <script type="text/javascript">window.close()</script>
+ </head>
+</html>
+
diff --git a/root/links b/root/links
index a23eaff..fa78da8 100644
--- a/root/links
+++ b/root/links
@@ -7,64 +7,73 @@
', ' UNLESS loop.last;
END %]
</title>
+ <link rel="stylesheet" href="[% href.stylesheet() %]" type="text/css" />
</head>
<body>
<div id="tagset">
<h2>[% IF tagset.size() == 1 %]Tag:[% ELSE %]Tags:[% END %]</h2>
- <ul>
- [% FOR tag IN tagset.tags %]
- <li>
- <span class="tag name">
- <a href="[% href.tag_info(tag) %]">[% tag.name %]</a>
- </span>
- [% IF tagset.size() > 1 %]
- <span class="tag remove">
- <a href="[% href.remove_tag(tagset,tag) %]">-</a>
- </span>
+ <div>
+ <ul>
+ [% FOR tag IN tagset.tags %]
+ <li>
+ <span class="tag name">
+ <a href="[% href.tag_info(tag) %]" target="_self">[% tag.name %]</a>
+ </span>
+ [% IF tagset.size() > 1 %]
+ <span class="tag remove">
+ <a href="[% href.remove_tag(tagset,tag) %]" target="_self">-</a>
+ </span>
+ [% END %]
+ </li>
[% END %]
- </li>
- [% END %]
- </ul>
+ </ul>
+ </div>
</div>
<div id="related">
<h2>Related:</h2>
- <ul>
- [% FOR rtag IN related %]
- <li>
- <span class="tag name"><a href="[% href.to_tag(rtag) %]">[% rtag.name %]</a></span>
- <span class="tag add">
- <a href="[% href.add_tag(tagset,rtag) %]">+</a>
- </span>
- </li>
- [% END %]
- </ul>
+ <div>
+ <ul>
+ [% FOR rtag IN related %]
+ <li>
+ <span class="tag name">
+ <a href="[% href.to_tag(rtag) %]" target="_self">[% rtag.name %]</a>
+ </span>
+ <span class="tag add">
+ <a href="[% href.add_tag(tagset,rtag) %]" target="_self">+</a>
+ </span>
+ </li>
+ [% END %]
+ </ul>
+ </div>
</div>
<div id="links">
<h2>Links:</h2>
- <ol>
- [% FOR link IN links %]
- <li>
- <span class="link icon">
- <img src="[% href.link_icon(link) %]" />
- </span>
- <span class="link title">
- <a href="[% href.link(link) %]">»[% link.title %]«</a>
- </span>
- <span class="link edit">
- <a href="[% href.edit_link(link) %]">edit</a>
- </span>
- <ul>
- [% FOR rtag IN link.tags %]
- <li>
- <span class="tag name">
- <a href="[% href.to_tag(rtag) %]">[% rtag.name %]</a>
- </span>
- </li>
- [% END %]
- </ul>
- </li>
- [% END %]
- </ol>
+ <div>
+ <ol>
+ [% FOR link IN links %]
+ <li>
+ <span class="link icon">
+ <img src="[% href.link_icon(link) %]" />
+ </span>
+ <span class="link title">
+ <a href="[% href.link(link) %]">»[% link.title %]«</a>
+ </span>
+ <span class="link edit">
+ <a href="[% href.edit_link(link) %]" target="_self">edit</a>
+ </span>
+ <ul>
+ [% FOR rtag IN link.tags %]
+ <li>
+ <span class="tag name">
+ <a href="[% href.to_tag(rtag) %]" target="_self">[% rtag.name %]</a>
+ </span>
+ </li>
+ [% END %]
+ </ul>
+ </li>
+ [% END %]
+ </ol>
+ </div>
</div>
</body>
</html>
diff --git a/root/notag b/root/notag
index 005d359..e5d7b02 100644
--- a/root/notag
+++ b/root/notag
@@ -1,8 +1,8 @@
<html>
-<head>
-<title>no tag</title>
-</head>
-<body>
-<p>Il tag [% tagname %] non esiste</p>
-</body>
+ <head>
+ <title>No such tag</title>
+ </head>
+ <body>
+ <p>Il tag [% tagname %] non esiste</p>
+ </body>
</html>
diff --git a/root/style.css b/root/style.css
new file mode 100644
index 0000000..859eae8
--- /dev/null
+++ b/root/style.css
@@ -0,0 +1,129 @@
+/* general */
+body
+{
+ font-size: 8pt;
+ width: 100%;
+ margin:0;padding:0;border:0;
+}
+a
+{
+ text-decoration: none;
+ color: black;
+}
+li:hover
+{
+ background-color: rgb(100,100,100);
+}
+
+/* tags */
+div#all-tags ol
+{
+ list-style: none;
+ margin:0;padding:0;border:0;
+}
+div#all-tags li
+{
+ padding: 1px;
+ position: relative;
+ display: block;
+ clear: both;
+}
+div#all-tags li span.tag.name a
+{
+ display: block;
+}
+div#all-tags li span.tag.count
+{
+ display: block;
+ position: absolute;top:0;right:0;
+ text-align: right;
+}
+
+/* links */
+div#tagset,
+div#related
+{
+ position: fixed;
+ top:0;
+ width: 49%; height: 80px;
+ border: solid thin black;
+ background-color: white;
+}
+div#tagset h2,
+div#related h2
+{
+ position: absolute;
+ top: 0; left: 5px;
+ margin:0;padding:0;border:0;
+ background-color: white;
+}
+div#tagset
+{
+ left: 0;
+}
+div#related
+{
+ right:0;
+}
+div#tagset > div,
+div#related > div
+{
+ overflow: auto;
+ height: 60px;
+ width: 100%;
+ margin-top: 20px;
+}
+div#tagset ul,
+div#related ul
+{
+ list-style: none;
+ margin:0;border:0;padding:0;
+}
+div#tagset ul li,
+div#related ul li
+{
+ padding: 1px;
+ position: relative;
+ display: block;
+ clear: both;
+}
+div#tagset ul li span.tag.name a,
+div#related ul li span.tag.name a
+{
+ display: block;
+}
+div#tagset ul li span.tag.remove,
+div#related ul li span.tag.add
+{
+ display: block;
+ position: absolute;top:0;right:1px;
+ text-align: right;
+ background-color: red;
+}
+div#tagset ul li span.tag.remove a,
+div#related ul li span.tag.add a
+{
+ display: block;
+ width: 15px;
+ text-align: center;
+}
+
+div#links
+{
+ padding:0;border:0;margin:0;
+ margin-top: 85px;
+}
+div#links h2
+{
+ display: none;
+}
+div#links ol
+{
+ list-style: none;
+ padding:0;margin:0;border:0;
+}
+div#links ol > li
+{
+ padding:0;margin:0;border:0;
+ margin-bottom: 5px;
+} \ No newline at end of file
diff --git a/root/tags b/root/tags
index 2df62e5..244ae32 100644
--- a/root/tags
+++ b/root/tags
@@ -1,12 +1,20 @@
<html>
-<head>
-<title>tags</title>
-</head>
-<body>
-<ol>
-[% FOR tag IN tags %]
-<li><a href="[% href.to_tag(tag) %]">[% tag.name %]</a> ([% tag.how_many %])</li>
-[% END %]
-</ol>
-</body>
+ <head>
+ <title>Tags</title>
+ <link rel="stylesheet" href="[% href.stylesheet() %]" type="text/css" />
+ </head>
+ <body>
+ <div id="all-tags">
+ <ol>
+ [% FOR tag IN tags %]
+ <li>
+ <span class="tag name">
+ <a href="[% href.to_tag(tag) %]" target="_self">[% tag.name %]</a>
+ </span>
+ <span class="tag count">[% tag.how_many() %]</span>
+ </li>
+ [% END %]
+ </ol>
+ </div>
+ </body>
</html>