Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ftr/dependency update #340

Merged
merged 17 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions .github/workflows/test-postgis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
strategy:
fail-fast: false
matrix:
redmine_version: [5.0-stable, 5.1-stable, master]
ruby_version: ['3.0', '3.1', '3.2']
db_version: [12-3.4, 16-3.4]
redmine_version: [5.1-stable, 6.0-stable, master]
ruby_version: ['3.1', '3.2', '3.3']
db_version: [13-3.4, 17-3.5]
include:
- system_test: true
redmine_version: 5.1-stable
ruby_version: '3.2'
redmine_version: 6.0-stable
ruby_version: '3.3'
exclude:
- redmine_version: 5.0-stable
ruby_version: '3.2'
- redmine_version: 5.1-stable
ruby_version: '3.3'
- redmine_version: master

services:
Expand Down Expand Up @@ -106,8 +106,9 @@ jobs:
- name: Adjust Gem environment
run: |
case "${{ matrix.redmine_version }}" in
master)
echo "GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION=9.0.1" >> ${GITHUB_ENV}
5.1-stable)
echo "GEM_RGEO_ACTIVERECORD_VERSION=7.0.1" >> ${GITHUB_ENV}
echo "GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION=7.1.1" >> ${GITHUB_ENV}
;;
esac

Expand Down Expand Up @@ -142,11 +143,11 @@ jobs:
GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
working-directory: redmine
run: |
bundle exec rake redmine:plugins:test:units NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
bundle exec rake redmine:plugins:test:functionals NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
bundle exec rake redmine:plugins:test:integration NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
bundle exec rails test plugins/redmine_gtt/test/unit
bundle exec rails test plugins/redmine_gtt/test/functional
bundle exec rails test plugins/redmine_gtt/test/integration
if [ ${{ matrix.system_test }} = "true" ]; then
bundle exec rake redmine:plugins:test:system NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
bundle exec rails test plugins/redmine_gtt/test/system
fi

- name: Run uninstall test
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ 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'
rgeo: ENV['GEM_RGEO_VERSION'] || '3.0.1',
rgeo_activerecord: ENV['GEM_RGEO_ACTIVERECORD_VERSION'] || '8.0.0',
activerecord_postgis_adapter: ENV['GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION'] || '10.0.0'
}

gem 'deface'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ The Geo-Task-Tracker (GTT) plugin adds spatial capabilities to Redmine:
Redmine GTT plugins **require PostgreSQL/PostGIS** and will not work with SQLite
or MariaDB/MySQL!!!

- Redmine >= 5.0.0
- PostgreSQL >= 12
- Redmine >= 5.1.0
- PostgreSQL >= 13
- PostGIS >= 3.0
- NodeJS v18
- yarn
Expand Down
2 changes: 1 addition & 1 deletion app/models/gtt_map_layer.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Map layer model
#
# Configuration is stored as json
class GttMapLayer < ActiveRecord::Base
class GttMapLayer < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
self.inheritance_column = 'none'

validates :name, presence: true
Expand Down
2 changes: 1 addition & 1 deletion app/views/gtt_map_layers/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="contextual">
<%= link_to t('map_layer.new'), new_gtt_map_layer_path, :class => 'icon icon-add' %>
<%= link_to (Redmine::VERSION.to_s >= '6.0.0') ? sprite_icon('add', t('map_layer.new')) : t('map_layer.new'), new_gtt_map_layer_path, :class => 'icon icon-add' %>
</div>

