Selectricity/Custom widgets plan

From WikiDotMako
Jump to: navigation, search

The widget works off 6 basic images:
1. Top Bar
2. Corner Image
3. Default Image for when Candidates don't have their own images
4. Background Type 1, which goes behind each 1/2 of the candidates and their descriptions
5. Background Type 2, goes behind the remaining candidates
6. Bottom Bar

Mako suggested having the user upload just one zip file, with all the images named properly. The other option, which I'm considering is having the files uploaded separatel (I don't know how to deal with zip files...) Are there any advantages to one method over the other? I guess uploading just one zip file is easier for the user, but then things would have to be named very specifically, wouldn't they?


My current idea is to add two columns to the Pictures database: 1. election_id, which would act as a link to elections model via belongs_to 2. type, which would perform a function similar to the type column in the elections table

   6 types: 'top', 'icon', 'image', 'bg1', 'bg2', 'bottom'

Then, from when creating widget in the view, have the code run a few checks.
if @election.top
<img src=url_for @election.icon>
else
<img src="images/embed_header_icon">

Any suggestions?