Git Product home page Git Product logo

shortcode-site-309's Introduction

Judy and Peterson are learning Rails 3. This project is a website for a POVRay shortcode contest that Peterson would like to run.

I am using this Ruby on Rails tutorial:

Ruby on Rails Tutorial: sample application

This is the sample application for Ruby on Rails Tutorial: Learn Rails by Example by Michael Hartl.

shortcode-site-309's People

Contributors

judytuna avatar petersont avatar

Stargazers

Anne Thorpe avatar Charlie Tuan avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

chtuan soatis

shortcode-site-309's Issues

Add user name indicator to home page.

On the home page, there's a sign out button, but it doesn't say who you are, it'd be nice if it said that, maybe it could go in the header, actually.

Fix user privileges

Only admin users should be able to see:

  • who is voting for an entry and how many votes an entry has
  • what entries a user is voting for
  • the "delete" button

Only the current user should be able to see:

  • which entries ey is voting_for, but not who any other user is voting_for
  • the "edit" button for their own entries (but not for any other users' entries) <--fix this!!!

Only logged-in user who has submitted a valid and rendered entry should see:

  • the voting buttons, but not on their own entries (doesn't prevent people from making another account and casting a vote for their original account's entry(ies), but that's another topic...)

Someone who is not logged in should:

  • not see "vote" buttons anywhere
  • should they be able to see the entries? maybe only after a certain time? discuss.
  • should they ever be able to see the list of viewers? no?

disallow multiple renders of same script

Nothing prevents the user from just jumping up and down on the render button. Really it should only allow a render if there's been an edit since the last render.

Add a "render" button

Allow a user to hit a button on their entry that says "render", which sends the shortcode text to our povray rendering cloud machine. IT'S THE FUTURE

Link entry submission to contest

Minimal functionality would be: the user page looks at the current contest. If an entry was created in the submission window, it assigns it to the current contest. If the deadline has passed, it closes that entry for editing (if it isn't in there aleady) and displays which contest the entry has been submitted to in the entry partial.

Link voting to contest

When the user goes to the all-entries page to vote, it looks at the current contest, makes sure you're in the voting window, and only shows entries in that contest.

Better error messages for signup

I know this is not a glamorous feature to add, but right now, when you try to make an account, if you give it invalid input, it gives you the same error message no matter why the input was invalid, so if your password is too short, it doesn't say, "password too short" it just says there's an error.

Gallery and Winners' Circle

We need another page to display the results of the voting. In the final version, that page should be withheld from public view until all the results are in, but for now it can be always visible so we can make sure it works. I'm thinking it's a different view like entries/index that appeals to rails code to compute the winner(s) and displays them prominently at the top with the runners up smaller below in random order (or alphabetical order by hash or something).

Time left instead of deadline

It sure would be nice if it told you how long it was until the deadline {in addition to || instead of} a calendar date.

Better sample data

Make better "fake" entries to use while testing (with povray code, so we can test the render link), so that rake db:populate will actually be useful.

Make time local timezone

Not sure how to do this, but it's got to be possible. The time in the timezone of the client machine. That's got to be possible.

Move the delete button

On the entry edit page, the delete button is in an awkward place, because it's really close to where the cursor is right after you navigate to that page. The submit button is really far away. The delete button should move to the bottom right, or something and submit to the top where it's easy to see.

Results link

Add a link to the nav bar to show the results page.

Forbid users from rendering other users' stuff

I think the way to do this is to add a "key" to the image submission form. The key is a big number that gets computed from the user id and entry id by a secret hash function of some sort. Then on server-side, we check that number using the same secret hash function and forbid the entry if it's wrong. This also provides a modicum of assurance that not just anybody can submit anything to our renderer. Only the entrants can submit.

Fancy up contest partial.

The contest partial is currently just a printout of all the data in the contest object. Make the partial print it in a more user friendly way, like with the title, starting date and submission deadline at the top with human readable dates and a countdown, rules after that.

Contest: Fathers, Lock Up Your Daughters
Entries due: November 5th, 2011 at 11:59pm.

Rules:
Lewdest image in 3x4 aspect ratio wins. Use any .inc files that come with the version 3.6 povray install.

Code length:
256 characters

Entries rendered with the following ini files:
blah blah blah

Make entries/index show thumbnails, not entire entries

Well, entries/index (aka "all entries") should show title and picture thumbnail (with pagination). Clicking on either should bring you to the entry show page.

This probably calls for a thumbnail partial.

If logged in, there should also be some visual indicator of the entries you have already voted for. Perhaps they will have a different color box around them, and/or the entries you voted for will appear at the top of the first page.

Decide: should there be a vote button for each entry on the "all entries" page?

Insist entries' names are unique

At least from one user. This will also prevent the bug where if you submit the same entry multiple times, it takes, and then there are a bunch of copies of the same entry, and it's stupid.

Full image and code-as-text

A full-sized version of the rendered image and text-only versions of the short code long code and comments ought to be available by link.

Display contest

Display the name and relevant deadline of the current contest prominently at the top of the page when appropriate (maybe in the header partial) particularly at the top of the user home page (when the current user is logged in) so that there's something showing the contest to which the currently edited entries belong.

Limit the votes

No matter how the voting algorithm works, we're going to need to limit the votes each user can do.

Make separate thumbnail render output text view

Right now, when you hit render, the page that it goes to says "output file didn't open" until something, I want it to say more about what's going on. "Attempting to render thumbnail, waiting for output..." "Thumbnail rendering..." and have outputs in separate text view objects on the screen, so you can tell the difference between "the render started and it's not done yet," "the render started and something didn't work" and "the render didn't start"

--pt

Link results to contest.

When you go to the results page, it should find not the current contest, but actually the most recent, and display results from that contest.

This means that the winner function should only compute based on the entries the contest that's being viewed.

EC2 should run all the time

Having the ec2 machine run its loop as a task with an "&" isn't the right solution, and it doesn't work very well. I have to do something to make it more persistent.

Render thumbnails

Add the capability to render a thumbnail to the pov server, and add a function to produce the thumbnail link for an entry.

Add Paperclip

For each entry: after our magical rendering ec2 machine renders the given shortcode, use Paperclip to store the resulting image file.

Make function to get current contest.

Everything needs to be able to see the current contest. Something like Contest.get_current member of the class? It'll live wherever it needs to to get everybody to be able to see it.

New entries get current contest id

Let's assume that when the user makes a new entry, that it is supposed to be an entry into the current contest, and then set the contest_id to the right thing, and display that in the entry partial (not the id, but the title).

Fix the Entry partial

It's totally broken right now.

Also need to add this functionality:
-- when logged in as the user who created that entry, show an "edit" button.
-- when logged in as any other user, show the "vote/unvote" button.

Fix the Votes model

Right now, the Votes relationship is incomplete. There is no way to list all of the users that voted for a particular entry. I think I missed something with reverse relationships.

Additionally, admins should be the only ones who can see the users that voted for an entry -- that information should not be public.

Contest index

Add a front end so that the admin can see the contests.

Entries get really wide

This bug happens if the shortcode in an entry doesn't have a lot of newline characters in it (which is probable). The text area it gets drawn in in the "My Home" section widens past the background rectangle and looks really awkward. Maybe fix by adding a ruby function to artificially inject newline characters?

Ajaxify render requests!

Currently the request to render is done with a regular hidden html form that links to a new page that's almost blank. This puts the user in a completely new context that doesn't make sense. They have to know to hit back, but not refresh. It would be much cleaner to just add a message to a dom element oncsreen that says the render is in progress. Ajax.

Make Contest class

It looks like we're going to need a context class.

Fields I think the contest class is going to have:

title: the contest itself can have a name, like "PSCC 2011, the HD round"
starting date: the date after which the contest is current
entry deadline: the date the entries will be collected and submitting new render jobs is closed
vote startdate: the date after which voting begins and hence the voting page becomes visible
vote deadline: the date after which voting is closed, and the gallery with winners becomes visible
rules: a string describing the rules of the particular contest
ini: a string containing the contents of the ini file, that's an initialization file for povray
thumbnail ini: one for the thumbnail as well.

Obviously its role in the project will be deeper than that, but first we have to make the class.

Count down the number of characters left in the shortcode text field

Add Javascript to the "new/edit entry" form (located at app/views/entry/_fields.html.erb) that counts down the available characters you have left as you type, like twitter does! Probably at the bottom right-hand corner of the text field.

Perhaps also display the number of characters used somewhere.

Sessions: log user out on browser close, & after time

Right now, if a user doesn't click "sign out", the session stays forever. The session should be destroyed when the browser closes (or even when you close the tab? I need to look into if that's even a thing). The session should also be destroyed after some long amount of time. Optionally, give the user an option of being logged-in forever (but maybe not, to keep things simple?).

Also: we should learn more about cookies. I don't want our site to leave unwanted cookies lying around or anything. https://www.eff.org/2011/october/facebook%E2%80%99s-hotel-california-cross-site-tracking-and-potential-impact-digital-privacy

Another thing to think about: should we try to implement another login system (through a gem like authlogic, clearance, or other: http://www.quora.com/Ruby-on-Rails/How-should-I-choose-an-authentication-gem )? Should we allow logins from other accounts (google, twitter, facebook), and/or openID? I am hesitant to allow facebook logins for ideological reasons. This is getting outside of the scope of this issue. =(

"are you sure?" when overwriting a vote

If a user already has a vote of weight 3, and they try to vote for another entry using a weight of 3, pop up a :confirm that clarifies that if they go through with the new vote of weight 3, the old one will be lost.

If they go through with it, maybe think about displaying a link to the old entry, so that they can click on it immediately (presumably to assign it another value, since they're adjusting what they want to vote for) instead of going back to the gallery pages and looking for it again.

(Alternatively, make a new UI that has you select up to three entries, and then assign vote weights between them ajaxly. Actually that sounds terrible and complicated, and if you changed your mind and wanted to vote for a different entry than one of the ones in your top 3, we'd have to come up with a UI where you chose which of your old top 3 you wanted to punt in favor of the new one... never mind)

Tiebreaker

Add to the voting algorithm to break a tie. Maybe this could work with the shortcode itself, like: in case of a tie, shortest code wins.

Only entrants may vote.

Only a logged-in user who has submitted an entry in the contest should see the voting buttons.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.