Class: PageCommentTypesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/page_comment_types_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#robot?

Instance Method Details

#createObject

POST /page_comment_types POST /page_comment_types.xml



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/page_comment_types_controller.rb', line 34

def create
  if has_permissions_or_redirect(:staff, page_comment_types_url)

    @page_comment_type = PageCommentType.new(params[:page_comment_type])

    respond_to do |format|
      if @page_comment_type.save
        flash[:notice] = 'PageCommentType was successfully created.'
        format.html { redirect_to(@page_comment_type) }
        format.xml { render :xml => @page_comment_type, :status => :created, :location => @page_comment_type }
      else
        format.html { render :action => "new" }
        format.xml { render :xml => @page_comment_type.errors, :status => :unprocessable_entity }
      end
    end
  end
end

#destroyObject

DELETE /page_comment_types/1 DELETE /page_comment_types/1.xml



73
74
75
76
77
78
79
80
81
82
83
# File 'app/controllers/page_comment_types_controller.rb', line 73

def destroy
  if has_permissions_or_redirect(:admin, page_comment_types_url)
    @page_comment_type = PageCommentType.find(params[:id])
    @page_comment_type.destroy

    respond_to do |format|
      format.html { redirect_to(page_comment_types_url) }
      format.xml { head :ok }
    end
  end
end

#editObject

GET /page_comment_types/1/edit



26
27
28
29
30
# File 'app/controllers/page_comment_types_controller.rb', line 26

def edit
  if has_permissions_or_redirect(:staff, page_comment_types_url)
    @page_comment_type = PageCommentType.find(params[:id])
  end
end

#indexObject

GET /page_comment_types GET /page_comment_types.xml



6
7
8
# File 'app/controllers/page_comment_types_controller.rb', line 6

def index
  @page_comment_types = PageCommentType.all
end

#newObject

GET /page_comment_types/new GET /page_comment_types/new.xml



18
19
20
21
22
23
# File 'app/controllers/page_comment_types_controller.rb', line 18

def new
  if has_permissions_or_redirect(:staff, page_comment_types_url)

    @page_comment_type = PageCommentType.new
  end
end

#showObject

GET /page_comment_types/1 GET /page_comment_types/1.xml



12
13
14
# File 'app/controllers/page_comment_types_controller.rb', line 12

def show
  @page_comment_type = PageCommentType.find(params[:id])
end

#updateObject

PUT /page_comment_types/1 PUT /page_comment_types/1.xml



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/controllers/page_comment_types_controller.rb', line 54

def update
  if has_permissions_or_redirect(:staff, page_comment_types_url)
    @page_comment_type = PageCommentType.find(params[:id])

    respond_to do |format|
      if @page_comment_type.update_attributes(params[:page_comment_type])
        flash[:notice] = 'PageCommentType was successfully updated.'
        format.html { redirect_to(@page_comment_type) }
        format.xml { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml { render :xml => @page_comment_type.errors, :status => :unprocessable_entity }
      end
    end
  end
end