Class: Goldberg::ContentPagesController
- Inherits:
-
ApplicationController
show all
- Includes:
- Controller
- Defined in:
- lib/six-updater-web/vendor/plugins/goldberg/test/functional/content_pages_controller_test.rb,
lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb
Overview
Re-raise errors caught by the controller.
Instance Method Summary
collapse
Methods included from Controller
included
#copy, #six_local_auto_login
#active_scaffold_render_secure_download, #assign_names_with_active_scaffold, #render_with_active_scaffold, #search_generic_view_paths?
Instance Method Details
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 50
def create
@content_page = ContentPage.new(params[:content_page])
if @content_page.save
flash[:notice] = 'ContentPage was successfully created.'
Role.rebuild_cache
redirect_to :action => 'list'
else
foreign
render :action => 'new'
end
end
|
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 79
def destroy
@content_page = ContentPage.find(params[:id])
foreign
if @menu_items.length == 0 and not @system_pages
@content_page.destroy
Role.rebuild_cache
redirect_to :action => 'list'
else
flash.now[:error] = "Cannot delete this Content Page as it has dependants (see below)"
render :action => 'show'
end
end
|
62
63
64
65
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 62
def edit
@content_page = ContentPage.find(params[:id])
foreign()
end
|
#fck_filemanager ⇒ Object
Entry point for any FCKeditor file operations.
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 94
def fck_filemanager
@command = params['Command']
@type = (params['Type'] == 'File' ? '' : params['Type'])
@subdir = params['CurrentFolder']
@path = File.join('/files', @type, @subdir)
@dir = File.join(RAILS_ROOT, 'public', @path)
@incl_files = false
case @command
when 'GetFolders'
fck_files
when 'GetFoldersAndFiles'
@incl_files = true
fck_files
when 'CreateFolder'
fck_create_folder
when 'FileUpload'
fck_file_upload
else render :nothing => true, :status => 400
end
end
|
#fck_speller_pages ⇒ Object
Invoked by FCKeditor spell check. Returns a HTML document containing Javascript with spelling suggestions.
120
121
122
123
124
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 120
def fck_speller_pages
@textinputs = params['textinputs'][0]
@suggestions = ContentPage.speller_pages( CGI.unescape(@textinputs) )
render :action => 'fck_speller_pages', :layout => false
end
|
9
10
11
12
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 9
def index
list
render :action => 'list'
end
|
14
15
16
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 14
def list
@content_pages = ContentPage.find(:all, :order => 'name')
end
|
44
45
46
47
48
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 44
def new
@content_page = ContentPage.new
foreign
@content_page.markup_style = @markup_styles.first
end
|
#rescue_action(e) ⇒ Object
6
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/test/functional/content_pages_controller_test.rb', line 6
def rescue_action(e) raise e end
|
18
19
20
21
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 18
def show
@content_page = ContentPage.find(params[:id])
foreign
end
|
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 67
def update
@content_page = ContentPage.find(params[:id])
if @content_page.update_attributes(params[:content_page])
flash[:notice] = 'ContentPage was successfully updated.'
Role.rebuild_cache
redirect_to :action => 'show', :id => @content_page
else
foreign
render :action => 'edit'
end
end
|
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 23
def view
@content_page = ContentPage.find_by_name(params[:page_name].join('/'))
if not @content_page
if Goldberg.settings
@content_page = ContentPage.find(Goldberg.settings.not_found_page_id)
else
@content_page = ContentPage.new(:id => nil,
:content => '(no such page)')
end
end
end
|
#view_default ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/content_pages_controller.rb', line 35
def view_default
if Goldberg.settings
@content_page = ContentPage.find(Goldberg.settings.site_default_page_id)
else
@content_page = ContentPage.new(:id => nil,
:content => '(Site not configured)')
end
end
|