quic_cms 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/quic_cms/admin/pages_controller.rb +46 -0
- data/app/models/ckeditor/asset.rb +1 -0
- data/app/models/ckeditor/attachment_file.rb +1 -0
- data/app/models/ckeditor/picture.rb +1 -0
- data/app/views/quic_cms/admin/base/index.html.erb +4 -0
- data/app/views/quic_cms/admin/pages/_form.html.erb +52 -0
- data/app/views/quic_cms/admin/pages/edit.html.erb +9 -0
- data/app/views/quic_cms/admin/pages/index.html.erb +27 -0
- data/app/views/quic_cms/admin/pages/new.html.erb +5 -0
- data/app/views/quic_cms/admin/pages/show.html.erb +29 -0
- data/lib/quic_cms/version.rb +1 -1
- metadata +9 -5
- data/test/dummy/tmp/pids/server.pid +0 -1
@@ -1,4 +1,50 @@
|
|
1
1
|
module QuicCms
|
2
2
|
class Admin::PagesController < ApplicationController
|
3
|
+
def index
|
4
|
+
@pages = Page.all
|
5
|
+
end
|
6
|
+
|
7
|
+
def show
|
8
|
+
if params[:permalink]
|
9
|
+
@page = Page.find_by_permalink(params[:permalink])
|
10
|
+
if @page.nil?
|
11
|
+
@page = Page.new(:title => "Page with permalink of #{params[:permalink]} does not exist", :content => "If you are an Admin Please <a href='/users/sign_in'> Log in </a>and create it", :permalink => params[:permalink])
|
12
|
+
end
|
13
|
+
else
|
14
|
+
@page = Page.find(params[:id])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def new
|
19
|
+
@page = Page.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def create
|
23
|
+
@page = Page.new(params[:page])
|
24
|
+
if @page.save
|
25
|
+
redirect_to [:admin, @page], :notice => "Successfully created page."
|
26
|
+
else
|
27
|
+
render :action => 'new'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def edit
|
32
|
+
@page = Page.find(params[:id])
|
33
|
+
end
|
34
|
+
|
35
|
+
def update
|
36
|
+
@page = Page.find(params[:id])
|
37
|
+
if @page.update_attributes(params[:page])
|
38
|
+
redirect_to [:admin, @page], :notice => "Successfully updated page."
|
39
|
+
else
|
40
|
+
render :action => 'edit'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def destroy
|
45
|
+
@page = Page.find(params[:id])
|
46
|
+
@page.destroy
|
47
|
+
redirect_to admin_pages_url, :notice => "Successfully destroyed page."
|
48
|
+
end
|
3
49
|
end
|
4
50
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<% content_for :head do %>
|
2
|
+
<%= javascript_include_tag '/javascripts/ckeditor/ckeditor.js' %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<h1>Administration: Edit Pages</h1> <br/><br/>
|
6
|
+
|
7
|
+
<%= form_for [:admin, @page] do |f| %>
|
8
|
+
<% if @page.errors.any? %>
|
9
|
+
<div id="error_explanation">
|
10
|
+
<h2><%= pluralize(@page.errors.count, "error") %> prohibited this page from being saved:</h2>
|
11
|
+
|
12
|
+
<ul>
|
13
|
+
<% @page.errors.full_messages.each do |msg| %>
|
14
|
+
<li><%= msg %></li>
|
15
|
+
<% end %>
|
16
|
+
</ul>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<p><%= f.submit %></p> <br/>
|
21
|
+
|
22
|
+
<table width="900" border="0" cellspacing="15" cellpadding="0">
|
23
|
+
<tr>
|
24
|
+
<td width="150"><strong><%= f.label :title %><br /> </strong></td>
|
25
|
+
<td width="300"> <%= f.text_field :title %></td>
|
26
|
+
<td width="150"><strong> <%= f.label :permalink %><br /> </strong></td>
|
27
|
+
<td width="300"> <%= f.text_field :permalink %></td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<td width="350"> <strong><%= f.label :position %> </strong></td>
|
31
|
+
<td width="500"> <%= f.number_field :position %></td>
|
32
|
+
</tr>
|
33
|
+
|
34
|
+
<tr>
|
35
|
+
<td width="350"> <strong><%= f.label :show_title %> </strong></td>
|
36
|
+
<td width="500"> <%= f.check_box :show_title %></td>
|
37
|
+
</tr>
|
38
|
+
|
39
|
+
<tr>
|
40
|
+
<td width="150"><strong><%= f.label :parent_id, "Parent Page" %> </strong></td>
|
41
|
+
<td width="300"> <%= f.select :parent_id, nested_set_options(Page, @page) {|i, level| "#{'-' * level} #{i.title}" } , :include_blank => true%></td>
|
42
|
+
</tr>
|
43
|
+
|
44
|
+
<tr>
|
45
|
+
<td width="150" valign="top"> <strong> <%= f.label :content %> </strong></td>
|
46
|
+
<td colspan="3"> <%= f.cktext_area :content %></td>
|
47
|
+
</tr>
|
48
|
+
|
49
|
+
</table>
|
50
|
+
|
51
|
+
<p><%= f.submit %></p> <br/>
|
52
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
<p><strong><%= link_to "Add New Page", new_admin_page_path %></strong></p>
|
5
|
+
|
6
|
+
<div style="padding-top: 30px; padding-bottom: 30px;">
|
7
|
+
<table width="700" border="0" cellspacing="10" cellpadding="0">
|
8
|
+
<tr>
|
9
|
+
<th>Title</th>
|
10
|
+
<th>Permalink</th>
|
11
|
+
<th>Content</th>
|
12
|
+
<th> </th>
|
13
|
+
<th> </th>
|
14
|
+
</tr>
|
15
|
+
<% for page in @pages %>
|
16
|
+
<tr>
|
17
|
+
<td width="300" style="font-weight: bold;"><%= page.title %></td>
|
18
|
+
<td width="300"><%= page.permalink %></td>
|
19
|
+
<td width="30"><%= link_to "Show", admin_page_path(page) %></td>
|
20
|
+
<td width="30"><%= link_to "Edit", edit_admin_page_path(page) %></td>
|
21
|
+
<td width="30"><%= link_to "Delete", admin_page_path(page), :confirm => 'Are you sure?', :method => :delete %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</table>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<% title @page.title, false %>
|
2
|
+
<% unless @page.children.empty? %>
|
3
|
+
|
4
|
+
<ul>
|
5
|
+
<% for page in @page.children %>
|
6
|
+
<li><%= link_to h(page.title), page %></li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
<br>
|
11
|
+
<% for page in @page.ancestors.each %>
|
12
|
+
<%= link_to h(page.title), page %> >
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
|
16
|
+
<br/><br/>
|
17
|
+
<p>
|
18
|
+
|
19
|
+
<%= link_to "Edit", edit_admin_page_path(@page) %> |
|
20
|
+
<%= link_to "Destroy", admin_page_path(@page), :confirm => 'Are you sure?', :method => :delete %> |
|
21
|
+
<%= link_to "View All", admin_pages_path %>
|
22
|
+
|
23
|
+
</p> <br/><br/> <br/>
|
24
|
+
<div id="page_content">
|
25
|
+
<%= raw @page.content %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
|
29
|
+
|
data/lib/quic_cms/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quic_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mark Wagner
|
@@ -135,6 +135,12 @@ files:
|
|
135
135
|
- app/models/ckeditor/picture.rb
|
136
136
|
- app/models/quic_cms/page.rb
|
137
137
|
- app/views/layouts/quic_cms/application.html.erb
|
138
|
+
- app/views/quic_cms/admin/base/index.html.erb
|
139
|
+
- app/views/quic_cms/admin/pages/_form.html.erb
|
140
|
+
- app/views/quic_cms/admin/pages/edit.html.erb
|
141
|
+
- app/views/quic_cms/admin/pages/index.html.erb
|
142
|
+
- app/views/quic_cms/admin/pages/new.html.erb
|
143
|
+
- app/views/quic_cms/admin/pages/show.html.erb
|
138
144
|
- app/views/quic_cms/pages/show.html.erb
|
139
145
|
- app/views/quic_cms/shared/_top_menu.html.erb
|
140
146
|
- config/initializers/ckeditor.rb
|
@@ -194,7 +200,6 @@ files:
|
|
194
200
|
- test/dummy/tmp/cache/assets/D8A/D60/sprockets%2F7d3204dfca6653e3f02c514e0ce3bc3c
|
195
201
|
- test/dummy/tmp/cache/assets/D97/9E0/sprockets%2F4d26efdc34508e208b2a82ce7cbd27d2
|
196
202
|
- test/dummy/tmp/cache/assets/DCD/490/sprockets%2F5be3ec9cd11d885e1de8ec0a1d91734b
|
197
|
-
- test/dummy/tmp/pids/server.pid
|
198
203
|
- test/fixtures/quic_cms/pages.yml
|
199
204
|
- test/functional/quic_cms/admin/pages_controller_test.rb
|
200
205
|
- test/functional/quic_cms/pages_controller_test.rb
|
@@ -284,7 +289,6 @@ test_files:
|
|
284
289
|
- test/dummy/tmp/cache/assets/D8A/D60/sprockets%2F7d3204dfca6653e3f02c514e0ce3bc3c
|
285
290
|
- test/dummy/tmp/cache/assets/D97/9E0/sprockets%2F4d26efdc34508e208b2a82ce7cbd27d2
|
286
291
|
- test/dummy/tmp/cache/assets/DCD/490/sprockets%2F5be3ec9cd11d885e1de8ec0a1d91734b
|
287
|
-
- test/dummy/tmp/pids/server.pid
|
288
292
|
- test/fixtures/quic_cms/pages.yml
|
289
293
|
- test/functional/quic_cms/admin/pages_controller_test.rb
|
290
294
|
- test/functional/quic_cms/pages_controller_test.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
91004
|