AppGeo / ckanext-agsview

MIT License
10 stars 10 forks source link

Embeds don't work #2

Closed jqnatividad closed 7 years ago

jqnatividad commented 7 years ago

When trying to embed it on a third party site, or when using ckanext-featuredviews to feature the map on the dataset landing page.

You get this Javascript error:

Uncaught TypeError: str.replace is not a function
    at Object.trim (ags_fs_view.js:497)
    at cleanUrl (ags_fs_view.js:14179)
    at NewClass.initialize (ags_fs_view.js:16565)
    at NewClass.initialize (ags_fs_view.js:17075)
    at new NewClass (ags_fs_view.js:648)
    at Object.featureLayer (ags_fs_view.js:17376)
    at Module.loadJson (ags_fs_view.js:23094)
    at Module.initialize (ags_fs_view.js:23090)
    at Function.module.createInstance (jquery.form-warning.min.js;sandbox.min.js;module.min.js;pubsub.min.js;client.min.js;notify.min.js;i…:64)
    at String.<anonymous> (jquery.form-warning.min.js;sandbox.min.js;module.min.js;pubsub.min.js;client.min.js;notify.min.js;i…:64)

cc @GuidoS @pgirard

calvinmetcalf commented 7 years ago

looks like options.path, the layer path, is not being defined correctly

jqnatividad commented 7 years ago

@calvinmetcalf Is this a quick fix? We need it so we can use the agsview as the canonical view for the bostonmaps data.

calvinmetcalf commented 7 years ago

I need to work with @GuidoS to figure it out, I haven't used ckanext-featuredviews so I'll need to figure out if we are doing something weird or it is

calvinmetcalf commented 7 years ago

having trouble reproducing

screen shot 2017-01-10 at 10 19 10 am

how are you doing the embed?

jqnatividad commented 7 years ago

Try it here - http://boston.ogopendata.com/dataset/wicked-free-wi-fi-locations

wicked-free-wi-fi-locations:1012 GET http://boston.ogopendata.com/fonts/fontawesome-webfont.woff2?v=4.7.0 
ags_fs_view.js:497 Uncaught TypeError: str.replace is not a function
    at Object.trim (ags_fs_view.js:497)
    at cleanUrl (ags_fs_view.js:14179)
    at NewClass.initialize (ags_fs_view.js:16565)
    at NewClass.initialize (ags_fs_view.js:17075)
    at new NewClass (ags_fs_view.js:648)
    at Object.featureLayer (ags_fs_view.js:17376)
    at Module.loadJson (ags_fs_view.js:23143)
    at Module.initialize (ags_fs_view.js:23139)
    at Function.module.createInstance (image-upload.min.js:64)
    at String.<anonymous> (image-upload.min.js:64)
wicked-free-wi-fi-locations:1 GET http://boston.ogopendata.com/fonts/fontawesome-webfont.woff?v=4.7.0 
wicked-free-wi-fi-locations:1 GET http://boston.ogopendata.com/fonts/fontawesome-webfont.ttf?v=4.7.0 

There seems to be a namespace issue with ckanext-spatial. What extensions do you have installed on your CKAN? e.g. http://[CKAN]/api/util/status

calvinmetcalf commented 7 years ago

http://boston.ogopendata.com/dataset/wicked-free-wi-fi-locations

doesn't look like it loads the code in question

http://boston.ogopendata.com/dataset/wicked-free-wi-fi-locations/resource/e08ac3f9-177a-4ddb-b3ce-3345c168b611

does load the code but it's executed without error for me, what browser and version are you using?

jqnatividad commented 7 years ago

Hi @calvinmetcalf ,

Check it now. The idea is to have the agsview as the canonical view and be featured on the dataset/package landing page - http://boston.ogopendata.com/dataset/wicked-free-wi-fi-locations

That is set using https://github.com/datacats/ckanext-featuredviews, and gets the resource view in

http://boston.ogopendata.com/dataset/wicked-free-wi-fi-locations/resource/e08ac3f9-177a-4ddb-b3ce-3345c168b611

show as the "featured" / or canonical view on the dataset landing page.

calvinmetcalf commented 7 years ago

ok reproduced, the issue seems to be ckanext-featuredviews isn't passing that particular option over, will look into why. From a look at the source code it looks like the server is not populating that particular value in the html.

What version of ckan and the various plugins are you using?

jqnatividad commented 7 years ago

Sorry about the delay... using CKAN 2.5.2 http://boston.ogopendata.com/api/util/status

calvinmetcalf commented 7 years ago

could you try filling in the ags url in the view config? screen shot 2017-01-20 at 1 43 26 pm

jqnatividad commented 7 years ago

Now work with @jguo144's PR #7