Navigation Menu

Skip to content

Commit

Permalink
Course show template tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
aslamnd committed Feb 16, 2012
1 parent 9dba80e commit 5789f07
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/helpers/courses_helper.rb
@@ -1,2 +1,5 @@
module CoursesHelper
def company_class
@course.company.name.parameterize if @course.company
end
end
4 changes: 4 additions & 0 deletions app/models/author.rb
Expand Up @@ -15,4 +15,8 @@ class Author < ActiveRecord::Base

validates :name, presence: true

def to_s
name
end

end
4 changes: 4 additions & 0 deletions app/models/company.rb
Expand Up @@ -15,4 +15,8 @@ class Company < ActiveRecord::Base

validates :name, presence: true

def to_s
name
end

end
10 changes: 10 additions & 0 deletions app/views/courses/show.html.haml
@@ -1,4 +1,14 @@
%h2= @course.title
%p.author= "by #{@course.author}"

%p
= "Difficulty: #{@course.difficulty_name}"
|
= "Duration: #{@course.duration}"

%p= @course.description

%p{ class: company_class }= @course.company

= link_to "Edit Course", edit_course_path(@course), class: "btn"
= link_to "Delete Course", @course, method: :delete, confirm: "Are you sure to delete this course?", class: "btn btn-danger"
6 changes: 5 additions & 1 deletion features/courses/admin_creates_courses.feature
Expand Up @@ -30,4 +30,8 @@ Feature: Admin creates a course
Then I should see "Course has been created."
And I should be on the course page for "CSS Essentials Training"
And I should see "CSS Essentials Training"

And I should see "by Joe Marani" within ".author"
And I should see "This course is super awesome"
And I should see "Lynda.com" within ".lynda-com"
And I should see "Difficulty: Beginner"
And I should see "Duration: 3h 30m"

0 comments on commit 5789f07

Please sign in to comment.