Code

Opened 7 years ago

Closed 6 years ago

#6289 closed (fixed)

Allow passing extra context to google-map.js

Reported by: omat at gezgin.com Owned by: jbronn
Component: GIS Version: gis
Severity: Keywords: gis, google maps, javascript
Cc: jbronn@…, omat@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The javascript template for displaying a Google Map is rendered inside the GoogleMap object with predefined parameters. Sometimes it may be useful to pass extra variables to the javascript temlaplates context.

For that, I patched the gmap.py by adding 2 lines to allow passing an extra_context dictionary.

Attachments (2)

gmap.py (3.8 KB) - added by omat at gezgin.com 7 years ago.
modified version of gmap.py to allow passing extra context to the js template
6289.diff (977 bytes) - added by arien 7 years ago.
patch proposed by reporter

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by omat at gezgin.com

modified version of gmap.py to allow passing extra context to the js template

comment:1 Changed 7 years ago by omat@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from SVN to gis

Changed 7 years ago by arien

patch proposed by reporter

comment:2 Changed 6 years ago by Simon Greenhill <dev@…>

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 6 years ago by jbronn

  • Cc jbronn@… added
  • Owner changed from nobody to jbronn
  • Status changed from new to assigned
  • Triage Stage changed from Ready for checkin to Unreviewed

Sounds like a good idea, and I'm all for it -- but I just found out about the ticket so I need to review it first before I'll check it in. Thanks for contributing.

comment:4 Changed 6 years ago by jbronn

  • Cc omat@… added
  • Triage Stage changed from Unreviewed to Design decision needed

If we are to go the keyword argument route I'd prefer to call it extra instead of extra_content (similar to IDL syntax). Or we could take it one step further -- add **kwargs, and have whatever additional keywords be sent to the template. A concern would be wanting to add a keyword argument in the future and messing up someone's template.

So I'm open to suggestions -- your thoughts?

comment:5 Changed 6 years ago by jbronn

  • Triage Stage changed from Design decision needed to Ready for checkin

On second thought extra_context is consistent with the Django API (specifically for generic views). No design design required.

comment:6 Changed 6 years ago by jbronn

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7027]) gis: Fixed #6289 (added extra_context keyword to GoogleMap). Thanks omat & arien.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.