Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Finished routes and layouts. Added bootstrap

  • Loading branch information...
commit 0ef0f9edb13718b605bf8fc1a9d5bdc58b956795 1 parent 670b64b
@cpursley authored
View
3  Gemfile
@@ -1,6 +1,7 @@
source 'https://rubygems.org'
gem 'rails', '3.2.8'
+gem 'bootstrap-sass'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -37,3 +38,5 @@ gem 'jquery-rails'
# To use debugger
# gem 'debugger'
+
+# git checkout -b routes-layouts
View
2  Gemfile.lock
@@ -30,6 +30,7 @@ GEM
multi_json (~> 1.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
+ bootstrap-sass (2.0.4.0)
builder (3.0.4)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -112,6 +113,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ bootstrap-sass
coffee-rails (~> 3.2.1)
devise
jquery-rails
View
102 app/assets/stylesheets/custom.css.scss
@@ -0,0 +1,102 @@
+@import "bootstrap";
+
+/* universal */
+
+html {
+ overflow-y: scroll;
+}
+
+body {
+ padding-top: 60px;
+}
+
+section {
+ overflow: auto;
+}
+
+textarea {
+ resize: vertical;
+}
+
+.center {
+ text-align: center;
+}
+
+.center h1 {
+ margin-bottom: 10px;
+}
+
+/* typography */
+
+h1, h2, h3, h4, h5, h6 {
+ line-height: 1;
+}
+
+h1 {
+ font-size: 3em;
+ letter-spacing: -2px;
+ margin-bottom: 30px;
+ text-align: center;
+}
+
+h2 {
+ font-size: 1.7em;
+ letter-spacing: -1px;
+ margin-bottom: 30px;
+ text-align: center;
+ font-weight: normal;
+ color: #999;
+}
+
+p {
+ font-size: 1.1em;
+ line-height: 1.7em;
+}
+
+#logo {
+ float: left;
+ margin-right: 10px;
+ font-size: 1.7em;
+ color: #fff;
+ text-transform: uppercase;
+ letter-spacing: -1px;
+ padding-top: 9px;
+ font-weight: bold;
+ line-height: 1;
+}
+
+#logo:hover {
+ color: #fff;
+ text-decoration: none;
+}
+
+/* footer */
+
+footer {
+ margin-top: 45px;
+ padding-top: 5px;
+ border-top: 1px solid #eaeaea;
+ color: #999;
+}
+
+footer a {
+ color: #555;
+}
+
+footer a:hover {
+ color: #222;
+}
+
+footer small {
+ float: left;
+}
+
+footer ul {
+ float: right;
+ list-style: none;
+}
+
+footer ul li {
+ float: left;
+ margin-left: 10px;
+}
View
5 app/controllers/application_controller.rb
@@ -1,3 +1,8 @@
class ApplicationController < ActionController::Base
protect_from_forgery
+
+ before_filter :authenticate_user!, :except => [:index, :show, :about]
+
+ def about
+ end
end
View
14 app/views/dreams/about.html.erb
@@ -0,0 +1,14 @@
+<div class="center hero-unit">
+ <h1>About Lucidly</h1>
+
+ <h4>
+ Lucidly is a dream journal.
+ </h4>
+
+ <% if user_signed_in? %>
+ <% else %>
+ <%= link_to "Sign up", new_user_registration_path, class: "btn btn-large btn-primary" %>
+ <% end %>
+
+</div>
+
View
48 app/views/dreams/index.html.erb
@@ -1,42 +1,12 @@
-<h1>Listing dreams</h1>
-
-<table>
- <tr>
- <th>User</th>
- <th>Title</th>
- <th>Teaser</th>
- <th>Body</th>
- <th>Version</th>
- <th>Changelog</th>
- <th>Message</th>
- <th>Freezebody</th>
- <th>State</th>
- <th>Submitted</th>
- <th>Accepted</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
-
-<% @dreams.each do |dream| %>
- <tr>
- <td><%= dream.user_id %></td>
- <td><%= dream.title %></td>
- <td><%= dream.teaser %></td>
- <td><%= dream.body %></td>
- <td><%= dream.version %></td>
- <td><%= dream.changelog %></td>
- <td><%= dream.message %></td>
- <td><%= dream.freezebody %></td>
- <td><%= dream.state %></td>
- <td><%= dream.submitted %></td>
- <td><%= dream.accepted %></td>
- <td><%= link_to 'Show', dream %></td>
- <td><%= link_to 'Edit', edit_dream_path(dream) %></td>
- <td><%= link_to 'Destroy', dream, method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
-<% end %>
-</table>
+<section id = "dreams">
+ <% @dreams.each do |dream| %>
+ <dream class="dream">
+ <div class = "title"><%= link_to dream.title, dream %></div>
+ <div class = "byline"><%= dream.created_at.strftime("%B %d, %Y") %></div>
+ <div class = "teaser"><%= dream.teaser %></div>
+ </dream>
+ <% end %>
+</section>
<br />
View
64 app/views/dreams/show.html.erb
@@ -1,59 +1,11 @@
-<p id="notice"><%= notice %></p>
-
-<p>
- <b>User:</b>
- <%= @dream.user_id %>
-</p>
-
-<p>
- <b>Title:</b>
- <%= @dream.title %>
-</p>
-
-<p>
- <b>Teaser:</b>
- <%= @dream.teaser %>
-</p>
-
-<p>
- <b>Body:</b>
- <%= @dream.body %>
-</p>
-
-<p>
- <b>Version:</b>
- <%= @dream.version %>
-</p>
-
-<p>
- <b>Changelog:</b>
- <%= @dream.changelog %>
-</p>
-
-<p>
- <b>Message:</b>
- <%= @dream.message %>
-</p>
-
-<p>
- <b>Freezebody:</b>
- <%= @dream.freezebody %>
-</p>
-
-<p>
- <b>State:</b>
- <%= @dream.state %>
-</p>
-
-<p>
- <b>Submitted:</b>
- <%= @dream.submitted %>
-</p>
-
-<p>
- <b>Accepted:</b>
- <%= @dream.accepted %>
-</p>
+<section id="dreamlebody">
+ <h2><%= @dream.title %></h2>
+ <h3><%= @dream.teaser %></h3>
+
+ <div class="textile">
+ <%= @dream.body %>
+ </div>
+</section>
<%= link_to 'Edit', edit_dream_path(@dream) %> |
View
10 app/views/layouts/_footer.html.erb
@@ -0,0 +1,10 @@
+ <footer id="page_footer">
+ <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
+ <img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" />
+ </a>
+ <br />
+ All content is licensed under
+ <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
+ Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
+ </a>.
+ </footer>
View
21 app/views/layouts/_header.html.erb
@@ -0,0 +1,21 @@
+<header class="navbar navbar-fixed-top navbar-inverse">
+ <div class="navbar-inner">
+ <div class="container">
+ <%= link_to "Lucidly: A dream journal", '/', id: "logo" %>
+ <nav>
+ <ul class="nav pull-right">
+ <li><%= link_to "About", about_dreams_path %></li>
+ <li><%= link_to "Featured Dreams", root_path %></li>
+ <li><%= link_to "All Dreams", all_dreams_path %></li>
+ <% if user_signed_in? %>
+ <li><%= link_to "My Profile", edit_user_registration_path %></li>
+ <li><%= link_to "Sign out", destroy_user_session_path %></li>
+ <% else %>
+ <li><%= link_to "Sign up", new_user_registration_path %></li>
+ <li><%= link_to "Sign in", new_user_session_path %></li>
+ <% end %>
+ </ul>
+ </nav>
+ </div>
+ </div>
+</header>
View
3  app/views/layouts/_shim.html.erb
@@ -0,0 +1,3 @@
+<!--[if lt IE 9]>
+<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+<![endif]-->
View
58 app/views/layouts/application.html.erb
@@ -2,56 +2,24 @@
<html>
<head>
<title>Lucidly</title>
- <%= stylesheet_link_tag :all %>
- <%= javascript_include_tag :defaults %>
+ <%= stylesheet_link_tag "application", media: "all" %>
+ <%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
+ <%= render 'layouts/shim' %>
</head>
<body>
- <header id="page_header">
- <nav id="nav_user">
- <ul>
- <% if user_signed_in? %>
- <li><span id="currentuser"><%= current_user.email %></span></li>
- &nbsp;
- <li><%= link_to "My Profile", edit_user_registration_path %></li>
- <li><%= link_to "Sign out", destroy_user_session_path %></li>
- <% else %>
- <li><%= link_to "Sign up", new_user_registration_path %></li>
- <li><%= link_to "Sign in", new_user_session_path %></li>
- <% end %>
- </ul>
- </nav>
-
- <div id="page_title">
- <h1>Lucidly <span>A dream journal</span></h1>
- </div>
- </header>
-
-
-
+ <%= render 'layouts/header' %>
+ <div class="container">
<section id="maincontainer">
- <section id="content">
- <section id="flash">
- <% flash.each do |key, value| %>
- <div class="flash <%= key %>"><%= value %></div>
- <% end %>
- </section>
-
- <%= yield %>
-
- </section>
+ <section id="flash">
+ <% flash.each do |key, value| %>
+ <div class="flash <%= key %>"><%= value %></div>
+ <% end %>
+ </section>
+ <%= yield %>
+ </div>
- <footer id="page_footer">
- <hr />
- <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
- <img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" />
- </a>
- <br />
- All content is licensed under
- <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
- Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
- </a>.
- </footer>
+ <%= render 'layouts/footer' %>
</body>
</html>
View
7 config/routes.rb
@@ -1,7 +1,12 @@
Lucidly::Application.routes.draw do
devise_for :users
- resources :dreams
+ resources :dreams do
+ collection do
+ get 'about'
+ get 'all'
+ end
+ end
root :to => "dreams#index"
Please sign in to comment.
Something went wrong with that request. Please try again.