Skip to content

Commit 5ec972d

Browse files
committed
Adds project rotation to map/api
Signed-off-by: Daniel Kastl <[email protected]>
1 parent 304cde8 commit 5ec972d

File tree

9 files changed

+13
-10
lines changed

9 files changed

+13
-10
lines changed

app/helpers/gtt_map_helper.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
module GttMapHelper
44

5-
def map_form_field(form, map, field: :geojson, bounds: nil, edit_mode: nil, upload: true)
5+
def map_form_field(form, map, field: :geojson, bounds: nil, edit_mode: nil, upload: true, rotation: 0)
66
safe_join [
77
form.hidden_field(field, id: 'geom'),
8-
map_tag(map: map, bounds: bounds, edit: edit_mode, upload: upload)
8+
map_tag(map: map, bounds: bounds, edit: edit_mode, upload: upload, rotation: rotation)
99
]
1010
end
1111

1212
def map_tag(map: nil, layers: map&.layers,
1313
geom: map.json, bounds: map.bounds,
1414
edit: nil, popup: nil, upload: true,
15-
collapsed: false)
15+
collapsed: false, rotation: map&.rotation)
1616

1717
data = {
18-
geom: geom.is_a?(String) ? geom : geom.to_json
18+
geom: geom.is_a?(String) ? geom : geom.to_json,
19+
rotation: rotation
1920
}
2021

2122
if layers

app/models/gtt_configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def self.from_params(params)
1919
end
2020

2121
def map
22-
GttMap.new json: geojson, layers: project.gtt_tile_sources.sorted, rotation: map_rotation
22+
GttMap.new json: geojson, layers: project.gtt_tile_sources.sorted, rotation: project.map_rotation
2323
end
2424

2525
end

app/views/issues/index/_map.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<legend class="<%= "icon " + (collapsed ? "icon-collapsed" : "icon-expended") %>"><%= l(:field_location) %></legend>
55

66
<%= map_tag map: @project.map, geom: (Issue.array_to_geojson(@issues, include_properties: { only: %i(id subject tracker_id status_id) }) if @issues),
7-
popup: { href: '/issues/[id]' }, collapsed: collapsed %>
7+
popup: { href: '/issues/[id]' }, collapsed: collapsed, rotation: @project.map_rotation %>
88
</fieldset>
99

1010
<% end %>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<% if @project.nil? or @project.module_enabled?(:gtt) %>
2-
<%= map_tag map: @issue.map, geom: (@issue.as_geojson(include_properties: { only: %i(tracker_id status_id) }) if @issue) %>
2+
<%= map_tag map: @issue.map, geom: (@issue.as_geojson(include_properties: { only: %i(tracker_id status_id) }) if @issue), rotation: @project.map_rotation %>
33
<% end %>

app/views/projects/index.api.rsb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ api.array :projects, api_meta(:total_count => @project_count, :offset => @offset
88
api.parent(:id => project.parent.id, :name => project.parent.name) if project.parent && project.parent.visible?
99
api.status project.status
1010
api.is_public project.is_public?
11+
api.rotation project.map_rotation
1112

1213
if @include_geometry
1314
if project.geom

app/views/projects/settings/_gtt.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121

2222
<div class="box">
23-
<%= map_form_field f, @form.map, bounds: nil, edit_mode: 'Polygon' %>
23+
<%= map_form_field f, @form.map, bounds: nil, edit_mode: 'Polygon', rotation: @project.map_rotation %>
2424
</div>
2525

2626
<%= submit_tag l(:button_save) %>

app/views/projects/show.api.rsb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ api.project do
77
api.parent(:id => @project.parent.id, :name => @project.parent.name) if @project.parent && @project.parent.visible?
88
api.status @project.status
99
api.is_public @project.is_public?
10+
api.rotation @project.map_rotation
1011

1112
if @project.geom
1213
api.geojson (params[:format] == "json") ? @project.geojson : @project.geojson.to_json

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<div class="projectmap box">
33
<h3 class="icon icon-gtt-map"><%= l(:label_project_map) %></h3>
44

5-
<%= map_tag map: @project.map %>
5+
<%= map_tag map: @project.map, rotation: @project.map_rotation %>
66
</div>
77
<% end %>

app/views/redmine_gtt/hooks/_view_issues_form_details_top.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
((issue.new_record? && User.current.allowed_to?(:add_issues, issue.project)) ||
33
User.current.allowed_to?(:edit_issues, issue.project))
44
%>
5-
<%= map_form_field form, issue.map, bounds: issue.project.map.bounds,
5+
<%= map_form_field form, issue.map, bounds: issue.project.map.bounds, rotation: @project.map_rotation,
66
edit_mode: Setting.plugin_redmine_gtt['editable_geometry_types_on_issue_map'] && Setting.plugin_redmine_gtt['editable_geometry_types_on_issue_map'].join(' '),
77
upload: Setting.plugin_redmine_gtt['enable_geojson_upload_on_issue_map'] == "true" %>
88
<% end %>

0 commit comments

Comments
 (0)