1 class RedactionsController < ApplicationController
4 before_action :authorize_web
5 before_action :set_locale
6 before_action :require_user, :only => [:new, :create, :edit, :update, :destroy]
7 before_action :require_moderator, :only => [:new, :create, :edit, :update, :destroy]
8 before_action :lookup_redaction, :only => [:show, :edit, :update, :destroy]
9 before_action :check_database_readable
10 before_action :check_database_writable, :only => [:create, :update, :destroy]
13 @redactions = Redaction.order(:id)
17 @redaction = Redaction.new
21 @redaction = Redaction.new
22 @redaction.user = current_user
23 @redaction.title = params[:redaction][:title]
24 @redaction.description = params[:redaction][:description]
25 # note that the description format will default to 'markdown'
28 flash[:notice] = t(".flash")
29 redirect_to @redaction
31 render :action => "new"
40 # note - don't update the user ID
41 @redaction.title = params[:redaction][:title]
42 @redaction.description = params[:redaction][:description]
45 flash[:notice] = t(".flash")
46 redirect_to @redaction
48 render :action => "edit"
53 if @redaction.old_nodes.empty? &&
54 @redaction.old_ways.empty? &&
55 @redaction.old_relations.empty?
57 flash[:notice] = t(".flash")
58 redirect_to :redactions
60 flash[:error] = t(".error")
61 redirect_to @redaction
64 flash[:error] = t(".not_empty")
65 redirect_to @redaction
72 @redaction = Redaction.find(params[:id])