Skip to content

Commit a635319

Browse files
committed
Initial bootstrap'd, fontawesome'd version.
1. Use Template::Toolkit instead of Simple in config.yml 2. Use [% %] as template operators (instead of <% %> ). 3. Load bootstrap,fontawesome CSS files, followed by the app's custom CSS (main.tt) 4. Load the JQuery, Bootstrap javascript files (main.tt) 5. Added scripts to update bootstrap/fontawesome 6. Added "README" file with some basic explanations.
1 parent 409ade0 commit a635319

File tree

10 files changed

+197
-508
lines changed

10 files changed

+197
-508
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
.*.swp
3+
*~
4+
5+
public/bootstrap*
6+
public/fontawesome*

README

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
3+
TODO when you start a new application:
4+
5+
1. Download the template
6+
2. Rename "lib/dancer_bootstrap_fontawesome_template.pm" to something relevant for you.
7+
3. Added "bin/app.pl" and change the module name (from step 2).
8+
4. ???
9+
5. Profit!
10+
11+
12+
13+
TODO when updating Tweeter's bootstreap:
14+
Quickest way:
15+
$ cd /path/to/your/dancer/project
16+
$ ./bin/update_bootstrap
17+
18+
19+
Manual Unix Way:
20+
$ cd /path/to/your/dancer/project
21+
$ cd public
22+
$ mv bootstrap bootstrap.$(date +%F).old
23+
$ wget http://twitter.github.com/bootstrap/assets/bootstrap.zip
24+
$ unzip bootstrap.zip
25+
$ rm bootstrap.zip
26+
27+
Steps are:
28+
1. Download bootstrap's ZIP file (should be named "bootstrap.zip") to the "<dancer>/public" directory.
29+
2. Delete (or rename/move-aside) the current "<dancer>/public/bootstrap" directory .
30+
3. unzip the bootstrap.zip file in "<dancer>/public" .
31+
4. The updated "bootstrap" directory will be used automatically.
32+
33+
34+
TODO when updating font-awesome:
35+
Quickest way:
36+
$ cd /path/to/your/dancer/project
37+
$ ./bin/update_fontawesome
38+
39+
Manual Unix Way:
40+
$ cd /path/to/your/dancer/project
41+
$ cd public
42+
$ mv FontAwesome FontAwesome.$(date +%F).old
43+
$ wget -O FontAwesome.zip https://github.com/FortAwesome/Font-Awesome/zipball/master
44+
$ unzip FontAwesome.zip
45+
# Here be a catch: the unzip'd directory will be different everytime, depending on the latest GIT version.
46+
# So we rename it using a shell-wildcard, assuming no other directroy is named like this.
47+
# run "ls -l" to see what I mean.
48+
$ mv FortAwesome-Font-Awesome-* FontAwesome
49+
$ rm FontAwesome.zip
50+
51+
Steps are:
52+
1. Download the latest Font-Awesome zipball
53+
2. Delete (or rename/move-aside) the current "<dancer>/public/FontAwesome" directory .
54+
3. unzip the FontAwesome.zip file in "<dancer>/public" .
55+
4. The updated "FontAwesome" directory will be used automatically.
56+
57+
58+
TODO when updating JQuery:
59+
Manual unix way:
60+
1. Find out the latest version at http://docs.jquery.com/Downloading_jQuery
61+
2. Goto <dancer>/public/javascripts
62+
3. Download the new JQuery file.
63+
4. Update <dancer>/views/layout/main.tt (at the bottom <script>) to use the new JQuery.

