Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Commit

Permalink
added subjects view; added schema-browswer plugin as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
robmckinnon committed Apr 27, 2008
1 parent 3941754 commit 41906f2
Show file tree
Hide file tree
Showing 12 changed files with 4,613 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "vendor/plugins/haml"]
path = vendor/plugins/haml
url = git://github.com/nex3/haml.git
[submodule "vendor/plugins/schema-browser"]
path = vendor/plugins/schema-browser
url = git://github.com/tomtt/schema-browser.git
20 changes: 20 additions & 0 deletions app/controllers/subjects_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class SubjectsController < ApplicationController

def index
@subjects = Subject.find(:all)

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @subjects }
end
end

def show
@subject = Subject.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @subject }
end
end
end
8 changes: 8 additions & 0 deletions app/helpers/answer_groups_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module AnswerGroupsHelper

def link_to_subjects group
link_to group.title, subject_path(group.subject)
end

def link_to_answer_group group
link_to group.title, answer_group_path(group)
end
Expand All @@ -24,4 +28,8 @@ def answering_member answer
answering << ":</span>"
answering.join('')
end

def format_answer answer
"<p>#{answering_member(answer)} #{answer.text[/<p>(.*)/, 1]}"
end
end
1 change: 1 addition & 0 deletions app/models/subject.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Subject < ActiveRecord::Base

has_many :answer_groups
has_many :minor_answer_groups, :class_name => 'AnswerGroup', :foreign_key => 'minor_subject_id'

def self.from_name name
name ? Subject.find_or_create_by_name(name) : nil
Expand Down
5 changes: 2 additions & 3 deletions app/views/answer_groups/show.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- @title = @answer_group.title
- @title = link_to_subjects(@answer_group)
.written_answers
%p= @answer_group.date

Expand All @@ -10,6 +10,5 @@
= question_introduction(question)
%blockquote
= question.text
= answering_member(answer)
= answer.text
= format_answer(answer)
= link_to 'Back', answer_groups_path
4 changes: 2 additions & 2 deletions app/views/layouts/application.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
%html
%head
%title Lords Q+A
= stylesheet_link_tag "http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css"
= stylesheet_link_tag "http://yui.yahooapis.com/2.5.1/build/assets/skins/sam/skin.css"
= stylesheet_link_tag "reset-fonts-grids.css" #"http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css"
= stylesheet_link_tag "skin.css" #"http://yui.yahooapis.com/2.5.1/build/assets/skins/sam/skin.css"
= stylesheet_link_tag "screen"
%body
#custom-doc.yui-t7
Expand Down
8 changes: 8 additions & 0 deletions app/views/subjects/show.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- @title = @subject.name
.related
%ul
- @subject.answer_groups.group_by(&:minor_subject).each do |subject, group|
%li
= link_to subject.name, answer_group_path(group) if subject

%p= link_to 'All written answers', answer_groups_path
278 changes: 278 additions & 0 deletions public/stylesheets/reset-fonts-grids.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@


