1 class RedactionsController < ApplicationController
4 before_filter :authorize_web
5 before_filter :set_locale
6 before_filter :require_user, :only => [:new, :create, :edit, :update, :destroy]
7 before_filter :require_moderator, :only => [:new, :create, :edit, :update, :destroy]
8 before_filter :lookup_redaction, :only => [:show, :edit, :update, :destroy]
9 before_filter :check_database_readable
10 before_filter :check_database_writable, :only => [:create, :update, :destroy]
13 @redactions_pages, @redactions = paginate(:redactions, :order => :id, :per_page => 10)
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 unless @redaction.old_nodes.empty? and
56 @redaction.old_ways.empty? and
57 @redaction.old_relations.empty?
58 flash[:error] = t('redaction.destroy.not_empty')
59 redirect_to @redaction
62 flash[:notice] = t('redaction.destroy.flash')
63 redirect_to :redactions
65 flash[:error] = t('redaction.destroy.error')
66 redirect_to @redaction
74 @redaction = Redaction.find(params[:id])