Skip to content

Commit 804b0a8

Browse files
authored
Merge pull request #130 from gtt-project/feature/separate-reload-patch-timing
Separate reload patches timing
2 parents fad226e + 06e11c1 commit 804b0a8

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

init.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# Automatically encode points to geojson with as_json in rails3
4343
RGeo::ActiveRecord::GeometryMixin.set_json_generator(:geojson)
4444

45-
RedmineGtt.setup
45+
RedmineGtt.setup_normal_patches
4646

4747
# ActiveRecord::Base.include_root_in_json = true
4848
# module RGeo
@@ -56,6 +56,10 @@
5656
# end
5757
end
5858

59+
Rails.configuration.to_prepare do
60+
RedmineGtt.setup_controller_patches
61+
end
62+
5963
class GttListener < Redmine::Hook::ViewListener
6064
render_on :view_layouts_base_html_head, inline: <<-END
6165
<%= stylesheet_link_tag 'gtt', :plugin => 'redmine_gtt' %>

lib/redmine_gtt.rb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,28 @@
2828

2929
module RedmineGtt
3030

31-
def self.setup
31+
def self.setup_normal_patches
3232
RedmineGtt::Patches::IssuesHelperPatch.apply
3333

3434
RedmineGtt::Patches::IssuePatch.apply
3535
RedmineGtt::Patches::IssueQueryPatch.apply
3636
RedmineGtt::Patches::ProjectPatch.apply
3737
RedmineGtt::Patches::UserPatch.apply
3838

39+
RedmineGtt::Patches::ProjectsHelperPatch.apply
40+
41+
# unless IssueQuery.included_modules.include?(RedmineGtt::Patches::IssueQueryPatch)
42+
# IssueQuery.send(:include, RedmineGtt::Patches::IssueQueryPatch)
43+
# end
44+
45+
46+
#Redmine::Views::ApiTemplateHandler.send(:prepend, RedmineGtt::Patches::ApiTemplateHandlerPatch)
47+
end
48+
49+
def self.setup_controller_patches
50+
3951
RedmineGtt::Patches::IssuesControllerPatch.apply
4052
RedmineGtt::Patches::ProjectsControllerPatch.apply
41-
RedmineGtt::Patches::ProjectsHelperPatch.apply
4253
RedmineGtt::Patches::UsersControllerPatch.apply
4354

4455
[
@@ -47,13 +58,6 @@ def self.setup
4758
ProjectsController,
4859
UsersController,
4960
].each{ |c| c.send :helper, 'gtt_map' }
50-
51-
# unless IssueQuery.included_modules.include?(RedmineGtt::Patches::IssueQueryPatch)
52-
# IssueQuery.send(:include, RedmineGtt::Patches::IssueQueryPatch)
53-
# end
54-
55-
56-
#Redmine::Views::ApiTemplateHandler.send(:prepend, RedmineGtt::Patches::ApiTemplateHandlerPatch)
5761
end
5862
end
5963

0 commit comments

Comments
 (0)