beef-pages 0.1.7 → 0.2.0

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 CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.2.0
@@ -3,7 +3,12 @@ class Admin::PagesController < Admin::BaseController
3
3
  helper_method :get_template_names
4
4
 
5
5
  def index
6
- @pages = Page.top
6
+ if params[:page_id].nil?
7
+ @pages = Page.top
8
+ else
9
+ @parent = Page.find(params[:page_id])
10
+ @pages = @parent.children
11
+ end
7
12
 
8
13
  respond_to do |format|
9
14
  format.html # index.html.erb
@@ -37,7 +42,13 @@ class Admin::PagesController < Admin::BaseController
37
42
  respond_to do |format|
38
43
  if @page.save
39
44
  flash[:notice] = 'Page was successfully created.'
40
- format.html { redirect_to(admin_pages_url) }
45
+ format.html {
46
+ if params[:page_id].nil?
47
+ redirect_to(admin_pages_url)
48
+ else
49
+ redirect_to(admin_page_pages_url(@page.parent))
50
+ end
51
+ }
41
52
  format.xml { render :xml => @page, :status => :created, :location => @page }
42
53
  else
43
54
  format.html { render :action => "show" }
@@ -53,7 +64,13 @@ class Admin::PagesController < Admin::BaseController
53
64
  respond_to do |format|
54
65
  if @page.update_attributes(params[:page])
55
66
  flash[:notice] = 'Page was successfully updated.'
56
- format.html { redirect_to(admin_pages_url) }
67
+ format.html {
68
+ if @page.parent.nil?
69
+ redirect_to(admin_pages_url)
70
+ else
71
+ redirect_to(admin_page_pages_url(@page.parent))
72
+ end
73
+ }
57
74
  format.xml { head :ok }
58
75
  else
59
76
  format.html { render :action => "show" }
@@ -67,7 +84,13 @@ class Admin::PagesController < Admin::BaseController
67
84
  @page.destroy
68
85
 
69
86
  respond_to do |format|
70
- format.html { redirect_to(admin_pages_url) }
87
+ format.html {
88
+ if params[:page].nil?
89
+ redirect_to(admin_pages_url)
90
+ else
91
+ redirect_to(admin_page_pages_url(@page.parent))
92
+ end
93
+ }
71
94
  format.xml { head :ok }
72
95
  end
73
96
  end
@@ -1,16 +1,17 @@
1
- <tr class="level-<%= level %>" id="pages-<%= page.id %>">
2
- <td class="title"><span class="indent"><% level.times{|i| %>-<%} %></span><%= link_to page.title, [:admin, page] %></td>
1
+ <tr id="pages-<%= page.id %>">
2
+ <td class="title"><%= link_to page.title, admin_page_page_path(page) %></td>
3
3
  <td><%= content_status(page) %></td>
4
- <td><%= page.author %></td>
5
- <td><%= page.editor %></td>
6
- <td class="date"><%= page.created_at.to_formatted_s(:short) %></td>
7
- <td class="date"><%= page.updated_at.to_formatted_s(:short) %></td>
4
+ <td><%= page.author %><br />(<%= page.created_at.to_formatted_s(:short) %>)</td>
5
+ <td><%= page.editor %><%= "<br />(#{page.updated_at.to_formatted_s(:short)})" unless page.updated_at.nil? %></td>
6
+ <td class="date"><%= page.published_at.to_formatted_s(:short) %></td>
7
+ <td class="date"><%= page.published_to.to_formatted_s(:short) unless page.published_to.nil? %></td>
8
8
  <td><%= link_to 'Show', page_path(page.permalink), :class => 'show' if page.published? %></td>
9
- <td><%= link_to 'Add page', new_admin_page_page_path(page), :class => 'add', :title => 'Add a sub page' %></td>
9
+ <td><%= link_to 'Add page', new_admin_page_page_path(page), :class => 'add', :title => "Add a sub-page under #{page.title}" %></td>
10
10
  <td><%= link_to 'Edit', [:admin, page], :class => 'edit' %></td>
11
11
  <td><%= link_to('Destroy', admin_page_path(page), :confirm => 'Are you sure?', :method => :delete, :class => 'delete') unless page.parent_id.nil? || !current_user.admin? %></td>
