1
1
module RedmineGtt
2
2
class ViewHooks < Redmine ::Hook ::ViewListener
3
-
4
3
include ActionView ::Context
5
4
6
5
# Render partials in various views
7
6
render_on :view_account_left_bottom ,
8
- partial : 'redmine_gtt/hooks/view_account_left_bottom'
7
+ partial : 'redmine_gtt/hooks/view_account_left_bottom'
9
8
10
9
render_on :view_my_account ,
11
10
partial : 'redmine_gtt/hooks/view_my_account'
@@ -16,48 +15,10 @@ class ViewHooks < Redmine::Hook::ViewListener
16
15
render_on :view_issues_form_details_top ,
17
16
partial : 'redmine_gtt/hooks/view_issues_form_details_top'
18
17
18
+ render_on :view_layouts_base_html_head ,
19
+ partial : 'redmine_gtt/hooks/view_layouts_base_html_head'
20
+
19
21
render_on :view_layouts_base_body_bottom ,
20
22
partial : 'redmine_gtt/hooks/view_layouts_base_body_bottom'
21
-
22
- # Add meta tags to the HTML head to inform about available fonts with their URL including the digest
23
- def view_layouts_base_html_head ( context = { } )
24
- tags = [ ]
25
- tags << tag . meta ( :name => 'gtt-font-custom-icons' , :content => asset_path ( 'plugin_assets/redmine_gtt/custom-icons.woff2' ) )
26
- tags << tag . meta ( :name => 'gtt-font-mdi-webfont' , :content => asset_path ( 'plugin_assets/redmine_gtt/materialdesignicons-webfont.woff2' ) )
27
- return tags . join ( "\n " )
28
- end
29
-
30
- # Add JavaScript and data tags to the body bottom
31
- def view_layouts_base_body_bottom ( context = { } )
32
- tags = [ ] ;
33
-
34
- tags << javascript_include_tag ( 'main' , :plugin => 'redmine_gtt' )
35
-
36
- geocoder = {
37
- enabled : false
38
- }
39
-
40
- if Setting . plugin_redmine_gtt [ 'enable_geocoding_on_map' ] == 'true'
41
- geocoder = {
42
- enabled : true ,
43
- provider : Setting . plugin_redmine_gtt [ 'default_geocoder_provider' ] ,
44
- options : ( JSON . parse ( Setting . plugin_redmine_gtt [ 'default_geocoder_options' ] ) rescue { } )
45
- }
46
- end
47
-
48
- tags . push ( tag . div :data => {
49
- :lon => Setting . plugin_redmine_gtt [ 'default_map_center_longitude' ] ,
50
- :lat => Setting . plugin_redmine_gtt [ 'default_map_center_latitude' ] ,
51
- :zoom => Setting . plugin_redmine_gtt [ 'default_map_zoom_level' ] ,
52
- :maxzoom => Setting . plugin_redmine_gtt [ 'default_map_maxzoom_level' ] ,
53
- :vector_minzoom => Setting . plugin_redmine_gtt [ 'vector_minzoom_level' ] ,
54
- :fit_maxzoom => Setting . plugin_redmine_gtt [ 'default_map_fit_maxzoom_level' ] ,
55
- :geocoder => geocoder ,
56
- :plugin_settings => Setting . plugin_redmine_gtt . select { |key , value | key . to_s . match ( /^(?!default).+/ ) } ,
57
- :i18n => l ( :gtt_js ) . to_json . html_safe
58
- } , :id => 'gtt-defaults' , :style => 'display:none' )
59
-
60
- return tags . join ( "\n " )
61
- end
62
23
end
63
24
end
0 commit comments