Skip to content

Commit 8a8407e

Browse files
committed
refactoring - move users#show map to hook, use new helper #50
1 parent d44fd31 commit 8a8407e

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

app/overrides/users.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
:partial => "users/form/map"
1313
)
1414

15-
Deface::Override.new(
16-
:virtual_path => "users/show",
17-
:name => "deface_view_users_show_map",
18-
:insert_bottom => "div.splitcontentleft",
19-
:partial => "users/show/map"
20-
)
2115

2216
Deface::Override.new(
2317
:virtual_path => "users/show",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<% if @user.geom %>
2+
<h3><%= l(:label_user_map) %></h3>
3+
<%= map_tag map: @user.map %>
4+
<% end %>
5+

app/views/users/show/_map.html.erb

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/redmine_gtt.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Global Hooks
44
require 'redmine_gtt/hooks/view_layouts_base_html_head_hook'
5+
require 'redmine_gtt/view_hooks'
56

67

78
# API Template Hooks
@@ -35,6 +36,9 @@ def self.setup
3536
ProjectsController.class_eval do
3637
helper 'gtt_map'
3738
end
39+
UsersController.class_eval do
40+
helper 'gtt_map'
41+
end
3842

3943
# unless IssueQuery.included_modules.include?(RedmineGtt::Patches::IssueQueryPatch)
4044
# IssueQuery.send(:include, RedmineGtt::Patches::IssueQueryPatch)

lib/redmine_gtt/view_hooks.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module RedmineGtt
2+
class ViewHooks < Redmine::Hook::ViewListener
3+
render_on :view_account_left_bottom,
4+
partial: 'redmine_gtt/hooks/view_account_left_bottom'
5+
end
6+
end

0 commit comments

Comments
 (0)