bin/update_bootstrap

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
3+
SCRIPT=$(readlink -f "$0") || exit 1
4+
DANCER_BASE_DIR=$(dirname $(dirname "$SCRIPT")) || exit 1
5+
DANCER_PUBLIC="$DANCER_BASE_DIR/public"
6+
7+
## Some sanity checks, make sure we're in a dancer directory
8+
if ! [ -e "$DANCER_BASE_DIR/config.yml" ] ;
9+
then
10+
echo "Error: directory '$DANCER_BASE_DIR' doesn't look like a Dancer directory (can't find 'config.yml' file." >&2
11+
exit 1
12+
fi
13+
14+
if ! [ -d "$DANCER_PUBLIC" ] ;
15+
then
16+
echo "Error: can't find Dancer's 'public' directory in '$DANCER_PUBLIC'" >&2
17+
exit 1
18+
fi
19+
20+
21+
cd "$DANCER_PUBLIC" || exit 1
22+
23+
## Move aside the old "bootstrap" directory
24+
if [ -d "bootstrap" ]; then
25+
echo "Moving aside old bootstrap directory..."
26+
mv "bootstrap" "bootstrap.$(date +%F).old" || exit 1
27+
fi
28+
29+
## delete the old bootstrap zipball, if exists
30+
rm -f "bootstrap.zip"
31+
32+
## Download the latest bootstrap
33+
echo "Downloading latest bootstrap..."
34+
wget --quiet http://twitter.github.com/bootstrap/assets/bootstrap.zip || exit 1
35+
echo "Unzipping..."
36+
unzip -q bootstrap.zip || exit 1
37+
38+
#delete the zipball
39+
rm bootstrap.zip || exit 1
40+
41+
echo "Done - bootstrap is updated."

bin/update_fontawesome

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
3+
SCRIPT=$(readlink -f "$0") || exit 1
4+
DANCER_BASE_DIR=$(dirname $(dirname "$SCRIPT")) || exit 1
5+
DANCER_PUBLIC="$DANCER_BASE_DIR/public"
6+
7+
## Some sanity checks, make sure we're in a dancer directory
8+
if ! [ -e "$DANCER_BASE_DIR/config.yml" ] ;
9+
then
10+
echo "Error: directory '$DANCER_BASE_DIR' doesn't look like a Dancer directory (can't find 'config.yml' file." >&2
11+
exit 1
12+
fi
13+
14+
if ! [ -d "$DANCER_PUBLIC" ] ;
15+
then
16+
echo "Error: can't find Dancer's 'public' directory in '$DANCER_PUBLIC'" >&2
17+
exit 1
18+
fi
19+
20+
21+
cd "$DANCER_PUBLIC" || exit 1
22+
23+
## Move aside the old "bootstrap" directory
24+
if [ -d "fontawesome" ]; then
25+
echo "Moving aside old fontawesome directory..."
26+
mv "fontawesome" "fontawesome.$(date +%F).old" || exit 1
27+
fi
28+
29+
## delete the old fontawesome zipball, if exists
30+
rm -f "fontawesome"
31+
32+
## Download the latest fontawesome
33+
echo "Downloading latest fontawesome"
34+
wget --quiet -O fontawesome.zip https://github.com/FortAwesome/Font-Awesome/zipball/master || exit 1
35+
echo "Unzipping..."
36+
unzip -q fontawesome.zip || exit 1
37+
38+
## Hackish tweak: detect the name of the unzip'd directory, and rename it to a fixed name
39+
NEWDIR=$(ls -d FortAwesome-Font-Awesome-*) || exit 1
40+
mv "$NEWDIR" "fontawesome" || exit 1
41+
42+
#delete the zipball
43+
rm fontawesome.zip || exit 1
44+
45+
echo "Done - Font-Awesome is updated."

config.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,10 @@ layout: "main"
1414
# about unicode within your app when this setting is set (recommended).
1515
charset: "UTF-8"
1616

17-
# template engine
18-
# simple: default and very basic template engine
19-
# template_toolkit: TT
20-
21-
template: "simple"
22-
23-
# template: "template_toolkit"
24-
# engines:
25-
# template_toolkit:
26-
# encoding: 'utf8'
27-
# start_tag: '[%'
28-
# end_tag: '%]'
17+
template: "template_toolkit"
18+
engines:
19+
template_toolkit:
20+
encoding: 'utf8'
21+
start_tag: '[%'
22+
end_tag: '%]'
2923

public/css/style.css

-188
Original file line numberDiff line numberDiff line change
@@ -1,189 +1 @@
11