<%= title t('map_layer.plural') %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/issues/show.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ api.issue do
api.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil?
api.notes journal.notes
api.created_on journal.created_on
api.updated_on journal.updated_on
api.updated_by(:id => journal.updated_by.id, :name => journal.updated_by.name) unless journal.updated_by.nil?
api.private_notes journal.private_notes
api.array :details do
journal.visible_details.each do |detail|
Expand Down
1 change: 1 addition & 0 deletions app/views/projects/index.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ api.array :projects, api_meta(:total_count => @project_count, :offset => @offset
api.name project.name
api.identifier project.identifier
api.description project.description
api.homepage project.homepage
api.parent(:id => project.parent.id, :name => project.parent.name) if project.parent && project.parent.visible?
api.status project.status
api.is_public project.is_public?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,27 @@
<textarea name="<%= l(:title_geojson_upload) %>" placeholder="<%= l(:placeholder_geojson_upload) %>" class="ui-widget ui-state-default ui-corner-all"></textarea>
<input type="file" id="file-selector" accept=".json,.geojson">
</div>

<%= javascript_include_tag 'main', plugin: 'redmine_gtt' %>

<% geocoder = { enabled: false } %>

<% if Setting.plugin_redmine_gtt['enable_geocoding_on_map'] == 'true' %>
<% geocoder = {
enabled: true,
provider: Setting.plugin_redmine_gtt['default_geocoder_provider'],
options: (JSON.parse(Setting.plugin_redmine_gtt['default_geocoder_options']) rescue {})
} %>
<% end %>

<%= tag.div data: {
lon: Setting.plugin_redmine_gtt['default_map_center_longitude'],
lat: Setting.plugin_redmine_gtt['default_map_center_latitude'],
zoom: Setting.plugin_redmine_gtt['default_map_zoom_level'],
maxzoom: Setting.plugin_redmine_gtt['default_map_maxzoom_level'],
vector_minzoom: Setting.plugin_redmine_gtt['vector_minzoom_level'],
fit_maxzoom: Setting.plugin_redmine_gtt['default_map_fit_maxzoom_level'],
geocoder: geocoder,
plugin_settings: Setting.plugin_redmine_gtt.select { |key, value| key.to_s.match(/^(?!default).+/) },
i18n: l(:gtt_js).to_json.html_safe
}, id: 'gtt-defaults', style: 'display:none' %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%= tag.meta(
name: 'gtt-font-custom-icons',
content: asset_path('plugin_assets/redmine_gtt/custom-icons.woff2')) %>

<%= tag.meta(
name: 'gtt-font-mdi-webfont',
content: asset_path('plugin_assets/redmine_gtt/materialdesignicons-webfont.woff2')) %>
9 changes: 3 additions & 6 deletions app/views/settings/gtt/_general.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<div class="box tabular settings">
<h3><%= l(:select_default_map_settings) %></h3>

<p>
Expand Down Expand Up @@ -41,9 +40,8 @@
:size => 10) %>
</p>

</div>
<hr>

<div class="box tabular settings">
<h3><%= l(:select_edit_geometry_settings) %></h3>

<p>
Expand All @@ -62,9 +60,9 @@
<%= content_tag(:label, l(:label_enable_geojson_upload_on_issue_map)) %>
<%= check_box_tag 'settings[enable_geojson_upload_on_issue_map]', true, @settings[:enable_geojson_upload_on_issue_map] %>
</p>
</div>

<div class="box tabular settings">
<hr>

<h3><%= l(:select_other_gtt_settings) %></h3>

<p>
Expand All @@ -81,4 +79,3 @@
<%= content_tag(:label, l(:label_hide_map_for_invalid_geom)) %>
<%= check_box_tag 'settings[hide_map_for_invalid_geom]', 1, Setting.plugin_redmine_gtt['hide_map_for_invalid_geom'] %>
</p>
</div>
2 changes: 0 additions & 2 deletions app/views/settings/gtt/_geocoder.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<div class="box tabular settings">
<h3><%= l(:select_default_geocoder_settings) %></h3>

<p>
Expand Down Expand Up @@ -27,7 +26,6 @@
:rows => 10,
:cols => 100) %>
</p>
</div>

<script>
document.getElementById('geocoder_load_example').addEventListener('click', (event) => {
Expand Down
11 changes: 7 additions & 4 deletions app/views/settings/gtt/_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@
});
}

// Activate tab if it is specified in the URL
document.addEventListener('DOMContentLoaded', function() {

// Activate tab if it is specified in the URL
var tab = getQueryParam('tab');
if (tab) {
activateTab(tab);
}
});

// Apply settings
window.gtt_setting()
// Apply GTT settings
if (typeof window.gtt_setting === 'function') {
window.gtt_setting();
}
});
<% end %>
30 changes: 15 additions & 15 deletions app/views/settings/gtt/_styling.html.erb
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<div class="box tabular settings">
<h3><%= l(:select_default_tracker_icon) %></h3>

<% Tracker.sorted.each do |t| %>
<p>
<%= content_tag :label, t.name %>
<%= select_tag "settings[tracker_#{t.id}]", "<option>#{@settings["tracker_#{t.id}"]}</option>".html_safe %>
<i id="icon_settings_tracker_<%= t.id %>"></i>
</p>
<p>
<%= content_tag :label, t.name %>
<%= select_tag "settings[tracker_#{t.id}]", "<option>#{@settings["tracker_#{t.id}"]}</option>".html_safe %>
<i id="icon_settings_tracker_<%= t.id %>"></i>
</p>
<% end %>
</div>

<div class="box tabular settings">
<hr>

<h3><%= l(:select_default_status_color) %></h3>

<% IssueStatus.sorted.each do |t| %>
<p>
<%= content_tag :label, t.name %>
<%= color_field_tag "settings[status_#{t.id}]", @settings["status_#{t.id}"] %>
</p>
<p>
<%= content_tag :label, t.name %>
<%= color_field_tag "settings[status_#{t.id}]", @settings["status_#{t.id}"] %>
</p>
<% end %>
</div>

<div class="box tabular settings">
<hr>

<h3><%= l(:select_other_style_settings) %></h3>

