page_engine 0.0.4 → 0.0.5
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.markdown +43 -33
- data/Rakefile +0 -13
- data/app/assets/javascripts/page_engine.js +36 -9
- data/app/assets/stylesheets/page_engine.css +0 -224
- data/app/controllers/admin/page_snippets_controller.rb +1 -3
- data/app/controllers/admin/pages_controller.rb +7 -6
- data/app/helpers/pages_helper.rb +29 -16
- data/app/models/page.rb +25 -34
- data/app/models/page_role.rb +7 -5
- data/app/views/admin/page_snippets/_form.html.haml +2 -2
- data/app/views/admin/pages/_form.html.haml +13 -11
- data/app/views/admin/pages/_page_part_fields.html.haml +2 -4
- data/db/seed.rb +1 -6
- data/lib/generators/page_engine/install/install_generator.rb +10 -10
- data/lib/generators/page_engine/templates/page_engine.rb +34 -0
- data/lib/page_engine.rb +59 -18
- data/lib/page_engine/extensions.rb +1 -15
- data/lib/page_engine/instance_methods.rb +14 -10
- data/lib/page_engine/version.rb +3 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/add.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/bullet_add.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/bullet_go.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/delete.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_add.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_copy.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_delete.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_edit.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_gear.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_green.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_hidden.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_lightning.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_line.jpg +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/page_red.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/pencil.png +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/waiting.gif +0 -0
- data/{app → spec/dummy/app}/assets/images/page_engine/zoom.png +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +133 -2
- data/{app → spec/dummy/app}/assets/stylesheets/jquery-ui.css +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +17 -0
- data/spec/dummy/app/models/odd_role.rb +5 -0
- data/spec/dummy/app/models/weird_user.rb +8 -0
- data/spec/dummy/app/views/layouts/admin/application.html.haml +15 -0
- data/spec/dummy/app/views/layouts/trouble.html.haml +29 -0
- data/spec/dummy/config/initializers/page_engine.rb +25 -4
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20111002171742_add_odd_roles.rb +16 -0
- data/spec/dummy/db/migrate/20111002230859_add_users.rb +21 -0
- data/spec/dummy/db/schema.rb +14 -1
- data/spec/dummy/log/development.log +24264 -0
- data/spec/dummy/tmp/cache/assets/C1F/4A0/sprockets%2Fb257125f39b2a708d678262f26152408 +0 -0
- data/spec/dummy/tmp/cache/assets/C4A/E50/sprockets%2Ff1447b533430f0b0366994087c742f1a +0 -0
- data/spec/dummy/tmp/cache/assets/C50/9E0/sprockets%2F5273207c05e438fab77180339ef07418 +0 -0
- data/spec/dummy/tmp/cache/assets/C5C/BA0/sprockets%2Fe97992f1040b2aa956168498b5e56142 +0 -0
- data/spec/dummy/tmp/cache/assets/C83/E20/sprockets%2F2d6f03d170965f27d7626502373e8cd2 +0 -0
- data/spec/dummy/tmp/cache/assets/CAA/DD0/sprockets%2F45aba9186167d40fb01c6213bd693559 +0 -0
- data/spec/dummy/tmp/cache/assets/CB1/EE0/sprockets%2F9610f802b5b028336d81cf3f019e7e66 +0 -0
- data/spec/dummy/tmp/cache/assets/CB8/880/sprockets%2F3b651a5763758db2fc0347488e69a3e1 +0 -0
- data/spec/dummy/tmp/cache/assets/CBA/0A0/sprockets%2F2983f7dd6130a7c24892da333c18d779 +0 -0
- data/spec/dummy/tmp/cache/assets/CBC/870/sprockets%2Fd85b473139826715974f58b6a6aa29aa +0 -0
- data/spec/dummy/tmp/cache/assets/CD1/EB0/sprockets%2Fba17700b36ee975c05d06042a6af9631 +0 -0
- data/spec/dummy/tmp/cache/assets/CDA/A30/sprockets%2Fd1a7692303d59c495dd61cd1d41246b5 +0 -0
- data/spec/dummy/tmp/cache/assets/CE0/CD0/sprockets%2Fd206c4ec51748382823dee1e7f28055a +0 -0
- data/spec/dummy/tmp/cache/assets/CE3/C10/sprockets%2F05a63f093f971cd73662695fab452b0f +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/5E0/sprockets%2F520141de9bf7351de829ee484b761d37 +0 -0
- data/spec/dummy/tmp/cache/assets/CEE/2B0/sprockets%2F75f58ee42279991f91ac43260b9b0fe3 +0 -0
- data/spec/dummy/tmp/cache/assets/CF3/CF0/sprockets%2Fb9232c5dfbe22949e8559fc03898242e +0 -0
- data/spec/dummy/tmp/cache/assets/CF8/730/sprockets%2F2e8b471c690843c889c86cef3273fd19 +0 -0
- data/spec/dummy/tmp/cache/assets/D04/230/sprockets%2F3081bc655eafedc2c77018c5b9000385 +0 -0
- data/spec/dummy/tmp/cache/assets/D0B/B40/sprockets%2Fb7d60dd0218956953d1afbb4d6d95220 +0 -0
- data/spec/dummy/tmp/cache/assets/D0D/000/sprockets%2Fbb689a9183e1482be8c02ab4f536083b +0 -0
- data/spec/dummy/tmp/cache/assets/D0D/3C0/sprockets%2F09db8b6dc9be3a7645321407ecf74313 +0 -0
- data/spec/dummy/tmp/cache/assets/D10/500/sprockets%2F14244cebaa065f6e0c461f88521d89e7 +0 -0
- data/spec/dummy/tmp/cache/assets/D13/FF0/sprockets%2Fd62e2814c718d1a22c84c7b3a78eb948 +0 -0
- data/spec/dummy/tmp/cache/assets/D1A/140/sprockets%2Fe5dbcc46887452182b85e8da04994ea0 +0 -0
- data/spec/dummy/tmp/cache/assets/D1B/490/sprockets%2Fe37c84afab109b736f593d271f94916c +0 -0
- data/spec/dummy/tmp/cache/assets/D22/630/sprockets%2F96268b95a26ee16a7b2d169e78af38c4 +0 -0
- data/spec/dummy/tmp/cache/assets/D27/2F0/sprockets%2F6b6e52b5006574d3fef8d34ef639978d +0 -0
- data/spec/dummy/tmp/cache/assets/D2F/D10/sprockets%2Fdcfcecea73a06520b314144da9180748 +0 -0
- data/spec/dummy/tmp/cache/assets/D30/ED0/sprockets%2Fea74cc14e1532ac70f928d8d205c5a13 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D35/4A0/sprockets%2F1b20d80f1d472f213983c30fc7a8d8ad +0 -0
- data/spec/dummy/tmp/cache/assets/D3B/4D0/sprockets%2Faf8a08611a00ade8c7f16d626708eb67 +0 -0
- data/spec/dummy/tmp/cache/assets/D3B/BA0/sprockets%2F7b8e66f1a87012c23d18d5c80a518adf +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/A00/sprockets%2Fe3c096ab6843a7f814bebf45b743316b +0 -0
- data/spec/dummy/tmp/cache/assets/D3F/1E0/sprockets%2F39fbfd2f4caf4d71b4232cf516175574 +0 -0
- data/spec/dummy/tmp/cache/assets/D40/720/sprockets%2Fe798537f2ae8abbbac509070c9e06506 +0 -0
- data/spec/dummy/tmp/cache/assets/D40/A70/sprockets%2Fffa6c67811911b1a6624281ce7e7dea6 +0 -0
- data/spec/dummy/tmp/cache/assets/D47/1D0/sprockets%2F904ef275b101c77ee529b4fe7cf323f7 +0 -0
- data/spec/dummy/tmp/cache/assets/D4C/EE0/sprockets%2F7ee487bf0d625668f3fcb075c89a420d +0 -0
- data/spec/dummy/tmp/cache/assets/D4D/6A0/sprockets%2F34ff66b81d54df8b855b5ad0609d384f +0 -0
- data/spec/dummy/tmp/cache/assets/D52/ED0/sprockets%2F7d4cc173f38eb1746547ac686f80ffd6 +0 -0
- data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
- data/spec/dummy/tmp/cache/assets/D58/450/sprockets%2F9bdf9046afa29f99222ffadf85572089 +0 -0
- data/spec/dummy/tmp/cache/assets/D58/B30/sprockets%2F211e7cc7898367fb09c489d4a8ccdd59 +0 -0
- data/spec/dummy/tmp/cache/assets/D59/BE0/sprockets%2Fb60619702caaaa748c6404a3a05fa7fc +0 -0
- data/spec/dummy/tmp/cache/assets/D5D/740/sprockets%2F7cfc90aad94f2822a4ce02701ca834b2 +0 -0
- data/spec/dummy/tmp/cache/assets/D63/F80/sprockets%2F9e27b3ca9c333b4cac10427d5524f3df +0 -0
- data/spec/dummy/tmp/cache/assets/D67/0C0/sprockets%2Fee349089edd8715f0039b0a1dd4fba30 +0 -0
- data/spec/dummy/tmp/cache/assets/D69/7E0/sprockets%2F95dc7c01f25afc8afc40e4353395cb15 +0 -0
- data/spec/dummy/tmp/cache/assets/D69/910/sprockets%2F05abeb33740bac77bef60b5445695c8c +0 -0
- data/spec/dummy/tmp/cache/assets/D6B/E70/sprockets%2F30cda0697c0ea9dc88d4aa885d00582c +0 -0
- data/spec/dummy/tmp/cache/assets/D6C/7E0/sprockets%2Fd3abe581052fc2ffd33b9f465b477b14 +0 -0
- data/spec/dummy/tmp/cache/assets/D70/280/sprockets%2F99a543e2b6be1d37c3ccc8a90261f87a +0 -0
- data/spec/dummy/tmp/cache/assets/D70/730/sprockets%2F626ce09065ee0bde629097e4a3e9faa1 +0 -0
- data/spec/dummy/tmp/cache/assets/D70/B60/sprockets%2F79c6e65f6ae3ca5d1f2791e304a6e4b1 +0 -0
- data/spec/dummy/tmp/cache/assets/D73/830/sprockets%2F38d93d829b7d163c372f3acd557c2eab +0 -0
- data/spec/dummy/tmp/cache/assets/D74/120/sprockets%2Ffbe442bef82371edd6525fe5622de319 +0 -0
- data/spec/dummy/tmp/cache/assets/D76/270/sprockets%2F7fa38bbc51591249e64f86df7da17d0a +0 -0
- data/spec/dummy/tmp/cache/assets/D76/F30/sprockets%2Fe47ed642049b57cdf8b9a48b00a9c7e2 +0 -0
- data/spec/dummy/tmp/cache/assets/D77/7C0/sprockets%2Fcf660249e6eb81370e70cfe24d771dfe +0 -0
- data/spec/dummy/tmp/cache/assets/D7A/710/sprockets%2F082db977dca9043b3cf64dd7b9a1799b +0 -0
- data/spec/dummy/tmp/cache/assets/D7C/660/sprockets%2Fbb4ce966494c0b544c7ea5f4e9c2b866 +0 -0
- data/spec/dummy/tmp/cache/assets/D7E/BE0/sprockets%2F336d946cd6267eee56681fcee16faa71 +0 -0
- data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
- data/spec/dummy/tmp/cache/assets/D87/FA0/sprockets%2Fed7ffae98375a3c9819ee641f00e388d +0 -0
- data/spec/dummy/tmp/cache/assets/D89/AA0/sprockets%2Fd214a96f1dca3c24f09149acd0acb390 +0 -0
- data/spec/dummy/tmp/cache/assets/D92/E50/sprockets%2F09a8ce459d99efe497507cad2ed88f56 +0 -0
- data/spec/dummy/tmp/cache/assets/D93/670/sprockets%2Fdf4cd8447459d7b31b077d0af7aba00b +0 -0
- data/spec/dummy/tmp/cache/assets/D96/510/sprockets%2F400b6fa7eb374fe27379be14bfb5ad13 +0 -0
- data/spec/dummy/tmp/cache/assets/D96/AE0/sprockets%2F6c450fd116d891f54a32bcfcbd4b762b +0 -0
- data/spec/dummy/tmp/cache/assets/D99/2A0/sprockets%2Fb758a4b47a5ef2e0a7c21478d0ca48ec +0 -0
- data/spec/dummy/tmp/cache/assets/D9A/F50/sprockets%2Fbd3168f97958b4fceaccd13f33aa2412 +0 -0
- data/spec/dummy/tmp/cache/assets/D9D/5E0/sprockets%2F405561b1dd3d76d9f2e1fcb0fd45c9f2 +0 -0
- data/spec/dummy/tmp/cache/assets/DA0/940/sprockets%2F9e3e91e2e1bee749a3a7b2ac62eb5294 +0 -0
- data/spec/dummy/tmp/cache/assets/DA2/0E0/sprockets%2F71a404ff712a059b23edee96c9bfcd75 +0 -0
- data/spec/dummy/tmp/cache/assets/DA2/410/sprockets%2F536cbf8fb330ef944baf1d7e45364fa4 +0 -0
- data/spec/dummy/tmp/cache/assets/DA6/860/sprockets%2Ff5526cc6647cdd14b05aed999377abbc +0 -0
- data/spec/dummy/tmp/cache/assets/DA7/5F0/sprockets%2Fe92688bcadd7fcddd86227c04b9712e1 +0 -0
- data/spec/dummy/tmp/cache/assets/DAB/C00/sprockets%2Fe755d63d3a434bd07ffc887af6aca398 +0 -0
- data/spec/dummy/tmp/cache/assets/DAB/E90/sprockets%2F7c1bf428eb83b9b91e619f5ae6cd3e73 +0 -0
- data/spec/dummy/tmp/cache/assets/DAF/F20/sprockets%2Ffefb6dc410d3c50be89565fb3e8e3788 +0 -0
- data/spec/dummy/tmp/cache/assets/DC6/630/sprockets%2F3098ccedf5502a0cd6e25aaeb8e9e232 +0 -0
- data/spec/dummy/tmp/cache/assets/DCA/BB0/sprockets%2F1a792cae50966aef0d0d4131fe5fafd9 +0 -0
- data/spec/dummy/tmp/cache/assets/DD9/E90/sprockets%2Fd44526e0ec17dcbbccf7e14db768e869 +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/270/sprockets%2Fadb8f369db4f8784c76fd2ee1d3633ac +0 -0
- data/spec/dummy/tmp/cache/assets/DDE/420/sprockets%2F69cf180e779eb3095cebe85edbfc22b7 +0 -0
- data/spec/dummy/tmp/cache/assets/DE0/250/sprockets%2F1559ff83d17dd6b788d6ab7fada65ee1 +0 -0
- data/spec/dummy/tmp/cache/assets/DE1/B40/sprockets%2F9c7deec5e90b5957c6d5b31ded7fe074 +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/E17/820/sprockets%2F37aabaff64eddfc141bc07013ad183fc +0 -0
- data/spec/dummy/tmp/cache/assets/E32/C40/sprockets%2Faade2bb8a94be3f057fe7d4a6fd65a84 +0 -0
- data/spec/dummy/tmp/cache/assets/E59/310/sprockets%2Fbc56e556d3e7aae7c8bf341d3dcea2bd +0 -0
- data/spec/dummy/tmp/cache/assets/E70/2B0/sprockets%2F7eedcfada8bf8bff28c96d9ea93521d3 +0 -0
- data/spec/dummy/tmp/cache/assets/E8B/160/sprockets%2Fe6d7a8c67d36fddcd9aaa40e10ade4ee +0 -0
- data/spec/dummy/tmp/cache/assets/E95/DC0/sprockets%2F7f2f99b25afac7fbe91a83f0cebcbcd8 +0 -0
- data/spec/dummy/tmp/pids/server.pid +1 -1
- metadata +465 -354
- data/app/views/layouts/admin.html.haml +0 -20
- data/lib/page_engine/routes_finder.rb +0 -23
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
class Admin::PagesController < ApplicationController
|
|
2
2
|
before_filter :get_routes, :except => [:index, :destroy]
|
|
3
|
-
layout 'admin'
|
|
4
3
|
|
|
5
4
|
def index
|
|
6
5
|
@pages = Page.order(:lft).all.group_by(&:parent_id)
|
|
@@ -28,7 +27,7 @@ class Admin::PagesController < ApplicationController
|
|
|
28
27
|
@page = Page.new
|
|
29
28
|
PageEngine.page_parts.collect { |page_part| @page.page_parts.build(:title => page_part) }
|
|
30
29
|
@parent = Page.find_by_permalink(params[:page_id])
|
|
31
|
-
@roles = PageEngine.
|
|
30
|
+
@roles = PageEngine.uses_roles? ? PageEngine.role_class.classify.constantize.all : []
|
|
32
31
|
|
|
33
32
|
respond_to do |format|
|
|
34
33
|
format.html # new.html.erb
|
|
@@ -38,11 +37,11 @@ class Admin::PagesController < ApplicationController
|
|
|
38
37
|
|
|
39
38
|
# GET /pages/1/edit
|
|
40
39
|
def edit
|
|
41
|
-
@page = Page.includes([:parent, :page_parts])
|
|
42
|
-
@page = @page.includes(:required_roles) if PageEngine.
|
|
43
|
-
@page = @page.
|
|
40
|
+
@page = Page.includes([:parent, :page_parts])
|
|
41
|
+
@page = @page.includes([:required_roles, :excluded_roles]) if PageEngine.uses_roles?
|
|
42
|
+
@page = @page.find_by_permalink(params[:id])
|
|
44
43
|
@parent = @page.parent
|
|
45
|
-
@roles = PageEngine.
|
|
44
|
+
@roles = PageEngine.uses_roles? ? PageEngine.role_class.classify.constantize.all : []
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
# POST /pages
|
|
@@ -50,6 +49,8 @@ class Admin::PagesController < ApplicationController
|
|
|
50
49
|
def create
|
|
51
50
|
@parent = Page.find_by_permalink(params[:page_id])
|
|
52
51
|
@page = Page.new(params[:page])
|
|
52
|
+
|
|
53
|
+
@page.author = send(PageEngine.current_author_helper) if PageEngine.has_author?
|
|
53
54
|
|
|
54
55
|
respond_to do |format|
|
|
55
56
|
if @page.save
|
data/app/helpers/pages_helper.rb
CHANGED
|
@@ -41,19 +41,35 @@ module PagesHelper
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def page_meta_keywords
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
def page_meta_keywords(options={})
|
|
45
|
+
options = {
|
|
46
|
+
:with_tags => true
|
|
47
|
+
}.with_indifferent_access.merge(options)
|
|
48
|
+
|
|
49
|
+
if options[:with_tags]
|
|
50
|
+
if @page && !@page.meta_keywords.blank?
|
|
51
|
+
content_tag :meta, :name => 'keywords' do
|
|
52
|
+
@page.meta_keywords
|
|
53
|
+
end
|
|
48
54
|
end
|
|
55
|
+
else
|
|
56
|
+
@page.meta_keywords
|
|
49
57
|
end
|
|
50
58
|
end
|
|
51
59
|
|
|
52
|
-
def page_meta_description
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
def page_meta_description(options={})
|
|
61
|
+
options = {
|
|
62
|
+
:with_tags => true
|
|
63
|
+
}.with_indifferent_access.merge(options)
|
|
64
|
+
|
|
65
|
+
if options[:with_tags]
|
|
66
|
+
if @page && !@page.meta_description.blank?
|
|
67
|
+
content_tag :meta, :name => 'description' do
|
|
68
|
+
@page.meta_description
|
|
69
|
+
end
|
|
56
70
|
end
|
|
71
|
+
else
|
|
72
|
+
@page.meta_description
|
|
57
73
|
end
|
|
58
74
|
end
|
|
59
75
|
|
|
@@ -85,15 +101,12 @@ module PagesHelper
|
|
|
85
101
|
page.title
|
|
86
102
|
end
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
fields = simple_fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
|
|
92
|
-
safe_concat(render(association.to_s.singularize + "_fields", :f => builder))
|
|
104
|
+
def page_part_fields(f)
|
|
105
|
+
fields = simple_fields_for(:page_parts, PagePart.new, :child_index => "new_page_parts") do |builder|
|
|
106
|
+
safe_concat(render('page_part_fields', :f => builder))
|
|
93
107
|
end
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
end
|
|
108
|
+
fields
|
|
109
|
+
end
|
|
97
110
|
|
|
98
111
|
# Return the specified page part content
|
|
99
112
|
def page_content(options={})
|
data/app/models/page.rb
CHANGED
|
@@ -2,13 +2,11 @@ class Page < ActiveRecord::Base
|
|
|
2
2
|
acts_as_nested_set
|
|
3
3
|
|
|
4
4
|
# Relationships
|
|
5
|
-
# has_many :descendants, :class_name => "Page", :conditions => proc { "pages.lft between #{self.send(:lft)} and #{self.send(:rgt)}" }
|
|
6
|
-
# has_many :ancestors, :class_name => "Page", :conditions => proc { "(pages.lft <= #{self.send(:lft)} AND pages.rgt >= #{self.send(:rgt)}) AND (pages.id != #{self.send(:id)})" }, :foreign_key => false
|
|
7
5
|
has_many :pages, :foreign_key => :parent_id
|
|
8
6
|
has_many :page_parts, :dependent => :destroy
|
|
9
7
|
|
|
10
|
-
if PageEngine.
|
|
11
|
-
has_many :page_roles
|
|
8
|
+
if PageEngine.uses_roles?
|
|
9
|
+
has_many :page_roles, :dependent => :destroy
|
|
12
10
|
has_many :required_roles, :through => :page_roles, :source => :required_role
|
|
13
11
|
has_many :excluded_roles, :through => :page_roles, :source => :excluded_role
|
|
14
12
|
end
|
|
@@ -17,8 +15,8 @@ class Page < ActiveRecord::Base
|
|
|
17
15
|
has_assets
|
|
18
16
|
end
|
|
19
17
|
|
|
20
|
-
if PageEngine.
|
|
21
|
-
belongs_to :
|
|
18
|
+
if PageEngine.has_author?
|
|
19
|
+
belongs_to :author, :class_name => PageEngine.author_class, :foreign_key => :authorable_id
|
|
22
20
|
end
|
|
23
21
|
|
|
24
22
|
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
|
@@ -26,7 +24,6 @@ class Page < ActiveRecord::Base
|
|
|
26
24
|
# Filters
|
|
27
25
|
before_validation :set_permalink
|
|
28
26
|
before_save :check_publish_window
|
|
29
|
-
before_save :set_controller_and_action
|
|
30
27
|
|
|
31
28
|
# Validations
|
|
32
29
|
validates :title, :presence => true
|
|
@@ -44,15 +41,24 @@ class Page < ActiveRecord::Base
|
|
|
44
41
|
scope :just_controller_and_actions, select("controller || '|' || action as taken").group('taken')
|
|
45
42
|
scope :for_nav, select([:id, :title, :parent_id, :menu_css_class, :no_link, :url, :controller, :action, :permalink])
|
|
46
43
|
|
|
47
|
-
attr_accessor :no_publish_window
|
|
44
|
+
attr_accessor :no_publish_window
|
|
48
45
|
|
|
49
46
|
def no_publish_window
|
|
50
47
|
no_publish_window_set?
|
|
51
48
|
end
|
|
52
49
|
|
|
53
50
|
def controller_action
|
|
54
|
-
if controller && action
|
|
55
|
-
|
|
51
|
+
"#{controller}|#{action}" if controller && action
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def controller_action=(c)
|
|
55
|
+
if c.is_a?(String)
|
|
56
|
+
controller_and_action = c.split('|')
|
|
57
|
+
self.controller = controller_and_action.first
|
|
58
|
+
self.action = controller_and_action.last
|
|
59
|
+
else
|
|
60
|
+
self.controller = nil
|
|
61
|
+
self.action = nil
|
|
56
62
|
end
|
|
57
63
|
end
|
|
58
64
|
|
|
@@ -98,7 +104,7 @@ class Page < ActiveRecord::Base
|
|
|
98
104
|
end
|
|
99
105
|
|
|
100
106
|
# Roles
|
|
101
|
-
if PageEngine.
|
|
107
|
+
if PageEngine.uses_roles?
|
|
102
108
|
page.required_roles = self.required_roles
|
|
103
109
|
page.excluded_roles = self.excluded_roles
|
|
104
110
|
end
|
|
@@ -114,7 +120,7 @@ class Page < ActiveRecord::Base
|
|
|
114
120
|
end
|
|
115
121
|
|
|
116
122
|
def is_viewable_by?(user)
|
|
117
|
-
if PageEngine.
|
|
123
|
+
if PageEngine.uses_roles?
|
|
118
124
|
if PageEngine.class_exists?('User') && user
|
|
119
125
|
return true if self.roles.length == 0
|
|
120
126
|
self.role_ids.length != (self.role_ids - user.role_ids.uniq).length
|
|
@@ -153,6 +159,10 @@ class Page < ActiveRecord::Base
|
|
|
153
159
|
|
|
154
160
|
class << self
|
|
155
161
|
|
|
162
|
+
def should_be_found?(params)
|
|
163
|
+
PageEngine.required_route_actions.include?(params[:action]) && !PageEngine.excluded_route_controllers.include?(params[:controller])
|
|
164
|
+
end
|
|
165
|
+
|
|
156
166
|
def breadcrumbs_for(user, url)
|
|
157
167
|
root = Page.published.viewable_by(user).find_by_url(url)
|
|
158
168
|
root.nil? ? [] : root.self_and_ancestors
|
|
@@ -165,25 +175,17 @@ class Page < ActiveRecord::Base
|
|
|
165
175
|
# Scopes
|
|
166
176
|
|
|
167
177
|
def viewable_by(user)
|
|
168
|
-
if PageEngine.
|
|
178
|
+
if PageEngine.uses_roles?
|
|
169
179
|
if user
|
|
170
180
|
# This is a bit of a kludge until I can figure out how to get it to work properly in a single sql query
|
|
171
181
|
includes(:page_roles).where("pages.id in (?) or (page_roles.required_role_id is null and page_roles.excluded_role_id is null)", PageRole.viewable_page_ids_for(user))
|
|
172
182
|
else
|
|
173
|
-
includes(:page_roles).where(
|
|
183
|
+
includes(:page_roles).where('page_roles.required_role_id' => nil, 'page_roles.excluded_role_id' => nil)
|
|
174
184
|
end
|
|
175
185
|
else
|
|
176
186
|
scoped
|
|
177
187
|
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
def with_roles(roles)
|
|
181
|
-
if Extras.class_exists?('Role')
|
|
182
|
-
includes(:roles).where([ "roles.id IN (?)", roles.join(',') ])
|
|
183
|
-
else
|
|
184
|
-
scoped
|
|
185
|
-
end
|
|
186
|
-
end
|
|
188
|
+
end
|
|
187
189
|
|
|
188
190
|
def with_url(request, params)
|
|
189
191
|
url = request.fullpath
|
|
@@ -201,17 +203,6 @@ class Page < ActiveRecord::Base
|
|
|
201
203
|
self.menu_css_class = self.permalink if self[:menu_css_class].blank?
|
|
202
204
|
end
|
|
203
205
|
|
|
204
|
-
def set_controller_and_action
|
|
205
|
-
if @controller_action
|
|
206
|
-
controller_and_action = @controller_action.split('|')
|
|
207
|
-
self.controller = controller_and_action.first
|
|
208
|
-
self.action = controller_and_action.last
|
|
209
|
-
else
|
|
210
|
-
self.controller = nil
|
|
211
|
-
self.action = nil
|
|
212
|
-
end
|
|
213
|
-
end
|
|
214
|
-
|
|
215
206
|
def check_publish_window
|
|
216
207
|
if @no_publish_window == "1"
|
|
217
208
|
self.publish_to = self.publish_from = nil
|
data/app/models/page_role.rb
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
class PageRole < ActiveRecord::Base
|
|
2
2
|
# Relationships
|
|
3
|
-
belongs_to :required_role, :class_name =>
|
|
4
|
-
belongs_to :excluded_role, :class_name =>
|
|
3
|
+
belongs_to :required_role, :class_name => PageEngine.role_class
|
|
4
|
+
belongs_to :excluded_role, :class_name => PageEngine.role_class
|
|
5
5
|
|
|
6
6
|
# Scopes
|
|
7
|
-
scope :viewable_by, lambda { |user| where(:required_role_id => user.
|
|
8
|
-
scope :not_viewable_by, lambda { |user| where(
|
|
7
|
+
scope :viewable_by, lambda { |user| user ? where(:required_role_id => user.send("#{PageEngine.role_class.underscore}_ids")) : scoped }
|
|
8
|
+
scope :not_viewable_by, lambda { |user| user ? where(['excluded_role_id not in (?)', user.send("#{PageEngine.role_class.underscore}_ids")]) : scoped }
|
|
9
9
|
|
|
10
10
|
class << self
|
|
11
|
+
|
|
11
12
|
def viewable_page_ids_for(user)
|
|
12
|
-
PageRole.viewable_by(user).map(&:page_id) - PageRole.not_viewable_by(user).map(&:page_id)
|
|
13
|
+
PageRole.viewable_by(user).select(:page_id).map(&:page_id) - PageRole.not_viewable_by(user).select(:page_id).map(&:page_id)
|
|
13
14
|
end
|
|
15
|
+
|
|
14
16
|
end
|
|
15
17
|
end
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
.inputs
|
|
5
5
|
= f.input :name
|
|
6
|
-
= f.input :filter, :collection =>
|
|
6
|
+
= f.input :filter, :collection => PageEngine.filters, :include_blank => false, :class => 'filter', :input_html => { :class => 'filter', :rel => 'page_snippet_content' }
|
|
7
7
|
= f.input :content, :input_html => { :class => 'editor', 'data-filter' => @page_snippet.filter }
|
|
8
8
|
|
|
9
|
-
.
|
|
9
|
+
.actions
|
|
10
10
|
= f.submit
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
= simple_form_for([:admin, @parent, @page]) do |f|
|
|
2
2
|
= f.error_notification
|
|
3
3
|
= hidden_field_tag :the_page_id, @page.id
|
|
4
|
+
|
|
5
|
+
- if !@page.new_record? && PageEngine.has_author? && @page.author
|
|
6
|
+
%p== Originally authored by: #{@page.author}
|
|
4
7
|
|
|
5
8
|
.inputs
|
|
6
9
|
= f.input :title
|
|
7
10
|
= f.input :permalink, :required => false
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
#page_engine_page_parts{ 'data-fields' => page_part_fields(f) }
|
|
10
13
|
.input.new_page_part_name
|
|
11
|
-
|
|
12
|
-
= text_field_tag :new_page_part_name
|
|
13
|
-
= link_to_add_fields 'Add page part', f, :page_parts
|
|
14
|
+
= link_to('Add a page part', '#', :id => 'add_page_part')
|
|
14
15
|
|
|
15
|
-
%ul
|
|
16
|
+
%ul
|
|
16
17
|
- @page.page_parts.each do |page_part|
|
|
17
18
|
%li{ :class => "#{page_part.title.parameterize} #{'tab_with_errors' if page_part.errors.any?}"}
|
|
18
|
-
= link_to page_part.title, "
|
|
19
|
+
= link_to page_part.title, "#page_part_#{page_part.title.parameterize}"
|
|
20
|
+
%span.icon.delete
|
|
19
21
|
|
|
20
22
|
= f.simple_fields_for :page_parts do |builder|
|
|
21
|
-
.page_part{ :id => "#{builder.object.title.parameterize}
|
|
23
|
+
.page_part{ :id => "page_part_#{builder.object.title.parameterize}" }
|
|
22
24
|
= render 'page_part_fields', :f => builder
|
|
23
25
|
|
|
24
|
-
-
|
|
25
|
-
= f.association :required_roles, :as => :check_boxes
|
|
26
|
-
= f.association :excluded_roles, :as => :check_boxes
|
|
26
|
+
- if PageEngine.uses_roles?
|
|
27
|
+
= f.association :required_roles, :as => :check_boxes, :collection => @roles
|
|
28
|
+
= f.association :excluded_roles, :as => :check_boxes, :collection => @roles
|
|
27
29
|
|
|
28
30
|
= f.input :css, :label => 'CSS', :input_html => { 'data-filter' => 'css' }
|
|
29
31
|
= f.input :js, :label => 'Javascript', :input_html => { 'data-filter' => 'javascript' }
|
|
@@ -36,7 +38,7 @@
|
|
|
36
38
|
= f.input :url
|
|
37
39
|
|
|
38
40
|
= f.input :controller_action, :as => :select do
|
|
39
|
-
= f.select :controller_action, grouped_options_for_select(@routes), :include_blank => true
|
|
41
|
+
= f.select :controller_action, grouped_options_for_select(@routes, @page.controller_action), :include_blank => true
|
|
40
42
|
|
|
41
43
|
= f.input :display_in_menu
|
|
42
44
|
= f.input :display_in_sitemap
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
.
|
|
2
|
-
= f.hidden_field :_destroy
|
|
3
|
-
= link_to 'Delete', '#', :class => 'icon delete', :title => "Delete the current page part"
|
|
1
|
+
= f.hidden_field :_destroy, :id => "delete_#{f.object.title}"
|
|
4
2
|
|
|
5
3
|
= f.error_notification
|
|
6
4
|
|
|
7
5
|
= f.input :title, :class => 'page_part_title'
|
|
8
6
|
= f.input :filter, :collection => PageEngine.filters, :include_blank => false, :class => 'filter', :input_html => { :class => 'filter', :rel => "page_part_content_#{f.object.id}" }
|
|
9
|
-
= f.input :content, :input_html => { 'data-filter' => f.object.filter, :class => '
|
|
7
|
+
= f.input :content, :input_html => { 'data-filter' => f.object.filter, :class => 'page_engine_editor ignore_tab', :id => "page_part_content_#{f.object.id}" }
|
data/db/seed.rb
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
page = Page.create(:title => 'Home')
|
|
2
2
|
body = page.page_parts.find_by_title('body')
|
|
3
|
-
body.update_attributes(:filter => 'textile', :content => "h1. Welcome
|
|
4
|
-
|
|
5
|
-
Aenean dictum porttitor arcu vitae vehicula. Nullam posuere augue vitae lorem ultrices facilisis? Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non nisi erat? Donec id eros sed metus lobortis semper sed non nulla. Cras cursus ipsum eget neque imperdiet feugiat. Etiam sed sapien id felis aliquam aliquet. Nam fermentum tempus suscipit.
|
|
6
|
-
|
|
7
|
-
Mauris non mi mi, a vulputate nunc! Phasellus aliquam urna nec lorem consectetur in porttitor sapien laoreet! Nam erat elit, aliquam quis auctor et, tempor quis arcu. Cras diam nunc, mollis pharetra pulvinar eu, dapibus in augue. Aenean malesuada nulla ac neque facilisis congue? Nulla interdum euismod eros; at tempor magna sagittis id. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam orci aliquam.
|
|
8
|
-
)")
|
|
3
|
+
body.update_attributes(:filter => 'textile', :content => "h1. Welcome\n\nAenean dictum porttitor arcu vitae vehicula. Nullam posuere augue vitae lorem ultrices facilisis? Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non nisi erat? Donec id eros sed metus lobortis semper sed non nulla. Cras cursus ipsum eget neque imperdiet feugiat. Etiam sed sapien id felis aliquam aliquet. Nam fermentum tempus suscipit.\n\nMauris non mi mi, a vulputate nunc! Phasellus aliquam urna nec lorem consectetur in porttitor sapien laoreet! Nam erat elit, aliquam quis auctor et, tempor quis arcu. Cras diam nunc, mollis pharetra pulvinar eu, dapibus in augue. Aenean malesuada nulla ac neque facilisis congue? Nulla interdum euismod eros; at tempor magna sagittis id. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam orci aliquam.")
|
|
@@ -7,19 +7,20 @@ module PageEngine
|
|
|
7
7
|
include Rails::Generators::Migration
|
|
8
8
|
desc "This generator installs PageEngine supporting assets"
|
|
9
9
|
|
|
10
|
-
source_root File.expand_path('
|
|
10
|
+
source_root File.expand_path('../../../../../', __FILE__)
|
|
11
11
|
|
|
12
12
|
def self.next_migration_number(path)
|
|
13
13
|
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def install
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
if Rails.version < "3.1"
|
|
18
|
+
create_migrations
|
|
19
|
+
copy_stylesheets
|
|
20
|
+
copy_javascripts
|
|
21
|
+
copy_images
|
|
22
|
+
end
|
|
23
|
+
copy_file 'lib/generators/page_engine/templates/page_engine.rb', 'config/initializers/page_engine.rb'
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
private
|
|
@@ -37,7 +38,7 @@ module PageEngine
|
|
|
37
38
|
directory 'vendor/assets/stylesheets', 'public/stylesheets'
|
|
38
39
|
|
|
39
40
|
puts 'Updating image location'
|
|
40
|
-
['
|
|
41
|
+
['textile', 'markdown', 'html'].each do |area|
|
|
41
42
|
gsub_file "public/stylesheets/markitup/sets/#{area}/style.css", /\/assets\//, '/images/'
|
|
42
43
|
end
|
|
43
44
|
|
|
@@ -55,10 +56,9 @@ module PageEngine
|
|
|
55
56
|
end
|
|
56
57
|
|
|
57
58
|
def copy_images
|
|
58
|
-
directory 'app/assets/images', 'public/images'
|
|
59
59
|
directory 'vendor/assets/images', 'public/images'
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
|
-
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
PageEngine.setup do |config|
|
|
2
|
+
# Layouts available to the psge
|
|
3
|
+
# config.layouts = [:application]
|
|
4
|
+
|
|
5
|
+
# Page parts that are created by default with a new page
|
|
6
|
+
# config.page_parts = %w{ body left right header footer }
|
|
7
|
+
|
|
8
|
+
# Extra page status options, added to defaults
|
|
9
|
+
# config.statuses = []
|
|
10
|
+
|
|
11
|
+
# Filters that can be applied to the page parts content
|
|
12
|
+
# config.filters = %w{ none html textile markdown }
|
|
13
|
+
|
|
14
|
+
# List of actions that should be included when getting the available routes
|
|
15
|
+
# config.required_route_actions = %w{ index show new edit create update }
|
|
16
|
+
|
|
17
|
+
# List of controllers that should be excluded when getting the available routes
|
|
18
|
+
# config.excluded_route_controllers = []
|
|
19
|
+
|
|
20
|
+
# To give more control over which controllers are returned
|
|
21
|
+
# config.excluded_route_controllers_regex = /^admin.*/
|
|
22
|
+
|
|
23
|
+
# If a page should only be vieawable by a specific role set the role class here
|
|
24
|
+
# config.role_class = 'Role'
|
|
25
|
+
|
|
26
|
+
# Author class for the created pages
|
|
27
|
+
# config.author_class = 'User'
|
|
28
|
+
|
|
29
|
+
# Set the helper method that will be used to get the current author
|
|
30
|
+
# config.current_author_helper = 'current_user'
|
|
31
|
+
|
|
32
|
+
# Set the helper method that will be used to get the current viewer
|
|
33
|
+
# config.current_viewer_helper = 'current_user'
|
|
34
|
+
end
|
data/lib/page_engine.rb
CHANGED
|
@@ -2,7 +2,6 @@ require 'page_engine/defaults'
|
|
|
2
2
|
require "page_engine/engine"
|
|
3
3
|
require 'page_engine/extensions'
|
|
4
4
|
require 'page_engine/helpers'
|
|
5
|
-
require 'page_engine/routes_finder'
|
|
6
5
|
require 'RedCloth'
|
|
7
6
|
require 'bluecloth'
|
|
8
7
|
require 'haml'
|
|
@@ -26,7 +25,34 @@ module PageEngine
|
|
|
26
25
|
mattr_accessor :filters
|
|
27
26
|
@@filters = %w{ none html textile markdown erb erb+textile }
|
|
28
27
|
|
|
28
|
+
# List of actions that should be included when getting the available routes
|
|
29
|
+
mattr_accessor :required_route_actions
|
|
30
|
+
@@required_route_actions = %w{ index show new edit create update }
|
|
29
31
|
|
|
32
|
+
# List of controllers that should be excluded when getting the available routes
|
|
33
|
+
mattr_accessor :excluded_route_controllers
|
|
34
|
+
@@excluded_route_controllers = []
|
|
35
|
+
|
|
36
|
+
# To give more control over which controllers are returned
|
|
37
|
+
mattr_accessor :excluded_route_controllers_regex
|
|
38
|
+
@@excluded_route_controllers_regex = /^admin.*/
|
|
39
|
+
|
|
40
|
+
# If the page should be only viewable by a specific role, set the role class here
|
|
41
|
+
mattr_accessor :role_class
|
|
42
|
+
@@role_class = 'Role'
|
|
43
|
+
|
|
44
|
+
# The author class
|
|
45
|
+
mattr_accessor :author_class
|
|
46
|
+
@@author_class = 'User'
|
|
47
|
+
|
|
48
|
+
# Set the helper method that will be used to get the current author
|
|
49
|
+
mattr_accessor :current_author_helper
|
|
50
|
+
@@author_class = 'current_user'
|
|
51
|
+
|
|
52
|
+
# Set the helper method that will be used to get the current user
|
|
53
|
+
mattr_accessor :current_viewer_helper
|
|
54
|
+
@@current_viewer_helper = 'current_user'
|
|
55
|
+
|
|
30
56
|
# Module methods
|
|
31
57
|
|
|
32
58
|
def self.statuses=s
|
|
@@ -44,29 +70,44 @@ module PageEngine
|
|
|
44
70
|
return false
|
|
45
71
|
end
|
|
46
72
|
|
|
47
|
-
def self.available_routes
|
|
73
|
+
def self.available_routes(options = {})
|
|
74
|
+
options = {
|
|
75
|
+
:required_actions => @@required_route_actions,
|
|
76
|
+
:excluded_controllers => @@excluded_route_controllers,
|
|
77
|
+
:excluded_controller_regex => @@excluded_route_controllers_regex
|
|
78
|
+
}.merge!(options.symbolize_keys)
|
|
79
|
+
|
|
48
80
|
available = {}
|
|
49
|
-
|
|
50
|
-
Rails.application.routes.routes.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
end
|
|
81
|
+
|
|
82
|
+
controller_actions = Rails.application.routes.routes.map(&:requirements)
|
|
83
|
+
|
|
84
|
+
controller_actions.delete_if { |c| c.empty? || c[:controller] == 'rails/info' || c[:controller] == 'pages' || !options[:required_actions].include?(c[:action]) || options[:excluded_controllers].include?(c[:controller]) || c[:controller] =~ options[:excluded_controller_regex] }
|
|
85
|
+
|
|
86
|
+
controller_actions.each do |c|
|
|
87
|
+
available[c[:controller]] ||= []
|
|
88
|
+
available[c[:controller]] << c[:action]
|
|
60
89
|
end
|
|
61
|
-
|
|
62
|
-
available.delete('rails/info')
|
|
90
|
+
|
|
63
91
|
available
|
|
64
92
|
end
|
|
65
93
|
|
|
66
94
|
def self.setup
|
|
67
95
|
yield self
|
|
68
|
-
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.uses_roles?
|
|
99
|
+
!self.role_class.blank?
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def self.has_author?
|
|
103
|
+
!self.author_class.blank?
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.has_viewers?
|
|
107
|
+
!self.current_viewer_helper.blank?
|
|
108
|
+
end
|
|
109
|
+
|
|
69
110
|
end
|
|
70
111
|
|
|
71
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :page_engine => ["jquery-ui-1.8.15.custom.min", "jquery.ui.nestedSortable", "jquery.markitup", "markitup/sets/html/set", "markitup/sets/textile/set", "markitup/sets/markdown/set", "
|
|
72
|
-
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :page_engine => ["jquery-ui", "markitup/skins/simple/style", "markitup/sets/html/style", "markitup/sets/textile/style", "markitup/sets/markdown/style", "
|
|
112
|
+
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :page_engine => ["jquery-ui-1.8.15.custom.min", "jquery.ui.nestedSortable", "jquery.markitup", "markitup/sets/html/set", "markitup/sets/textile/set", "markitup/sets/markdown/set", "codemirror/codemirror", "codemirror/modes/javascript", "codemirror/modes/css", "page_engine"]
|
|
113
|
+
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :page_engine => ["jquery-ui", "markitup/skins/simple/style", "markitup/sets/html/style", "markitup/sets/textile/style", "markitup/sets/markdown/style", "codemirror/codemirror", "codemirror/themes/default", "page_engine"]
|