diff --git a/app/components/polls/callout_component.html.erb b/app/components/polls/callout_component.html.erb
index a47306b89..16a0333c7 100644
--- a/app/components/polls/callout_component.html.erb
+++ b/app/components/polls/callout_component.html.erb
@@ -1,32 +1,17 @@
<% if can?(:answer, poll) %>
- <% if poll.voted_in_booth?(current_user) %>
-
- <%= t("polls.show.already_voted_in_booth") %>
-
- <% elsif poll.voted_in_web?(current_user) %>
-
- <%= t("polls.show.already_voted_in_web") %>
-
+ <% if voted_in_booth? %>
+ <%= callout(t("polls.show.already_voted_in_booth")) %>
+ <% elsif voted_in_web? %>
+ <%= callout(t("polls.show.already_voted_in_web")) %>
<% end %>
<% else %>
<% if current_user.nil? %>
-
- <%= sanitize(t("polls.show.cant_answer_not_logged_in",
- signin: link_to_signin(class: "probe-message"),
- signup: link_to_signup(class: "probe-message"))) %>
-
+ <%= callout(not_logged_in_text, html_class: "primary") %>
<% elsif current_user.unverified? %>
-
- <%= sanitize(t("polls.show.cant_answer_verify",
- verify_link: link_to(t("polls.show.verify_link"), verification_path))) %>
-
+ <%= callout(unverified_text) %>
<% elsif poll.expired? %>
-
- <%= t("polls.show.cant_answer_expired") %>
-
+ <%= callout(t("polls.show.cant_answer_expired"), html_class: "alert") %>
<% else %>
-
- <%= t("polls.show.cant_answer_wrong_geozone") %>
-
+ <%= callout(t("polls.show.cant_answer_wrong_geozone")) %>
<% end %>
<% end %>
diff --git a/app/components/polls/callout_component.rb b/app/components/polls/callout_component.rb
index f639115aa..7091643d2 100644
--- a/app/components/polls/callout_component.rb
+++ b/app/components/polls/callout_component.rb
@@ -5,4 +5,29 @@ class Polls::CalloutComponent < ApplicationComponent
def initialize(poll)
@poll = poll
end
+
+ private
+
+ def voted_in_booth?
+ poll.voted_in_booth?(current_user)
+ end
+
+ def voted_in_web?
+ poll.voted_in_web?(current_user)
+ end
+
+ def callout(text, html_class: "warning")
+ tag.div(text, class: "callout #{html_class}")
+ end
+
+ def not_logged_in_text
+ sanitize(t("polls.show.cant_answer_not_logged_in",
+ signin: link_to_signin(class: "probe-message"),
+ signup: link_to_signup(class: "probe-message")))
+ end
+
+ def unverified_text
+ sanitize(t("polls.show.cant_answer_verify",
+ verify_link: link_to(t("polls.show.verify_link"), verification_path)))
+ end
end