Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filling in layout #2

Merged
merged 18 commits into from Oct 18, 2015
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Gemfile
Expand Up @@ -9,6 +9,10 @@ gem 'pg'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'

# Use Bootstrap
gem 'bootstrap-sass', '~> 3.3.5.1'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
Expand Down
9 changes: 8 additions & 1 deletion Gemfile.lock
Expand Up @@ -37,6 +37,9 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.0)
autoprefixer-rails (5.2.1)
execjs
json
awesome_print (1.6.1)
bcrypt (3.1.10)
better_errors (2.1.1)
Expand All @@ -45,6 +48,9 @@ GEM
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.5.1)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.3.0)
builder (3.2.2)
capybara (2.2.0)
mime-types (>= 1.16)
Expand Down Expand Up @@ -172,7 +178,7 @@ GEM
rubyzip (< 1.0.0)
websocket (~> 1.0.4)
slop (3.6.0)
spring (1.3.2)
spring (1.4.0)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
Expand Down Expand Up @@ -209,6 +215,7 @@ DEPENDENCIES
bcrypt (~> 3.1.7)
better_errors
binding_of_caller
bootstrap-sass (~> 3.3.5.1)
capybara (= 2.2.0)
coffee-rails (~> 4.1.0)
factory_girl_rails (= 4.2.0)
Expand Down
98 changes: 98 additions & 0 deletions app/assets/stylesheets/custom.css.scss
@@ -0,0 +1,98 @@
@import "bootstrap-sprockets";
@import "bootstrap";

/* mixins, variables, etc. */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use // comments everywhere


$gray-medium-light: #eaeaea;

/* universal */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use // comments everywhere

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use // comments everywhere


body {
padding-top: 60px;
}

section {
overflow: auto;
}

textarea {
resize: vertical;
}

.center {
text-align: center;
h1 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be preceded by an empty line

margin-bottom: 10px;
}
}

/* typography */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use // comments everywhere


h1, h2, h3, h4, h5, h6 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector in a comma sequence should be on its own line

line-height: 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector in a comma sequence should be on its own line

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector in a comma sequence should be on its own line


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector in a comma sequence should be on its own line

h1 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector in a comma sequence should be on its own line

font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}

h2 {
font-size: 1.2em;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered color, font-size, font-weight, letter-spacing, margin-bottom, text-align

letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: $gray-light;
}

p {
font-size: 1.1em;
line-height: 1.7em;
}


/* header */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use // comments everywhere


#logo {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using id selectors

float: left;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered color, float, font-size, font-weight, letter-spacing, margin-right, padding-top, text-transform

margin-right: 10px;
font-size: 1.7em;
color: white;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
&:hover {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be preceded by an empty line

color: white;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color white should be written in hexadecimal form as #ffffff
Color literals like white should only be used in variable declarations; they should be referred to via variable everywhere else.

text-decoration: none;
}
}

/* footer */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use // comments everywhere

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use // comments everywhere


