-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from gtt-project/next
Prepares for the v5.0.0 release
- Loading branch information
Showing
133 changed files
with
11,380 additions
and
5,530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
# Ignore commonly generated/ignored files | ||
.DS_Store | ||
node_modules | ||
# webpack generate files | ||
assets/javascripts/main.js | ||
assets/javascripts/main.js.* | ||
assets/javascripts/*.png | ||
assets/javascripts/*.svg | ||
assets/javascripts/*.ttf | ||
assets/javascripts/*.eot | ||
assets/javascripts/*.woff2 | ||
assets/javascripts/*.woff | ||
|
||
node_modules/ | ||
|
||
# Ignore webpack generated files | ||
assets/* | ||
!assets/.keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Define gem versions with environment variables or default versions | ||
gem_versions = { | ||
pg: ENV['GEM_PG_VERSION'] || '1.5.3', | ||
rgeo: ENV['GEM_RGEO_VERSION'] || '3.0.0', | ||
rgeo_activerecord: ENV['GEM_RGEO_ACTIVERECORD_VERSION'] || '7.0.1', | ||
activerecord_postgis_adapter: ENV['GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION'] || '7.1.1' | ||
} | ||
|
||
gem 'deface' | ||
gem 'immutable-struct' | ||
gem "rgeo", "~> 2.4.0" | ||
gem "rgeo", "~> #{gem_versions[:rgeo]}" | ||
gem "rgeo-geojson" | ||
gem "pg", (ENV['GEM_PG_VERSION'] ? "~> #{ENV['GEM_PG_VERSION']}" : "~> 1.2.2") # make sure we use a version compatible with AR | ||
gem "rgeo-activerecord", (ENV['GEM_RGEO_ACTIVERECORD_VERSION'] ? "~> #{ENV['GEM_RGEO_ACTIVERECORD_VERSION']}" : "~> 7.0.1") # same as above | ||
gem 'activerecord-postgis-adapter', (ENV['GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION'] ? "~> #{ENV['GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION']}" : "~> 7.1.1") # same as above | ||
gem "pg", "~> #{gem_versions[:pg]}" | ||
gem "rgeo-activerecord", "~> #{gem_versions[:rgeo_activerecord]}" | ||
gem 'activerecord-postgis-adapter', "~> #{gem_versions[:activerecord_postgis_adapter]}" | ||
gem 'rails-controller-testing' # This gem brings back assigns to your controller tests as well as assert_template to both controller and integration tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,73 @@ | ||
class GttConfigurationController < ApplicationController | ||
|
||
before_action :find_optional_project_and_authorize | ||
before_action :find_optional_project_and_authorize | ||
|
||
accept_api_auth :default_setting_configuration | ||
accept_api_auth :default_setting_configuration | ||
|
||
def default_setting_configuration | ||
gtt_map_config = build_default_setting_config | ||
respond_to do |format| | ||
format.api { render json: build_default_setting_config} | ||
end | ||
def default_setting_configuration | ||
gtt_map_config = build_default_setting_config | ||
respond_to do |format| | ||
format.api { render json: build_default_setting_config} | ||
end | ||
end | ||
|
||
def build_default_setting_config | ||
default_tracker_icon = [] | ||
default_status_color = [] | ||
gtt_tile_source = [] | ||
def build_default_setting_config | ||
default_tracker_icon = [] | ||
default_status_color = [] | ||
gtt_map_layer = [] | ||
|
||
Tracker.all.sort.each {|tracker| | ||
default_tracker_icon.append({ | ||
trackerID: tracker.id, | ||
trackerName: tracker.name, | ||
icon: Setting.plugin_redmine_gtt['tracker_'+tracker.id.to_s] | ||
}) | ||
} | ||
IssueStatus.all.sort.each {|status| | ||
default_status_color.append({ | ||
statusID: status.id, | ||
statusName: status.name, | ||
color: Setting.plugin_redmine_gtt['status_'+status.id.to_s] | ||
}) | ||
} | ||
GttTileSource.where(global: true).sort.each {|tileSource| | ||
gtt_tile_source.append({ | ||
id: tileSource.id, | ||
name: tileSource.name, | ||
type: tileSource.type, | ||
options: tileSource.options | ||
}) | ||
} | ||
Tracker.all.sort.each {|tracker| | ||
default_tracker_icon.append({ | ||
trackerID: tracker.id, | ||
trackerName: tracker.name, | ||
icon: Setting.plugin_redmine_gtt['tracker_'+tracker.id.to_s] | ||
}) | ||
} | ||
|
||
mapConfig = { | ||
gttDefaultSetting: { | ||
defaultTrackerIcon: default_tracker_icon, | ||
defaultStatusColor: default_status_color, | ||
defaultMapSetting: { | ||
centerLng: Setting.plugin_redmine_gtt['default_map_center_longitude'], | ||
centerLat: Setting.plugin_redmine_gtt['default_map_center_latitude'] | ||
}, | ||
geometrySetting: { | ||
geometryTypes: Setting.plugin_redmine_gtt['editable_geometry_types_on_issue_map'], | ||
GeoJsonUpload: (Setting.plugin_redmine_gtt['enable_geojson_upload_on_issue_map'] == 'true'), | ||
}, | ||
geocoderSetting: { | ||
enableGeocodingOnMap: (Setting.plugin_redmine_gtt['enable_geocoding_on_map'] == 'true'), | ||
geocoderOptions: Setting.plugin_redmine_gtt['default_geocoder_options'] | ||
}, | ||
}, | ||
gttLayer: gtt_tile_source, | ||
} | ||
return mapConfig | ||
end | ||
IssueStatus.all.sort.each {|status| | ||
default_status_color.append({ | ||
statusID: status.id, | ||
statusName: status.name, | ||
color: Setting.plugin_redmine_gtt['status_'+status.id.to_s] | ||
}) | ||
} | ||
|
||
GttMapLayer.where(global: true).sort.each {|mapLayer| | ||
gtt_map_layer.append( | ||
mapLayer.as_json.except("created_at", "updated_at","position","global") | ||
) | ||
} | ||
|
||
mapConfig = { | ||
gttDefaultSetting: { | ||
defaultTrackerIcon: default_tracker_icon, | ||
defaultStatusColor: default_status_color, | ||
defaultMapSetting: { | ||
centerLng: Setting.plugin_redmine_gtt['default_map_center_longitude'], | ||
centerLat: Setting.plugin_redmine_gtt['default_map_center_latitude'] | ||
}, | ||
geometrySetting: { | ||
geometryTypes: Setting.plugin_redmine_gtt['editable_geometry_types_on_issue_map'], | ||
GeoJsonUpload: (Setting.plugin_redmine_gtt['enable_geojson_upload_on_issue_map'] == 'true'), | ||
}, | ||
geocoderSetting: { | ||
enableGeocodingOnMap: (Setting.plugin_redmine_gtt['enable_geocoding_on_map'] == 'true'), | ||
geocoderOptions: Setting.plugin_redmine_gtt['default_geocoder_options'] | ||
}, | ||
}, | ||
gttLayer: gtt_map_layer, | ||
} | ||
return mapConfig | ||
end | ||
|
||
private | ||
private | ||
|
||
def find_optional_project_and_authorize | ||
if params[:project_id] | ||
@project = Project.find params[:project_id] | ||
authorize | ||
else | ||
authorize_global | ||
end | ||
def find_optional_project_and_authorize | ||
if params[:project_id] | ||
@project = Project.find(params[:project_id]) | ||
authorize | ||
else | ||
authorize_global | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class GttController < ApplicationController | ||
def map | ||
path = Rails.root.join('public', 'plugin_assets', 'redmine_gtt', 'javascripts', 'main.js.map') | ||
send_file path, type: 'application/json', disposition: 'inline' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
class GttMapLayersController < ApplicationController | ||
layout 'admin' | ||
|
||
before_action :require_admin | ||
|
||
self.main_menu = false | ||
|
||
def index | ||
@map_layers = GttMapLayer.sorted | ||
end | ||
|
||
def new | ||
@map_layer = GttMapLayer.new | ||
end | ||
|
||
def create | ||
r = RedmineGtt::Actions::CreateMapLayer.(map_layer_params) | ||
if r.map_layer_created? | ||
redirect_to(params[:continue] ? new_gtt_map_layer_path : gtt_map_layers_path) | ||
else | ||
@map_layer = r.map_layer | ||
render 'new' | ||
end | ||
end | ||
|
||
def edit | ||
@map_layer = GttMapLayer.find(params[:id]) | ||
end | ||
|
||
def update | ||
ml = GttMapLayer.find(params[:id]) | ||
r = RedmineGtt::Actions::UpdateMapLayer.(ml, map_layer_params) | ||
if r.map_layer_updated? | ||
respond_to do |format| | ||
format.html { | ||
flash[:notice] = l(:notice_successful_update) | ||
redirect_to gtt_map_layers_path | ||
} | ||
format.js { head 200 } | ||
end | ||
else | ||
respond_to do |format| | ||
format.html { | ||
@map_layer = r.map_layer | ||
render 'edit' | ||
} | ||
format.js { head 422 } | ||
end | ||
end | ||
end | ||
|
||
def destroy | ||
ml = GttMapLayer.find(params[:id]) | ||
ml.destroy | ||
redirect_to gtt_map_layers_path | ||
end | ||
|
||
private | ||
|
||
def map_layer_params | ||
return {} unless params[:map_layer] | ||
|
||
params[:map_layer].permit( | ||
:name, :default, :global, :baselayer, :position, | ||
:layer, :layer_options_string, | ||
:source, :source_options_string, | ||
:format, :format_options_string, | ||
:styles | ||
) | ||
end | ||
end |
Oops, something went wrong.