I succesfully posted an action to open graph with the 'Item' attachment layout. However I also want to post a action with the 'Map' attachment layout. My iOS app has an array with coordinates which form a route on a map.
I looked everywhere but just cant find a good tutorial which explains how to achieve this. Does someone know how to post a action to the open graph with a route preview on the map?
When you are creating your Open Graph custom Objects, you need to define a property of that Object as a GeoPoint and then set 'Is Array', like this:
If you include this information, there should be a Map style newsfeed post automatically created when the action is published. You should also set up a Map style Aggregation. There is more info on this here.
You can see an example of how this sort of complex route is created by looking at an example, here is one from an Endomondo workout:
http://pastebin.com/VEW2GU0t
Related
I try to create a custom Map with Highcharts – I need german job center districts. I've done it the way it is described here.
I imported the shapefiles to QGIS an created a highcharts map here. But on this way, all information like the name oft he district got lost. Is there a way to keep it? Because there are a lot of districts – I don't want to write all single names by my own.
I was able to generate GeoJSON from the provided shapefile (the one that you provided me with via email) and place it in the JSFiddle boilerplate (http://jsfiddle.net/highcharts/xbzxfx2L/). Empty map displayed without any problems. To add values to the regions and also to display data labels you need to add adequate data and link it to the mapData (more about it in the API link below). I have prepared an example for you. Simply, copy the content of created GeoJSON (generated from the shapefile using QGIS, as described here: https://www.highcharts.com/docs/maps/custom-geojson-maps) to the textarea and click run button. The map with the values should show up. Also, you could try to use map of Germany from our maps collection. It can be found here: http://code.highcharts.com/mapdata/.
API Reference:
https://api.highcharts.com/highmaps/series.map.joinBy
Example:
http://jsfiddle.net/w20e8vja/
I have built a simple website and have the requirement to display all post from a blog for a year.
For example www.mysite.com/blogs/2015 should display all posts of 2015.
However, this year is not the real creation date of the post but it is given as input while creating the post (I have added new field to the editor).
I should also have a way to access a post with a unique URL like www.mysite.com/blogs/2015/2, which should display the second post of 2015.
The post number is unique for the year. So I cannot use the content id.
I was able to make this work with my own controller, but an issue remains:
When posts are listed it will attach the URL created by the AutoroutePart, which will be like www.mysite.com/blogs/first-post.
I attempted to change this URL while creating the post by updating the Path property of the AutoroutePart but had no luck.
Any suggestions or advise are appreciated.
You can define you own route for any content item which has the AutoroutePart.
Example in you situation you need to edit the content definition of the blog posts. So under the Content Definition menu you select Blog Post, then edit, then you click on the expando arrow next to the Autoroute label and you'll see the Patterns field where you can define your own pattern.
I know this could be done by using aggregates. But I can't understand how to render the filter urls(drill down urls) to the view. So that user user can move to the down layer. Should I create them manually or does elasticsearch have built in method to achieve this?
The real problem is this. Say I click link in my category facet and now the URL of the current page looks like: http://example.com/search/cars-for-sale
Once I moved my mouse pointer over the link in location facet url should change like http://example.com/search/cars-for-sale-in-new-york
So my real concern is how to generate urls in the facets related to the current URl ?
Looking for general guidance on design/architecture of this in rails.
Use-case / Goal:
User can go to website, and search for a list of Mortgages (the model in the database):
User will select a single mortgage
After selecting, they will receive a QR Code on the screen which is the URL for the MortgageController#show method for the particular Mortgage that was chosen.
To emphasize: When they select the mortgage, they won't go to the MortgageController#show, rather they need to be returned a page containing a QR code which represents the URL to the proper MortgageController#show for the mortgage they selected.
Context: The QR-code page will be printed, scanned --along with the physical mortgage files-- into a document imaging system. The document imaging system will parse the QR Code, hitting the MortgageController#show, receiving JSON "describing"/representing that particular scanned Mortgage. (Using Qr-code leading to JSON, rather than the raw JSON, as scanners do better with QR-codes than text.).
I think I pretty well understand the MortgageController#show side of things -- it's just returning a JSON representation of the model Mortgage.
Things get fuzzy:
I imagine where the user will search/select a mortgage could be the MortgageController#index method.
But if I have a get QR Code link for each Mortgage, should it hit a custom method on the MortgageController like qr_code, which determines the proper URL which needs to be made into a QR code and returned?
I'm not sure how to organize the part that generates a QR Code pointing to the show method of MortgageController, and how the plumbing of this will work. Is it possible to know from a list of Models, which one was selected from a link, or form_for tag, if that link doesn't go to the standard show method of the controller? (Because I cannot use that method... that's the one that will be returning JSON!)
I'm pretty mixed up about this, and am new to Rails. Any ideas are appreciated!
I'll try to answer all of your questions:
Yes, the action listing the mortgages should be MortgageController#index
For the QR view, you have several choices. One way, probably the most REST-pure, you'll call MortgageController#show on that particular mortgage, using format: :qr, a MimeType you'd define for the occasion (the URL would be /mortgages/2.qr and the path in the form_for block would be mortgage_path(mortgage, format: :qr). In the controller side, you'd handle this using the respond_to |format| structure.
Another simpler option would be to define a non-REST action to present the QR: MortgageController#qr_code. That action you'd define like this on your routes.rb file:
resources :mortgages do
get :qr_code, on: :member
end
As a bonus track (not included in your question), you can use rqrcode_png gem to generate and print the QR codes in the /mortgage/3/qr_code view.
I need to add markers for locations matching a specific keyword on my map.
Such as "hotel" for instance.
I need to obtain the same result as when I search for that keyword on maps.google.com, only I want this search to be done automatically using gmaps4rails. I would add my location with a different marker on top.
cheers,
joel
the process would be:
Ajax version
you already have a map from gmaps4rails displayed
submit a form remotely to your server
create the proper query on your records in your controller, simply respond with .to_gmaps4rails
use the js replaceMarkers function to clear the map and display the markers from the server response.
use the geolocation functions of the client browser (beware, not available on all of them) + the js addMarkers function to display the user position.
I wrote the relevant documentation here
Standard version
get the proper objects from your controller
create the json from them
create your map
add a js callback to create the marker with user's position