Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hungdv98 committed Jun 29, 2019
1 parent fd55c11 commit e6bf7e4
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 144 deletions.
102 changes: 51 additions & 51 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.6)
actionpack (= 5.1.6)
actioncable (5.1.7)
actionpack (= 5.1.7)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.6)
actionpack (= 5.1.6)
actionview (= 5.1.6)
activejob (= 5.1.6)
actionmailer (5.1.7)
actionpack (= 5.1.7)
actionview (= 5.1.7)
activejob (= 5.1.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.6)
actionview (= 5.1.6)
activesupport (= 5.1.6)
actionpack (5.1.7)
actionview (= 5.1.7)
activesupport (= 5.1.7)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.6)
activesupport (= 5.1.6)
actionview (5.1.7)
activesupport (= 5.1.7)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.1.6)
activesupport (= 5.1.6)
activejob (5.1.7)
activesupport (= 5.1.7)
globalid (>= 0.3.6)
activemodel (5.1.6)
activesupport (= 5.1.6)
activerecord (5.1.6)
activemodel (= 5.1.6)
activesupport (= 5.1.6)
activemodel (5.1.7)
activesupport (= 5.1.7)
activerecord (5.1.7)
activemodel (= 5.1.7)
activesupport (= 5.1.7)
arel (~> 8.0)
activesupport (5.1.6)
activesupport (5.1.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
Expand Down Expand Up @@ -82,7 +82,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
concurrent-ruby (1.1.5)
config (1.7.0)
activesupport (>= 3.0)
deep_merge (~> 1.2.1)
Expand Down Expand Up @@ -116,7 +116,7 @@ GEM
dry-equalizer (~> 0.2)
dry-logic (~> 0.4, >= 0.4.0)
dry-types (~> 0.12.0)
erubi (1.7.1)
erubi (1.8.0)
execjs (2.7.0)
faraday (0.12.2)
multipart-post (>= 1.2, < 3)
Expand All @@ -125,10 +125,10 @@ GEM
thor (~> 0.14)
font-awesome-rails (4.7.0.4)
railties (>= 3.2, < 6.0)
globalid (0.4.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
hashie (3.5.7)
i18n (1.0.1)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
inflecto (0.0.2)
jbuilder (2.7.0)
Expand All @@ -155,26 +155,26 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.0)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (0.9.0)
method_source (0.9.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_magick (4.8.0)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
mysql2 (0.5.1)
nio4r (2.3.1)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
oauth2 (1.4.0)
faraday (>= 0.8, < 0.13)
jwt (~> 1.0)
Expand All @@ -198,33 +198,33 @@ GEM
activerecord (>= 3.0)
public_suffix (3.0.2)
puma (3.11.4)
rack (2.0.5)
rack-test (1.0.0)
rack (2.0.7)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.1.6)
actioncable (= 5.1.6)
actionmailer (= 5.1.6)
actionpack (= 5.1.6)
actionview (= 5.1.6)
activejob (= 5.1.6)
activemodel (= 5.1.6)
activerecord (= 5.1.6)
activesupport (= 5.1.6)
rails (5.1.7)
actioncable (= 5.1.7)
actionmailer (= 5.1.7)
actionpack (= 5.1.7)
actionview (= 5.1.7)
activejob (= 5.1.7)
activemodel (= 5.1.7)
activerecord (= 5.1.7)
activesupport (= 5.1.7)
bundler (>= 1.3.0)
railties (= 5.1.6)
sprockets-rails (>= 3.7.2)
railties (= 5.1.7)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.1.6)
actionpack (= 5.1.6)
activesupport (= 5.1.6)
railties (5.1.7)
actionpack (= 5.1.7)
activesupport (= 5.1.7)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.1)
rake (12.3.2)
ransack (1.8.8)
actionpack (>= 3.0)
activerecord (>= 3.0)
Expand Down Expand Up @@ -255,7 +255,7 @@ GEM
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
Expand All @@ -265,7 +265,7 @@ GEM
sqlite3 (1.3.13)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
thor (0.20.0)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.8)
time_difference (0.7.0)
Expand All @@ -284,7 +284,7 @@ GEM
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
websocket-extensions (0.1.4)
xpath (3.1.0)
nokogiri (~> 1.8)

Expand Down Expand Up @@ -329,4 +329,4 @@ DEPENDENCIES
web-console (>= 3.3.0)

BUNDLED WITH
1.16.1
1.17.3
9 changes: 0 additions & 9 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ def create
render :new
end
end
else
user = User.from_omniauth(request.env["omniauth.auth"])
if user == nil
flash.now[:danger] = t "controllers.sessions.email_taken"
redirect_to login_url
else
log_in user
redirect_back_or user
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class User < ApplicationRecord
format: {with: VALID_EMAIL_REGEX},
uniqueness: {case_sensitive: false}
has_secure_password
validates :password, presence: true, length: {minimum: 6}, allow_nil: true
validates :password, presence: true, length: {minimum: 8}, allow_nil: true

def User.digest string
cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :
Expand Down
20 changes: 15 additions & 5 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
<div id="top-menu">
<div id="account">
<ul>
<li class="language_li">
<%= link_to locale:"en" do %>
<%= image_tag "united-kingdom.png", class: "language_flag_right" %>
<% end %> |
<%= link_to locale:"vi" do %>
<%= image_tag "vietnam.png", class: "language_flag_left" %>
<% end %>
</li>

<li><%= link_to t("sign_in"), login_path, class: "login" %></li>
<li><%= link_to t("register"), register_path, class: "register" %></a></li>
</ul>