<p>
<%= content_tag(:label, l(:gtt_settings_vector_minzoom_level)) %>
<%= text_field_tag('settings[vector_minzoom_level]',
@settings['vector_minzoom_level'],
:size => 10 ) %>
</p>
</div>
6 changes: 6 additions & 0 deletions app/views/users/index.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ api.array :users, api_meta(:total_count => @user_count, :offset => @offset, :lim
api.passwd_changed_on user.passwd_changed_on
api.avatar_url gravatar_url(user.mail, {rating: nil, size: nil, default: Setting.gravatar_default}) if Setting.gravatar_enabled?
api.twofa_scheme user.twofa_scheme
api.status user.status

if user.geom
api.geojson (params[:format] == "json") ? user.geojson : user.geojson.to_json
else
api.geojson nil
end

api.auth_source do
api.id user.auth_source.id
api.name user.auth_source.name
end if include_in_api_response?('auth_source') && user.auth_source.present?

render_api_custom_values user.visible_custom_field_values, api
end
end
Expand Down
5 changes: 5 additions & 0 deletions app/views/users/show.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ api.user do

render_api_custom_values @user.visible_custom_field_values, api

api.auth_source do
api.id @user.auth_source.id
api.name @user.auth_source.name
end if User.current.admin? && include_in_api_response?('auth_source') && @user.auth_source.present?

api.array :groups do |groups|
@user.groups.each do |group|
api.group :id => group.id, :name => group.name
Expand Down
2 changes: 2 additions & 0 deletions config/icon_source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: gtt-map
svg: map
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ en:
select_edit_geometry_settings: "Set edit geometry settings:"
select_default_geocoder_settings: "Set Geocoder settings:"

select_other_style_settings: "Other style settings"

project_module_gtt: "GTT"
permission_manage_gtt_settings: "Manage GTT settings"
permission_view_gtt_settings: "View GTT settings"
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
to: 'projects#update_gtt_configuration',
as: :update_gtt_configuration

# Todo: check if this route should start with "/assets" for consistency
get '/plugin_assets/redmine_gtt/javascripts/index.js.map', to: 'gtt#map'

scope 'gtt' do
Expand Down
50 changes: 12 additions & 38 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Global Hooks
require File.expand_path('../lib/redmine_gtt/hooks/view_layouts_base_html_head_hook', __FILE__)
require File.expand_path('../lib/redmine_gtt/view_hooks', __FILE__)
require_relative 'lib/redmine_gtt/view_hooks'

Redmine::Plugin.register :redmine_gtt do
name 'Redmine GTT plugin'
author 'Georepublic'
author_url 'https://github.com/georepublic'
url 'https://github.com/gtt-project/redmine_gtt'
description 'Adds location-based task management and maps'
version '5.1.2'
version '6.0.0'

requires_redmine :version_or_higher => '5.0.0'
requires_redmine :version_or_higher => '5.1.0'

project_module :gtt do
permission :manage_gtt_settings, {
Expand Down Expand Up @@ -44,7 +42,8 @@
menu :admin_menu,
:gtt_map_layers,
{ controller: 'gtt_map_layers', action: 'index' },
caption: :'map_layer.plural', html: { class: 'icon icon-gtt-map' }
caption: :'map_layer.plural', html: { class: 'icon icon-gtt-map' },
:icon => 'gtt-map', :plugin => :redmine_gtt
end

# Register MIME Types
Expand All @@ -57,37 +56,12 @@
config.register RGeo::Cartesian.preferred_factory(has_z_coordinate: true, srid: 4326), geo_type: 'geometry', sql_type: "geometry", srid: 4326
end

if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
Dir.glob("#{Rails.root}/plugins/redmine_gtt/app/overrides/**/*.rb").each do |path|
Rails.autoloaders.main.ignore(path)
require path
end
RedmineGtt.setup_normal_patches
Rails.application.config.after_initialize do
RedmineGtt.setup_controller_patches
end
else
require 'redmine_gtt'
# Configure View Overrides
Rails.application.paths["app/overrides"] ||= []
Rails.application.paths["app/overrides"] << File.expand_path("../app/overrides", __FILE__)

ActiveSupport::Reloader.to_prepare do
RedmineGtt.setup_normal_patches

# ActiveRecord::Base.include_root_in_json = true
# module RGeo
# module Feature
# module Point
# def as_json(params)
# ::RGeo::GeoJSON.encode(self)
# end
# end
# end
# end
end
Dir.glob("#{Rails.root}/plugins/redmine_gtt/app/overrides/**/*.rb").each do |path|
Rails.autoloaders.main.ignore(path)
require path
end

Rails.configuration.to_prepare do
RedmineGtt.setup_controller_patches
end
RedmineGtt.setup_normal_patches
Rails.application.config.after_initialize do
RedmineGtt.setup_controller_patches
end
Loading
Loading