Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

PSA Submissions #22

Open
pstoica opened this issue Feb 24, 2014 · 2 comments
Open

PSA Submissions #22

pstoica opened this issue Feb 24, 2014 · 2 comments
Assignees
Labels

Comments

@pstoica
Copy link
Member

pstoica commented Feb 24, 2014

UP FOR GRABS

Staff members should be able to submit PSAs for approval, since DJs are often part of other student orgs that would have good material.

  • Create a "PSA Suggestions" page in the Staff section of the site.
  • Staff should be able to add a title, body, and expiration date.

We often use a natural language parser called Chronic for dates, abstracted as a mixable concern). This module could use some documentation, but it's already implemented in the PSA model:

class Psa < ActiveRecord::Base
  include NaturalLanguageDate
  natural_language_date_attr :expiration_date

  validate :expiration_date_string_is_date
end

You use it by calling natural_language_date_attr on the field, and it will create a setter named :expiration_date_string which takes a string, parses it into a date, and passes it back to the :expiration_date field. The mixin also creates an _is_date validator, but you have to add the validation yourself.

The PSA admin form shows how to use all this in a form:

= f.input :expiration_date_string, input_html: { class: 'form-control' }, required: true

So, make a controller (app/controllers/staff/psas_controller.rb) with new and create actions (maybe index if you want to show pending PSAs?), the appropriate views in (app/views/staff/*.html.slim), and the routes in routes.rb.

@pstoica
Copy link
Member Author

pstoica commented Feb 27, 2014

Note: PSA submissions should have the status 'new' which can only be changed on the admin side; so hide this for the end user.

@pstoica
Copy link
Member Author

pstoica commented Apr 4, 2014

@nlts if you're looking for a starter/refresher issue, this one is pretty straightforward.

@radioblazer radioblazer self-assigned this Apr 4, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants