From 5aa63ea6cd6545d5d962dbcac5f3352b05a18be5 Mon Sep 17 00:00:00 2001 From: Keith Date: Wed, 22 Feb 2017 19:00:53 +0800 Subject: [PATCH] fixed some issue --- app/models/member_log.rb | 1 + .../admin/memberlogs/_memberlogs.html.erb | 21 ++++++++------ app/views/admin/memberlogs/index.html.erb | 3 +- app/views/admin/memberlogs/show.html.erb | 23 +++++++++------ app/views/plugin/memberlog/_profile.html.erb | 28 +++++++++---------- config/locales/en.yml | 2 ++ config/locales/zh_tw.yml | 2 ++ 7 files changed, 46 insertions(+), 34 deletions(-) diff --git a/app/models/member_log.rb b/app/models/member_log.rb index 582781a..9da3aaa 100644 --- a/app/models/member_log.rb +++ b/app/models/member_log.rb @@ -10,6 +10,7 @@ class MemberLog field :excuse, localize: true field :finish, :type => Boolean, :default => false field :checkout, :type => DateTime + field :dayoff, :type => Boolean, :default => false belongs_to :member_profile has_many :dayoffs diff --git a/app/views/admin/memberlogs/_memberlogs.html.erb b/app/views/admin/memberlogs/_memberlogs.html.erb index 176c255..9125b83 100644 --- a/app/views/admin/memberlogs/_memberlogs.html.erb +++ b/app/views/admin/memberlogs/_memberlogs.html.erb @@ -2,14 +2,17 @@ <%= memberlog.member_profile.name rescue "" %> <%= memberlog.created_at.strftime('%Y/%m/%d (%a)') %> - <%= memberlog.created_at.strftime('%R') %> - - <% if memberlog.finish == true %> - <%= memberlog.checkout.strftime('%R') %> - <% else %> - <%= t('memberlog.working') %> - <% end %> - + <% if memberlog.dayoff == true %> + <%= t('memberlog.dayoff') %> + <% else %> + <%= memberlog.created_at.strftime('%R') %> + <% if memberlog.finish == true %> + <%= memberlog.checkout.strftime('%R') %> + <% else %> + <%= t('memberlog.working') %> + <% end %> + + <% end %> <%= link_to memberlog.todo.html_safe, admin_memberlog_path(memberlog.id), :class => "modal-opener" %>
@@ -33,7 +36,7 @@
" class="footable-row-detail-inner" style="display: none;">
<%= t(:complete) %> : - <%= memberlog.complete%> + <%= memberlog.complete.html.safe %>
diff --git a/app/views/admin/memberlogs/index.html.erb b/app/views/admin/memberlogs/index.html.erb index bf86d7c..f5d4117 100644 --- a/app/views/admin/memberlogs/index.html.erb +++ b/app/views/admin/memberlogs/index.html.erb @@ -15,8 +15,7 @@ <%= t('memberlog.staff') %> <%= t('memberlog.date') %> - <%= t('memberlog.checkin') %> - <%= t('memberlog.checkout') %> + <%= t('memberlog.check_in_out') %> <%= t('memberlog.todo') %> <%= t('memberlog.excuse') %> diff --git a/app/views/admin/memberlogs/show.html.erb b/app/views/admin/memberlogs/show.html.erb index b7444b2..0f0dafc 100644 --- a/app/views/admin/memberlogs/show.html.erb +++ b/app/views/admin/memberlogs/show.html.erb @@ -32,15 +32,20 @@ - <%= @memberlog.member_profile.name rescue "" %> - <%= @memberlog.created_at.strftime('%Y-%m-%d %R') %> - - <% if @memberlog.finish == true %> - <%= @memberlog.checkout.strftime('%Y-%m-%d %R') %> - <% else %> - <%= t('memberlog.working') %> - <% end %> - + <%= @memberlog.member_profile.name rescue "" %> + <% if @memberlog.dayoff == true %> + <%= t('memberlog.dayoff') %> + + <% else %> + <%= @memberlog.created_at.strftime('%Y-%m-%d %R') %> + + <% if @memberlog.finish == true %> + <%= @memberlog.checkout.strftime('%Y-%m-%d %R') %> + <% else %> + <%= t('memberlog.working') %> + <% end %> + + <% end %> diff --git a/app/views/plugin/memberlog/_profile.html.erb b/app/views/plugin/memberlog/_profile.html.erb index fcbcbd8..41c304e 100644 --- a/app/views/plugin/memberlog/_profile.html.erb +++ b/app/views/plugin/memberlog/_profile.html.erb @@ -37,8 +37,7 @@ <%= t('memberlog.date') %> - <%= t('memberlog.checkin') %> - <%= t('memberlog.checkout') %> + <%= t('memberlog.check_in_out') %> <%= t('memberlog.excuse') %> @@ -46,7 +45,7 @@ <% @memberlogs.each do |memberlog| %> - <%= link_to memberlog.created_at.strftime('%Y-%m-%d (%a)'), admin_memberlog_path(memberlog.id), :data => {"target" => "#logModal", "toggle" => "modal"} %> + <%= link_to memberlog.created_at.strftime('%Y-%m-%d (%a)'), admin_memberlog_path(memberlog.id), :class => "modal-opener" %>
- <%= memberlog.created_at.strftime('%R') %> + <% if memberlog.dayoff == true %> + <%= t('memberlog.dayoff') %> + <% else %> + <%= memberlog.created_at.strftime('%R') %> + <% if memberlog.finish == true %> + <%= memberlog.checkout.strftime('%R') %> + <% else %> + <%= t('memberlog.working') %> + <% end %> + + <% end %> - <% if memberlog.finish == true %> - <%= memberlog.checkout.strftime('%R') %> - <% else %> - <%= t('memberlog.working') %> - <% end %> - - - <% if !memberlog.excuse.nil? %> - <%= memberlog.excuse %> - <% end %> + <%= memberlog.excuse %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 41f4938..813e0af 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -14,3 +14,5 @@ en: end_dayoff: End Dayoff status: Status date: Date + check_in_out: Check-In~Check-Out + dayoff: Day off diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 986367a..dedabfa 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -14,3 +14,5 @@ zh_tw: end_dayoff: 休假結束日期 status: 狀態 date: 出勤日期 + check_in_out: 上班時間~下班時間 + dayoff: 休假 \ No newline at end of file