Conflicts: app/controllers/documents_controller.rb app/controllers/meetings_controller.rb app/models/ability.rb app/models/document.rb app/models/meeting.rb app/models/meetingtyp.rb app/views/documents/_document.html.erb app/views/documents/_nested_form.html.erb app/views/documents/edit.js.erb app/views/documents/new.js.erb app/views/meetings/_meeting.html.erb app/views/themen/_small.html.erb config/routes.rb
92 lines
2.2 KiB
Ruby
92 lines
2.2 KiB
Ruby
class DocumentsController < ApplicationController
|
|
|
|
load_and_authorize_resource
|
|
def index
|
|
respond_to do |format|
|
|
format.html {redirect_to rubriken_path}
|
|
end
|
|
end
|
|
def new
|
|
@document=Document.new
|
|
@parent=params[:parent_type].constantize.find(params[:parent_id])
|
|
@document.parent=@parent
|
|
|
|
@document.typ = 1
|
|
respond_to do |format|
|
|
format.js
|
|
end
|
|
end
|
|
def edit
|
|
@document = Document.find(params[:id])
|
|
<<<<<<< HEAD
|
|
@parent=@document.parent
|
|
=======
|
|
>>>>>>> origin/documentmeeting
|
|
respond_to do |format|
|
|
format.js
|
|
end
|
|
|
|
end
|
|
|
|
def create
|
|
@document = Document.new(params[:document])
|
|
<<<<<<< HEAD
|
|
@parent=@document.parent
|
|
=======
|
|
|
|
>>>>>>> origin/documentmeeting
|
|
respond_to do |format|
|
|
if @document.save
|
|
# format.html { redirect_to @document, notice: 'Document was successfully created.' }
|
|
#format.json { render json: @document, status: :created, location: @document }
|
|
format.js
|
|
else
|
|
# format.html { render action: "new" }
|
|
# format.json { render json: @document.errors, status: :unprocessable_entity }
|
|
format.js { render action: "new" }
|
|
end
|
|
end
|
|
end
|
|
|
|
<<<<<<< HEAD
|
|
def update
|
|
@document = Document.find(params[:id])
|
|
@parent=@document.parent
|
|
=======
|
|
def update
|
|
@document = Document.find(params[:id])
|
|
|
|
>>>>>>> origin/documentmeeting
|
|
respond_to do |format|
|
|
if @document.update_attributes(params[:document])
|
|
format.html { redirect_to @document, notice: 'Document was successfully updated.' }
|
|
format.json { head :no_content }
|
|
format.js
|
|
else
|
|
# format.html { render action: "edit" }
|
|
# format.json { render json: @document.errors, status: :unprocessable_entity }
|
|
format.js { render action: "edit"}
|
|
end
|
|
end
|
|
end
|
|
def destroy
|
|
logger.info("-------------delete------------------")
|
|
@document = Document.find(params[:id])
|
|
<<<<<<< HEAD
|
|
@parent=@document.parent
|
|
=======
|
|
>>>>>>> origin/documentmeeting
|
|
@document_id = params[:id]
|
|
|
|
@document.destroy
|
|
|
|
respond_to do |format|
|
|
#format.html { redirect_to @object}
|
|
#format.json { head :no_content }
|
|
format.js
|
|
end
|
|
end
|
|
|
|
|
|
end
|