2-
body {
3-
margin: 0;
4-
margin-bottom: 25px;
5-
padding: 0;
6-
background-color: #ddd;
7-
background-image: url("/images/perldancer-bg.jpg");
8-
background-repeat: no-repeat;
9-
background-position: top left;
10-
11-
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
12-
font-size: 13px;
13-
color: #333;
14-
}
15-
16-
h1 {
17-
font-size: 28px;
18-
color: #000;
19-
}
20-
21-
a {color: #03c}
22-
a:hover {
23-
background-color: #03c;
24-
color: white;
25-
text-decoration: none;
26-
}
27-
28-
#page {
29-
background-color: #ddd;
30-
width: 750px;
31-
margin: auto;
32-
margin-left: auto;
33-
padding-left: 0px;
34-
margin-right: auto;
35-
}
36-
37-
#content {
38-
background-color: white;
39-
border: 3px solid #aaa;
40-
border-top: none;
41-
padding: 25px;
42-
width: 500px;
43-
}
44-
45-
#sidebar {
46-
float: right;
47-
width: 175px;
48-
}
49-
50-
#header, #about, #getting-started {
51-
padding-left: 75px;
52-
padding-right: 30px;
53-
}
54-
55-
56-
#header {
57-
background-image: url("/images/perldancer.jpg");
58-
background-repeat: no-repeat;
59-
background-position: top left;
60-
height: 64px;
61-
}
62-
#header h1, #header h2 {margin: 0}
63-
#header h2 {
64-
color: #888;
65-
font-weight: normal;
66-
font-size: 16px;
67-
}
68-
69-
#about h3 {
70-
margin: 0;
71-
margin-bottom: 10px;
72-
font-size: 14px;
73-
}
74-
75-
#about-content {
76-
background-color: #ffd;
77-
border: 1px solid #fc0;
78-
margin-left: -11px;
79-
}
80-
#about-content table {
81-
margin-top: 10px;
82-
margin-bottom: 10px;
83-
font-size: 11px;
84-
border-collapse: collapse;
85-
}
86-
#about-content td {
87-
padding: 10px;
88-
padding-top: 3px;
89-
padding-bottom: 3px;
90-
}
91-
#about-content td.name {color: #555}
92-
#about-content td.value {color: #000}
93-
94-
#about-content.failure {
95-
background-color: #fcc;
96-
border: 1px solid #f00;
97-
}
98-
#about-content.failure p {
99-
margin: 0;
100-
padding: 10px;
101-
}
102-
103-
#getting-started {
104-
border-top: 1px solid #ccc;
105-
margin-top: 25px;
106-
padding-top: 15px;
107-
}
108-
#getting-started h1 {
109-
margin: 0;
110-
font-size: 20px;
111-
}
112-
#getting-started h2 {
113-
margin: 0;
114-
font-size: 14px;
115-
font-weight: normal;
116-
color: #333;
117-
margin-bottom: 25px;
118-
}
119-
#getting-started ol {
120-
margin-left: 0;
121-
padding-left: 0;
122-
}
123-
#getting-started li {
124-
font-size: 18px;
125-
color: #888;
126-
margin-bottom: 25px;
127-
}
128-
#getting-started li h2 {
129-
margin: 0;
130-
font-weight: normal;
131-
font-size: 18px;
132-
color: #333;
133-
}
134-
#getting-started li p {
135-
color: #555;
136-
font-size: 13px;
137-
}
138-
139-
#search {
140-
margin: 0;
141-
padding-top: 10px;
142-
padding-bottom: 10px;
143-
font-size: 11px;
144-
}
145-
#search input {
146-
font-size: 11px;
147-
margin: 2px;
148-
}
149-
#search-text {width: 170px}
150-
151-
#sidebar ul {
152-
margin-left: 0;
153-
padding-left: 0;
154-
}
155-
#sidebar ul h3 {
156-
margin-top: 25px;
157-
font-size: 16px;
158-
padding-bottom: 10px;
159-
border-bottom: 1px solid #ccc;
160-
}
161-
#sidebar li {
162-
list-style-type: none;
163-
}
164-
#sidebar ul.links li {
165-
margin-bottom: 5px;
166-
}
167-
168-
h1, h2, h3, h4, h5 {
169-
font-family: sans-serif;
170-
margin: 1.2em 0 0.6em 0;
171-
}
172-
173-
p {
174-
line-height: 1.5em;
175-
margin: 1.6em 0;
176-
}
177-
178-
code, tt {
179-
font-family: 'Andale Mono', Monaco, 'Liberation Mono', 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', monospace;
180-
}
181-
182-
#footer {
183-
clear: both;
184-
padding-top: 2em;
185-
text-align: center;
186-
padding-right: 160px;
187-
font-family: sans-serif;
188-
font-size: 10px;
189-
}

public/javascripts/jquery-1.7.2.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)