Skip to content

Commit b8fbd48

Browse files
chapter_3_4_5
1 parent 28f4749 commit b8fbd48

File tree

19 files changed

+171
-150
lines changed

19 files changed

+171
-150
lines changed

app/assets/stylesheets/custom.scss

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,66 @@
1+
// Import bootstrap
12
@import 'bootstrap-sprockets';
23
@import 'bootstrap';
34

4-
/* universal */
5+
// ===== Universal Styles =====
56
body {
6-
padding-top: 60px;
7+
padding-top: 60px;
78
}
89

910
section {
10-
overflow: auto;
11+
overflow: auto;
1112
}
1213

1314
textarea {
14-
resize: vertical;
15+
resize: vertical;
1516
}
1617

1718
.center {
18-
text-align: center;
19-
}
19+
text-align: center;
2020

21-
.center h1 {
21+
h1 {
2222
margin-bottom: 10px;
23+
}
2324
}
2425

25-
/* header */
26-
#logo {
27-
color: #fff;
28-
float: left;
29-
font-size: 1.7em;
30-
font-weight: bold;
31-
letter-spacing: -1px;
32-
margin-right: 10px;
33-
padding-top: 9px;
34-
text-transform: uppercase;
26+
.notice {
27+
color: green;
3528
}
3629

37-
#logo:hover {
30+
// ===== Header / Logo =====
31+
#logo {
32+
float: left;
33+
padding-top: 9px;
34+
margin-right: 10px;
35+
font-size: 1.7em;
36+
font-weight: bold;
37+
letter-spacing: -1px;
38+
text-transform: uppercase;
39+
color: #fff;
40+
41+
&:hover {
3842
color: #fff;
3943
text-decoration: none;
44+
}
45+
}
46+
47+
// ===== Locale Switcher =====
48+
.locale-switcher {
49+
margin: 20px 0;
50+
text-align: right;
51+
52+
ul {
53+
list-style: none;
54+
margin: 0;
55+
padding: 0;
56+
57+
li {
58+
display: inline-block;
59+
60+
a {
61+
font-weight: bold;
62+
margin: 0 5px;
63+
}
64+
}
65+
}
4066
}

app/javascript/application.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2-
import "@hotwired/turbo-rails"
3-
import "controllers"
2+
import '@hotwired/turbo-rails'
3+
import 'controllers'
4+

app/javascript/controllers/application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Application } from "@hotwired/stimulus"
1+
import { Application } from '@hotwired/stimulus'
22

33
const application = Application.start()
44

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Controller } from "@hotwired/stimulus"
1+
import { Controller } from '@hotwired/stimulus'
22

33
export default class extends Controller {
44
connect() {
5-
this.element.textContent = "Hello World!"
5+
this.element.textContent = 'Hello World!'
66
}
77
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Import and register all your controllers from the importmap under controllers/*
22

3-
import { application } from "controllers/application"
3+
import { application } from 'controllers/application'
44

55
// Eager load all controllers defined in the import map under controllers/**/*_controller
6-
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7-
eagerLoadControllersFrom("controllers", application)
6+
import { eagerLoadControllersFrom } from '@hotwired/stimulus-loading'
7+
eagerLoadControllersFrom('controllers', application)
88

99
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10-
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11-
// lazyLoadControllersFrom("controllers", application)
10+
// import { lazyLoadControllersFrom } from '@hotwired/stimulus-loading'
11+
// lazyLoadControllersFrom('controllers', application)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<p> Zone: <%= zone %>
2-
<p> Date: <%= date %>
1+
<p><%= t("zones.zone_label") %>: <%= zone %></p>
2+
<p><%= t("zones.date_label") %>: <%= date %></p>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<h1>Editing zone</h1>
2-
<%= render partial: "form", locals: {zone: @zone, date: @date} %>
1+
<h1><%= t("zones.edit_zone") %></h1>
2+
<%= render partial: "form", locals: {zone: @zone, date: @date} %>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<h1>New zone</h1>
2-
<%= render partial: "form", locals: {zone: @zone, date: @date} %>
1+
<h1><%= t("zones.new_zone") %></h1>
2+
<%= render partial: "form", locals: {zone: @zone, date: @date} %>

app/views/layouts/_header.html.erb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
<li><%= link_to t("navbar.home"), root_path %></li>
77
<li><%= link_to t("navbar.help"), help_path %></li>
88
<li><%= link_to t("navbar.login"), "#"%></li>
9-
<%= link_to "English", url_for(locale: :en) %> |
10-
<%= link_to "Tiếng Việt", url_for(locale: :vi) %>
119
</ul>
1210
</nav>
1311
</div>
14-
</header>
12+
</header>
13+
14+
<div class="locale-switcher">
15+
<ul class="nav navbar-nav navbar-right">
16+
<li><%= link_to t("languages.en") , request.params.merge(locale: :en) %></li>
17+
<li><%= link_to t("languages.vi"), request.params.merge(locale: :vi) %></li>
18+
</ul>
19+
</div>

app/views/products/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<% if product.errors.any? %>
33
<div style="color: red">
44
<h2>
5-
<%= t('errors.template.header', count: product.errors.count, model: product.class.model_name.human) %>
5+
<%= t("errors.template.header", count: product.errors.count, model: product.class.model_name.human) %>
66
</h2>
77
<ul>
88
<% product.errors.each do |error| %>

0 commit comments

Comments
 (0)