Skip to content

Commit 904c75e

Browse files
authored
Merge pull request #87 from gtt-project/develop
Prepares for release 3.0.0 (webpack support version)
2 parents 3953592 + d48409a commit 904c75e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3490
-115850
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
.DS_Store
2+
node_modules
3+
# webpack generate files
4+
assets/javascripts/main.js
5+
assets/javascripts/main.js.*
6+
assets/javascripts/*.png
7+
assets/javascripts/*.svg
8+
assets/javascripts/*.ttf
9+
assets/javascripts/*.eot
10+
assets/javascripts/*.woff2
11+
assets/javascripts/*.woff
12+
13+

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ gem 'deface'
44
gem 'immutable-struct'
55
gem "rgeo"
66
gem "rgeo-geojson"
7-
gem "pg", (ENV['GEM_PG_VERSION'] ? "~> #{ENV['GEM_PG_VERSION']}" : "~> 1.1.4") # make sure we use a version compatible with AR
7+
gem "pg", (ENV['GEM_PG_VERSION'] ? "~> #{ENV['GEM_PG_VERSION']}" : "~> 1.2.2") # make sure we use a version compatible with AR
88
gem "rgeo-activerecord", (ENV['GEM_RGEO_ACTIVERECORD_VERSION'] ? "~> #{ENV['GEM_RGEO_ACTIVERECORD_VERSION']}" : "~> 6.2.2") # same as above
99
gem 'activerecord-postgis-adapter', (ENV['GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION'] ? "~> #{ENV['GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION']}" : "~> 5.2.3") # same as above
1010
gem 'rails-controller-testing' # This gem brings back assigns to your controller tests as well as assert_template to both controller and integration tests.

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Redmine GTT plugins **require PostgreSQL/PostGIS** and will not work with SQLite
1919
- Redmine >= 4.0.0
2020
- PostgreSQL >= 9.6
2121
- PostGIS >= 2.4
22+
- NodeJS v14
23+
- yarn
2224

2325
## Installation
2426

@@ -34,30 +36,27 @@ To install Redmine GTT plugin, download or clone this repository in your Redmine
3436
```
3537
cd path/to/plugin/directory
3638
git clone https://github.com/gtt-project/redmine_gtt.git
39+
cd redmine_gtt
40+
yarn
41+
npx webpack
3742
```
3843

3944
Then run
4045

4146
```
42-
export GEM_PG_VERSION=your-pg-version # skip this line if redmine use pg 1.1.4.
47+
export GEM_PG_VERSION=your-pg-version # skip this line if redmine use pg 1.2.2.
4348
export GEM_RGEO_ACTIVERECORD_VERSION=your-rgeo-activerecord-version # skip this line if using rgeo-activerecord 6.2.2.
4449
export GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION=your-activerecord-postgis-adapter-version # skip this line if using activerecord-postgis-adapter 5.2.3.
4550
bundle install
4651
bundle exec rake redmine:plugins:migrate
4752
```
4853

54+
Before restarting Redmine, you need to set `postgis` adapter instead of `postgres` adapter in your `config/database.yml`.
55+
4956
After restarting Redmine, you should be able to see the Redmine GTT plugin in the Plugins page.
5057

5158
More information on installing (and uninstalling) Redmine plugins can be found here: http://www.redmine.org/wiki/redmine/Plugins
5259

53-
## How to run test
54-
55-
After the installation, you can run the plugin test by the following command:
56-
57-
```
58-
RAILS_ENV=test NAME=redmine_gtt bundle exec rake redmine:plugins:test
59-
```
60-
6160
## How to use
6261

6362
1. Go to plugin configuration for global settings
@@ -72,6 +71,25 @@ For more information with screenshots see the [Getting Started](doc/getting-star
7271

7372
The GTT Project appreciates any [contributions](https://github.com/gtt-project/.github/blob/main/CONTRIBUTING.md)! Feel free to contact us for [reporting problems and support](https://github.com/gtt-project/.github/blob/main/CONTRIBUTING.md).
7473

74+
### How to debug frontend
75+
76+
You can debug frontend by running the following command on another console:
77+
78+
```
79+
npx webpack --watch --mode=development
80+
```
81+
82+
### How to run test
83+
84+
You can run the plugin test on rails test environment by the following command:
85+
86+
```
87+
bundle exec rake db:create
88+
RAILS_ENV=test bundle exec rake db:migrate
89+
RAILS_ENV=test bundle exec rake redmine:plugins:migrate
90+
RAILS_ENV=test NAME=redmine_gtt bundle exec rake redmine:plugins:test
91+
```
92+
7593
## Version History
7694

7795
See [all releases](https://github.com/gtt-project/redmine_gtt/releases) with release notes.
@@ -82,6 +100,7 @@ See [all releases](https://github.com/gtt-project/redmine_gtt/releases) with rel
82100
- [Daniel Kastl](https://github.com/dkastl)
83101
- [Thibault Mutabazi](https://github.com/eyewritecode)
84102
- [Ko Nagase](https://github.com/sanak)
103+
- [Taro Matsuzawa](https://github.com/smellman)
85104
- ... [and others](https://github.com/gtt-project/redmine_gtt/graphs/contributors)
86105

87106
## LICENSE

app/helpers/gtt_map_helper.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
module GttMapHelper
44

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

@@ -33,10 +33,9 @@ def map_tag(map: nil, layers: map&.layers,
3333
safe_join [
3434
content_tag(:div, "", data: data, id: uid, class: 'ol-map'),
3535
javascript_tag("
36-
$(document).ready(function(){
37-
App.init({
38-
target: $('##{uid}')[0]
39-
});
36+
document.addEventListener('DOMContentLoaded', function(){
37+
var target = document.getElementById('#{uid}');
38+
window.createGttClient(target);
4039
});
4140
")
4241
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</div>
1616

1717
<div class="box">
18-
<%= map_form_field f, @form.map, edit_mode: 'Polygon' %>
18+
<%= map_form_field f, @form.map, bounds: nil, edit_mode: 'Polygon' %>
1919
</div>
2020

2121

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
</fieldset>
22
<fieldset class="box tabular">
33
<legend><%= l(:label_user_map) %></legend>
4-
<%= map_form_field form, user.map, edit_mode: 'Point' %>
4+
<%= map_form_field form, user.map, bounds: nil, edit_mode: 'Point' %>
55

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,6 +2,6 @@
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, edit_mode: 'Point LineString Polygon' %>
5+
<%= map_form_field form, issue.map, bounds: issue.project.map.bounds, edit_mode: 'Point LineString Polygon' %>
66
<% end %>
77

app/views/settings/gtt/_settings.html.erb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<% Tracker.all.each do |t| %>
44
<p>
55
<%= content_tag :label, t.name %>
6-
<%= select_tag "settings[tracker_#{t.id}]", "<option>#{@settings["tracker_#{t.id}"]}</option>".html_safe %>
6+
<%= select_tag "settings[tracker_#{t.id}]", "<option>#{@settings["tracker_#{t.id}"]}</option>".html_safe %>
77
<i id="icon_settings_tracker_<%= t.id %>"></i>
88
</p>
99
<% end %>
@@ -72,16 +72,5 @@
7272
</div>
7373

7474
<%= javascript_tag do %>
75-
var glyph = ol.style.FontSymbol.prototype.defs.glyphs;
76-
for (var font in ol.style.FontSymbol.prototype.defs.fonts){
77-
for (var i in glyph){
78-
if (glyph[i].font == font){
79-
$("[id^='settings_tracker_']").append(new Option(glyph[i].name, i))
80-
}
81-
}
82-
}
83-
$("[id^='settings_tracker_']").change(function(){
84-
var trackerId = $(this).attr("id")
85-
$("#icon_" + trackerId).attr("class", $(this).val())
86-
})
75+
window.gtt_setting()
8776
<% end %>

assets/fonts/Redmine.eot

-4.61 KB
Binary file not shown.

assets/fonts/Redmine.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)