public_pages 0.1.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/README +1 -0
- data/app/controllers/public_pages_controller.rb +61 -0
- data/app/models/public_page.rb +3 -0
- data/config/routes.rb +5 -0
- data/lib/generators/public_pages/migration_generator.rb +19 -0
- data/lib/public_pages/engine.rb +9 -0
- data/lib/public_pages.rb +3 -0
- metadata +70 -0
data/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
script/rails generate public_pages:migration
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module PublicPages
|
2
|
+
|
3
|
+
class PublicpagesController < ApplicationController
|
4
|
+
|
5
|
+
unloadable
|
6
|
+
|
7
|
+
respond_to :html, :xml, :css, :js
|
8
|
+
|
9
|
+
def index
|
10
|
+
@pages = PublicPage.all
|
11
|
+
end
|
12
|
+
|
13
|
+
def new
|
14
|
+
@page = PublicPage.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def create
|
18
|
+
@page = PublicPage.new(params[:public_page])
|
19
|
+
if @page.save
|
20
|
+
redirect_to public_pages_path
|
21
|
+
else
|
22
|
+
render :action => :new, :note => 'Nothing can be blank.'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def show
|
27
|
+
@page = PublicPage.find_by_full_url(:parent_url => params[:parent_url], :url => params[:url], :format => params[:format])
|
28
|
+
|
29
|
+
raise ActiveRecord::RecordNotFound unless @page
|
30
|
+
|
31
|
+
respond_with @page
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def edit
|
36
|
+
@page = PublicPage.find(params[:id])
|
37
|
+
end
|
38
|
+
|
39
|
+
def update
|
40
|
+
@page = PublicPage.find(params[:id])
|
41
|
+
if @page.update_attributes(params[:public_page])
|
42
|
+
redirect_to @page.public_url
|
43
|
+
else
|
44
|
+
render :action => :edit, :notice => 'Nothing can be blank.'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def destroy
|
49
|
+
PublicPage.find(params[:id]).destroy
|
50
|
+
redirect_to public_pages_path
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def sitemap
|
55
|
+
@pages = PublicPage.all
|
56
|
+
respond_wth @pages
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module PublicPages
|
4
|
+
module Generators
|
5
|
+
|
6
|
+
class MigrationGenerator < Rails::Generators::Base
|
7
|
+
|
8
|
+
def add_migration
|
9
|
+
generate :model, "PublicPage name:string parent_name:string body:text"
|
10
|
+
end
|
11
|
+
|
12
|
+
def remove_the_local_model
|
13
|
+
%x{rm #{Rails.root}/app/models/public_page.rb}
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/public_pages.rb
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: public_pages
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors: []
|
12
|
+
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-06 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email:
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README
|
29
|
+
files:
|
30
|
+
- app/controllers/public_pages_controller.rb
|
31
|
+
- app/models/public_page.rb
|
32
|
+
- config/routes.rb
|
33
|
+
- lib/generators/public_pages/migration_generator.rb
|
34
|
+
- lib/public_pages.rb
|
35
|
+
- lib/public_pages/engine.rb
|
36
|
+
- README
|
37
|
+
has_rdoc: true
|
38
|
+
homepage:
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options:
|
43
|
+
- --charset=UTF-8
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.3.7
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Simplest possible CMS for Rails 3
|
69
|
+
test_files: []
|
70
|
+
|