beef-pages 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/app/models/page.rb +17 -0
- data/app/views/admin/pages/_page.html.erb +5 -4
- data/app/views/admin/pages/index.html.erb +1 -1
- data/app/views/admin/pages/show.html.erb +5 -5
- data/{pages.gemspec → beef-pages.gemspec} +4 -4
- metadata +6 -5
data/Rakefile
CHANGED
@@ -4,14 +4,14 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "pages"
|
7
|
+
gem.name = "beef-pages"
|
8
8
|
gem.summary = %Q{Pages engine}
|
9
9
|
gem.email = "steve@wearebeef.co.uk"
|
10
10
|
gem.homepage = "http://github.com/stengland/pages"
|
11
11
|
gem.authors = ["Steve England"]
|
12
12
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
13
|
end
|
14
|
-
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
15
|
rescue LoadError
|
16
16
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
data/app/models/page.rb
CHANGED
@@ -15,6 +15,12 @@ class Page < ActiveRecord::Base
|
|
15
15
|
validates_presence_of :title
|
16
16
|
validates_presence_of :body, :tag_list, :description, :if => :publish
|
17
17
|
|
18
|
+
LOCK_LEVEL_DELETE = 1
|
19
|
+
LOCK_LEVEL_PERMALINK = 2
|
20
|
+
LOCK_LEVEL_TEMPLATE = 3
|
21
|
+
LOCK_LEVEL_SUBPAGE = 4
|
22
|
+
LOCK_LEVEL_TITLE = 5
|
23
|
+
|
18
24
|
def first_child?
|
19
25
|
self == self.self_and_siblings.first
|
20
26
|
end
|
@@ -43,8 +49,19 @@ class Page < ActiveRecord::Base
|
|
43
49
|
read_attribute(:lock_level) || 0
|
44
50
|
end
|
45
51
|
|
52
|
+
def permalink=(permalink)
|
53
|
+
unless permalink.blank? || lock_level >= LOCK_LEVEL_PERMALINK
|
54
|
+
write_attribute :permalink, permalink.parameterize
|
55
|
+
@permalink_written = true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
46
59
|
private
|
47
60
|
|
61
|
+
def set_url
|
62
|
+
write_attribute :permalink, title.parameterize unless permalink_written or !title_changed? || lock_level >= LOCK_LEVEL_PERMALINK
|
63
|
+
end
|
64
|
+
|
48
65
|
# takes a given array of pages and recursively (or not) reindexes
|
49
66
|
# if departing_child is supplied, it is removed from the array so
|
50
67
|
# that former siblings are reindexed as though it was already
|
@@ -7,9 +7,10 @@
|
|
7
7
|
<td class="date"><%= page.published_at.to_formatted_s(:short) unless page.published_at.nil? %></td>
|
8
8
|
<td class="date"><%= page.published_to.to_formatted_s(:short) unless page.published_to.nil? %></td>
|
9
9
|
<td class="action"><%= link_to 'Show', page_path(page.permalink), :class => 'show' if page.published? %></td>
|
10
|
-
<td class="action"><%= link_to 'Add page', new_admin_page_page_path(page), :class => 'add', :title => "Add a sub-page under #{page.title}" %></td>
|
10
|
+
<td class="action"><%= link_to 'Add page', new_admin_page_page_path(page), :class => 'add', :title => "Add a sub-page under #{page.title}" unless page.lock_level >= Page::LOCK_LEVEL_SUBPAGE %></td>
|
11
|
+
<% logger.debug Page::LOCK_LEVEL_SUBPAGE.inspect %>
|
11
12
|
<td class="action"><%= link_to 'Edit', [:admin, page], :class => 'edit' %></td>
|
12
|
-
<td class="action"><%= link_to('Destroy', admin_page_path(page), :confirm => 'Are you sure?', :method => :delete, :class => 'delete') unless page.lock_level >=
|
13
|
-
<td class="action"><%= link_to 'up', move_up_admin_page_path(page), { :class => "page_up" }
|
14
|
-
<td class="action"><%= link_to 'down', move_down_admin_page_path(page), { :class => 'page_down' }
|
13
|
+
<td class="action"><%= link_to('Destroy', admin_page_path(page), :confirm => 'Are you sure?', :method => :delete, :class => 'delete') unless page.lock_level >= Page::LOCK_LEVEL_DELETE %></td>
|
14
|
+
<td class="action"><%= link_to 'up', move_up_admin_page_path(page), { :class => "page_up" } unless page.first? %></td>
|
15
|
+
<td class="action"><%= link_to 'down', move_down_admin_page_path(page), { :class => 'page_down' } unless page.last? %></td>
|
15
16
|
</tr>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<ul class="choices">
|
4
4
|
<% unless @parent.nil? %>
|
5
|
-
<li
|
5
|
+
<%= "<li>#{link_to 'New page', new_admin_page_page_path(@parent), :class => 'button', :title => "Add a sub-page under #{@parent.title}"}</li>" unless @parent.lock_level >= Page::LOCK_LEVEL_SUBPAGE %>
|
6
6
|
<% if @parent.parent.nil? %>
|
7
7
|
<li><%= link_to "All top pages", admin_pages_path(), :class => "up button" %></li>
|
8
8
|
<% else %>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
<%= f.hidden_field :parent_id %>
|
12
12
|
|
13
|
-
<% if @page.lock_level <
|
13
|
+
<% if @page.lock_level < Page::LOCK_LEVEL_TITLE %>
|
14
14
|
<p>
|
15
15
|
<%= f.label :title, 'Title*' %><br/>
|
16
16
|
<%= f.text_field :title, :class => 'title' %>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
</p>
|
23
23
|
<% end %>
|
24
24
|
|
25
|
-
<% if @page.lock_level <
|
25
|
+
<% if @page.lock_level < Page::LOCK_LEVEL_PERMALINK %>
|
26
26
|
<p>
|
27
27
|
<%= f.label :permalink, "URL" %><br/>
|
28
28
|
<%= root_url %><%= f.text_field :permalink %>
|
@@ -45,14 +45,14 @@
|
|
45
45
|
<%= f.text_field :tag_list, :class => 'long' %>
|
46
46
|
</p>
|
47
47
|
|
48
|
-
<% if @page.lock_level <
|
48
|
+
<% if @page.lock_level < Page::LOCK_LEVEL_TEMPLATE %>
|
49
49
|
<p>
|
50
50
|
<%= f.label :template %>
|
51
51
|
<%= f.select :template, get_template_names.collect{|t| [ t.titleize, t ] } %>
|
52
52
|
</p>
|
53
53
|
<% else %>
|
54
54
|
<p>
|
55
|
-
<%= f.label :template %>
|
55
|
+
<%= f.label :template %> <%= @page.template.titleize %>
|
56
56
|
(locked)
|
57
57
|
</p>
|
58
58
|
<% end %>
|
@@ -68,7 +68,7 @@
|
|
68
68
|
<%= preview_link(@page) %>
|
69
69
|
<%= f.submit 'Publish', :name => 'page[publish]' %>
|
70
70
|
<%= f.submit 'Save as draft', :name => 'page[hide]' %>
|
71
|
-
or <%= link_to 'Cancel',
|
71
|
+
or <%= link_to 'Cancel', admin_pages_path %>
|
72
72
|
</p>
|
73
73
|
|
74
74
|
<% end %>
|
@@ -4,12 +4,12 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{pages}
|
8
|
-
s.version = "0.3.
|
7
|
+
s.name = %q{beef-pages}
|
8
|
+
s.version = "0.3.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Steve England"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-10-30}
|
13
13
|
s.email = %q{steve@wearebeef.co.uk}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -31,13 +31,13 @@ Gem::Specification.new do |s|
|
|
31
31
|
"app/views/admin/pages/preview.rjs",
|
32
32
|
"app/views/admin/pages/show.html.erb",
|
33
33
|
"app/views/pages/_naviagtion.html.erb",
|
34
|
+
"beef-pages.gemspec",
|
34
35
|
"config/routes.rb",
|
35
36
|
"generators/page_tempate/page_template_generator.rb",
|
36
37
|
"generators/page_tempate/templates/default.html.erb",
|
37
38
|
"generators/pages_migration/pages_migration_generator.rb",
|
38
39
|
"generators/pages_migration/templates/migration.rb",
|
39
40
|
"lib/pages.rb",
|
40
|
-
"pages.gemspec",
|
41
41
|
"test/pages_test.rb",
|
42
42
|
"test/test_helper.rb"
|
43
43
|
]
|
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.3.
|
4
|
+
version: 0.3.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-
|
12
|
+
date: 2009-10-30 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -38,18 +38,19 @@ files:
|
|
38
38
|
- app/views/admin/pages/preview.rjs
|
39
39
|
- app/views/admin/pages/show.html.erb
|
40
40
|
- app/views/pages/_naviagtion.html.erb
|
41
|
+
- beef-pages.gemspec
|
41
42
|
- config/routes.rb
|
42
43
|
- generators/page_tempate/page_template_generator.rb
|
43
44
|
- generators/page_tempate/templates/default.html.erb
|
44
45
|
- generators/pages_migration/pages_migration_generator.rb
|
45
46
|
- generators/pages_migration/templates/migration.rb
|
46
47
|
- lib/pages.rb
|
47
|
-
- pages.gemspec
|
48
48
|
- test/pages_test.rb
|
49
49
|
- test/test_helper.rb
|
50
|
-
has_rdoc:
|
50
|
+
has_rdoc: true
|
51
51
|
homepage: http://github.com/stengland/pages
|
52
|
-
licenses:
|
52
|
+
licenses: []
|
53
|
+
|
53
54
|
post_install_message:
|
54
55
|
rdoc_options:
|
55
56
|
- --charset=UTF-8
|