Add Claim switch.

This commit is contained in:
2013-04-02 01:07:35 +01:00
parent 60ec1b0c0e
commit 7a097e4339
3 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load markdown_deux_tags %} {% load markdown_deux_tags %}
{% load staticfiles %} {% load staticfiles %}
{% load waffle_tags %}
{% block title %} {% block title %}
{{ chain.name }} {{ chain.name }}
@@ -35,7 +36,7 @@
<div class="span12"> <div class="span12">
{% if user.is_authenticated or not store.editor or user.is_superuser %} {% if user.is_authenticated or not store.editor or user.is_superuser %}
<p> <p>
{% if not chain.editor %}<a href="{% url "chain-claim" chain.slug %}" class="btn btn-small">Claim Chain</a>{% endif %} {% switch claim_support %}{% if not chain.editor %}<a href="{% url "chain-claim" chain.slug %}" class="btn btn-small">Claim Chain</a>{% endif %}{% switchflag %}
{% if is_editor %}<a href="#" class="btn btn-small">Edit Chain</a>{% endif %} {% if is_editor %}<a href="#" class="btn btn-small">Edit Chain</a>{% endif %}
{% if user.is_superuser %}<a href="{% url "admin:stores_chain_change" chain.pk %}" class="btn btn-small">Edit in Admin</a>{% endif %} {% if user.is_superuser %}<a href="{% url "admin:stores_chain_change" chain.pk %}" class="btn btn-small">Edit in Admin</a>{% endif %}
</p> </p>

View File

@@ -1,5 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load markdown_deux_tags %} {% load markdown_deux_tags %}
{% load waffle_tags %}
{% block title %} {% block title %}
{{ store.name }} {{ store.name }}
@@ -63,7 +64,7 @@ $(document).ready(function(){initialize_map_store()});
<div class="span4"> <div class="span4">
{% if user.is_authenticated and not store.editor or user.is_superuser %} {% if user.is_authenticated and not store.editor or user.is_superuser %}
<p> <p>
{% if not store.editor %}<a href="{% url "store-claim" store.slug %}" class="btn btn-small">Claim Store</a>{% endif %} {% switch claim_support %}{% if not store.editor %}<a href="{% url "store-claim" store.slug %}" class="btn btn-small">Claim Store</a>{% endif %}{% endswitch %}
{% if is_editor %}<a href="{% url "store-update" store.slug %}" class="btn btn-small">Edit Store</a>{% endif %} {% if is_editor %}<a href="{% url "store-update" store.slug %}" class="btn btn-small">Edit Store</a>{% endif %}
{% if user.is_superuser %}<a href="{% url "admin:stores_store_change" store.pk %}" class="btn btn-small">Edit in Admin</a>{% endif %} {% if user.is_superuser %}<a href="{% url "admin:stores_store_change" store.pk %}" class="btn btn-small">Edit in Admin</a>{% endif %}
</p> </p>

View File

@@ -4,13 +4,15 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib import messages from django.contrib import messages
from ..forms import ClaimRequestForm from ..forms import ClaimRequestForm
from ..models import ClaimRequest from ..models import ClaimRequest
from .mixins import WaffleSwitchMixin
class ClaimCreateView(CreateView): class ClaimCreateView(WaffleSwitchMixin, CreateView):
model = ClaimRequest model = ClaimRequest
target_model = None target_model = None
form_class = ClaimRequestForm form_class = ClaimRequestForm
template_name = 'stores/claim_form.html' template_name = 'stores/claim_form.html'
waffle_switch = 'claim_support'
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.target_obj = self.get_target_object() self.target_obj = self.get_target_object()