diff --git a/app/contrib/actions/pressure/cms_plugins.py b/app/contrib/actions/pressure/cms_plugins.py index afcb5eaa..95e2b049 100644 --- a/app/contrib/actions/pressure/cms_plugins.py +++ b/app/contrib/actions/pressure/cms_plugins.py @@ -51,12 +51,20 @@ def get_settings(self, obj): "title": "Envie um e-mail mandando seu recado", "button": "Pressionar", "count": "pessoas já pressionaram", + "main_color": None, } if obj: - settings["title"] = obj.settings.get("title_text", settings["title"]) + settings["title"] = ( + obj.settings.get("call_to_action") + or obj.settings.get("title_text") + or settings["title"] + ) settings["button"] = obj.settings.get("button_text", settings["button"]) settings["count"] = obj.settings.get("count_text", settings["count"]) + settings["main_color"] = obj.settings.get( + "main_color", settings["main_color"] + ) settings["targets"] = list( map( diff --git a/app/contrib/actions/pressure/forms.py b/app/contrib/actions/pressure/forms.py index 495f6482..5e70de00 100644 --- a/app/contrib/actions/pressure/forms.py +++ b/app/contrib/actions/pressure/forms.py @@ -23,8 +23,8 @@ class PressureAjaxForm(StyledBaseForm): reference_id = forms.IntegerField(widget=forms.HiddenInput) referrer_path = forms.CharField(widget=forms.HiddenInput) - email_address = forms.EmailField(label="Seu e-mail") - name = forms.CharField(label="Seu nome", max_length=80) + email_address = forms.EmailField(label="Seu e-mail*") + name = forms.CharField(label="Seu nome*", max_length=80) phone_number = forms.CharField(label="Seu telefone", max_length=15, required=False) email_subject = forms.CharField(label="Assunto", max_length=100) email_body = forms.CharField(label="Corpo do e-mail", widget=forms.Textarea) @@ -64,10 +64,17 @@ def submit(self): "widget_id": self.cleaned_data["reference_id"], } - resp = requests.post(settings.BONDE_ACTION_API_URL, json={"query": query, "variables": variables}) + resp = requests.post( + settings.BONDE_ACTION_API_URL, + json={"query": query, "variables": variables}, + ) if resp.status_code == 200: print(resp.json()) else: - raise Exception("Query failed to run by returning code of {}. {}".format(resp.status_code, query)) + raise Exception( + "Query failed to run by returning code of {}. {}".format( + resp.status_code, query + ) + ) except requests.ConnectionError: raise Exception("ConnectionError") diff --git a/app/contrib/actions/pressure/templates/pressure/pressure_plugin.html b/app/contrib/actions/pressure/templates/pressure/pressure_plugin.html index 3654d7fc..672cfbf6 100644 --- a/app/contrib/actions/pressure/templates/pressure/pressure_plugin.html +++ b/app/contrib/actions/pressure/templates/pressure/pressure_plugin.html @@ -1,5 +1,25 @@ {% load cms_tags sekizai_tags static %} +{% addtoblock "css" %} +{% if settings.main_color %} + +{% endif %} +{% endaddtoblock %} + {% addtoblock "js" %} @@ -7,7 +27,7 @@
-

{{settings.title}}

+

{{settings.title}}

{% with settings.targets|length as targets_size %}

Quem você vai pressionar? ({{targets_size}} alvo{% if targets_size > 1 %}s{% endif %})

@@ -43,7 +63,7 @@

{{settings.title}}

Ao inserir seus dados, você concorda em ter seus dados compartilhados com os organizadores dessa página e aceita receber emails de atualização, conforme descrito na política de privacidade. Você pode cancelar o recebimento desses e-mails a qualquer momento.

-

{{ size }} {{ settings.count }}

+

{{ size }} {{ settings.count }}

diff --git a/app/tailwind/forms.py b/app/tailwind/forms.py index 6759566f..25e84300 100644 --- a/app/tailwind/forms.py +++ b/app/tailwind/forms.py @@ -33,6 +33,7 @@ def __init__(self, *args, **kwargs): # Add readonly fields if visible.name in self.Meta.readonly_fields: + visible.field.widget.attrs["disabled"] = True visible.field.widget.attrs["readonly"] = True # Add placeholder to use focus animation label