beef-pages 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/controllers/admin/pages_controller.rb +16 -11
- data/app/models/page.rb +4 -0
- data/app/views/admin/pages/_page.html.erb +2 -2
- data/app/views/admin/pages/index.html.erb +4 -7
- data/app/views/admin/pages/show.html.erb +22 -6
- data/generators/pages_migration/templates/migration.rb +1 -0
- data/lib/pages.rb +5 -2
- data/pages.gemspec +2 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
@@ -86,17 +86,22 @@ class Admin::PagesController < Admin::BaseController
|
|
86
86
|
|
87
87
|
def destroy
|
88
88
|
@page = Page.find(params[:id])
|
89
|
-
@page.
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
89
|
+
if @page.lock_level >0
|
90
|
+
flash[:notice] = 'This Page is locked.'
|
91
|
+
redirect_to(:back)
|
92
|
+
else
|
93
|
+
@page.destroy
|
94
|
+
|
95
|
+
respond_to do |format|
|
96
|
+
format.html {
|
97
|
+
if params[:page].nil?
|
98
|
+
redirect_to(admin_pages_url)
|
99
|
+
else
|
100
|
+
redirect_to(admin_page_pages_url(@page.parent))
|
101
|
+
end
|
102
|
+
}
|
103
|
+
format.xml { head :ok }
|
104
|
+
end
|
100
105
|
end
|
101
106
|
end
|
102
107
|
|
data/app/models/page.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<tr id="pages-<%= page.id %>">
|
2
|
-
<td class="title"><%= link_to page.title,
|
2
|
+
<td class="title"><%= link_to page.title, admin_page_path(page) %></td>
|
3
3
|
<td><%= link_to pluralize(page.children.count, "sub page"), admin_page_pages_path(page) %></td>
|
4
4
|
<td><%= content_status(page) %></td>
|
5
5
|
<td><%= page.author %><br />(<%= page.created_at.to_formatted_s(:short) %>)</td>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<td><%= link_to 'Show', page_path(page.permalink), :class => 'show' if page.published? %></td>
|
10
10
|
<td><%= link_to 'Add page', new_admin_page_page_path(page), :class => 'add', :title => "Add a sub-page under #{page.title}" %></td>
|
11
11
|
<td><%= link_to 'Edit', [:admin, page], :class => 'edit' %></td>
|
12
|
-
<td><%= link_to('Destroy', admin_page_path(page), :confirm => 'Are you sure?', :method => :delete, :class => 'delete') unless page.
|
12
|
+
<td><%= link_to('Destroy', admin_page_path(page), :confirm => 'Are you sure?', :method => :delete, :class => 'delete') unless page.lock_level >=1 || !current_user.admin? %></td>
|
13
13
|
<td>
|
14
14
|
<%= link_to 'up', move_up_admin_page_path(page), { :class => "page_up" } if current_user.admin? && !page.first? %>
|
15
15
|
<%= link_to 'down', move_down_admin_page_path(page), { :class => 'page_down' } if current_user.admin? && !page.last? %>
|
@@ -2,16 +2,13 @@
|
|
2
2
|
|
3
3
|
<ul class="choices">
|
4
4
|
<% unless @parent.nil? %>
|
5
|
-
|
6
|
-
|
5
|
+
<li><%= link_to 'New page', new_admin_page_page_path(@parent), :class => "button", :title => "Add a sub-page under #{@parent.title}" %></li>
|
7
6
|
<% if @parent.parent.nil? %>
|
8
|
-
|
7
|
+
<li><%= link_to "All top pages", admin_pages_path(), :class => "up button" %></li>
|
9
8
|
<% else %>
|
10
|
-
|
9
|
+
<li><%= link_to "Up to #{@parent.parent.title}", admin_page_pages_path(@parent.parent), :class => "up button" %></li>
|
11
10
|
<% end %>
|
12
|
-
|
13
11
|
<% end %>
|
14
|
-
|
15
12
|
</ul>
|
16
13
|
|
17
14
|
<%= hidden_field_tag 'form_authenticity_token', "#{form_authenticity_token}" %>
|
@@ -22,7 +19,7 @@
|
|
22
19
|
<th>Title</th>
|
23
20
|
<th># Sub Pages</th>
|
24
21
|
<th>Status</th>
|
25
|
-
<th>Author</
|
22
|
+
<th>Author</th>
|
26
23
|
<th>Updater</th>
|
27
24
|
<th>Published At</th>
|
28
25
|
<th>Published To</th>
|
@@ -3,30 +3,45 @@
|
|
3
3
|
<%= stylesheet_link_tag 'lightwindow' %>
|
4
4
|
<% end -%>
|
5
5
|
|
6
|
-
<h1><%= @page.new_record? ? 'New' : 'Editing' %>
|
6
|
+
<h1><%= @page.new_record? ? 'New' : 'Editing a' %> Page</h1>
|
7
7
|
|
8
8
|
<% form_for([:admin, @page], :html => { :id => 'has-assets-form' }) do |f| %>
|
9
9
|
<%= f.error_messages %>
|
10
10
|
|
11
11
|
<%= f.hidden_field :parent_id %>
|
12
|
+
|
13
|
+
<% if @page.lock_level < 3 %>
|
12
14
|
<p>
|
13
|
-
<%= f.label :title %><br/>
|
15
|
+
<%= f.label :title, 'Title*' %><br/>
|
14
16
|
<%= f.text_field :title, :class => 'title' %>
|
15
17
|
</p>
|
16
|
-
|
18
|
+
<% else %>
|
19
|
+
<p>
|
20
|
+
<%= f.label :title %><br/>
|
21
|
+
<%= @page.title %> (locked)
|
22
|
+
</p>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<% if @page.lock_level < 2 %>
|
17
26
|
<p>
|
18
27
|
<%= f.label :permalink, "URL" %><br/>
|
19
28
|
<%= root_url %><%= f.text_field :permalink %>
|
20
29
|
<p>URLs are most efficient if they closely reflect the title or main subject of this content. Changing the permalink will make search engines think it is a different page resulting in a loss of page rank, only change if very necessary. Leave blank to use the title.</p>
|
21
30
|
</p>
|
31
|
+
<% else %>
|
32
|
+
<p>
|
33
|
+
<%= f.label :permalink, "URL" %><br/>
|
34
|
+
<%= root_url %><%= @page.permalink %> (locked)
|
35
|
+
</p>
|
36
|
+
<% end %>
|
22
37
|
|
23
38
|
<p>
|
24
|
-
<%= f.label :description, "Description for search engines" %><br/>
|
39
|
+
<%= f.label :description, "Description for search engines*" %><br/>
|
25
40
|
<%= f.text_area :description, "rows" => 4 %>
|
26
41
|
</p>
|
27
42
|
|
28
43
|
<p>
|
29
|
-
<%= f.label :tag_list, "Keywords (
|
44
|
+
<%= f.label :tag_list, "Keywords (used by search engines) & Tags - comma separated*" %><br/>
|
30
45
|
<%= f.text_field :tag_list, :class => 'long' %>
|
31
46
|
</p>
|
32
47
|
|
@@ -37,7 +52,7 @@
|
|
37
52
|
</p>
|
38
53
|
|
39
54
|
<p>
|
40
|
-
<%= f.label :body %><br/>
|
55
|
+
<%= f.label :body, 'Body*' %><br/>
|
41
56
|
<%= f.text_area 'body', :class => 'editor' %>
|
42
57
|
</p>
|
43
58
|
|
@@ -62,4 +77,5 @@
|
|
62
77
|
<h2>Asset Upload</h2>
|
63
78
|
<%= asset_upload_form %>
|
64
79
|
|
80
|
+
<%= flickr_select %>
|
65
81
|
<% end %>
|
data/lib/pages.rb
CHANGED
@@ -3,12 +3,15 @@ module Beef
|
|
3
3
|
module HelperMethods
|
4
4
|
def get_template_names
|
5
5
|
templates = []
|
6
|
-
Dir.glob("#{RAILS_ROOT}/app/views/pages/templates/*")
|
6
|
+
Dir.glob("#{RAILS_ROOT}/app/views/pages/templates/*") do |f|
|
7
|
+
match = /\/([^\/]+)\.html\.erb$/.match(f)
|
8
|
+
templates << match[1] unless match.nil?
|
9
|
+
end
|
7
10
|
# Move default to top if it exists
|
8
11
|
if default = templates.delete('default')
|
9
12
|
templates.insert(0, default)
|
10
13
|
end
|
11
|
-
templates
|
14
|
+
templates
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
data/pages.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{pages}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Steve England"]
|
9
|
-
s.date = %q{2009-09-
|
9
|
+
s.date = %q{2009-09-10}
|
10
10
|
s.email = %q{steve@wearebeef.co.uk}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beef-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve England
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|