Skip to content

Commit

Permalink
Add project form template overrides into the base IPlugin class to
Browse files Browse the repository at this point in the history
allow for plugins which require a different / custom form rendering
than the default form partial without having to recreate everything
in the `project_configuration.html`
  • Loading branch information
thurloat committed Sep 11, 2012
1 parent a042dc0 commit 2b201c9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/sentry/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class IPlugin(local):
conf_title = None

project_conf_form = None
project_conf_form_template = 'sentry/partial/_form.html'
project_conf_template = 'sentry/plugins/project_configuration.html'

site_conf_form = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
{% endif %}

{% include "sentry/partial/_form.html" %}
{% include form_template %}
</div>
<div class="span4">
<div class="well plugin-meta">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
</div>
{% endif %}

{% include "sentry/partial/_form.html" %}
{% include form_template %}
3 changes: 3 additions & 0 deletions src/sentry/web/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ def plugin_config(plugin, project, request):
plugin_key = plugin.get_conf_key()
if project:
form_class = plugin.project_conf_form
form_template = plugin.project_conf_form_template
template = plugin.project_conf_template
else:
form_class = plugin.site_conf_form
form_template = "sentry/partial/_form.html"
template = plugin.site_conf_template

initials = plugin.get_form_initial(project)
Expand Down Expand Up @@ -187,4 +189,5 @@ def plugin_config(plugin, project, request):
'request': request,
'plugin': plugin,
'plugin_description': plugin.get_description() or '',
'form_template': form_template
}, context_instance=RequestContext(request))))

0 comments on commit 2b201c9

Please sign in to comment.