Skip to content

Commit

Permalink
Merge pull request #12 from srogers/develop
Browse files Browse the repository at this point in the history
Release v003
  • Loading branch information
srogers authored Jul 10, 2018
2 parents a0e7c30 + d7269c2 commit 7cdca03
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/controllers/publications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def destroy
end

def publication_params
params.require(:publication).permit(:presentation_id, :published_on, :format, :url)
params.require(:publication).permit(:presentation_id, :published_on, :format, :url, :notes)
end
end
18 changes: 11 additions & 7 deletions app/models/publication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ class Publication < ApplicationRecord

validates :presentation_id, presence: true

TAPE = 'Tape'
CD = 'CD'
VHS = 'VHS'
DISK = 'DVD/Blu-ray'
ONLINE = 'Online'
ESTORE = 'e-Store'
FORMATS = [TAPE, CD, VHS, DISK, ONLINE, ESTORE]
# These are just short word strings and not icons because there aren't good icons for making things like DVD and CD distinct.
TAPE = 'Tape'
CD = 'CD'
VHS = 'VHS'
DISK = 'DVD/Blu-ray'
CAMPUS = 'Campus'
YOUTUBE = 'YouTube' # Is it helpful to make this distinct?
PODCAST = 'Podcast'
ONLINE = 'Online' # Meant to be an "other" catch-all
ESTORE = 'e-Store' # This is going away . . .
FORMATS = [TAPE, CD, VHS, DISK, CAMPUS, YOUTUBE, PODCAST, ONLINE, ESTORE]

validates :format, inclusion: { in: FORMATS, message: "%{value} is not a recognized format" }

Expand Down
2 changes: 1 addition & 1 deletion app/views/presentations/_form_fields.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
= f.trix_editor :description
= f.input :tag_list, label: 'Subject Area', hint: "economics, politics, psychology, etc. - separate with commas"
= f.input :parts
= f.input :duration
= f.input :duration, hint: "total minutes"
4 changes: 3 additions & 1 deletion app/views/presentations/_presentation.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
%tr{ :class => cycle(:even, :odd) }
%td= link_to(truncate(presentation.name, length: 80), presentation_path(presentation))
%td= presentation.speaker_names
%td= presentation.conference_name
%td
- if presentation.conference.present?
= link_to presentation.conference_name, conference_path(presentation.conference)
%td= presentation.formats

%td{width: 120}
Expand Down
3 changes: 2 additions & 1 deletion app/views/presentations/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@
= simple_form_for @publication do |f|
= f.input :presentation_id, as: :hidden, input_html: { value: @presentation.id }
= f.input :format, collection: Publication::FORMATS, include_blank: false
= f.input :published_on, as: :date, start_year: 1980, order: [:year], label: "Published"
= f.input :published_on, as: :date, start_year: 1980, end_year: Date.today.year, order: [:year], label: "Published"
= f.input :url, label: 'URL'
= f.input :notes, hint: 'Any special clarifying info or references'
= f.submit "Add"
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20180710043556_add_notes_to_publications.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNotesToPublications < ActiveRecord::Migration[5.2]
def change
add_column "publications", :notes, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2018_07_09_014354) do
ActiveRecord::Schema.define(version: 2018_07_10_043556) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -94,6 +94,7 @@
t.string "url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "notes"
t.index ["creator_id"], name: "index_publications_on_creator_id"
t.index ["presentation_id"], name: "index_publications_on_presentation_id"
end
Expand Down

0 comments on commit 7cdca03

Please sign in to comment.