footer {
margin-top: 45px;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered border-top, color, margin-top, padding-top

padding-top: 5px;
border-top: 1px solid $gray-medium-light;
color: $gray-light;
a {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be preceded by an empty line

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be preceded by an empty line

color: $gray;
&:hover {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be preceded by an empty line

color: $gray-darker;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be followed by an empty line

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be followed by an empty line

small {
float: left;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be followed by an empty line

ul {
float: right;
list-style: none;
li {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be preceded by an empty line
Selector should have depth of applicability no greater than 2, but was 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selector should have depth of applicability no greater than 2, but was 3

float: left;
margin-left: 15px;
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files should end with a trailing newline

13 changes: 13 additions & 0 deletions app/controllers/static_pages_controller.rb
@@ -0,0 +1,13 @@
class StaticPagesController < ApplicationController
def home
end

def help
end

def about
end

def contact
end
end
8 changes: 8 additions & 0 deletions app/helpers/application_helper.rb
@@ -1,2 +1,10 @@
module ApplicationHelper
def full_title(page_title)
base_title = "Expenses"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
end
12 changes: 12 additions & 0 deletions app/views/layouts/_footer.html.erb
@@ -0,0 +1,12 @@
<footer class="footer">
<small>
Expenses App
by <a href="http://www.mohnishjadwani.com/">Mohnish G J</a>
</small>
<nav>
<ul>
<li><%= link_to "About", about_path %></li>
<li><%= link_to "Contact", contact_path %></li>
</ul>
</nav>
</footer>
18 changes: 13 additions & 5 deletions app/views/layouts/_header.html.erb
@@ -1,8 +1,16 @@
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to "User Registrations App", '#', style:"float:left" %>
<% if logged_in? %>
<%= link_to "Log out", logout_path, method: "delete", style:"float:right" %>
<% end %>
<%= link_to "Expenses App", root_path, id: "logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Help", help_path %></li>
<% if logged_in? %>
<li><%= link_to "Log out", logout_path, method: "delete"%></li>
<% else %>
<li><%= link_to "Log in", login_path %></li>
<% end %>
</ul>
</nav>
</div>
</header>
</header>
4 changes: 4 additions & 0 deletions app/views/layouts/_shim.html.erb
@@ -0,0 +1,4 @@
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js">
</script>
<![endif]-->
32 changes: 18 additions & 14 deletions app/views/layouts/application.html.erb
@@ -1,17 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<%= render 'layouts/header' %>
<br/><br/>
<% flash.each do |message_type, message| %>
<div class="alert alert-<%= message_type %>"><%= message %></div>
<br/>
<% end %>
<%= yield %>
</body>
<head>
<title><%= full_title(yield(:title)) %> </title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<% flash.each do |message_type, message| %>
<div class="alert alert-<%= message_type %>"><%= message %></div>
<br/>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions app/views/static_pages/about.html.erb
@@ -0,0 +1,3 @@
<% provide(:title, 'About') %>
<h2>About</h2>
<p>This is a basic app to help you better track your expenses</p>
3 changes: 3 additions & 0 deletions app/views/static_pages/contact.html.erb
@@ -0,0 +1,3 @@
<% provide(:title, 'Contact') %>
<h2>Contact</h2>
<p>Feel free to contact me on mail4mohnish@gmail.com</p>
3 changes: 3 additions & 0 deletions app/views/static_pages/help.html.erb
@@ -0,0 +1,3 @@
<% provide(:title, 'Help') %>
<h2>Help</h2>
<p>For any queries/feedback on the app feel free to email me on mail4mohnish@gmail.com</p>
8 changes: 8 additions & 0 deletions app/views/static_pages/home.html.erb
@@ -0,0 +1,8 @@
<% provide(:title, 'Home') %>

<div class="center jumbotron">
<h3>Welcome to the Expenses App where tracking your expenses are made easy</h3>


<%= link_to "New user? Sign up now!", signup_path, class: "btn btn-large btn-primary" %>
</div>
4 changes: 4 additions & 0 deletions bin/rails
@@ -1,4 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
4 changes: 4 additions & 0 deletions bin/rake
@@ -1,4 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
15 changes: 15 additions & 0 deletions bin/spring
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
require "rubygems"
require "bundler"

if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
Gem.paths = { "GEM_PATH" => Bundler.bundle_path.to_s }
gem "spring", match[1]
require "spring/binstub"
end
end
6 changes: 5 additions & 1 deletion config/routes.rb
@@ -1,6 +1,10 @@
Rails.application.routes.draw do

root 'sessions#new'
root 'static_pages#home'
get 'home' => 'static_pages#home'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

get 'help' => 'static_pages#help'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

get 'about' => 'static_pages#about'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

get 'contact' => 'static_pages#contact'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


resources :users

Expand Down
18 changes: 18 additions & 0 deletions spec/helpers/application_helper_spec.rb
@@ -0,0 +1,18 @@
require 'rails_helper'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


describe ApplicationHelper do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at block body beginning.

describe "#full_title" do
it "should include the page title" do
expect(full_title("About")).to match(/About/)
end

it "should include the base title" do
expect(full_title("About")).to match(/^Expenses/)
end

it "should not include a bar for the home page" do
expect(full_title("")).not_to match(/\|/)
end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final newline missing.

2 changes: 1 addition & 1 deletion spec/requests/home_page_spec.rb
Expand Up @@ -4,7 +4,7 @@
describe "Home page" do
it "should have the name of the app" do
visit root_path
expect(page).to have_content('User Registrations App')
expect(page).to have_content('Expenses App')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
end

Expand Down