poll with picture

Post

Posted
Rating:
#6628 (In Topic #1716)
Avatar
Standard member
cwdean is in the usergroup ‘Fan in action’
I'm a big fan of the polls feature of Composr and was wondering if there was a way to include a picture beside the poll?  Most people are visual and I think adding a picture associated with the Poll helps to emphasize and promote the poll, and adds a bit of polish, professionalism as well :)

Here's an example of what I'm talking about:
wind-chimes-poll.png
Is this something that can be done already?  Or should this be a new feature add?

Best,
Christopher
 
Online now: No Back to the top

Post

Posted
Rating:
#6639
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
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.

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">
 


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#6647
Avatar
Standard member
cwdean is in the usergroup ‘Fan in action’

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.



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.  :thumbs:
Online now: No Back to the top

Post

Posted
Rating:
#6649
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Cool  :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


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#6650
Avatar
Standard member
cwdean is in the usergroup ‘Fan in action’

Chris Graham said

Cool  :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

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!
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

babu, John Connor, Paul D, Manu, ManojSree, deepu_ms, mytracker

Forum statistics:
  • 1,214 topics, 5,700 posts, 6,857 members
  • Our newest member is Ektasharma
Birthdays:
Back to Top