Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
509bfcc
Fix bug show page
Oct 25, 2013
5be8b3e
Merge branch 'develop'
Oct 25, 2013
e0180ed
Refs #9349 Translate to Vietnamese in Home page
Nov 25, 2013
f1d59f6
Merge pull request #50 from 22dfly/9349
Nov 25, 2013
6396ebf
refs #9346 change pagination
canhnnt Nov 25, 2013
23c7326
Merge pull request #51 from canhnnt/9346
Nov 25, 2013
1e82c92
ref #9348 Translate to Vietnamese in User#edit page
Nov 25, 2013
f02d39e
Merge pull request #52 from NghiemThai/9348
Nov 25, 2013
27c079d
Refs #9367 remove delete user link in User#index
Nov 25, 2013
197ae68
refs #9364 Delete Help page
canhnnt Nov 25, 2013
ceb4365
Merge pull request #54 from 22dfly/9367
Nov 25, 2013
d70a0ae
Merge pull request #53 from canhnnt/9364
Nov 25, 2013
a2f4078
ref 9366 Add user email in User#index
Nov 25, 2013
79e948c
Merge pull request #55 from NghiemThai/9366
Nov 25, 2013
80944e6
refs #task10099 fix bug when can not access localhost:3000
VanYen Dec 24, 2013
46cc51e
Merge pull request #56 from VanYen/task#10099
Dec 24, 2013
cba28de
refs task#10100 Change pagination
Dec 24, 2013
a1f7225
Merge pull request #57 from TrAnh/task#10100
Dec 24, 2013
7550ac4
refs #task10103 Translate some text into english
VanYen Dec 24, 2013
f0d0b9b
refs task#10105 Remove avatar field when change user infomation
Dec 24, 2013
dfc8d81
Merge pull request #58 from VanYen/task#10103
Dec 24, 2013
00aaaa1
Merge pull request #59 from TrAnh/task#10105
Dec 24, 2013
1afcf37
Update README.md
Dec 27, 2013
d789ed5
Update README.md
Dec 27, 2013
92558ca
refs #10211 Translate to Vietnamese in User#edit page
ducnhat1989 Dec 27, 2013
4a221f6
Merge pull request #65 from ducnhat1989/task#10211
Dec 27, 2013
630faf1
refs task10210 Name of task
quanghung Dec 27, 2013
8b29e17
refs ##10212 Add phone field to User table.
HaChan Dec 27, 2013
1b153e3
refs task#10208 change paignation
gmini196 Dec 27, 2013
68ce6bd
Merge pull request #63 from gmini196/task#10208
Dec 27, 2013
97755f7
Merge pull request #66 from quanghung/task10210
Dec 27, 2013
6be21fe
Merge pull request #64 from HaChan/task#10212
Dec 27, 2013
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
66 changes: 33 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.0)
arel (4.0.1)
atomic (1.1.14)
bcrypt-ruby (3.0.1)
better_errors (1.0.1)
better_errors (1.1.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
Expand All @@ -47,7 +47,7 @@ GEM
celluloid (0.15.2)
timers (~> 1.1.0)
choice (0.1.6)
coderay (1.0.9)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
Expand All @@ -57,13 +57,13 @@ GEM
coffee-script-source (1.6.3)
columnize (0.3.6)
debug_inspector (0.0.2)
debugger (1.6.2)
debugger (1.6.4)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
debugger-ruby_core_source (~> 1.2.3)
debugger-ruby_core_source (~> 1.3.0)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.2.3)
diff-lcs (1.2.4)
debugger-ruby_core_source (1.3.0)
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.2.0)
Expand All @@ -73,25 +73,25 @@ GEM
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
ffi (1.9.0)
ffi (1.9.3)
formatador (0.2.4)
guard (2.1.0)
guard (2.2.5)
formatador (>= 0.2.4)
listen (~> 2.1)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
hike (1.2.3)
i18n (0.6.5)
jbuilder (1.5.2)
i18n (0.6.9)
jbuilder (1.5.3)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
libv8 (3.16.14.3)
listen (2.1.1)
listen (2.4.0)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
Expand All @@ -100,17 +100,17 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25)
mini_portile (0.5.1)
mime-types (1.25.1)
mini_portile (0.5.2)
minitest (4.7.5)
mono_logger (1.1.0)
multi_json (1.8.2)
nokogiri (1.6.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
pg (0.15.1)
polyglot (0.3.3)
pry (0.9.12.2)
coderay (~> 1.0.5)
pry (0.9.12.4)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry-debugger (0.2.2)
Expand All @@ -119,7 +119,7 @@ GEM
pry-rails (0.3.2)
pry (>= 0.9.10)
rack (1.5.2)
rack-protection (1.5.0)
rack-protection (1.5.1)
rack
rack-test (0.6.2)
rack (>= 1.0)
Expand All @@ -139,31 +139,31 @@ GEM
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.1)
rails_serve_static_assets (0.0.2)
rails_stdout_logging (0.0.3)
railties (4.0.0)
actionpack (= 4.0.0)
activesupport (= 4.0.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.1.0)
rake (10.1.1)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
rb-inotify (0.9.3)
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
redis (3.0.5)
redis-namespace (1.3.1)
redis (~> 3.0.0)
redis (3.0.6)
redis-namespace (1.4.1)
redis (~> 3.0.4)
ref (1.0.5)
resque (1.25.1)
mono_logger (~> 1.0)
multi_json (~> 1.0)
redis-namespace (~> 1.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
rspec-core (2.14.6)
rspec-expectations (2.14.3)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.0)
Expand All @@ -174,20 +174,20 @@ GEM
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-graphviz (1.0.9)
sass (3.2.12)
sass (3.2.13)
sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10)
sprockets-rails (~> 2.0.0)
sdoc (0.3.20)
json (>= 1.1.3)
rdoc (~> 3.10)
sinatra (1.4.3)
sinatra (1.4.4)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
slop (3.4.6)
sprockets (2.10.0)
slop (3.4.7)
sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
Expand All @@ -208,12 +208,12 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (1.3.0)
turbolinks (2.1.0)
coffee-rails
tzinfo (0.3.38)
uglifier (2.2.1)
uglifier (2.4.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
json (>= 1.8.0)
vegas (0.1.11)
rack (>= 1.0.0)
will_paginate (3.0.4)
Expand Down
50 changes: 45 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ You must clone project repository(repo) into your repo by click "Fork" button in
Using Terminal to clone (download) project to local

```sh
$ git clone https://github.com/khanhhd/git_trainer.git
$ git clone https://github.com/<your-github-account>/git_trainer.git
```
Fetch and pull code from develop branch

Expand All @@ -20,8 +20,8 @@ now, `$ git remote -v`, you will see 2 remote like this:
```sh
framgia https://github.com/khanhhd/git_trainer.git (fetch)
framgia https://github.com/khanhhd/git_trainer.git (push)
origin https://github.com/kienbt01359/git_trainer.git (fetch)
origin https://github.com/kienbt01359/git_trainer.git (push)
origin https://github.com/<your-github-account>/git_trainer.git (fetch)
origin https://github.com/<your-github-account>/git_trainer.git (push)
```


Expand Down Expand Up @@ -53,9 +53,49 @@ $ git commit -m "refs #TaskID Name of task"
$ git push origin taskID
```
Go to your github's project repo. And send pull request to framgia/develop<br/>
If your code is OK, reviewers will merge, if not, they will adding some comments, and you must fix it again.
And then you will push it again.
And you send the URL of pull-request to reviewers to review it.

## Reviewing a pull-request
When reviewers review a pull-request, there are 3 cases will be happened
### 1. Merge in "first touch"
It means your code is acceptable and it will be merged to develop(branch) of project.
### 2. Have comments
When your code must be modify somewhere, follow by reviews' comments.<br/>
Go to your editor, and modify code as all comments of reviewrs. <br/>
After that, you will commit again, but meld to previous commit.

```sh
$ git add .
$ git commit --amend (save and close new opend file to edit.)
$ git push origin taskID -f (force new code to existed branch)
```
And you should notice reviews to review again. If OK -> will merge. If has any comments -> Do this part again.
### 3. Conflicts
Your pushed code has conflict with develop branch of project, so it can not be merged automatically.<br/>
In this case, you should do..<br/>
1. Get newest code from framgia/develop to your develop branch

```sh
$ git checkout develop
$ git pull framgia develop
```
2. Checkout to current task and rebase with develop branch

```sh
$ git checkout taskID
$ git rebase develop
```
Because of conflicts, so you should contact to member who modified conflict files. And then remove conflicts. <br/>
After resolving all conflicts.

```sh
$ git add .
$ git rebase --continue
$ git push origin taskID -f
```

And you notice for reviewers to check your pull-request is can be merged or not.<br/>
When your pull-request has been merged. Go to redmine and change status of task to Resolved.<br/>
This is called a cycle of pull-request.

## Faster commit
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
class ApplicationController < ActionController::Base

before_action :set_locale

# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
include SessionsHelper

def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
end
2 changes: 1 addition & 1 deletion app/controllers/microposts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def micropost_params
end

def correct_user
@micropost = current_user.microposts.find_by(id: params[:id])
@micropost = current_user.microposts.find_by(id: params[:id], per_page: 25)
redirect_to root_url if @micropost.nil?
end
end
5 changes: 1 addition & 4 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ class StaticPagesController < ApplicationController
def home
if signed_in?
@micropost = current_user.microposts.build if signed_in?
@feed_items = current_user.feed.paginate(page: params[:page])
@feed_items = current_user.feed.paginate page: params[:page], per_page: 25
end
end

def help
end
end
6 changes: 3 additions & 3 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def index
end

def show
@microposts = @user.microposts.paginate(page: params[:page])
@microposts = @user.microposts.paginate page: params[:page], per_page: 25
end

def create
Expand Down Expand Up @@ -48,14 +48,14 @@ def destroy
def following
@title = "Following"
@user = User.find(params[:id])
@users = @user.followed_users.paginate(page: params[:page])
@users = @user.followed_users.paginate(page: params[:page], per_page: 25)
render 'show_follow'
end

def followers
@title = "Followers"
@user = User.find(params[:id])
@users = @user.followers.paginate(page: params[:page])
@users = @user.followers.paginate(page: params[:page], per_page: 25)
render 'show_follow'
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_micropost_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= form_for(@micropost) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<div class="field">
<%= f.text_area :content, placeholder: "Compose new micropost..." %>
<%= f.text_area :content, placeholder: t(:compose_new_micropost) << "..." %>
</div>
<%= f.submit "Post", class: "btn btn-large btn-primary" %>
<%= f.submit t(:post), class: "btn btn-large btn-primary" %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/shared/_user_info.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= current_user.name %>
</h1>
<span>
<%= link_to "view my profile", current_user %>
<%= link_to t(:view_my_profile), current_user %>
</span>
<span>
<%= pluralize(current_user.microposts.count, "micropost") %>
Expand Down
20 changes: 2 additions & 18 deletions app/views/static_pages/help.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
<% provide(:title, "Help") %>
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
</head>
<body>
<h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
<a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
To get help on this sample app, see the
<a href="http://railstutorial.org/book">Rails Tutorial book</a>.
</p>
</body>
</html>

<p>Find me in app/views/static_pages/help.html.erb</p>
<h1>Help</h1>
Day la trang help .
10 changes: 4 additions & 6 deletions app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@
</section>
</aside>
<div class="span8">
<h3>Micropost Feed</h3>
<h3><h1><%=t :micropost_feed %></h3>
<%= render 'shared/feed' %>
</div>
</div>
<% else %>
<div class="center hero-unit">
<h1>Welcome to the Sample App</h1>
<h1><%=t :home_welcom_message %></h1>

<h2>
This is the home page for the Ruby on Rails Tutorial sample application.
<%=t :home_description_message %>
</h2>

<h3> Test for Git </h3>

<%= link_to "Dang ky!", signup_path,
<%= link_to t(:home_register_message), signup_path,
class: "btn btn-large btn-primary" %>
</div>

Expand Down
11 changes: 4 additions & 7 deletions app/views/users/_user.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<li>
<%= gravatar_for user %>
<%= link_to user.name, user %>
<% if current_user.admin? && !current_user?(user) %>
| <%= link_to "delete", user, method: :delete,
data: { confirm: "You sure?" } %>
<% end %>
</li>
<%= gravatar_for user %>
<%= link_to user.name, user %>
<%= user.email %>
</li>
Loading