12
- <% if page.parent %>
13
- <td><%= link_to 'up', move_up_admin_page_path(page), { :class => "page_up" } if current_user.admin? && !page.first_child? %><%= link_to 'down', move_down_admin_page_path(page), { :class => 'page_down' } if current_user.admin? && !page.last_child? %></td>
14
- <% end %>
12
+ <td>
13
+ <%= link_to 'up', move_up_admin_page_path(page), { :class => "page_up" } if current_user.admin? && !page.first? %>
14
+ <%= link_to 'down', move_down_admin_page_path(page), { :class => 'page_down' } if current_user.admin? && !page.last? %>
15
+ </td>
15
16
  </tr>
16
- <%= render :partial => page.children, :locals => { :level => level + 1 } %>
17
+ <%= render :partial => page.children, :locals => { :level => level + 1 } %>
@@ -1,7 +1,19 @@
1
- <h1>Listing pages</h1>
1
+ <h1>Listing pages<%= " under #{@parent.title}" unless @parent.nil? %></h1>
2
2
 
3
3
  <ul class="choices">
4
- <li><%= link_to 'New page', new_admin_page_path, :class => "button" %></li>
4
+ <% if @parent.nil? %>
5
+ <li><%= link_to 'New page', new_admin_page_path(), :class => "button", :title => "Add a new root page" %></li>
6
+ <% else %>
7
+ <li><%= link_to 'New page', new_admin_page_page_path(@parent), :class => "button", :title => "Add a sub-page under #{@parent.title}" %></li>
8
+
9
+ <% if @parent.parent.nil? %>
10
+ <li><%= link_to "All top pages", admin_pages_path(), :class => "up button" %></li>
11
+ <% else %>
12
+ <li><%= link_to "Up to #{@parent.parent.title}", admin_page_pages_path(@parent.parent), :class => "up button" %></li>
13
+ <% end %>
14
+
15
+ <% end %>
16
+
5
17
  </ul>
6
18
 
7
19
  <%= hidden_field_tag 'form_authenticity_token', "#{form_authenticity_token}" %>
@@ -12,10 +24,10 @@
12
24
  <th>Title</th>
13
25
  <th>Status</th>
14
26
  <th>Author</th>
15
- <th>Updated</th>
27
+ <th>Updater</th>
16
28
  <th>Published At</th>
17
29
  <th>Published To</th>
18
- <th colspan="4">Actions</th>
30
+ <th colspan="5">Actions</th>
19
31
  </tr>
20
32
  </thead>
21
33
  <tbody>
@@ -26,10 +38,10 @@
26
38
  <th>Title</th>
27
39
  <th>Status</th>
28
40
  <th>Author</th>
29
- <th>Updated</th>
41
+ <th>Updater</th>
30
42
  <th>Published At</th>
31
43
  <th>Published To</th>
32
- <th colspan="4">Actions</th>
44
+ <th colspan="5">Actions</th>
33
45
  </tr>
34
46
  </tfoot>
35
47
  </table>
data/config/routes.rb CHANGED
@@ -3,4 +3,5 @@ ActionController::Routing::Routes.draw do |map|
3
3
  map.namespace(:admin) do |admin|
4
4
  admin.resources :pages, :has_many => :pages, :collection => {:preview => :post}, :member => {:preview => :put, :feature => [:get, :put], :move_up => :get, :move_down => :get}
5
5
  end
6
+ map.page ':id', :controller => 'pages', :action => 'show'
6
7
  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.1.7"
5
+ s.version = "0.2.0"
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-08-04}
9
+ s.date = %q{2009-08-27}
10
10
  s.email = %q{steve@wearebeef.co.uk}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  s.homepage = %q{http://github.com/stengland/pages}
42
42
  s.rdoc_options = ["--charset=UTF-8"]
43
43
  s.require_paths = ["lib"]
44
- s.rubygems_version = %q{1.3.3}
44
+ s.rubygems_version = %q{1.3.5}
45
45
  s.summary = %q{Pages engine}
46
46
  s.test_files = [
47
47
  "test/pages_test.rb",
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.1.7
4
+ version: 0.2.0
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-08-04 00:00:00 -07:00
12
+ date: 2009-08-27 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15