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
46 changes: 23 additions & 23 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
source 'https://rubygems.org'
source "https://rubygems.org"

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end


gem 'bootstrap-sass','3.3.6'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.2'
gem "bootstrap-sass","3.3.6"
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
gem "rails", "~> 5.0.2"
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem "sqlite3"
# Use Puma as the app server
gem 'puma', '~> 3.0'
gem "puma", "~> 3.0"
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem "sass-rails", "~> 5.0"
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem "uglifier", ">= 1.3.0"
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
gem "coffee-rails", "~> 4.2"
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# gem "therubyracer", platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
gem "jquery-rails"
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
gem "turbolinks", "~> 5"
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
gem "jbuilder", "~> 2.5"
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# gem "redis", "~> 3.0"
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem "bcrypt", "~> 3.1.7"

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# gem "capistrano-rails", group: :development

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
# Call "byebug" anywhere in the code to stop execution and get a debugger console
gem "byebug", platform: :mri
end

group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
gem "web-console", ">= 3.3.0"
gem "listen", "~> 3.0.5"
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem "spring"
gem "spring-watcher-listen", "~> 2.0.0"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ GEM
arel (7.1.4)
autoprefixer-rails (6.7.7)
execjs
bcrypt (3.1.11)
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
Expand Down Expand Up @@ -159,6 +160,7 @@ PLATFORMS
ruby

DEPENDENCIES
bcrypt (~> 3.1.7)
bootstrap-sass (= 3.3.6)
byebug
coffee-rails (~> 4.2)
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

6 changes: 0 additions & 6 deletions Rakefile

This file was deleted.

16 changes: 0 additions & 16 deletions app/assets/javascripts/application.js

This file was deleted.

4 changes: 4 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class UsersController < ApplicationController
def new
end
end
6 changes: 3 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module ApplicationHelper
def full_title page_title=''
base_title="Ruby on Rails Tutorial Sample App"
def full_title page_title = ""
Copy link
Owner

Choose a reason for hiding this comment

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

ident check lại đi em ơi

base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
page_title+ "|" +base_title
page_title + "|" + base_title
end
end
end
4 changes: 2 additions & 2 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
default from: "from@example.com"
layout "mailer"
end
27 changes: 27 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class User < ApplicationRecord
validates :name, presence: true
validates :email, presence:true
validates :phone, presence:true
validates :birthday, presence:true
validate :check_phone
validate :check_date
has_secure_password

private
def check_phone
if self.phone
if self.phone.length == 10 && self.phone[0] == "0"
else
self.errors.add :phone, "So dien thoai phai co 10 ky tu va khong bat dau boi 0"
end
end
end

def check_date
if self.birthday
if (Time.now.year-birthday.year) < 7 || (Time.now.year-birthday.year) > 90
self.errors.add :date, "So tuoi phai tu 7 den 90"
end
end
end
end
22 changes: 11 additions & 11 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to "sample app","#",id:"logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to"Home","#" %></li>
<li><%= link_to"Help","#" %></li>
<li><%= link_to"Log in", "#" %></li>
</ul>
</nav>
</div>
</header>
<div class="container">
<%= link_to "sample app","#",id:"logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to"Home","#" %></li>
<li><%= link_to"Help","#" %></li>
<li><%= link_to"Log in", "#" %></li>
</ul>
</nav>
</div>
</header>
10 changes: 4 additions & 6 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
<head>
<title><%= full_title yield :title %></title>
<%= csrf_meta_tags %>

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track": "reload" %>
<%= javascript_include_tag "application", "data-turbolinks-track": "reload" %>
</head>

<body>
<%= render "layouts/header" %>
Copy link
Owner

Choose a reason for hiding this comment

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

ident

<div class="container">
<%= yield %>
</div>

<%= yield %>
</div>
</body>
</html>
5 changes: 2 additions & 3 deletions app/views/static_pages/help.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<head>
<% provide(:title, "Help")%>
</head>
<body>

<body>
<h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
Expand All @@ -17,4 +16,4 @@
book</a>.
</p>
</body>
</html>
</html>
25 changes: 12 additions & 13 deletions app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
<!DOCTYPE html>
<html>
<head>
<% provide :title, "Home" %>
<% provide :title, "Home" %>
</head>
<body>

<div class="center jumbotron">
<h1>Welcome to the Sample App</h1>
<div class="center jumbotron">
<h1> Welcome to the Sample App </h1>

<h2>
This is the home page for the
<a href="http://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</h2>
<h2>
This is the home page for the
<a href="http://www.railstutorial.org/"> Ruby on Rails Tutorial </a>
sample application.
</h2>

<%= link_to "Sign up now!", '#', class: "btn btn-lg btn-primary" %>
</div>
<%= link_to "Sign up now!", "#", class: "btn btn-lg btn-primary" %>
</div>

<%= link_to image_tag("rails.png", alt: "Rails logo"),
'http://rubyonrails.org/' %>
<%= link_to image_tag("rails.png", alt: "Rails logo"),
"http://rubyonrails.org/" %>
</body>
</html>
2 changes: 2 additions & 0 deletions app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Users#new</h1>
<p>Find me in app/views/users/new.html.erb</p>
34 changes: 0 additions & 34 deletions bin/setup

This file was deleted.

17 changes: 0 additions & 17 deletions bin/spring

This file was deleted.

29 changes: 0 additions & 29 deletions bin/update

This file was deleted.

5 changes: 0 additions & 5 deletions config.ru

This file was deleted.

Loading