Commit 214097c2 by Thanh Hung Pham

Fist layout

parent fa55f791
...@@ -13,3 +13,4 @@ ...@@ -13,3 +13,4 @@
//= require rails-ujs //= require rails-ujs
//= require turbolinks //= require turbolinks
//= require_tree . //= require_tree .
//= require bootstrap
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
...@@ -12,4 +12,5 @@ ...@@ -12,4 +12,5 @@
* *
*= require_tree . *= require_tree .
*= require_self *= require_self
*/ *= require bootstrap
*/
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
@import 'bootstrap';
body {
padding-top: 60px;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
}
footer small {
float: left;
}
input {
border: 1px solid #bbb;
margin-bottom: 15px;
width: 100%;
}
// Place all the styles related to the StaticPages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
class StaticPagesController < ApplicationController
def home
@total_jobs = Job.distinct.count('name')
@latest_jobs = Job.all
@top_cities = City.all
@top_categories = Category.all
end
end
class UsersController < ApplicationController
def new
@user = User.new
end
end
module ApplicationHelper module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = 'veNJOB'
if page_title.empty?
base_title
else
page_title + ' | ' + base_title
end
end
end end
module StaticPagesHelper
end
module UsersHelper
end
<footer class="footer">
<small>ZIGExN VeNtura <%= Date.today.year %></small>
</footer>
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to "veNJOB", root_path, id: 'logo' %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li> <%= link_to 'Login', '#' %> </li>
<li> <%= link_to 'Register', register_path %> </li>
<li> <%= link_to 'Favorite', '#' %> </li>
<li> <%= link_to 'History', '#' %> </li>
</ul>
</nav>
</div>
</header>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>VeNJOB</title> <title><%= full_title(yield(:title)) %></title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
</head> </head>
<body> <body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %> <%= yield %>
<%= render 'layouts/footer' %>
</div>
</body> </body>
</html> </html>
<%- provide(:title, 'Home') -%>
<div class="center jumbotron">
<div class="well">
<div class="banner"> TODO
</div>
<div class="total_jobs"> Total jobs: <%= @total_jobs %>
</div>
</div>
<div class="well">
<div class="search_box">
</div>
</div>
<div class="well">
<p> Latest Jobs </p>
<div class="latest_jobs">
<%- @latest_jobs.limit(5).each do |job| -%>
<div>
<%= job.name %>
<%= job.salary %>
</div>
<%- end -%>
</div>
</div>
<div class="well">
<p> Top cities </p>
<div class="top_cities">
<%- @top_cities.limit(9).each do |city| -%>
<div>
<%= city.name %>
<%= city.job.count %>
</div>
<%- end -%>
</div>
<%= link_to 'All cities', '#' %>
</div>
<div class="well">
<p> Top industries </p>
<div class="top_industries">
<%- @top_categories.limit(9).each do |category| -%>
<div>
<%= category.name %>
<%= category.job_category.count %>
</div>
<%- end -%>
</div>
<%- link_to 'All industries', '#' -%>
</div>
</div>
<%- provide(:title, 'Register') -%>
<h1>Register</h1>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= form_for(@user) do |f| %>
<%= f.label :email %>
<%= f.email_field :email %>
<%= f.submit 'Confirm your email', class: 'btn btn-primary' %>
<%- end -%>
</div>
</div>
Rails.application.routes.draw do Rails.application.routes.draw do
root 'static_pages#home'
get 'static_pages/home'
get '/register', to: 'users#new'
resource :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end end
require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
test "should get home" do
get static_pages_home_url
assert_response :success
end
end
require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get users_new_url
assert_response :success
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment