Permalink
Browse files

cleaning up old idea: questions & answers

  • Loading branch information...
1 parent faa1233 commit 24c20fa28f21a4daca43e3349a31b0e0521f9778 @szemek committed Oct 26, 2012
@@ -1,3 +0,0 @@
-// Place all the styles related to the Answers controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -1,42 +0,0 @@
-// Place all the styles related to the Questions controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
-
-.header {
- h1 {
- margin-bottom: 50px
- }
-}
-
-.question-box {
- border-bottom: 1px dotted #999;
- padding: 10px 0;
- width: 550px;
-}
-
-.question-summary {
- h3 {
- a {
- color: #07c;
- text-decoration: none;
- }
- a:hover {
- background-color: transparent;
- text-decoration: underline;
- }
- }
-}
-
-.new-question {
- margin-top: 50px;
- a {
- background-color: #777;
- color: white !important;
- font-weight: bold;
- padding: 6px 12px 6px 12px;
- text-decoration: none;
- }
- a:hover {
- background-color: #f90;
- }
-}
@@ -1,57 +0,0 @@
-class AnswersController < ApplicationController
-
- before_filter :authenticate_user
-
- def new
- @question = Question.find(params[:question_id])
- @answer = @question.answers.build
-
- respond_to do |format|
- format.html # new.html.erb
- format.json { render json: @answer }
- end
- end
-
- def edit
- @answer = Answer.find(params[:id])
- end
-
- def create
- @question = Question.find(params[:question_id])
- @answer = @question.answers.build(params[:answer])
-
- respond_to do |format|
- if @answer.save
- format.html { redirect_to @question, notice: 'Answer was successfully created.' }
- format.json { render json: @question, status: :created, location: @question }
- else
- format.html { render action: "new" }
- format.json { render json: @answer.errors, status: :unprocessable_entity }
- end
- end
- end
-
- def update
- @answer = Answer.find(params[:id])
-
- respond_to do |format|
- if @answer.update_attributes(params[:answer])
- format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }
- format.json { head :no_content }
- else
- format.html { render action: "edit" }
- format.json { render json: @answer.errors, status: :unprocessable_entity }
- end
- end
- end
-
- def destroy
- @answer = Answer.find(params[:id])
- @answer.destroy
-
- respond_to do |format|
- format.html { redirect_to answers_url }
- format.json { head :no_content }
- end
- end
-end
@@ -1,57 +0,0 @@
-class QuestionsController < ApplicationController
-
- before_filter :authenticate_user,
- :except => [:index, :show],
- :if => lambda { Rails.env.production? }
-
- # GET /questions
- def index
- @questions = Question.all
- end
-
- # GET /questions/1
- def show
- @question = Question.find(params[:id])
- @answers = @question.answers
- end
-
- # GET /questions/new
- def new
- @question = Question.new
- end
-
- # GET /questions/1/edit
- def edit
- @question = Question.find(params[:id])
- end
-
- # POST /questions
- def create
- @question = Question.new(params[:question])
-
- if @question.save
- redirect_to @question, notice: 'Question was successfully created.'
- else
- render action: "new"
- end
- end
-
- # PUT /questions/1
- def update
- @question = Question.find(params[:id])
-
- if @question.update_attributes(params[:question])
- redirect_to @question, notice: 'Question was successfully updated.'
- else
- render action: "edit"
- end
- end
-
- # DELETE /questions/1
- def destroy
- @question = Question.find(params[:id])
- @question.destroy
-
- redirect_to questions_url
- end
-end
@@ -1,2 +0,0 @@
-module AnswersHelper
-end
@@ -1,2 +0,0 @@
-module QuestionsHelper
-end
View
@@ -1,6 +0,0 @@
-class Answer < ActiveRecord::Base
- attr_accessible :content, :question_id
-
- belongs_to :question
- belongs_to :user
-end
View
@@ -1,6 +0,0 @@
-class Question < ActiveRecord::Base
- attr_accessible :content, :title
-
- has_many :answers
- belongs_to :user
-end
@@ -1,15 +0,0 @@
-= form_for [@question, @answer] do |f|
- -if @answer.errors.any?
- #error_explanation
- %h2= "#{pluralize(@answer.errors.count, "error")} prohibited this answer from being saved:"
- %ul
- - @answer.errors.full_messages.each do |msg|
- %li= msg
-
- .field
- = f.hidden_field :question_id
- .field
- = f.label :content
- = f.text_area :content
- .actions
- = f.submit 'Save'
@@ -1,7 +0,0 @@
-%h1 Editing answer
-
-= render 'form'
-
-= link_to 'Show', @answer
-\|
-= link_to 'Back', answers_path
@@ -1,21 +0,0 @@
-%h1 Listing answers
-
-%table
- %tr
- %th Question
- %th Content
- %th
- %th
- %th
-
- - @answers.each do |answer|
- %tr
- %td= answer.question_id
- %td= answer.content
- %td= link_to 'Show', answer
- %td= link_to 'Edit', edit_answer_path(answer)
- %td= link_to 'Destroy', answer, :confirm => 'Are you sure?', :method => :delete
-
-%br
-
-= link_to 'New Answer', new_answer_path
@@ -1,5 +0,0 @@
-.header
- %h1 Nowa odpowiedź
-.content
- = render 'form'
-= link_to 'Back', question_path(@question)
@@ -1,12 +0,0 @@
-%p#notice= notice
-
-%p
- %b Question:
- = @answer.question_id
-%p
- %b Content:
- = @answer.content
-
-= link_to 'Edit', edit_answer_path(@answer)
-\|
-= link_to 'Back', answers_path
@@ -1,16 +0,0 @@
-= form_for @question do |f|
- -if @question.errors.any?
- #error_explanation
- %h2= "#{pluralize(@question.errors.count, "error")} prohibited this question from being saved:"
- %ul
- - @question.errors.full_messages.each do |msg|
- %li= msg
-
- .field
- = f.label :title
- = f.text_field :title
- .field
- = f.label :content
- = f.text_area :content
- .actions
- = f.submit 'Save'
@@ -1,7 +0,0 @@
-%h1 Editing question
-
-= render 'form'
-
-= link_to 'Show', @question
-\|
-= link_to 'Back', questions_path
@@ -1,12 +0,0 @@
-.header
- = image_tag 'questions_and_answers.png'
- %h1 Pytania i odpowiedzi
-
-.questions
- - @questions.each do |question|
- .question-box
- .question-summary
- %h3= link_to question.title, question
-
-.new-question
- = link_to 'Zadaj pytanie', new_question_path
@@ -1,5 +0,0 @@
-%h1 New question
-
-= render 'form'
-
-= link_to 'Back', questions_path
@@ -1,14 +0,0 @@
-.header
- %h1= @question.title
-.content
- = @question.content
-.answers
- %h3 Odpowiedzi
- %ul
- - @answers.each do |answer|
- %li= answer.content
-
-= link_to 'Odpowiedz', new_question_answer_path(@question)
-
-= link_to 'Edytuj', edit_question_path(@question)
-= link_to 'Wróć do listy pytań', questions_path
View
@@ -1,9 +1,6 @@
WeCanDoIt::Application.routes.draw do
-
resources :posts
-
resources :photos
-
resources :guides
resources :projects do
@@ -29,10 +26,6 @@
get "/logout" => 'oauth/sessions#destroy', :as => :logout
get "wall" => 'wall#index'
-
- resources :users do
- resources :posts
- end
# The priority is based upon order of creation:
# first created -> highest priority.
Oops, something went wrong.

0 comments on commit 24c20fa

Please sign in to comment.