1 class RedactionsController < ApplicationController
4 before_action :authorize_web
5 before_action :set_locale
9 before_action :lookup_redaction, :only => [:show, :edit, :update, :destroy]
10 before_action :check_database_readable
11 before_action :check_database_writable, :only => [:create, :update, :destroy]
14 @redactions = Redaction.order(:id)
18 @redaction = Redaction.new
22 @redaction = Redaction.new
23 @redaction.user = current_user
24 @redaction.title = params[:redaction][:title]
25 @redaction.description = params[:redaction][:description]
26 # note that the description format will default to 'markdown'
29 flash[:notice] = t(".flash")
30 redirect_to @redaction
32 render :action => "new"
41 # note - don't update the user ID
42 @redaction.title = params[:redaction][:title]
43 @redaction.description = params[:redaction][:description]
46 flash[:notice] = t(".flash")
47 redirect_to @redaction
49 render :action => "edit"
54 if @redaction.old_nodes.empty? &&
55 @redaction.old_ways.empty? &&
56 @redaction.old_relations.empty?
58 flash[:notice] = t(".flash")
59 redirect_to :redactions
61 flash[:error] = t(".error")
62 redirect_to @redaction
65 flash[:error] = t(".not_empty")
66 redirect_to @redaction
73 @redaction = Redaction.find(params[:id])