Skip to content

Commit 293d27a

Browse files
authored
Merge pull request #21 from OpenHistoricalMap/iD-2.18
use iD 2.18
2 parents d32eb97 + f7736e5 commit 293d27a

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ RUN apt-get update -qq && \
2828
nodejs \
2929
npm \
3030
vim \
31-
yarn \
3231
&& rm -rf /var/lib/apt/lists/*
3332

3433
# ###########################
@@ -77,11 +76,11 @@ RUN npm install -g \
7776
RUN mkdir -p /ohm-website
7877
WORKDIR /ohm-website
7978

80-
# bundle install takes a while, so only copy these in if Gemfiles have changed
79+
# Install app dependencies
8180
ADD ./Gemfile /ohm-website/Gemfile
8281
ADD ./Gemfile.lock /ohm-website/Gemfile.lock
83-
RUN echo 'gem "passenger", ">= 5.0.25", require: "phusion_passenger/rack_handler"' >> /ohm-website/Gemfile
84-
RUN bundle install -j $(nproc)
82+
RUN bundle install
83+
RUN gem install rake
8584

8685
# copy the Rails app in
8786
COPY . /ohm-website/
@@ -96,9 +95,9 @@ RUN vendorer
9695
RUN cp config/example.application.yml config/application.yml
9796
RUN cp config/example.database.yml config/database.yml
9897

99-
# generate translated JS
98+
RUN npm install yarn -g
99+
RUN bundle exec rake yarn:install
100100
RUN bundle exec rake i18n:js:export
101-
# precompile the asset pipeline
102101
RUN bundle exec rake assets:precompile
103102

104103
# 1. update the database with the current environment (known at runtime)

Vendorfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ folder 'vendor/assets' do
5252

5353
folder 'iD' do
5454
from 'git://github.com/openhistoricalmap/iD', :branch => 'release' do
55+
folder 'iD/data', 'dist/data'
5556
folder 'iD/img', 'dist/img'
5657
folder 'iD/locales', 'dist/locales'
5758
folder 'iD/mapillary-js', 'dist/mapillary-js'

app/assets/javascripts/id.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@
55
document.addEventListener("DOMContentLoaded", function() {
66
var container = document.getElementById("id-container");
77

8-
if (typeof iD === 'undefined' || !iD.Detect().support) {
8+
if (typeof iD === 'undefined' || !iD.utilDetect().support) {
99
container.innerHTML = 'This editor is supported ' +
1010
'in Firefox, Chrome, Safari, Opera, Edge, and Internet Explorer 11. ' +
1111
'Please upgrade your browser or use Potlatch 2 to edit the map.';
1212
container.className = 'unsupported';
1313
} else {
14-
var id = iD.Context()
14+
var id = iD.coreContext()
1515
.embed(true)
1616
.assetPath("iD/")
1717
.assetMap(JSON.parse(container.dataset.assetMap))
18-
.locale(container.dataset.locale, container.dataset.localePath)
18+
.locale(container.dataset.locale)
1919
.preauth({
2020
urlroot: location.protocol + "//" + location.host,
2121
oauth_consumer_key: container.dataset.consumerKey,
2222
oauth_secret: container.dataset.consumerSecret,
2323
oauth_token: container.dataset.token,
2424
oauth_token_secret: container.dataset.tokenSecret
25-
});
25+
})
26+
.containerNode(container)
27+
.init();
2628

2729
id.map().on('move.embed', parent.$.throttle(250, function() {
2830
if (id.inIntro()) return;
@@ -53,6 +55,5 @@ document.addEventListener("DOMContentLoaded", function() {
5355
}, 0);
5456
});
5557

56-
id.ui()(container);
5758
}
5859
});

app/assets/stylesheets/id.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
/*
22
*= require iD
33
*/
4+
5+
/* document-level styling */
6+
html, body {
7+
width: 100%;
8+
height: 100%;
9+
margin: 0;
10+
padding: 0;
11+
overflow: hidden;
12+
}

app/views/site/id.html.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<% data[:consumer_secret] = token.client_application.secret -%>
1818
<% end %>
1919
<% data[:locale] = ID::LOCALES.preferred(preferred_languages).to_s -%>
20-
<% data[:locale_path] = asset_path("iD/locales/#{data[:locale]}.json") -%>
2120
<% data[:asset_map] = assets("iD").to_json -%>
2221
<%= content_tag :div, "", :id => "id-container", :data => data %>
2322
</body>

config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
2424

2525
# Compress JavaScripts and CSS.
26-
config.assets.js_compressor = :uglifier
26+
config.assets.js_compressor = Uglifier.new(harmony: true)
2727
# config.assets.css_compressor = :sass
2828

2929
# Do not fallback to assets pipeline if a precompiled asset is missed.

0 commit comments

Comments
 (0)