Skip to content

Commit

Permalink
Merge pull request #21 from OpenHistoricalMap/iD-2.18
Browse files Browse the repository at this point in the history
use iD 2.18
  • Loading branch information
geohacker authored Nov 24, 2020
2 parents d32eb97 + f7736e5 commit 293d27a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ RUN apt-get update -qq && \
nodejs \
npm \
vim \
yarn \
&& rm -rf /var/lib/apt/lists/*

# ###########################
Expand Down Expand Up @@ -77,11 +76,11 @@ RUN npm install -g \
RUN mkdir -p /ohm-website
WORKDIR /ohm-website

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

# copy the Rails app in
COPY . /ohm-website/
Expand All @@ -96,9 +95,9 @@ RUN vendorer
RUN cp config/example.application.yml config/application.yml
RUN cp config/example.database.yml config/database.yml

# generate translated JS
RUN npm install yarn -g
RUN bundle exec rake yarn:install
RUN bundle exec rake i18n:js:export
# precompile the asset pipeline
RUN bundle exec rake assets:precompile

# 1. update the database with the current environment (known at runtime)
Expand Down
1 change: 1 addition & 0 deletions Vendorfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ folder 'vendor/assets' do

folder 'iD' do
from 'git://github.com/openhistoricalmap/iD', :branch => 'release' do
folder 'iD/data', 'dist/data'
folder 'iD/img', 'dist/img'
folder 'iD/locales', 'dist/locales'
folder 'iD/mapillary-js', 'dist/mapillary-js'
Expand Down
11 changes: 6 additions & 5 deletions app/assets/javascripts/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@
document.addEventListener("DOMContentLoaded", function() {
var container = document.getElementById("id-container");

if (typeof iD === 'undefined' || !iD.Detect().support) {
if (typeof iD === 'undefined' || !iD.utilDetect().support) {
container.innerHTML = 'This editor is supported ' +
'in Firefox, Chrome, Safari, Opera, Edge, and Internet Explorer 11. ' +
'Please upgrade your browser or use Potlatch 2 to edit the map.';
container.className = 'unsupported';
} else {
var id = iD.Context()
var id = iD.coreContext()
.embed(true)
.assetPath("iD/")
.assetMap(JSON.parse(container.dataset.assetMap))
.locale(container.dataset.locale, container.dataset.localePath)
.locale(container.dataset.locale)
.preauth({
urlroot: location.protocol + "//" + location.host,
oauth_consumer_key: container.dataset.consumerKey,
oauth_secret: container.dataset.consumerSecret,
oauth_token: container.dataset.token,
oauth_token_secret: container.dataset.tokenSecret
});
})
.containerNode(container)
.init();

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

id.ui()(container);
}
});
9 changes: 9 additions & 0 deletions app/assets/stylesheets/id.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
*= require iD
*/

/* document-level styling */
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
1 change: 0 additions & 1 deletion app/views/site/id.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<% data[:consumer_secret] = token.client_application.secret -%>
<% end %>
<% data[:locale] = ID::LOCALES.preferred(preferred_languages).to_s -%>
<% data[:locale_path] = asset_path("iD/locales/#{data[:locale]}.json") -%>
<% data[:asset_map] = assets("iD").to_json -%>
<%= content_tag :div, "", :id => "id-container", :data => data %>
</body>
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass

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

0 comments on commit 293d27a

Please sign in to comment.