Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor JSON controller for easier extension.. #853

Closed
rjmackay opened this issue Sep 30, 2012 · 0 comments
Closed

Refactor JSON controller for easier extension.. #853

rjmackay opened this issue Sep 30, 2012 · 0 comments
Labels
Milestone

Comments

@rjmackay
Copy link
Contributor

In particular I need this to build a better sharing plugin

  • Split GeoJSON rendering into its own function
  • Reuse JSON array building for /json in generating single points for /json/cluster
  • Passthrough any extra geo params on /json/cluster to the cluster urls
    ie. if you call json/cluster?...&sharing=2 cluster urls will be like /reports?...&sharing=2
  • Fix some minor issue
    • Always display thumbnails if we've got them.
    • Don't use default map icon for categories that are missing an icon
    • handle media urls using url::convert_uploaded_to_abs()
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 1, 2012
…hahidi#853

Split out code for parsing params, generation geojson arrays and
rending geojson. Now cluster() and index() both call geojson().
This parses parameters and calls either clusters_geojson()
or markers_geojson() to get the markers arrays. Markers are
passed to render_geojson() to render the final JSON output.

clusters_geojson() now reuses markers_geojson() for the single
point markers left over after clustering.

single() also reuses markers_geojson and geojson() render
after man fetching single marker and neighbors.

We jump through a few hoops to handle both std_class objects
and ORM objects as markers. Particularly lat/lon can come either
directly in the marker object or accessed through the a
location object. This is to make it easier for plugins to
tweak everything.

We're no longer storing cluster distance as this wasn't
used and was breaking real ORM objects

Also add more events to tweak marker or json:
* altering or replacings markers before they are clustered
  or converted to geojson.
* Add generalised event for modifying json_features
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 1, 2012
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 1, 2012
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 1, 2012
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 1, 2012
These are used in the json controller and reports listing
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 1, 2012
…shahidi#853

Allows plugins to pass markers with their own url attribute or method
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 1, 2012
This is a hack so when plugins like sharing_two pass extra markers
via events we can tell which is which. Sure there is a better way
but this is quick.
@rjmackay rjmackay closed this as completed Oct 1, 2012
rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Oct 11, 2012
* Make _get_geometry protected not private to allow overriding
  markers_json()
* Add events for tweaking the marker color / icon
* Pass marker link to _get_geometry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant