Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move CSS into Rails 3.1 asset pipeline. Make better use of the page t…

…itle and add some tests.
  • Loading branch information...
commit 55464bb0a8b5f559acadaf9bbe2078a76b391d7c 1 parent 69fee0e
@esambo authored
View
102 app/assets/stylesheets/welcome.css.scss
@@ -1,3 +1,105 @@
// Place all the styles related to the Welcome controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+
+h1 {
+ /*font-size: 28px;*/
+ /*color: #000;*/
+}
+
+#content {
+ float: left;
+ /*background-color: white;*/
+ /*border: 3px solid #aaa;*/
+ /*border-top: none;*/
+ padding: 25px;
+ /*width: 500px;*/
+}
+
+#sidebar {
+ float: right;
+ width: 250px;
+}
+
+#footer {
+ clear: both;
+}
+
+#header, #history {
+ /*padding-left: 75px;*/
+ /*padding-right: 30px;*/
+}
+
+#header {
+ /*background-image: url("assets/rails.png");*/
+ /*background-repeat: no-repeat;*/
+ /*background-position: top left;*/
+ /*height: 64px;*/
+}
+#header h1, #header h2 {margin: 0}
+#header h2 {
+ /*color: #888;*/
+ font-weight: normal;
+ font-size: 16px;
+}
+
+#history {
+ /*border-top: 1px solid #ccc;*/
+ margin-top: 25px;
+ padding-top: 15px;
+}
+#history h1 {
+ margin: 0;
+ font-size: 20px;
+}
+#history h2 {
+ margin: 0;
+ font-size: 14px;
+ font-weight: normal;
+ color: #333;
+ margin-bottom: 25px;
+}
+#history ol {
+ margin-left: 0;
+ padding-left: 0;
+}
+#history li {
+ font-size: 18px;
+ color: #888;
+ margin-bottom: 25px;
+}
+#history li h2 {
+ margin: 0;
+ font-weight: normal;
+ font-size: 18px;
+ color: #333;
+}
+#history li p {
+ color: #555;
+ font-size: 13px;
+}
+
+#sidebar ul {
+ margin-left: 0;
+ padding-left: 0;
+}
+#sidebar ul h3 {
+ margin-top: 25px;
+ font-size: 16px;
+ padding-bottom: 10px;
+ /*border-bottom: 1px solid #ccc;*/
+}
+#sidebar li {
+ list-style-type: none;
+}
+#sidebar ul.links li {
+ margin-bottom: 5px;
+}
+
+/* http://www.skinyourscreen.com/site/Downloads/killer-css3-web-buttons
+ Used style2 as big
+ Used style4:hover to be big:hover
+*/
+a.big_button{text-decoration:none;paddin:25px;color:white;padding:12px;font-family:"Arvo";text-shadow:1px 1px 1px #444;text-align:center;width:140px;-webkit-border-radius:18px;-moz-border-radius:18px;border-radius:18px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-moz-transition:all 0.3s ease-out;-o-transition:all 0.3s ease-out;-webkit-transition:all 0.3s ease-out;-ms-transition:all 0.3s ease-out;transition:all 0.3s ease-out;text-shadow:1px 1px 1px #021d35;border:1px solid #2c98f6;background-color:#59aef8;background-image:-moz-linear-gradient(19% 90% 90deg, #2c98f6, #0761b0, #59aef8 60%);background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#59aef8), to(#2c98f6), color-stop(0.6, #0761b0));background-image:-o-linear-gradient(top, #59aef8, #0761b0 50%, #2c98f6);background-image:linear-gradient(top, #59aef8, #2c98f6);-moz-box-shadow:inset 0px 3px 4px #ffffff,inset 0px 0px 6px #0761b0,0px 4px 15px #444444;-webkit-box-shadow:inset 0px 3px 4px #ffffff,inset 0px 0px 6px #0761b0,0px 4px 15px #444444;box-shadow:inset 0px 3px 4px #ffffff,inset 0px 0px 6px #0761b0,0px 4px 15px #444444;}
+a.big_button:hover{text-decoration:none;paddin:25px;border:10px solid white;background-color:#2e9fe6;background-image:-webkit-gradient(linear, 0% 0%, 0% 81%, from(#b7def6), to(#5cb4eb), color-stop(0.6, #2e9fe6), color-stop(0.6, #1885c9));background-image:-moz-linear-gradient(100% 100% 90deg, #5cb4eb, #5cb4eb, #1885c9 48%, #2e9fe6 48%, #b7def6 100%);background-image:-o-linear-gradient(top, #b7def6, #2e9fe6 48%, #1885c9 49%, #5cb4eb);background-image:linear-gradient(top, #b7def6, #2e9fe6 48%, #1885c9 49%, #5cb4eb);-moz-box-shadow:inset 0 0 7px #1885c9,inset 0 0 3px #1885c9,0 4px 15px #1576b2;-webkit-box-shadow:inset 0 0 7px #1885c9,inset 0 0 3px #1885c9,0 4px 15px #1576b2;box-shadow:inset 0 0 7px #1885c9,inset 0 0 3px #1885c9,0 4px 15px #1576b2;}
+
View
17 app/helpers/application_helper.rb
@@ -1,23 +1,8 @@
module ApplicationHelper
- def title(page_title = nil, show_title = true)
- @show_title = show_title
- if page_title.nil?
- @content_for_title
- elsif page_title.blank?
- @content_for_title = "#{controller.controller_name.titleize} #{controller.action_name.titleize}"
- else
- @content_for_title = page_title.to_s
- end
- end
-
- def show_title?
- @show_title
- end
-
def stylesheet(*args)
content_for(:head) { stylesheet_link_tag(*args) }
end
-
+
def javascript(*args)
content_for(:head) { javascript_include_tag(*args) }
end
View
14 app/helpers/title_helper.rb
@@ -0,0 +1,14 @@
+module TitleHelper
+ def title(page_title = nil, show_title = true)
+ @show_title = show_title
+ @content_for_title = page_title
+ end
+
+ def show_title?
+ @show_title
+ end
+
+ def get_title
+ @content_for_title ||= "#{controller.controller_name.titleize} #{controller.action_name.titleize}"
+ end
+end
View
7 app/views/layouts/application.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>Time Flies By | <%= title %></title>
+ <title>Time Flies By | <%= get_title %></title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
@@ -31,6 +31,11 @@
</div>
<div style="clear:both"></div>
<hr>
+ <%- if show_title? -%>
+ <h1><%= get_title %></h1>
+ <%- end -%>
+
+
<%= yield %>
</div>
<script type="text/javascript">
View
50 app/views/layouts/tasks.html.erb
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Time Flies By | <%= title %></title>
- <%= stylesheet_link_tag "application" %>
- <%= javascript_include_tag "application" %>
- <%= csrf_meta_tags %>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <%= yield(:head) %>
-</head>
-<body>
- <div id="container">
- <%- flash.each do |name, msg| -%>
- <%= content_tag :div, msg, :id => "flash_#{name}" %>
- <%- end -%>
-
- <div id="user_login_box" style="float:right">
- <% if user_signed_in? -%>
- <%= current_user.email %> |
- <%= link_to 'My info', edit_user_registration_path %> |
- <%= link_to 'Sign out', destroy_user_session_path, :method => :delete %>
- <% else -%>
- <%= link_to 'Register', new_user_registration_path %> |
- <%= link_to 'Sign in', new_user_session_path %>
- <% end -%>
- </div>
- <div style="float:left">
- <%= link_to 'Home', root_path %>
- | <%= link_to 'New Task', new_task_path %>
- | <%= link_to 'Tasks', tasks_path %>
- | <%= link_to 'Tags', tags_path %>
- </div>
- <div style="clear:both"></div>
- <hr>
- <%- if show_title? -%>
- <h1><%= title %></h1>
- <%- end -%>
-
-
- <%= yield %>
- </div>
- <script type="text/javascript">
- (function() {
- var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
- uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/DzJwKC8dwPhKxagEOUjpbA.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
- })();
- </script>
-</body>
-</html>
View
2  app/views/tags/edit.html.erb
@@ -1,4 +1,4 @@
-<h1>Editing Tag</h1>
+<% title 'Editing Tag' -%>
<%= render 'form' %>
View
2  app/views/tags/index.html.erb
@@ -1,4 +1,4 @@
-<h1>Tags</h1>
+<% title 'Tags' -%>
<p>
Manage tags to be used by tasks
</p>
View
2  app/views/tags/new.html.erb
@@ -1,4 +1,4 @@
-<h1>New Tag</h1>
+<% title 'New Tag' -%>
<%= render 'form' %>
View
2  app/views/tags/show.html.erb
@@ -1,4 +1,4 @@
-<h1>Tag</h1>
+<% title 'Tag' -%>
<p id="notice"><%= notice %></p>
<p>
View
110 app/views/welcome/index.html.erb
@@ -1,101 +1,4 @@
-<% title "Time Flies By" -%>
-
-<style type="text/css" media="screen">
- h1 {
- /*font-size: 28px;*/
- /*color: #000;*/
- }
-
- #content {
- float: left;
- /*background-color: white;*/
- /*border: 3px solid #aaa;*/
- /*border-top: none;*/
- padding: 25px;
- /*width: 500px;*/
- }
-
- #sidebar {
- float: right;
- width: 250px;
- }
-
- #footer {
- clear: both;
- }
-
- #header, #history {
- /*padding-left: 75px;*/
- /*padding-right: 30px;*/
- }
-
- #header {
- /*background-image: url("assets/rails.png");*/
- /*background-repeat: no-repeat;*/
- /*background-position: top left;*/
- /*height: 64px;*/
- }
- #header h1, #header h2 {margin: 0}
- #header h2 {
- /*color: #888;*/
- font-weight: normal;
- font-size: 16px;
- }
-
- #history {
- /*border-top: 1px solid #ccc;*/
- margin-top: 25px;
- padding-top: 15px;
- }
- #history h1 {
- margin: 0;
- font-size: 20px;
- }
- #history h2 {
- margin: 0;
- font-size: 14px;
- font-weight: normal;
- color: #333;
- margin-bottom: 25px;
- }
- #history ol {
- margin-left: 0;
- padding-left: 0;
- }
- #history li {
- font-size: 18px;
- color: #888;
- margin-bottom: 25px;
- }
- #history li h2 {
- margin: 0;
- font-weight: normal;
- font-size: 18px;
- color: #333;
- }
- #history li p {
- color: #555;
- font-size: 13px;
- }
-
- #sidebar ul {
- margin-left: 0;
- padding-left: 0;
- }
- #sidebar ul h3 {
- margin-top: 25px;
- font-size: 16px;
- padding-bottom: 10px;
- /*border-bottom: 1px solid #ccc;*/
- }
- #sidebar li {
- list-style-type: none;
- }
- #sidebar ul.links li {
- margin-bottom: 5px;
- }
-
-</style>
+<% title "Home", false -%>
<div id="content">
<div id="header">
@@ -106,17 +9,6 @@
<div>
<h2>Already know what you are doing?</h2>
<div style="padding:1em;">
- <style type="text/css" media="screen">
- /* http://www.skinyourscreen.com/site/Downloads/killer-css3-web-buttons
- Used style2 as big
- Used style4:hover to be big:hover
- */
-
- a.big_button{text-decoration:none;paddin:25px;color:white;padding:12px;font-family:"Arvo";text-shadow:1px 1px 1px #444;text-align:center;width:140px;-webkit-border-radius:18px;-moz-border-radius:18px;border-radius:18px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;-moz-transition:all 0.3s ease-out;-o-transition:all 0.3s ease-out;-webkit-transition:all 0.3s ease-out;-ms-transition:all 0.3s ease-out;transition:all 0.3s ease-out;text-shadow:1px 1px 1px #021d35;border:1px solid #2c98f6;background-color:#59aef8;background-image:-moz-linear-gradient(19% 90% 90deg, #2c98f6, #0761b0, #59aef8 60%);background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#59aef8), to(#2c98f6), color-stop(0.6, #0761b0));background-image:-o-linear-gradient(top, #59aef8, #0761b0 50%, #2c98f6);background-image:linear-gradient(top, #59aef8, #2c98f6);-moz-box-shadow:inset 0px 3px 4px #ffffff,inset 0px 0px 6px #0761b0,0px 4px 15px #444444;-webkit-box-shadow:inset 0px 3px 4px #ffffff,inset 0px 0px 6px #0761b0,0px 4px 15px #444444;box-shadow:inset 0px 3px 4px #ffffff,inset 0px 0px 6px #0761b0,0px 4px 15px #444444;}
-
- a.big_button:hover{text-decoration:none;paddin:25px;border:10px solid white;background-color:#2e9fe6;background-image:-webkit-gradient(linear, 0% 0%, 0% 81%, from(#b7def6), to(#5cb4eb), color-stop(0.6, #2e9fe6), color-stop(0.6, #1885c9));background-image:-moz-linear-gradient(100% 100% 90deg, #5cb4eb, #5cb4eb, #1885c9 48%, #2e9fe6 48%, #b7def6 100%);background-image:-o-linear-gradient(top, #b7def6, #2e9fe6 48%, #1885c9 49%, #5cb4eb);background-image:linear-gradient(top, #b7def6, #2e9fe6 48%, #1885c9 49%, #5cb4eb);-moz-box-shadow:inset 0 0 7px #1885c9,inset 0 0 3px #1885c9,0 4px 15px #1576b2;-webkit-box-shadow:inset 0 0 7px #1885c9,inset 0 0 3px #1885c9,0 4px 15px #1576b2;box-shadow:inset 0 0 7px #1885c9,inset 0 0 3px #1885c9,0 4px 15px #1576b2;}
-
- </style>
<%= link_to 'New Task', new_task_path, :class => 'big_button' %>
</div>
</div>
View
23 spec/helpers/title_helper_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe TitleHelper do
+
+ it 'sets and gets the title' do
+ title('test').should == 'test'
+ end
+
+ it 'defaults to showing the title' do
+ title('test')
+ show_title?.should == true
+ end
+
+ it 'will not show the title' do
+ title('test', false)
+ show_title?.should == false
+ end
+
+ it 'gets the title' do
+ title('test')
+ get_title.should == 'test'
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.