implement base url thing whoo
This commit is contained in:
parent
b9c5b59269
commit
609d58b0b6
3 changed files with 6 additions and 4 deletions
|
@ -91,7 +91,8 @@ class MapsController < ApplicationController
|
|||
|
||||
# GET maps/:id/export
|
||||
def export
|
||||
exporter = MapExportService.new(current_user, @map)
|
||||
|
||||
exporter = MapExportService.new(current_user, @map, base_url: request.base_url)
|
||||
respond_to do |format|
|
||||
format.json { render json: exporter.json }
|
||||
format.csv { send_data exporter.csv }
|
||||
|
|
|
@ -67,11 +67,12 @@ class User < ApplicationRecord
|
|||
json
|
||||
end
|
||||
|
||||
def as_rdf
|
||||
def as_rdf(opts = {})
|
||||
base_url = opts[:base_url] || 'https://metamaps.cc'
|
||||
output = ''
|
||||
output += %(d:mapper_#{id} a foaf:OnlineAccount ;\n)
|
||||
output += %( foaf:accountName "#{name}";\n)
|
||||
output += %( foaf:accountServiceHomepage "https://metamaps.cc/mapper/#{id}";\n)
|
||||
output += %( foaf:accountServiceHomepage "#{base_url}/mapper/#{id}";\n)
|
||||
output[-2] = '.' # change last ; to a .
|
||||
output += %(\n)
|
||||
output
|
||||
|
|
|
@ -32,7 +32,7 @@ class MapExportService
|
|||
output += "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n"
|
||||
output += "\n"
|
||||
map.contributors.each do |mapper|
|
||||
output += mapper.as_rdf
|
||||
output += mapper.as_rdf(base_url: base_url)
|
||||
end
|
||||
map.topics.each do |topic|
|
||||
output += topic.as_rdf
|
||||
|
|
Loading…
Add table
Reference in a new issue