poll with picture
Posted
#5936
(In Topic #1230)
Here's an example of what I'm talking about:

Is this something that can be done already? Or should this be a new feature add?
Best,
Christopher
Posted
Go to Content Management > Polls > Choose custom 'Poll' fields.
Add a new 'Picture' field.
Add/edit polls(s) with that field filled in.
Then you need to make a couple of template edits. The below shows the changes needed. I just tested right on top of the default templates, but you'd do it using the template editor to create overrides.
Code (Diff)
diff --git a/themes/default/templates/POLL_BOX.tpl b/themes/default/templates/POLL_BOX.tpl
index f9c7b9b18..76d5a5dac 100644
--- a/themes/default/templates/POLL_BOX.tpl
+++ b/themes/default/templates/POLL_BOX.tpl
@@ -18,8 +18,15 @@
{$INSERT_SPAMMER_BLACKHOLE}
{+END}
- <div>
- {CONTENT}
+ <div style="display: flex">
+ <div style="margin-right: 1em">
+ {$SET,bound_catalogue_entry,{$CATALOGUE_ENTRY_FOR,poll,{PID}}}
+ {+START,IF_NON_EMPTY,{$GET,bound_catalogue_entry}}{$CATALOGUE_ENTRY_FIELD_VALUE,{$GET,bound_catalogue_entry},0}{+END}
+ </div>
+
+ <div>
+ {CONTENT}
+ </div>
</div>
{+START,IF_NON_EMPTY,{RESULT_URL}}
diff --git a/themes/default/templates/POLL_SCREEN.tpl b/themes/default/templates/POLL_SCREEN.tpl
index e508657f9..2427721f8 100755
--- a/themes/default/templates/POLL_SCREEN.tpl
+++ b/themes/default/templates/POLL_SCREEN.tpl
@@ -15,9 +15,6 @@
{POLL_DETAILS}
</div>
-{$SET,bound_catalogue_entry,{$CATALOGUE_ENTRY_FOR,poll,{ID}}}
-{+START,IF_NON_EMPTY,{$GET,bound_catalogue_entry}}{$CATALOGUE_ENTRY_ALL_FIELD_VALUES,{$GET,bound_catalogue_entry}}{+END}
-
<div class="float_surrounder lined_up_boxes">
{+START,IF_NON_EMPTY,{TRACKBACK_DETAILS}}
<div class="trackbacks right">
index f9c7b9b18..76d5a5dac 100644
--- a/themes/default/templates/POLL_BOX.tpl
+++ b/themes/default/templates/POLL_BOX.tpl
@@ -18,8 +18,15 @@
{$INSERT_SPAMMER_BLACKHOLE}
{+END}
- <div>
- {CONTENT}
+ <div style="display: flex">
+ <div style="margin-right: 1em">
+ {$SET,bound_catalogue_entry,{$CATALOGUE_ENTRY_FOR,poll,{PID}}}
+ {+START,IF_NON_EMPTY,{$GET,bound_catalogue_entry}}{$CATALOGUE_ENTRY_FIELD_VALUE,{$GET,bound_catalogue_entry},0}{+END}
+ </div>
+
+ <div>
+ {CONTENT}
+ </div>
</div>
{+START,IF_NON_EMPTY,{RESULT_URL}}
diff --git a/themes/default/templates/POLL_SCREEN.tpl b/themes/default/templates/POLL_SCREEN.tpl
index e508657f9..2427721f8 100755
--- a/themes/default/templates/POLL_SCREEN.tpl
+++ b/themes/default/templates/POLL_SCREEN.tpl
@@ -15,9 +15,6 @@
{POLL_DETAILS}
</div>
-{$SET,bound_catalogue_entry,{$CATALOGUE_ENTRY_FOR,poll,{ID}}}
-{+START,IF_NON_EMPTY,{$GET,bound_catalogue_entry}}{$CATALOGUE_ENTRY_ALL_FIELD_VALUES,{$GET,bound_catalogue_entry}}{+END}
-
<div class="float_surrounder lined_up_boxes">
{+START,IF_NON_EMPTY,{TRACKBACK_DETAILS}}
<div class="trackbacks right">
Posted
Chris Graham said
It can be done.
Go to Content Management > Polls > Choose custom 'Poll' fields.
Add a new 'Picture' field.
Add/edit polls(s) with that field filled in.
Then you need to make a couple of template edits. The below shows the changes needed. I just tested right on top of the default templates, but you'd do it using the template editor to create overrides.
From “Post #6639”, 13th Jan 2021
Awesome. This worked great. Thanks!
The only thing I noticed when testing was that when I went to Preview the 'Add Poll' entry the picture did not display in the preview. Otherwise, everything else worked just as expected.
Posted
I didn't consider previews, but that's a tricky thing. I've added a tracker issue for it.
0004224: Support custom fields on previews - Composr CMS feature tracker
Posted
Chris Graham said
Cool.
I didn't consider previews, but that's a tricky thing. I've added a tracker issue for it.
0004224: Support custom fields on previews - Composr CMS feature tracker
From “Post #6649”, 15th Jan 2021
No worries. Just wanted to point out that I didn't see the image on the preview, so that you were aware. As is, it still works very well (ignoring the lack of preview, of course, which isn't a show-stopper). Thanks!
2 guests and 0 members have recently viewed this.
