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)
 
  20     @redaction = Redaction.new
 
  26     @redaction = Redaction.new
 
  27     @redaction.user = current_user
 
  28     @redaction.title = params[:redaction][:title]
 
  29     @redaction.description = params[:redaction][:description]
 
  30     # NOTE: the description format will default to 'markdown'
 
  33       flash[:notice] = t(".flash")
 
  34       redirect_to @redaction
 
  36       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])