_gat is not defined
[Break on this error] </script>
robmckinnon (line 580)
urchinTracker is not defined
[Break on this error] urchinTracker(url);
home (line 1564)
_gat is not defined
[Break on this error] </script>
master (line 1427)
html {
background:#FFFFFF none repeat scroll 0%;
color:#000000;
}
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td {
margin:0pt;
padding:0pt;
}
table {
border-collapse:collapse;
border-spacing:0pt;
}
fieldset, img {
border:0pt none;
}
address, caption, cite, code, dfn, em, strong, th, var {
font-style:normal;
font-weight:normal;
}
li {
list-style-image:none;
list-style-position:outside;
list-style-type:none;
}
caption, th {
text-align:left;
}
h1, h2, h3, h4, h5, h6 {
font-size:100%;
font-weight:normal;
}
q:before, q:after {
content:'';
}
abbr, acronym {
border:0pt none;
font-variant:normal;
}
sup {
vertical-align:text-top;
}
sub {
vertical-align:text-bottom;
}
input, textarea, select {
font-family:inherit;
font-size:inherit;
font-weight:inherit;
}
input, textarea, select {
}
legend {
color:#000000;
}
body {
font-family:arial,helvetica,clean,sans-serif;
font-size:13px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:1.231;
}
table {
font-size:inherit;
}
pre, code, kbd, samp, tt {
font-family:monospace;
line-height:100%;
}
body {
text-align:center;
}
#ft {
clear:both;
}
#doc, #doc2, #doc3, #doc4, .yui-t1, .yui-t2, .yui-t3, .yui-t4, .yui-t5, .yui-t6, .yui-t7 {
margin:auto;
min-width:750px;
text-align:left;
width:57.69em;
}
#doc2 {
width:73.076em;
}
#doc3 {
margin:auto 10px;
width:auto;
}
#doc4 {
width:74.923em;
}
.yui-b {
position:relative;
}
.yui-b {
}
#yui-main .yui-b {
position:static;
}
#yui-main {
width:100%;
}
.yui-t1 #yui-main, .yui-t2 #yui-main, .yui-t3 #yui-main {
float:right;
margin-left:-25em;
}
.yui-t4 #yui-main, .yui-t5 #yui-main, .yui-t6 #yui-main {
float:left;
margin-right:-25em;
}
.yui-t1 .yui-b {
float:left;
width:12.3077em;
}
.yui-t1 #yui-main .yui-b {
margin-left:13.3077em;
}
.yui-t2 .yui-b {
float:left;
width:13.8461em;
}
.yui-t2 #yui-main .yui-b {
margin-left:14.8461em;
}
.yui-t3 .yui-b {
float:left;
width:23.0769em;
}
.yui-t3 #yui-main .yui-b {
margin-left:24.0769em;
}
.yui-t4 .yui-b {
float:right;
width:13.8456em;
}
.yui-t4 #yui-main .yui-b {
margin-right:14.8456em;
}
.yui-t5 .yui-b {
float:right;
width:18.4615em;
}
.yui-t5 #yui-main .yui-b {
margin-right:19.4615em;
}
.yui-t6 .yui-b {
float:right;
width:23.0769em;
}
.yui-t6 #yui-main .yui-b {
margin-right:24.0769em;
}
.yui-t7 #yui-main .yui-b {
display:block;
margin:0pt 0pt 1em;
}
#yui-main .yui-b {
float:none;
width:auto;
}
.yui-gb .yui-u, .yui-g .yui-gb .yui-u, .yui-gb .yui-g, .yui-gb .yui-gb, .yui-gb .yui-gc, .yui-gb .yui-gd, .yui-gb .yui-ge, .yui-gb .yui-gf, .yui-gc .yui-u, .yui-gc .yui-g, .yui-gd .yui-u {
float:left;
}
.yui-g .yui-u, .yui-g .yui-g, .yui-g .yui-gb, .yui-g .yui-gc, .yui-g .yui-gd, .yui-g .yui-ge, .yui-g .yui-gf, .yui-gc .yui-u, .yui-gd .yui-g, .yui-g .yui-gc .yui-u, .yui-ge .yui-u, .yui-ge .yui-g, .yui-gf .yui-g, .yui-gf .yui-u {
float:right;
}
.yui-g div.first, .yui-gb div.first, .yui-gc div.first, .yui-gd div.first, .yui-ge div.first, .yui-gf div.first, .yui-g .yui-gc div.first, .yui-g .yui-ge div.first, .yui-gc div.first div.first {
float:left;
}
.yui-g .yui-u, .yui-g .yui-g, .yui-g .yui-gb, .yui-g .yui-gc, .yui-g .yui-gd, .yui-g .yui-ge, .yui-g .yui-gf {
width:49.1%;
}
.yui-gb .yui-u, .yui-g .yui-gb .yui-u, .yui-gb .yui-g, .yui-gb .yui-gb, .yui-gb .yui-gc, .yui-gb .yui-gd, .yui-gb .yui-ge, .yui-gb .yui-gf, .yui-gc .yui-u, .yui-gc .yui-g, .yui-gd .yui-u {
margin-left:1.99%;
width:32%;
}
.yui-gb .yui-u {
}
.yui-gc div.first, .yui-gd .yui-u {
width:66%;
}
.yui-gd div.first {
width:32%;
}
.yui-ge div.first, .yui-gf .yui-u {
width:74.2%;
}
.yui-ge .yui-u, .yui-gf div.first {
width:24%;
}
.yui-g .yui-gb div.first, .yui-gb div.first, .yui-gc div.first, .yui-gd div.first {
margin-left:0pt;
}
.yui-g .yui-g .yui-u, .yui-gb .yui-g .yui-u, .yui-gc .yui-g .yui-u, .yui-gd .yui-g .yui-u, .yui-ge .yui-g .yui-u, .yui-gf .yui-g .yui-u {
width:49%;
}
.yui-g .yui-gb div.first, .yui-gb .yui-gb div.first {
}
.yui-g .yui-gc div.first, .yui-gd .yui-g {
width:66%;
}
.yui-gb .yui-g div.first {
}
.yui-gb .yui-gc div.first, .yui-gb .yui-gd div.first {
}
.yui-gb .yui-gb .yui-u, .yui-gb .yui-gc .yui-u {
}
.yui-g .yui-gb .yui-u {
}
.yui-gb .yui-gd .yui-u {
}
.yui-gb .yui-gd div.first {
}
.yui-g .yui-gc .yui-u, .yui-gb .yui-gc .yui-u {
margin-right:0pt;
width:32%;
}
.yui-gb .yui-gc div.first {
width:66%;
}
.yui-gb .yui-ge .yui-u, .yui-gb .yui-gf .yui-u {
margin:0pt;
}
.yui-gb .yui-gb .yui-u {
}
.yui-gb .yui-g div.first, .yui-gb .yui-gb div.first {
}
.yui-gc .yui-g .yui-u, .yui-gd .yui-g .yui-u {
}
s .yui-gb .yui-gd div.first {
width:32%;
}
.yui-g .yui-gd div.first {
}
.yui-ge .yui-g {
width:24%;
}
.yui-gf .yui-g {
width:74.2%;
}
.yui-gb .yui-ge div.yui-u, .yui-gb .yui-gf div.yui-u {
float:right;
}
.yui-gb .yui-ge div.first, .yui-gb .yui-gf div.first {
float:left;
}
.yui-gb .yui-ge .yui-u, .yui-gb .yui-gf div.first {
}
.yui-gb .yui-ge div.first, .yui-gb .yui-gf .yui-u {
}
.yui-ge div.first .yui-gd .yui-u {
width:65%;
}
.yui-ge div.first .yui-gd div.first {
width:32%;
}
#bd:after, .yui-g:after, .yui-gb:after, .yui-gc:after, .yui-gd:after, .yui-ge:after, .yui-gf:after {
clear:both;
content:".";
display:block;
height:0pt;
visibility:hidden;
}
#bd, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf {
}
Loading

0 comments on commit 41906f2

Please sign in to comment.