-
Notifications
You must be signed in to change notification settings - Fork 0
chap 5 filling the layout #12
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
Open
haihv96
wants to merge
1
commit into
master
Choose a base branch
from
chap-5_filling-in-the-layout
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| !/log/.keep | ||
| !/tmp/.keep | ||
| /.idea/* | ||
| /config/database.yml | ||
| /node_modules | ||
| /yarn-error.log | ||
|
|
||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 %> | ||
| <%= render "layouts/footer" %> | ||
| </div> | ||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <%= t ".content" %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <%= t ".content" %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| <% provide :title, t "words.help" %> | ||
| <%= t ".content" %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/" %> |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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