forked from bofh/fetsite
themengruppen verwalten form
This commit is contained in:
@@ -32,6 +32,7 @@ class AttachmentsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @attachment }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,15 +47,17 @@ class AttachmentsController < ApplicationController
|
||||
def create
|
||||
@attachment = Attachment.new(params[:attachment])
|
||||
@thema = Thema.find(params[:thema_id])
|
||||
@attachment.thema_id = @thema.id
|
||||
|
||||
@attachment.thema_id = @thema.id
|
||||
|
||||
respond_to do |format|
|
||||
if @attachment.save
|
||||
format.html { redirect_to @thema, notice: 'Attachment was successfully created.' }
|
||||
format.json { render json: @thema, status: :created, location: @thema }
|
||||
format.js { @attachment = Attachment.new }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @attachment.errors, status: :unprocessable_entity }
|
||||
format.js { render action: "new"}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -69,9 +72,11 @@ class AttachmentsController < ApplicationController
|
||||
if @attachment.update_attributes(params[:attachment])
|
||||
format.html { redirect_to @thema, notice: 'Attachment was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
format.js {@attachment=Attachment.new; render action:"create"}
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @attachment.errors, status: :unprocessable_entity }
|
||||
format.js { render action: "new"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,28 +31,34 @@ class FragenController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: @frage }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /fragen/1/edit
|
||||
def edit
|
||||
@frage = Frage.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js {render action: :new}
|
||||
end
|
||||
end
|
||||
|
||||
# POST /fragen
|
||||
# POST /fragen.json
|
||||
def create
|
||||
@frage = Frage.new(params[:frage])
|
||||
thema=@frage.thema
|
||||
@fragen=@frage.thema.fragen
|
||||
respond_to do |format|
|
||||
if @frage.save
|
||||
format.html { redirect_to @frage.thema, notice: 'Frage was successfully created.' }
|
||||
format.json { render json: @frage, status: :created, location: @frage }
|
||||
format.js
|
||||
format.js {@frage=Frage.new ; @frage.thema=thema}
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @frage.errors, status: :unprocessable_entity }
|
||||
format.js
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -66,9 +72,11 @@ class FragenController < ApplicationController
|
||||
if @frage.update_attributes(params[:frage])
|
||||
format.html { redirect_to @frage, notice: 'Frage was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
format.js {@frage=Frage.new; render action: "new"}
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @frage.errors, status: :unprocessable_entity }
|
||||
format.js {render action: "edit"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,6 +40,10 @@ class ThemenController < ApplicationController
|
||||
# GET /themen/1/edit
|
||||
def edit
|
||||
@thema = Thema.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# POST /themen
|
||||
@@ -57,7 +61,13 @@ class ThemenController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fragen
|
||||
@thema = Thema.find(params[:thema_id])
|
||||
@fragen=@thema.fragen
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
# PUT /themen/1
|
||||
# PUT /themen/1.json
|
||||
def update
|
||||
@@ -67,9 +77,11 @@ class ThemenController < ApplicationController
|
||||
if @thema.update_attributes(params[:thema])
|
||||
format.html { redirect_to @thema, notice: 'Thema was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @thema.errors, status: :unprocessable_entity }
|
||||
format.js { render action: "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user