forked from mendicant-original/liskov
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve conflicts after pulled from original
- Loading branch information
Showing
8 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class DiscussionsController < ApplicationController | ||
before_filter :find_course | ||
|
||
def index | ||
@discussions = case params[:category] | ||
when "conversation" | ||
@course.discussions.conversations | ||
when "review" | ||
@course.discussions.reviews | ||
when "evaluation" | ||
@course.discussions.evaluations | ||
else | ||
@course.discussions.conversations | ||
end | ||
end | ||
|
||
private | ||
|
||
def find_course | ||
@course = Course.find(params[:course_id]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Discussion < ActiveRecord::Base | ||
belongs_to :course | ||
|
||
def self.conversations | ||
where(:category => "conversation") | ||
end | ||
|
||
def self.reviews | ||
where(:category => "review") | ||
end | ||
|
||
def self.evaluations | ||
where(:category => "evaluation") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
= link_to "Conversations", course_discussions_path(:category => "conversation") | ||
| | ||
= link_to "Reviews", course_discussions_path(:category => "review") | ||
| | ||
= link_to "Evaluations", course_discussions_path(:category => "evaluation") | ||
|
||
%br | ||
%br | ||
|
||
- @discussions.each do |discussion| | ||
%h3= discussion.subject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class CreateDiscussions < ActiveRecord::Migration | ||
def change | ||
create_table :discussions do |t| | ||
t.string :category | ||
|
||
t.text :subject | ||
t.text :body | ||
|
||
t.belongs_to :course | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters