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 = @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("redaction.create.flash")
29 redirect_to @redaction
31 render :action => "new"
42 # note - don't update the user ID
43 @redaction.title = params[:redaction][:title]
44 @redaction.description = params[:redaction][:description]
47 flash[:notice] = t("redaction.update.flash")
48 redirect_to @redaction
50 render :action => "edit"
55 if @redaction.old_nodes.empty? &&
56 @redaction.old_ways.empty? &&
57 @redaction.old_relations.empty?
59 flash[:notice] = t("redaction.destroy.flash")
60 redirect_to :redactions
62 flash[:error] = t("redaction.destroy.error")
63 redirect_to @redaction
66 flash[:error] = t("redaction.destroy.not_empty")
67 redirect_to @redaction
74 @redaction = Redaction.find(params[:id])