ADD: Dateieinbindung in TinyMCE für Attachments

This commit is contained in:
HausdorffHimself
2013-08-24 04:07:33 +02:00
parent adbbce5fc8
commit 94614b1d5b
11 changed files with 79 additions and 18 deletions

View File

@@ -25,7 +25,9 @@ class AttachmentsController < ApplicationController
# GET /attachments/new.json
def new
@attachment = Attachment.new
@thema = Thema.find(params[:thema_id])
@attachment.thema = @thema
respond_to do |format|
format.html # new.html.erb
format.json { render json: @attachment }
@@ -35,17 +37,20 @@ class AttachmentsController < ApplicationController
# GET /attachments/1/edit
def edit
@attachment = Attachment.find(params[:id])
@thema = @attachment.thema
end
# POST /attachments
# POST /attachments.json
def create
@attachment = Attachment.new(params[:attachment])
@thema = Thema.find(params[:thema_id])
@attachment.thema_id = @thema.id
respond_to do |format|
if @attachment.save
format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }
format.json { render json: @attachment, status: :created, location: @attachment }
format.html { redirect_to @thema, notice: 'Attachment was successfully created.' }
format.json { render json: @thema, status: :created, location: @thema }
else
format.html { render action: "new" }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
@@ -57,10 +62,11 @@ class AttachmentsController < ApplicationController
# PUT /attachments/1.json
def update
@attachment = Attachment.find(params[:id])
@thema = @attachment.thema
respond_to do |format|
if @attachment.update_attributes(params[:attachment])
format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }
format.html { redirect_to @thema, notice: 'Attachment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
@@ -74,9 +80,10 @@ class AttachmentsController < ApplicationController
def destroy
@attachment = Attachment.find(params[:id])
@attachment.destroy
@thema = Thema.find(params[:thema_id])
respond_to do |format|
format.html { redirect_to attachments_url }
format.html { redirect_to @thema }
format.json { head :no_content }
end
end