tft_rails 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.rvmrc +1 -0
- data/Gemfile +8 -0
- data/LICENSE +57 -0
- data/README.md +72 -0
- data/Rakefile +25 -0
- data/lib/generators/chapter07/begin/USAGE +27 -0
- data/lib/generators/chapter07/begin/begin_generator.rb +32 -0
- data/lib/generators/chapter07/begin/instructions.md +74 -0
- data/lib/generators/chapter07/begin/templates/app/controllers/application_controller.rb +8 -0
- data/lib/generators/chapter07/begin/templates/app/controllers/pages_controller.rb +11 -0
- data/lib/generators/chapter07/begin/templates/app/controllers/users_controller.rb +3 -0
- data/lib/generators/chapter07/begin/templates/app/helpers/application_helper.rb +12 -0
- data/lib/generators/chapter07/begin/templates/app/helpers/pages_helper.rb +2 -0
- data/lib/generators/chapter07/begin/templates/app/helpers/users_helper.rb +7 -0
- data/lib/generators/chapter07/begin/templates/app/models/user.rb +9 -0
- data/lib/generators/chapter07/begin/templates/app/views/layouts/_footer.html.erb +9 -0
- data/lib/generators/chapter07/begin/templates/app/views/layouts/_header.html.erb +10 -0
- data/lib/generators/chapter07/begin/templates/app/views/layouts/_stylesheets.html.erb +7 -0
- data/lib/generators/chapter07/begin/templates/app/views/layouts/application.html.erb +17 -0
- data/lib/generators/chapter07/begin/templates/app/views/pages/about.html.erb +7 -0
- data/lib/generators/chapter07/begin/templates/app/views/pages/contact.html.erb +5 -0
- data/lib/generators/chapter07/begin/templates/app/views/pages/home.html.erb +7 -0
- data/lib/generators/chapter07/begin/templates/app/views/users/show.html.erb +15 -0
- data/lib/generators/chapter07/begin/templates/config/initializers/devise.rb +194 -0
- data/lib/generators/chapter07/begin/templates/config/locales/devise.en.yml +50 -0
- data/lib/generators/chapter07/begin/templates/config/routes.rb.tt +17 -0
- data/lib/generators/chapter07/begin/templates/db/migrate/20110608224650_devise_create_users.rb +29 -0
- data/lib/generators/chapter07/begin/templates/db/schema.rb +34 -0
- data/lib/generators/chapter07/begin/templates/public/images/logo.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/ie.css +36 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/buttons/icons/key.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/buttons/readme.txt +32 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/buttons/screen.css +97 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/fancy-type/screen.css +71 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/lock.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/readme.txt +18 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/link-icons/screen.css +42 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/rtl/readme.txt +10 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/plugins/rtl/screen.css +110 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/print.css +29 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/screen.css +265 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/src/forms.css +82 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/src/grid.css +280 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/src/grid.png +0 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/src/ie.css +79 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/src/print.css +92 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/src/reset.css +65 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/blueprint/src/typography.css +123 -0
- data/lib/generators/chapter07/begin/templates/public/stylesheets/custom.css +137 -0
- data/lib/generators/chapter07/begin/templates/spec/controllers/pages_controller_07_spec.rb +48 -0
- data/lib/generators/chapter07/begin/templates/spec/controllers/users_controller_07_spec.rb +38 -0
- data/lib/generators/chapter07/begin/templates/spec/factories.rb +7 -0
- data/lib/generators/chapter07/begin/templates/spec/models/user_07_spec.rb +38 -0
- data/lib/generators/chapter07/begin/templates/spec/requests/layout_links_07_spec.rb +44 -0
- data/lib/generators/chapter07/begin/templates/spec/spec_helper.rb +29 -0
- data/lib/generators/chapter07/solutions/USAGE +21 -0
- data/lib/generators/chapter07/solutions/solutions_generator.rb +23 -0
- data/lib/generators/chapter07/solutions/templates/app/controllers/pages_controller.rb +18 -0
- data/lib/generators/chapter07/solutions/templates/app/controllers/users_controller.rb +8 -0
- data/lib/generators/chapter07/solutions/templates/app/models/user.rb +11 -0
- data/lib/generators/chapter07/solutions/templates/app/views/layouts/_footer.html.erb +10 -0
- data/lib/generators/chapter07/solutions/templates/app/views/layouts/_header.html.erb +11 -0
- data/lib/generators/chapter07/solutions/templates/app/views/pages/help.html.erb +4 -0
- data/lib/generators/chapter07/solutions/templates/app/views/pages/home.html.erb +7 -0
- data/lib/generators/chapter07/solutions/templates/app/views/users/show.html.erb +15 -0
- data/lib/generators/chapter08_09/begin/USAGE +24 -0
- data/lib/generators/chapter08_09/begin/begin_generator.rb +29 -0
- data/lib/generators/chapter08_09/begin/instructions.md +54 -0
- data/lib/generators/chapter08_09/begin/snippets/custom.css +49 -0
- data/lib/generators/chapter08_09/begin/templates/spec/controllers/devise/registrations_controller_08_spec.rb +83 -0
- data/lib/generators/chapter08_09/begin/templates/spec/requests/layout_links_09_spec.rb +35 -0
- data/lib/generators/chapter08_09/begin/templates/spec/requests/users_signup_08_spec.rb +36 -0
- data/lib/generators/chapter08_09/solutions/USAGE +18 -0
- data/lib/generators/chapter08_09/solutions/solutions_generator.rb +12 -0
- data/lib/generators/chapter08_09/solutions/templates/app/helpers/application_helper.rb +16 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/devise/passwords/edit.html.erb +16 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/devise/passwords/new.html.erb +12 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/devise/registrations/_fields.html.erb +16 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/devise/registrations/edit.html.erb +28 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/devise/registrations/new.html.erb +13 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/devise/sessions/new.html.erb +17 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/devise/shared/_links.erb +25 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/layouts/_header.html.erb +19 -0
- data/lib/generators/chapter08_09/solutions/templates/app/views/layouts/application.html.erb +20 -0
- data/lib/tft_rails.rb +2 -0
- metadata +160 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
/* --------------------------------------------------------------
|
2
|
+
|
3
|
+
ie.css
|
4
|
+
|
5
|
+
Contains every hack for Internet Explorer,
|
6
|
+
so that our core files stay sweet and nimble.
|
7
|
+
|
8
|
+
-------------------------------------------------------------- */
|
9
|
+
|
10
|
+
/* Make sure the layout is centered in IE5 */
|
11
|
+
body { text-align: center; }
|
12
|
+
.container { text-align: left; }
|
13
|
+
|
14
|
+
/* Fixes IE margin bugs */
|
15
|
+
* html .column, * html .span-1, * html .span-2,
|
16
|
+
* html .span-3, * html .span-4, * html .span-5,
|
17
|
+
* html .span-6, * html .span-7, * html .span-8,
|
18
|
+
* html .span-9, * html .span-10, * html .span-11,
|
19
|
+
* html .span-12, * html .span-13, * html .span-14,
|
20
|
+
* html .span-15, * html .span-16, * html .span-17,
|
21
|
+
* html .span-18, * html .span-19, * html .span-20,
|
22
|
+
* html .span-21, * html .span-22, * html .span-23,
|
23
|
+
* html .span-24 { display:inline; overflow-x: hidden; }
|
24
|
+
|
25
|
+
|
26
|
+
/* Elements
|
27
|
+
-------------------------------------------------------------- */
|
28
|
+
|
29
|
+
/* Fixes incorrect styling of legend in IE6. */
|
30
|
+
* html legend { margin:0px -8px 16px 0; padding:0; }
|
31
|
+
|
32
|
+
/* Fixes wrong line-height on sup/sub in IE. */
|
33
|
+
sup { vertical-align:text-top; }
|
34
|
+
sub { vertical-align:text-bottom; }
|
35
|
+
|
36
|
+
/* Fixes IE7 missing wrapping of code elements. */
|
37
|
+
html>body p code { *white-space: normal; }
|
38
|
+
|
39
|
+
/* IE 6&7 has problems with setting proper <hr> margins. */
|
40
|
+
hr { margin:-8px auto 11px; }
|
41
|
+
|
42
|
+
/* Explicitly set interpolation, allowing dynamically resized images to not look horrible */
|
43
|
+
img { -ms-interpolation-mode:bicubic; }
|
44
|
+
|
45
|
+
/* Clearing
|
46
|
+
-------------------------------------------------------------- */
|
47
|
+
|
48
|
+
/* Makes clearfix actually work in IE */
|
49
|
+
.clearfix, .container { display:inline-block; }
|
50
|
+
* html .clearfix,
|
51
|
+
* html .container { height:1%; }
|
52
|
+
|
53
|
+
|
54
|
+
/* Forms
|
55
|
+
-------------------------------------------------------------- */
|
56
|
+
|
57
|
+
/* Fixes padding on fieldset */
|
58
|
+
fieldset { padding-top:0; }
|
59
|
+
legend { margin-top:-0.2em; margin-bottom:1em; margin-left:-0.5em; }
|
60
|
+
|
61
|
+
/* Makes classic textareas in IE 6 resemble other browsers */
|
62
|
+
textarea { overflow:auto; }
|
63
|
+
|
64
|
+
/* Makes labels behave correctly in IE 6 and 7 */
|
65
|
+
label { vertical-align:middle; position:relative; top:-0.25em; }
|
66
|
+
|
67
|
+
/* Fixes rule that IE 6 ignores */
|
68
|
+
input.text, input.title, textarea { background-color:#fff; border:1px solid #bbb; }
|
69
|
+
input.text:focus, input.title:focus { border-color:#666; }
|
70
|
+
input.text, input.title, textarea, select { margin:0.5em 0; }
|
71
|
+
input.checkbox, input.radio { position:relative; top:.25em; }
|
72
|
+
|
73
|
+
/* Fixes alignment of inline form elements */
|
74
|
+
form.inline div, form.inline p { vertical-align:middle; }
|
75
|
+
form.inline input.checkbox, form.inline input.radio,
|
76
|
+
form.inline input.button, form.inline button {
|
77
|
+
margin:0.5em 0;
|
78
|
+
}
|
79
|
+
button, input.button { position:relative;top:0.25em; }
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/* --------------------------------------------------------------
|
2
|
+
|
3
|
+
print.css
|
4
|
+
* Gives you some sensible styles for printing pages.
|
5
|
+
* See Readme file in this directory for further instructions.
|
6
|
+
|
7
|
+
Some additions you'll want to make, customized to your markup:
|
8
|
+
#header, #footer, #navigation { display:none; }
|
9
|
+
|
10
|
+
-------------------------------------------------------------- */
|
11
|
+
|
12
|
+
body {
|
13
|
+
line-height: 1.5;
|
14
|
+
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
15
|
+
color:#000;
|
16
|
+
background: none;
|
17
|
+
font-size: 10pt;
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
/* Layout
|
22
|
+
-------------------------------------------------------------- */
|
23
|
+
|
24
|
+
.container {
|
25
|
+
background: none;
|
26
|
+
}
|
27
|
+
|
28
|
+
hr {
|
29
|
+
background:#ccc;
|
30
|
+
color:#ccc;
|
31
|
+
width:100%;
|
32
|
+
height:2px;
|
33
|
+
margin:2em 0;
|
34
|
+
padding:0;
|
35
|
+
border:none;
|
36
|
+
}
|
37
|
+
hr.space {
|
38
|
+
background: #fff;
|
39
|
+
color: #fff;
|
40
|
+
visibility: hidden;
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
/* Text
|
45
|
+
-------------------------------------------------------------- */
|
46
|
+
|
47
|
+
h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; }
|
48
|
+
code { font:.9em "Courier New", Monaco, Courier, monospace; }
|
49
|
+
|
50
|
+
a img { border:none; }
|
51
|
+
p img.top { margin-top: 0; }
|
52
|
+
|
53
|
+
blockquote {
|
54
|
+
margin:1.5em;
|
55
|
+
padding:1em;
|
56
|
+
font-style:italic;
|
57
|
+
font-size:.9em;
|
58
|
+
}
|
59
|
+
|
60
|
+
.small { font-size: .9em; }
|
61
|
+
.large { font-size: 1.1em; }
|
62
|
+
.quiet { color: #999; }
|
63
|
+
.hide { display:none; }
|
64
|
+
|
65
|
+
|
66
|
+
/* Links
|
67
|
+
-------------------------------------------------------------- */
|
68
|
+
|
69
|
+
a:link, a:visited {
|
70
|
+
background: transparent;
|
71
|
+
font-weight:700;
|
72
|
+
text-decoration: underline;
|
73
|
+
}
|
74
|
+
|
75
|
+
/*
|
76
|
+
This has been the source of many questions in the past. This
|
77
|
+
snippet of CSS appends the URL of each link within the text.
|
78
|
+
The idea is that users printing your webpage will want to know
|
79
|
+
the URLs they go to. If you want to remove this functionality,
|
80
|
+
comment out this snippet and make sure to re-compress your files.
|
81
|
+
*/
|
82
|
+
a:link:after, a:visited:after {
|
83
|
+
content: " (" attr(href) ")";
|
84
|
+
font-size: 90%;
|
85
|
+
}
|
86
|
+
|
87
|
+
/* If you're having trouble printing relative links, uncomment and customize this:
|
88
|
+
(note: This is valid CSS3, but it still won't go through the W3C CSS Validator) */
|
89
|
+
|
90
|
+
/* a[href^="/"]:after {
|
91
|
+
content: " (http://www.yourdomain.com" attr(href) ") ";
|
92
|
+
} */
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* --------------------------------------------------------------
|
2
|
+
|
3
|
+
reset.css
|
4
|
+
* Resets default browser CSS.
|
5
|
+
|
6
|
+
-------------------------------------------------------------- */
|
7
|
+
|
8
|
+
html {
|
9
|
+
margin:0;
|
10
|
+
padding:0;
|
11
|
+
border:0;
|
12
|
+
}
|
13
|
+
|
14
|
+
body, div, span, object, iframe,
|
15
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
16
|
+
a, abbr, acronym, address, code,
|
17
|
+
del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
|
18
|
+
fieldset, form, label, legend,
|
19
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
20
|
+
article, aside, dialog, figure, footer, header,
|
21
|
+
hgroup, nav, section {
|
22
|
+
margin: 0;
|
23
|
+
padding: 0;
|
24
|
+
border: 0;
|
25
|
+
font-size: 100%;
|
26
|
+
font: inherit;
|
27
|
+
vertical-align: baseline;
|
28
|
+
}
|
29
|
+
|
30
|
+
/* This helps to make newer HTML5 elements behave like DIVs in older browers */
|
31
|
+
article, aside, details, figcaption, figure, dialog,
|
32
|
+
footer, header, hgroup, menu, nav, section {
|
33
|
+
display:block;
|
34
|
+
}
|
35
|
+
|
36
|
+
/* Line-height should always be unitless! */
|
37
|
+
body {
|
38
|
+
line-height: 1.5;
|
39
|
+
background: white;
|
40
|
+
}
|
41
|
+
|
42
|
+
/* Tables still need 'cellspacing="0"' in the markup. */
|
43
|
+
table {
|
44
|
+
border-collapse: separate;
|
45
|
+
border-spacing: 0;
|
46
|
+
}
|
47
|
+
/* float:none prevents the span-x classes from breaking table-cell display */
|
48
|
+
caption, th, td {
|
49
|
+
text-align: left;
|
50
|
+
font-weight: normal;
|
51
|
+
float:none !important;
|
52
|
+
}
|
53
|
+
table, th, td {
|
54
|
+
vertical-align: middle;
|
55
|
+
}
|
56
|
+
|
57
|
+
/* Remove possible quote marks (") from <q>, <blockquote>. */
|
58
|
+
blockquote:before, blockquote:after, q:before, q:after { content: ''; }
|
59
|
+
blockquote, q { quotes: "" ""; }
|
60
|
+
|
61
|
+
/* Remove annoying border on linked images. */
|
62
|
+
a img { border: none; }
|
63
|
+
|
64
|
+
/* Remember to define your own focus styles! */
|
65
|
+
:focus { outline: 0; }
|
@@ -0,0 +1,123 @@
|
|
1
|
+
/* --------------------------------------------------------------
|
2
|
+
|
3
|
+
typography.css
|
4
|
+
* Sets up some sensible default typography.
|
5
|
+
|
6
|
+
-------------------------------------------------------------- */
|
7
|
+
|
8
|
+
/* Default font settings.
|
9
|
+
The font-size percentage is of 16px. (0.75 * 16px = 12px) */
|
10
|
+
html { font-size:100.01%; }
|
11
|
+
body {
|
12
|
+
font-size: 75%;
|
13
|
+
color: #222;
|
14
|
+
background: #fff;
|
15
|
+
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
/* Headings
|
20
|
+
-------------------------------------------------------------- */
|
21
|
+
|
22
|
+
h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; }
|
23
|
+
|
24
|
+
h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; }
|
25
|
+
h2 { font-size: 2em; margin-bottom: 0.75em; }
|
26
|
+
h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; }
|
27
|
+
h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; }
|
28
|
+
h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; }
|
29
|
+
h6 { font-size: 1em; font-weight: bold; }
|
30
|
+
|
31
|
+
h1 img, h2 img, h3 img,
|
32
|
+
h4 img, h5 img, h6 img {
|
33
|
+
margin: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
/* Text elements
|
38
|
+
-------------------------------------------------------------- */
|
39
|
+
|
40
|
+
p { margin: 0 0 1.5em; }
|
41
|
+
/*
|
42
|
+
These can be used to pull an image at the start of a paragraph, so
|
43
|
+
that the text flows around it (usage: <p><img class="left">Text</p>)
|
44
|
+
*/
|
45
|
+
.left { float: left !important; }
|
46
|
+
p .left { margin: 1.5em 1.5em 1.5em 0; padding: 0; }
|
47
|
+
.right { float: right !important; }
|
48
|
+
p .right { margin: 1.5em 0 1.5em 1.5em; padding: 0; }
|
49
|
+
|
50
|
+
a:focus,
|
51
|
+
a:hover { color: #09f; }
|
52
|
+
a { color: #06c; text-decoration: underline; }
|
53
|
+
|
54
|
+
blockquote { margin: 1.5em; color: #666; font-style: italic; }
|
55
|
+
strong,dfn { font-weight: bold; }
|
56
|
+
em,dfn { font-style: italic; }
|
57
|
+
sup, sub { line-height: 0; }
|
58
|
+
|
59
|
+
abbr,
|
60
|
+
acronym { border-bottom: 1px dotted #666; }
|
61
|
+
address { margin: 0 0 1.5em; font-style: italic; }
|
62
|
+
del { color:#666; }
|
63
|
+
|
64
|
+
pre { margin: 1.5em 0; white-space: pre; }
|
65
|
+
pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; }
|
66
|
+
|
67
|
+
|
68
|
+
/* Lists
|
69
|
+
-------------------------------------------------------------- */
|
70
|
+
|
71
|
+
li ul,
|
72
|
+
li ol { margin: 0; }
|
73
|
+
ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 1.5em; }
|
74
|
+
|
75
|
+
ul { list-style-type: disc; }
|
76
|
+
ol { list-style-type: decimal; }
|
77
|
+
|
78
|
+
dl { margin: 0 0 1.5em 0; }
|
79
|
+
dl dt { font-weight: bold; }
|
80
|
+
dd { margin-left: 1.5em;}
|
81
|
+
|
82
|
+
|
83
|
+
/* Tables
|
84
|
+
-------------------------------------------------------------- */
|
85
|
+
|
86
|
+
/*
|
87
|
+
Because of the need for padding on TH and TD, the vertical rhythm
|
88
|
+
on table cells has to be 27px, instead of the standard 18px or 36px
|
89
|
+
of other elements.
|
90
|
+
*/
|
91
|
+
table { margin-bottom: 1.4em; width:100%; }
|
92
|
+
th { font-weight: bold; }
|
93
|
+
thead th { background: #c3d9ff; }
|
94
|
+
th,td,caption { padding: 4px 10px 4px 5px; }
|
95
|
+
/*
|
96
|
+
You can zebra-stripe your tables in outdated browsers by adding
|
97
|
+
the class "even" to every other table row.
|
98
|
+
*/
|
99
|
+
tbody tr:nth-child(even) td,
|
100
|
+
tbody tr.even td {
|
101
|
+
background: #e5ecf9;
|
102
|
+
}
|
103
|
+
tfoot { font-style: italic; }
|
104
|
+
caption { background: #eee; }
|
105
|
+
|
106
|
+
|
107
|
+
/* Misc classes
|
108
|
+
-------------------------------------------------------------- */
|
109
|
+
|
110
|
+
.small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; }
|
111
|
+
.large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; }
|
112
|
+
.hide { display: none; }
|
113
|
+
|
114
|
+
.quiet { color: #666; }
|
115
|
+
.loud { color: #000; }
|
116
|
+
.highlight { background:#ff0; }
|
117
|
+
.added { background:#060; color: #fff; }
|
118
|
+
.removed { background:#900; color: #fff; }
|
119
|
+
|
120
|
+
.first { margin-left:0; padding-left:0; }
|
121
|
+
.last { margin-right:0; padding-right:0; }
|
122
|
+
.top { margin-top:0; padding-top:0; }
|
123
|
+
.bottom { margin-bottom:0; padding-bottom:0; }
|
@@ -0,0 +1,137 @@
|
|
1
|
+
.container {
|
2
|
+
width: 710px;
|
3
|
+
}
|
4
|
+
|
5
|
+
body {
|
6
|
+
background: #cff;
|
7
|
+
}
|
8
|
+
|
9
|
+
header {
|
10
|
+
padding-top: 20px;
|
11
|
+
}
|
12
|
+
|
13
|
+
header img {
|
14
|
+
padding: 1em;
|
15
|
+
background: #fff;
|
16
|
+
}
|
17
|
+
|
18
|
+
section {
|
19
|
+
margin-top: 1em;
|
20
|
+
font-size: 120%;
|
21
|
+
padding: 20px;
|
22
|
+
background: #fff;
|
23
|
+
}
|
24
|
+
|
25
|
+
section h1 {
|
26
|
+
font-size: 200%;
|
27
|
+
}
|
28
|
+
|
29
|
+
/* Links */
|
30
|
+
|
31
|
+
a {
|
32
|
+
color: #09c;
|
33
|
+
text-decoration: none;
|
34
|
+
}
|
35
|
+
|
36
|
+
a:hover {
|
37
|
+
color: #069;
|
38
|
+
text-decoration: underline;
|
39
|
+
}
|
40
|
+
|
41
|
+
a:visited {
|
42
|
+
color: #069;
|
43
|
+
}
|
44
|
+
|
45
|
+
/* Navigation */
|
46
|
+
|
47
|
+
nav {
|
48
|
+
float: right;
|
49
|
+
}
|
50
|
+
|
51
|
+
nav {
|
52
|
+
background-color: white;
|
53
|
+
padding: 0 0.7em;
|
54
|
+
white-space: nowrap;
|
55
|
+
}
|
56
|
+
|
57
|
+
nav ul {
|
58
|
+
margin: 0;
|
59
|
+
padding: 0;
|
60
|
+
}
|
61
|
+
|
62
|
+
nav ul li {
|
63
|
+
list-style-type: none;
|
64
|
+
display: inline-block;
|
65
|
+
padding: 0.2em 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
nav ul li a {
|
69
|
+
padding: 0 5px;
|
70
|
+
font-weight: bold;
|
71
|
+
}
|
72
|
+
|
73
|
+
nav ul li a:visited {
|
74
|
+
color: #09c;
|
75
|
+
}
|
76
|
+
|
77
|
+
nav ul li a:hover {
|
78
|
+
text-decoration: underline;
|
79
|
+
}
|
80
|
+
|
81
|
+
/* Sign up button */
|
82
|
+
|
83
|
+
a.signup_button {
|
84
|
+
margin-left: auto;
|
85
|
+
margin-right: auto;
|
86
|
+
display: block;
|
87
|
+
text-align: center;
|
88
|
+
width: 190px;
|
89
|
+
color: #fff;
|
90
|
+
background: #006400;
|
91
|
+
font-size: 150%;
|
92
|
+
font-weight: bold;
|
93
|
+
padding: 20px;
|
94
|
+
}
|
95
|
+
|
96
|
+
/* Round corners */
|
97
|
+
|
98
|
+
.round {
|
99
|
+
-moz-border-radius: 10px;
|
100
|
+
-webkit-border-radius: 10px;
|
101
|
+
border-radius: 10px;
|
102
|
+
}
|
103
|
+
|
104
|
+
footer {
|
105
|
+
text-align: center;
|
106
|
+
margin-top: 10px;
|
107
|
+
width: 710px;
|
108
|
+
margin-left: auto;
|
109
|
+
margin-right: auto;
|
110
|
+
}
|
111
|
+
|
112
|
+
footer nav {
|
113
|
+
float: none;
|
114
|
+
}
|
115
|
+
|
116
|
+
/* User show page */
|
117
|
+
table.profile {
|
118
|
+
width: 100%;
|
119
|
+
margin-bottom: 0;
|
120
|
+
}
|
121
|
+
|
122
|
+
td.main {
|
123
|
+
width: 70%;
|
124
|
+
padding: 1em;
|
125
|
+
}
|
126
|
+
|
127
|
+
td.sidebar {
|
128
|
+
width: 30%;
|
129
|
+
padding: 1em;
|
130
|
+
vertical-align: top;
|
131
|
+
background: #ffc;
|
132
|
+
}
|
133
|
+
|
134
|
+
.profile img.gravatar {
|
135
|
+
border: 1px solid #999;
|
136
|
+
margin-bottom: -15px;
|
137
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PagesController do
|
4
|
+
render_views
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@base_title = 'Ruby on Rails Tutorial Sample App'
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "GET 'home'" do
|
11
|
+
it "should be successful" do
|
12
|
+
get 'home'
|
13
|
+
response.should be_success
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have the right title" do
|
17
|
+
get 'home'
|
18
|
+
response.should have_selector("title",
|
19
|
+
:content => @base_title + " | Home")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "GET 'contact'" do
|
24
|
+
it "should be successful" do
|
25
|
+
get 'contact'
|
26
|
+
response.should be_success
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should have the right title" do
|
30
|
+
get 'contact'
|
31
|
+
response.should have_selector("title",
|
32
|
+
:content => @base_title + " | Contact")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "GET 'about'" do
|
37
|
+
it "should be successful" do
|
38
|
+
get 'about'
|
39
|
+
response.should be_success
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have the right title" do
|
43
|
+
get 'about'
|
44
|
+
response.should have_selector("title",
|
45
|
+
:content => @base_title + " | About")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe UsersController do
|
4
|
+
render_views
|
5
|
+
|
6
|
+
describe "GET 'show'" do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@user = Factory(:user)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be successful" do
|
13
|
+
get :show, :id => @user
|
14
|
+
response.should be_success
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should find the right user" do
|
18
|
+
get :show, :id => @user
|
19
|
+
assigns(:user).should == @user
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have the right title" do
|
23
|
+
get :show, :id => @user
|
24
|
+
response.should have_selector("title", :content => @user.name)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should include the user's name" do
|
28
|
+
get :show, :id => @user
|
29
|
+
response.should have_selector("h1", :content => @user.name)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should have a profile image" do
|
33
|
+
get :show, :id => @user
|
34
|
+
response.should have_selector("h1>img", :class => "gravatar")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe User do
|
4
|
+
|
5
|
+
it "has a name method" do
|
6
|
+
# Note: Ruby has a way to ask a class if it has a certain method defined,
|
7
|
+
# like User.respond_to?(:name) returns true or false depending on whether the
|
8
|
+
# class has a method called "name" defined on it
|
9
|
+
# RSpec's way of asserting this is with "should respond_to(:method_name)"
|
10
|
+
|
11
|
+
# Question: How does ActiveRecord know there is a name method? There is no such
|
12
|
+
# method explicitly defined in the class (user.rb)
|
13
|
+
User.should respond_to(:name)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "can set and read back name" do
|
17
|
+
u = User.new
|
18
|
+
u.name = 'Joe Smith'
|
19
|
+
u.name.should == 'Joe Smith'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "requires a name" do
|
23
|
+
no_name_user = User.new # Note: no attributes set at all, i.e. name is nil
|
24
|
+
# Note: the errors array on a model object is populated when valid? is called
|
25
|
+
# RSpec's be_valid is a fancy way of saying valid?.should == true
|
26
|
+
# This will call valid, and populate the error array, so we can check
|
27
|
+
# what failure occurred
|
28
|
+
no_name_user.should_not be_valid
|
29
|
+
no_name_user.errors[:name].should == ["can't be blank"]
|
30
|
+
end
|
31
|
+
|
32
|
+
it "rejects names that are too long" do
|
33
|
+
long_name_user = User.new(:name => 'a' * 51)
|
34
|
+
long_name_user.should_not be_valid
|
35
|
+
long_name_user.errors[:name].should == ["is too long (maximum is 50 characters)"]
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "LayoutLinks" do
|
4
|
+
|
5
|
+
it "should have a Home page at '/'" do
|
6
|
+
get '/'
|
7
|
+
response.should have_selector('title', :content => "Home")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have a Contact page at '/contact'" do
|
11
|
+
get '/contact'
|
12
|
+
response.should have_selector('title', :content => "Contact")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have an About page at '/about'" do
|
16
|
+
get '/about'
|
17
|
+
response.should have_selector('title', :content => "About")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have a Help page at '/help'" do
|
21
|
+
get '/help'
|
22
|
+
response.should have_selector('title', :content => "Help")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should have a signup page at '/signup'" do
|
26
|
+
get '/signup'
|
27
|
+
response.should be_success
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have the right links on the layout" do
|
31
|
+
visit root_path
|
32
|
+
click_link "About"
|
33
|
+
response.should have_selector('title', :content => "About")
|
34
|
+
click_link "Help"
|
35
|
+
response.should have_selector('title', :content => "Help")
|
36
|
+
click_link "Contact"
|
37
|
+
response.should have_selector('title', :content => "Contact")
|
38
|
+
click_link "Home"
|
39
|
+
response.should have_selector('title', :content => "Home")
|
40
|
+
click_link "Sign up now!"
|
41
|
+
response.should be_success
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
|
6
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
+
# in spec/support/ and its subdirectories.
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
# == Mock Framework
|
12
|
+
#
|
13
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
+
#
|
15
|
+
# config.mock_with :mocha
|
16
|
+
# config.mock_with :flexmock
|
17
|
+
# config.mock_with :rr
|
18
|
+
config.mock_with :rspec
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
|
28
|
+
config.include Devise::TestHelpers, :type => :controller
|
29
|
+
end
|