Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
!/log/.keep
!/tmp/.keep
/.idea/*
/config/database.yml
/node_modules
/yarn-error.log

Expand Down
Binary file added app/assets/images/rails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions app/assets/stylesheets/custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@import 'bootstrap-sprockets';
@import 'bootstrap';

/* mixins, variables, etc. */

$gray-medium-light: #eaeaea;

/* universal */

body {
padding-top: 60px;
}

section {
overflow: auto;
}

textarea {
resize: vertical;
}

.center {
text-align: 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 {
color: $gray-light;
font-size: 1.2em;
font-weight: normal;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
}

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

/* header */

#logo {
color: white;
float: left;
font-weight: bold;
font-size: 1.7em;
letter-spacing: -1px;
margin-right: 10px;
padding-top: 9px;
text-transform: uppercase;
&:hover {
color: white;
text-decoration: none;
}
}

/* footer */

footer {
border-top: 1px solid $gray-medium-light;
color: $gray-light;
margin-top: 45px;
padding-top: 5px;
a {
color: $gray;
&:hover {
color: $gray-darker;
}
}
small {
float: left;
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 15px;
}
}
}
13 changes: 13 additions & 0 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class StaticPagesController < ApplicationController
def home
end

def about
end

def contact
end

def help
end
end
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
module ApplicationHelper
def full_title page_title = ""
base_title = t "content.base_title"
page_title.empty? ? base_title : page_title + " | " + base_title
end
end
17 changes: 17 additions & 0 deletions app/views/layouts/_footer.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<footer class="footer">
<small>
<%= t "words.the" %>
<%= link_to t(".rails_book"), "http://www.railstutorial.org/" %>
<%= t "words.by" %>
<%= link_to t(".author"), "http://www.michaelhartl.com/" %>
</small>
<nav>
<ul>
<li><%= link_to t(".about"), about_path %></li>
<li><%= link_to t(".contact"), contact_path %></li>
<li>
<%= link_to t("words.news"), "http://news.railstutorial.org/" %>
</li>
</ul>
</nav>
</footer>
12 changes: 12 additions & 0 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to t(".app_name"), root_path, id: "logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to t("words.home"), root_path %></li>
<li><%= link_to t("words.help"), help_path %></li>
<li><%= link_to t("word.log_in"), "#" %></li>
</ul>
</nav>
</div>
</header>
4 changes: 4 additions & 0 deletions app/views/layouts/_rails_default.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<%= csrf_meta_tags %>
<%= stylesheet_link_tag "application", media: "all",
"data-turbolinks-track": "reload" %>
<%= javascript_include_tag "application", "data-turbolinks-track": "reload" %>
4 changes: 4 additions & 0 deletions app/views/layouts/_shim.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js">
</script>
<![endif]-->
15 changes: 8 additions & 7 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>FirstProject</title>
<%= csrf_meta_tags %>

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<title><%= full_title yield :title %></title>
<%= render "layouts/rails_default" %>
<%= render "layouts/shim" %>
</head>

<body>
<%= yield %>
<%= render "layouts/header" %>
<div class="container">
<%= yield %>
Copy link
Owner Author

Choose a reason for hiding this comment

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

phải làm như A

<%= render "layouts/footer" %>
</div>
</body>
</html>
3 changes: 1 addition & 2 deletions app/views/layouts/mailer.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
/* Email styles need to be inline */
</style>
</head>

<body>
<%= yield %>
</body>
Expand Down
1 change: 1 addition & 0 deletions app/views/static_pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= t ".content" %>
1 change: 1 addition & 0 deletions app/views/static_pages/contact.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= t ".content" %>
2 changes: 2 additions & 0 deletions app/views/static_pages/help.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<% provide :title, t "words.help" %>
<%= t ".content" %>
11 changes: 11 additions & 0 deletions app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="center jumbotron">
<h1><%= t ".wellcome" %></h1>
<h2>
<%= t ".first_content" %>
<%= link_to t(".sub_title_first"), "http://www.railstutorial.org/" %>
<%= t ".sub_content" %>
</h2>
<%= link_to t("words.sign_up_now"), "#", class: "btn btn-lg btn-primary" %>
</div>
<%= link_to image_tag("rails.png", alt: t("rails_logo")),
"http://rubyonrails.org/" %>
54 changes: 0 additions & 54 deletions config/database.yml

This file was deleted.

64 changes: 32 additions & 32 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.

en:
hello: "Hello world"
words:
about: "About"
help: "Help"
contact: "Contact"
news: "News"
the: "the"
by: "by"
is_a: "is a"
log_in: "Log in"
home: "home"
rails_logo: "Rails logo"
sign_up_now: "Sign up now!"
layouts:
footer:
rails_book: "Ruby on Rails Tutorial"
author: "Michael Hartl"
header:
app_name: "Sample app"
static_pages:
about:
content: "wellcome to about page"
contact:
content: "wellcome to contact page"
home:
wellcome: "Welcome to the Sample App"
first_content: "This is the home page for the"
sub_title_first: "Ruby on Rails Tutorial"
sub_content: "sample application."
help:
content: "wellcome to help page"
content:
base_title: "Ruby on Rails Tutorial Sample App"
5 changes: 4 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root "static_pages#home"
get "help", to: "static_pages#help"
get "about", to: "static_pages#about"
get "contact", to: "static_pages#contact"
end
Empty file added config/settings.local.yml
Empty file.
Binary file added kitten.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.