</div>
</div>
<div id="header">
<%= link_to image_tag("logo.png", alt: " logo"),root_url %>
<!%= link_to image_tag("logo.png", alt: " logo"),root_url %>
</div>
<% else %>
<div id="top-menu">
Expand Down Expand Up @@ -39,8 +49,6 @@
<ul>
<li><%= link_to t("my_page"), my_page_path(current_user.id), class: "my-page" %></li>
<li><%= link_to t("project"), projects_url, class: "projects" %></li>
<li><%= link_to t("help"), "#", class: "help" %></li>
<li><%= link_to "Templates", issue_templates_path, class: "help" %></li>
<% if current_user.user_type==0 %>
<li>
<%= link_to t("user"), users_path, class: "fa fa-users" %>
Expand All @@ -60,6 +68,8 @@
<%= submit_tag "Search", id: "search-issue", style: "display: none;" %>
<% end %>
<div class="select2-container" id="s2id_project_quick_jump_box" style="width: 210px;">


<% tmp = UserProject.includes(:project).where("user_id = ?", current_user.id) %>
<%=select_tag "textcolor",
options_for_select(tmp.all.collect{ |o| [o.project.name, o.project_id] }),
Expand Down Expand Up @@ -91,7 +101,7 @@
</div>
</div>
</div>
<%= link_to image_tag("logo.png", alt: " logo"),root_url %>
<!%= link_to image_tag("logo.png", alt: " logo"),root_url %>
</div>
<% get_prj_id %>
<% if current_project != nil %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Redmine</title>
<title>HVKTMM</title>
<%= csrf_meta_tags %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track": "reload" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/my_pages/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<thead>
<tr>
<th>#</th>
<th><%= t "projetc" %></th>
<th><%= t "project" %></th>
<th><%= t "views.issue.index.tracker" %></th>
<th><%= t "subject" %></th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@
<div style="clear:both;"></div>
</div>
</div>
<% end %>
<% end %>
14 changes: 7 additions & 7 deletions app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<h3><%= t "time" %></h3>
<p><span class="icon icon-time">16.00 giờ</span></p>
<p>
<a href="/projects/ruby-intern-redmine-cl/time_entries/new"><%= t "views.issue.show.add_time" %></a> |
<a href="/projects/ruby-intern-redmine-cl/time_entries"><%= t "views.projects.show.details" %></a> |
<a href="/projects/ruby-intern-redmine-cl/time_entries/report"><%= t "views.projects.show.report" %></a>
<a href="#"><%= t "views.issue.show.add_time" %></a> |
<a href="#"><%= t "views.projects.show.details" %></a> |
<a href="#"><%= t "views.projects.show.report" %></a>
</p>
</div>

Expand Down Expand Up @@ -62,13 +62,13 @@
<% g = t.split("/projects/") %>
<p>
<%= link_to t("views.projects.index.all_issue"), issues_path %>
| <%= link_to t("views.projects.show.calendar"), "#" %>
| <%= link_to t("views.projects.show.chart"), "#" %>
<% if current_user.user_type == 0 %>
|<%= link_to "Edit", edit_project_path(g[1].to_i) %>
<% elsif @project.user_id == current_user.id and current_project != nil %>
|<%= link_to "Edit", edit_project_path(current_project) %>
<% elsif @project.user_id == current_user.id %>
|<%= link_to "Edit", edit_project_path(g[1].to_i) %>
<% end %>
| <%= link_to t("views.projects.show.calendar"), "#" %>
| <%= link_to t("views.projects.show.chart"), "#" %>
</p>

</div>
Expand Down
9 changes: 0 additions & 9 deletions app/views/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<td style="text-align:right;"><label for="password"><%= t "views.sessions.pass" %>:</label></td>
<td style="text-align:left;"><%= f.password_field :password, class: "form-control" %></td>
</tr>
<tr>
<td></td>
<td style="text-align:left;">
<label for="autologin"><%= f.check_box :remember_me %></label>
<span><%= t "views.sessions.stay_logged_in" %></span>
</td>
</tr>
<tr>
<td style="text-align:left;">
<%= link_to t("views.sessions.lost_pass"), new_password_reset_path %>
Expand All @@ -29,8 +22,6 @@
</tbody>
</table>
<% end %>

<center><%= link_to t("views.sessions.signin_google"), "/auth/google_oauth2", id: "sign_in" %></center>
</div>
<div style="clear:both;"></div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2>
<img default="default" rating="PG" alt="" title=""
class="gravatar" ssl="false" src="http://www.gravatar.com/avatar/bf15d543da15121752d56fa811f887a3?rating=PG&amp;size=50&amp;default=monsterid"
class="gravatar" ssl="false" src="#"
width="50" height="50" /> <%= @user.login_name %>
</h2>
<div class="splitcontentleft">
Expand All @@ -12,14 +12,14 @@
<ul>
<% @project.each do |project| %>
<% if Project.where("id=? and user_id=?", project.project_id, current_user.id).count>0%>
<li>
<li>
<%= link_to project.project.name, project_path(project.project.id) %>
(Manager, <%= project.created_at.strftime("%d-%m-%Y") %>)
</li>
<% else %>
<li>
<%= link_to project.project.name, project_path(project.project.id) %>
(Developer, <%= project.created_at.strftime("%d-%m-%Y") %>)
(Worker, <%= project.created_at.strftime("%d-%m-%Y") %>)
</li>
<% end %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default: &default
encoding: utf8
pool: 5
username: root
password: ...
password: root
host: 127.0.0.1
port: 3306

Expand Down
Loading

0 comments on commit e6bf7e4

Please sign in to comment.