radiant 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of radiant might be problematic. Click here for more details.
- data/CHANGELOG +61 -7
- data/CONTRIBUTORS +15 -0
- data/app/controllers/admin/export_controller.rb +1 -1
- data/app/controllers/admin/page_controller.rb +1 -0
- data/app/controllers/admin/user_controller.rb +2 -1
- data/app/controllers/application.rb +7 -8
- data/app/helpers/admin/node_helper.rb +84 -0
- data/app/helpers/admin/page_helper.rb +1 -19
- data/app/helpers/application_helper.rb +15 -9
- data/app/models/file_not_found_page.rb +2 -2
- data/app/models/page.rb +22 -18
- data/app/models/page_context.rb +9 -0
- data/app/models/radiant/config.rb +4 -2
- data/app/models/response_cache.rb +18 -12
- data/app/models/standard_tags.rb +111 -50
- data/app/views/admin/extension/index.rhtml +2 -2
- data/app/views/admin/layout/edit.rhtml +2 -2
- data/app/views/admin/layout/remove.rhtml +2 -2
- data/app/views/admin/page/_node.rhtml +4 -26
- data/app/views/admin/page/_part.rhtml +9 -14
- data/app/views/admin/page/edit.rhtml +38 -121
- data/app/views/admin/page/index.rhtml +2 -6
- data/app/views/admin/page/remove.rhtml +2 -2
- data/app/views/admin/snippet/edit.rhtml +3 -3
- data/app/views/admin/snippet/index.rhtml +2 -2
- data/app/views/admin/snippet/remove.rhtml +2 -2
- data/app/views/admin/user/edit.rhtml +4 -4
- data/app/views/admin/user/preferences.rhtml +2 -2
- data/app/views/admin/welcome/login.rhtml +1 -1
- data/config/environment.rb +79 -78
- data/db/schema.rb +2 -0
- data/lib/local_time.rb +12 -0
- data/lib/plugins/extension_patches/lib/fixture_loading_extension.rb +1 -1
- data/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb +3 -3
- data/lib/radiant.rb +1 -1
- data/lib/radiant/extension.rb +9 -3
- data/lib/radiant/extension_loader.rb +2 -2
- data/lib/tasks/extensions.rake +23 -8
- data/public/javascripts/admin.js +89 -0
- data/public/javascripts/controls.js +486 -354
- data/public/javascripts/dragdrop.js +90 -58
- data/public/javascripts/effects.js +398 -364
- data/public/javascripts/pngfix.js +37 -37
- data/public/javascripts/prototype.js +2764 -1095
- data/public/javascripts/ruledtable.js +10 -25
- data/public/javascripts/sitemap.js +74 -112
- data/public/javascripts/string.js +1 -7
- data/public/javascripts/tabcontrol.js +71 -86
- data/public/javascripts/tag_reference_search.js +19 -26
- data/public/stylesheets/admin/main.css +11 -5
- data/test/fixtures/extensions/01_basic/lib/new_module.rb +2 -0
- data/test/fixtures/page_parts.yml +16 -1
- data/test/fixtures/pages.yml +47 -84
- data/test/functional/extension_initialization_test.rb +11 -0
- data/test/helpers/login_test_helper.rb +12 -1
- data/test/helpers/page_test_helper.rb +6 -0
- data/test/helpers/render_test_helper.rb +11 -8
- data/test/test_helper.rb +1 -12
- data/test/unit/file_not_found_page_test.rb +5 -1
- data/test/unit/local_time_test.rb +45 -0
- data/test/unit/page_context_test.rb +32 -1
- data/test/unit/page_test.rb +45 -11
- data/test/unit/radiant/config_test.rb +1 -1
- data/test/unit/response_cache_test.rb +27 -2
- data/test/unit/standard_tags_test.rb +60 -15
- data/vendor/extensions/archive/README +29 -0
- data/vendor/extensions/archive/Rakefile +25 -0
- data/{app → vendor/extensions/archive/app}/models/archive_day_index_page.rb +0 -0
- data/{app → vendor/extensions/archive/app}/models/archive_finder.rb +8 -6
- data/{app → vendor/extensions/archive/app}/models/archive_month_index_page.rb +0 -0
- data/{app → vendor/extensions/archive/app}/models/archive_page.rb +0 -0
- data/{app → vendor/extensions/archive/app}/models/archive_year_index_page.rb +0 -0
- data/vendor/extensions/archive/archive_extension.rb +19 -0
- data/{lib → vendor/extensions/archive/lib}/archive_index_tags_and_methods.rb +0 -0
- data/vendor/extensions/archive/lib/tasks/archive_extension_tasks.rake +28 -0
- data/vendor/extensions/archive/test/fixtures/pages.yml +397 -0
- data/vendor/extensions/archive/test/functional/archive_extension_test.rb +16 -0
- data/{test → vendor/extensions/archive/test}/helpers/archive_index_test_helper.rb +0 -0
- data/vendor/extensions/archive/test/test_helper.rb +19 -0
- data/{test → vendor/extensions/archive/test}/unit/archive_day_index_page_test.rb +0 -0
- data/{test → vendor/extensions/archive/test}/unit/archive_month_index_page_test.rb +0 -0
- data/{test → vendor/extensions/archive/test}/unit/archive_page_test.rb +7 -1
- data/{test → vendor/extensions/archive/test}/unit/archive_year_index_page_test.rb +0 -0
- data/vendor/rails/actionmailer/CHANGELOG +10 -0
- data/vendor/rails/actionmailer/Rakefile +1 -1
- data/vendor/rails/actionmailer/lib/action_mailer/version.rb +1 -1
- data/vendor/rails/actionpack/CHANGELOG +51 -2
- data/vendor/rails/actionpack/Rakefile +1 -1
- data/vendor/rails/actionpack/lib/action_controller/assertions/dom_assertions.rb +2 -2
- data/vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/assertions/response_assertions.rb +3 -0
- data/vendor/rails/actionpack/lib/action_controller/assertions/routing_assertions.rb +1 -0
- data/vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb +2 -0
- data/vendor/rails/actionpack/lib/action_controller/base.rb +7 -1
- data/vendor/rails/actionpack/lib/action_controller/caching.rb +39 -38
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/pstore_performance_fix.rb +30 -0
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/cgi_process.rb +13 -4
- data/vendor/rails/actionpack/lib/action_controller/cookies.rb +5 -3
- data/vendor/rails/actionpack/lib/action_controller/filters.rb +176 -77
- data/vendor/rails/actionpack/lib/action_controller/integration.rb +31 -21
- data/vendor/rails/actionpack/lib/action_controller/macros/in_place_editing.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/pagination.rb +7 -1
- data/vendor/rails/actionpack/lib/action_controller/resources.rb +117 -32
- data/vendor/rails/actionpack/lib/action_controller/routing.rb +56 -23
- data/vendor/rails/actionpack/lib/action_controller/test_process.rb +5 -2
- data/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb +4 -1
- data/vendor/rails/actionpack/lib/action_controller/verification.rb +1 -0
- data/vendor/rails/actionpack/lib/action_pack/version.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/base.rb +25 -19
- data/vendor/rails/actionpack/lib/action_view/compiled_templates.rb +2 -2
- data/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb +18 -18
- data/vendor/rails/actionpack/lib/action_view/helpers/debug_helper.rb +10 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/deprecated_helper.rb +3 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb +33 -17
- data/vendor/rails/actionpack/test/activerecord/pagination_test.rb +9 -0
- data/vendor/rails/actionpack/test/controller/action_pack_assertions_test.rb +13 -0
- data/vendor/rails/actionpack/test/controller/addresses_render_test.rb +4 -1
- data/vendor/rails/actionpack/test/controller/base_test.rb +1 -1
- data/vendor/rails/actionpack/test/controller/caching_test.rb +3 -2
- data/vendor/rails/actionpack/test/controller/cookie_test.rb +11 -0
- data/vendor/rails/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb +18 -0
- data/vendor/rails/actionpack/test/controller/filter_params_test.rb +1 -0
- data/vendor/rails/actionpack/test/controller/filters_test.rb +149 -26
- data/vendor/rails/actionpack/test/controller/integration_test.rb +93 -8
- data/vendor/rails/actionpack/test/controller/resources_test.rb +215 -36
- data/vendor/rails/actionpack/test/controller/routing_test.rb +2 -2
- data/vendor/rails/actionpack/test/controller/test_test.rb +16 -0
- data/vendor/rails/actionpack/test/controller/url_rewriter_test.rb +66 -10
- data/vendor/rails/actionpack/test/controller/verification_test.rb +15 -0
- data/vendor/rails/actionpack/test/fixtures/test/hello_world.rxml +2 -1
- data/vendor/rails/actionpack/test/template/asset_tag_helper_test.rb +5 -0
- data/vendor/rails/actionpack/test/template/compiled_templates_test.rb +29 -17
- data/vendor/rails/actionpack/test/template/javascript_helper_test.rb +4 -4
- data/vendor/rails/actionpack/test/template/number_helper_test.rb +1 -1
- data/vendor/rails/actionpack/test/template/prototype_helper_test.rb +13 -13
- data/vendor/rails/actionwebservice/CHANGELOG +14 -0
- data/vendor/rails/actionwebservice/Rakefile +2 -2
- data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +1 -1
- data/vendor/rails/activerecord/CHANGELOG +34 -0
- data/vendor/rails/activerecord/Rakefile +1 -1
- data/vendor/rails/activerecord/lib/active_record/acts/list.rb +14 -2
- data/vendor/rails/activerecord/lib/active_record/acts/tree.rb +7 -0
- data/vendor/rails/activerecord/lib/active_record/associations.rb +29 -14
- data/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb +5 -1
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +10 -0
- data/vendor/rails/activerecord/lib/active_record/base.rb +12 -3
- data/vendor/rails/activerecord/lib/active_record/calculations.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +1 -0
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +54 -38
- data/vendor/rails/activerecord/lib/active_record/deprecated_finders.rb +3 -3
- data/vendor/rails/activerecord/lib/active_record/fixtures.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/timestamp.rb +0 -9
- data/vendor/rails/activerecord/lib/active_record/version.rb +1 -1
- data/vendor/rails/activerecord/test/associations/eager_test.rb +13 -0
- data/vendor/rails/activerecord/test/associations/join_model_test.rb +10 -1
- data/vendor/rails/activerecord/test/associations_test.rb +36 -3
- data/vendor/rails/activerecord/test/base_test.rb +17 -4
- data/vendor/rails/activerecord/test/defaults_test.rb +15 -0
- data/vendor/rails/activerecord/test/fixtures/author.rb +1 -0
- data/vendor/rails/activerecord/test/fixtures/binaries.yml +437 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/schema.rb +13 -0
- data/vendor/rails/activerecord/test/fixtures/developer.rb +10 -0
- data/vendor/rails/activerecord/test/fixtures_test.rb +9 -5
- data/vendor/rails/activerecord/test/migration_test.rb +9 -10
- data/vendor/rails/activerecord/test/mixin_test.rb +47 -0
- data/vendor/rails/activerecord/test/validations_test.rb +2 -2
- data/vendor/rails/activesupport/CHANGELOG +16 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/blank.rb +9 -3
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +48 -3
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/introspection.rb +14 -0
- data/vendor/rails/activesupport/lib/active_support/dependencies.rb +3 -3
- data/vendor/rails/activesupport/lib/active_support/json/encoders/core.rb +5 -3
- data/vendor/rails/activesupport/lib/active_support/multibyte/chars.rb +6 -6
- data/vendor/rails/activesupport/lib/active_support/version.rb +1 -1
- data/vendor/rails/activesupport/test/core_ext/hash_ext_test.rb +37 -0
- data/vendor/rails/activesupport/test/core_ext/module_test.rb +8 -0
- data/vendor/rails/activesupport/test/dependencies_test.rb +11 -0
- data/vendor/rails/activesupport/test/{json.rb → json_test.rb} +15 -5
- data/vendor/rails/railties/CHANGELOG +25 -1
- data/vendor/rails/railties/README +32 -3
- data/vendor/rails/railties/Rakefile +5 -5
- data/vendor/rails/railties/environments/boot.rb +12 -18
- data/vendor/rails/railties/environments/environment.rb +15 -15
- data/vendor/rails/railties/lib/dispatcher.rb +1 -2
- data/vendor/rails/railties/lib/initializer.rb +33 -9
- data/vendor/rails/railties/lib/rails/version.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb +1 -0
- data/vendor/rails/railties/lib/railties_path.rb +1 -1
- data/vendor/rails/railties/lib/tasks/framework.rake +4 -4
- data/vendor/rails/railties/lib/tasks/routes.rake +17 -0
- data/vendor/rails/release.rb +2 -2
- metadata +1877 -1848
data/CHANGELOG
CHANGED
@@ -1,26 +1,80 @@
|
|
1
1
|
== Change Log
|
2
2
|
|
3
|
+
=== 0.6.4 Gem Shaper
|
4
|
+
* Extract Archive pages into a core extension. Add automatic testing of core
|
5
|
+
extensions from default test task. [Sean Cribbs]
|
6
|
+
* Add <r:if_children /> and <r:unless_children /> tags. [Andrew Neil]
|
7
|
+
* Add HTML labels to role checkboxes in user edit template. [zilkey]
|
8
|
+
* Cleanup whitespace and line-endings in environment.rb. [Bjorn Maeland]
|
9
|
+
* Fix various SQL Server issues via Rails ticket #8886. [Mark Gallop]
|
10
|
+
* Refactor locals from _node.rhtml into Admin::NodeHelper. [Sean Cribbs]
|
11
|
+
* Fix XHTML validation errors in view templates. [Bjorn Maeland]
|
12
|
+
* Update Prototype and script.aculo.us to 1.6 and 1.8 releases. [Sean Cribbs]
|
13
|
+
* Fix edge case in tabcontrol.js where tab label is incorrect. [Sean Cribbs]
|
14
|
+
* Remove duplication in admin.js. [Sean Cribbs]
|
15
|
+
* Factor TimeZone stuff out of Radiant::Config into a module, fix failing tests.
|
16
|
+
[Sean Cribbs]
|
17
|
+
* Add has_part?, inherits_part?, and has_or_inherits_part? methods to Page.
|
18
|
+
[ana]
|
19
|
+
* Allow setting of local timezone via Radiant::Config and auto-adjustment of times
|
20
|
+
in admin UI and <r:date /> tag. [Bodhi Philpot]
|
21
|
+
* Update to latest Prototype and script.aculo.us and refactor and extract inline
|
22
|
+
Javascript into external files. [Mislav Marohnic]
|
23
|
+
* Narrow scope of exception to only throw on missing fixture files, allowing
|
24
|
+
invalid yaml errors through. [Daniel Sheppard]
|
25
|
+
* Added tests to ensure that response_cache stays within the cache dir.
|
26
|
+
[Daniel Sheppard]
|
27
|
+
* Add assert_requires_login to LoginTestHelper. [Sean Cribbs]
|
28
|
+
* Make sure tag binding stack is popped when an exception occurs. [jay@jay.fm]
|
29
|
+
* Clean up some apparent cruft in page.rb [Daniel Sheppard]
|
30
|
+
* Add logout method to LoginTestHelper. [Sean Cribbs]
|
31
|
+
* Run single extension tests with rake test:extensions EXT=<extension_name>
|
32
|
+
[Brian Skahan]
|
33
|
+
* Update Javascript libraries to Prototype 1.6.0_rc1 and script.aculo.us
|
34
|
+
1.8.0_pre1. [Mislav Marohnic]
|
35
|
+
* Fixed <r:attempted_url /> tag to escape the uri [Daniel Sheppard]
|
36
|
+
* Allow parts to be accessed by name from Page#part before they are saved.
|
37
|
+
[Sean Cribbs]
|
38
|
+
* Disambiguate namespace of ActionMailer::Part. [Sean Cribbs]
|
39
|
+
* Fix namespacing problem with ActionController::RoutingError. [Sean Cribbs]
|
40
|
+
* Update Rails to 1.2.5. [John Long]
|
41
|
+
* Ensured that the request and response are passed along to other pages that
|
42
|
+
are rendered within the same context. [John Long]
|
43
|
+
* Added <r:if_dev /> and <r:unless_dev /> tags. [Peter Berkenbosch]
|
44
|
+
* Removed session stringification patch in test helper. [Sean Cribbs]
|
45
|
+
* Update Rails to 1.2.4. [Sean Cribbs]
|
46
|
+
* Add extensions paths to the standard $LOAD_PATH so requires work properly.
|
47
|
+
[Sean Cribbs]
|
48
|
+
* Fixed some loading issues for plugins that are included in extensions.
|
49
|
+
[Sean Cribbs]
|
50
|
+
|
3
51
|
=== 0.6.3 Rock Grinder
|
4
52
|
* Add generic public/ copy task to generated extensions. [Sean Cribbs]
|
5
53
|
* Fix typo in StandardTags. [oli]
|
6
54
|
* Added db:remigrate:extensions task. [Sean Cribbs]
|
7
|
-
* Show all child pages on remove confirmation, regardless of sitemap expansion.
|
8
|
-
|
55
|
+
* Show all child pages on remove confirmation, regardless of sitemap expansion.
|
56
|
+
[Sean Cribbs]
|
57
|
+
* Make LoginSystem store user ids in session rather than whole user objects.
|
58
|
+
[Sean Cribbs]
|
9
59
|
* Plugins included in an extension's vendor/plugins directory will automatically
|
10
|
-
be loaded before the extension is activated. Plugins included in more than one
|
11
|
-
will be loaded only once according to the extension load order.
|
60
|
+
be loaded before the extension is activated. Plugins included in more than one
|
61
|
+
extension will be loaded only once according to the extension load order.
|
62
|
+
[Sean Cribbs]
|
12
63
|
* Allow subclassing of FileNotFoundPage. [Daniel Sheppard]
|
13
64
|
* <r:find/> should not return FileNotFoundPage. [Daniel Sheppard]
|
14
65
|
* Change test for tabs to just check dupes and for the requested tab
|
15
66
|
rather than a specific list (test was breaking if a real extension added
|
16
67
|
a tab). [Daniel Sheppard]
|
17
68
|
* Ensure test extensions are loaded in the test environment. [Daniel Sheppard]
|
18
|
-
* Prevent ExtensionInitializationTest from unloading real extensions.
|
69
|
+
* Prevent ExtensionInitializationTest from unloading real extensions.
|
70
|
+
[Daniel Sheppard]
|
19
71
|
* Expire the old URL from the cache when the page slug changes. [Daniel Sheppard]
|
20
72
|
* Fix failing tests in instance mode. [Daniel Sheppard]
|
21
|
-
* Move difference assertions upstream from forms extension into a test helper.
|
73
|
+
* Move difference assertions upstream from forms extension into a test helper.
|
74
|
+
[Sean Cribbs]
|
22
75
|
* Update Prototype to 1.5.0 final release. [Sean Cribbs]
|
23
|
-
* Allow specification of extension loading order in environment.rb
|
76
|
+
* Allow specification of extension loading order in environment.rb
|
77
|
+
[Daniel Sheppard]
|
24
78
|
* Fix bugs in assert_global_tag_defined and assert_tag_defined of
|
25
79
|
ExtensionTagTestHelper. [Sean Cribbs]
|
26
80
|
* Make sure included stylesheets and javascripts are only linked to once in
|
data/CONTRIBUTORS
CHANGED
@@ -4,6 +4,21 @@
|
|
4
4
|
The following people have submitted changes which have been applied to the
|
5
5
|
core:
|
6
6
|
|
7
|
+
=== 0.6.4 Gem Shaper
|
8
|
+
* Andrew Neil
|
9
|
+
* zilkey
|
10
|
+
* Mark Gallop
|
11
|
+
* Bjorn Maeland
|
12
|
+
* ana
|
13
|
+
* Bodhi Philpot
|
14
|
+
* jay@jay.fm
|
15
|
+
* Brian Skahan
|
16
|
+
* Mislav Marohnic
|
17
|
+
* Daniel Sheppard
|
18
|
+
* John Long
|
19
|
+
* Peter Berkenbosch
|
20
|
+
* Sean Cribbs
|
21
|
+
|
7
22
|
=== 0.6.3 Rock Grinder
|
8
23
|
* oli
|
9
24
|
* Daniel Sheppard
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class Admin::UserController < Admin::AbstractModelController
|
2
2
|
model_class User
|
3
3
|
|
4
|
-
only_allow_access_to :index, :new, :edit, :remove,
|
4
|
+
only_allow_access_to :index, :new, :edit, :remove,
|
5
|
+
:when => :admin,
|
5
6
|
:denied_url => {:controller => 'page', :action => :index},
|
6
7
|
:denied_message => 'You must have administrative privileges to perform this action.'
|
7
8
|
|
@@ -1,9 +1,5 @@
|
|
1
1
|
require_dependency 'radiant'
|
2
2
|
|
3
|
-
ActionView::Base.field_error_proc = Proc.new do |html, instance|
|
4
|
-
%{<div class="error-with-field">#{html} <small class="error">• #{[instance.error_message].flatten.first}</small></div>}
|
5
|
-
end
|
6
|
-
|
7
3
|
class ApplicationController < ActionController::Base
|
8
4
|
include LoginSystem
|
9
5
|
|
@@ -19,7 +15,9 @@ class ApplicationController < ActionController::Base
|
|
19
15
|
@config = Radiant::Config
|
20
16
|
end
|
21
17
|
|
18
|
+
# helpers to include additional assets from actions or views
|
22
19
|
helper_method :include_stylesheet, :include_javascript
|
20
|
+
|
23
21
|
def include_stylesheet(sheet)
|
24
22
|
@stylesheets << sheet
|
25
23
|
end
|
@@ -30,12 +28,13 @@ class ApplicationController < ActionController::Base
|
|
30
28
|
|
31
29
|
def rescue_action_in_public(exception)
|
32
30
|
case exception
|
33
|
-
when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::
|
31
|
+
when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::RoutingError
|
34
32
|
render :template => "site/not_found", :status => 404
|
35
33
|
else
|
36
34
|
super
|
37
35
|
end
|
38
36
|
end
|
37
|
+
|
39
38
|
private
|
40
39
|
|
41
40
|
def set_current_user
|
@@ -43,7 +42,7 @@ class ApplicationController < ActionController::Base
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def set_javascripts_and_stylesheets
|
46
|
-
@stylesheets =
|
47
|
-
@javascripts =
|
45
|
+
@stylesheets = %w(admin/main)
|
46
|
+
@javascripts = %w(prototype string effects tabcontrol ruledtable admin)
|
48
47
|
end
|
49
|
-
end
|
48
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Admin::NodeHelper
|
2
|
+
|
3
|
+
def render_node(page, locals = {})
|
4
|
+
@current_node = page
|
5
|
+
locals.reverse_merge!(:level => 0, :simple => false).merge!(:page => page)
|
6
|
+
render :partial => 'node', :locals => locals
|
7
|
+
end
|
8
|
+
|
9
|
+
def show_all?
|
10
|
+
@controller.action_name == 'remove'
|
11
|
+
end
|
12
|
+
|
13
|
+
def expanded_rows
|
14
|
+
unless @expanded_rows
|
15
|
+
@expanded_rows = case
|
16
|
+
when row_string = (cookies['expanded_rows'] || []).first
|
17
|
+
row_string.split(',').map { |x| Integer(x) rescue nil }.compact
|
18
|
+
else
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
(@expanded_rows << homepage.id).uniq if homepage
|
22
|
+
end
|
23
|
+
@expanded_rows
|
24
|
+
end
|
25
|
+
|
26
|
+
def expanded
|
27
|
+
show_all? || expanded_rows.include?(@current_node.id)
|
28
|
+
end
|
29
|
+
|
30
|
+
def padding_left(level)
|
31
|
+
(level * 22) + 4
|
32
|
+
end
|
33
|
+
|
34
|
+
def children_class
|
35
|
+
unless @current_node.children.empty?
|
36
|
+
if expanded
|
37
|
+
" children-visible"
|
38
|
+
else
|
39
|
+
" children-hidden"
|
40
|
+
end
|
41
|
+
else
|
42
|
+
" no-children"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def virtual_class
|
47
|
+
@current_node.virtual? ? " virtual": ""
|
48
|
+
end
|
49
|
+
|
50
|
+
def expander
|
51
|
+
unless @current_node.children.empty?
|
52
|
+
image((expanded ? "collapse" : "expand"),
|
53
|
+
:class => "expander", :alt => 'toggle children',
|
54
|
+
:title => '')
|
55
|
+
else
|
56
|
+
""
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def icon
|
61
|
+
icon_name = @current_node.virtual? ? 'virtual-page' : 'page'
|
62
|
+
image(icon_name, :class => "icon", :alt => 'page-icon', :title => '')
|
63
|
+
end
|
64
|
+
|
65
|
+
def node_title
|
66
|
+
%{<span class="title">#{ @current_node.title }</span>}
|
67
|
+
end
|
68
|
+
|
69
|
+
def page_type
|
70
|
+
display_name = @current_node.class.display_name
|
71
|
+
if display_name == 'Page'
|
72
|
+
""
|
73
|
+
else
|
74
|
+
%{<small class="info">(#{ display_name })</small>}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def spinner
|
79
|
+
image('spinner.gif',
|
80
|
+
:class => 'busy', :id => "busy-#{@current_node.id}",
|
81
|
+
:alt => "", :title => "",
|
82
|
+
:style => 'display: none;')
|
83
|
+
end
|
84
|
+
end
|
@@ -1,23 +1,5 @@
|
|
1
1
|
module Admin::PageHelper
|
2
|
-
|
3
|
-
locals.reverse_merge!(:level => 0, :simple => false).merge!(:page => page)
|
4
|
-
render :partial => 'node', :locals => locals
|
5
|
-
end
|
6
|
-
|
7
|
-
def show_all?
|
8
|
-
@controller.action_name == 'remove'
|
9
|
-
end
|
10
|
-
|
11
|
-
def expanded_rows
|
12
|
-
rows = case
|
13
|
-
when row_string = (cookies['expanded_rows'] || []).first
|
14
|
-
row_string.split(',').map { |x| Integer(x) rescue nil }.compact
|
15
|
-
else
|
16
|
-
[]
|
17
|
-
end
|
18
|
-
(rows << homepage.id).uniq if homepage
|
19
|
-
rows
|
20
|
-
end
|
2
|
+
include Admin::NodeHelper
|
21
3
|
|
22
4
|
def meta_errors?
|
23
5
|
!!(@page.errors[:slug] or @page.errors[:breadcrumb])
|
@@ -1,4 +1,6 @@
|
|
1
1
|
module ApplicationHelper
|
2
|
+
include LocalTime
|
3
|
+
|
2
4
|
def config
|
3
5
|
Radiant::Config
|
4
6
|
end
|
@@ -18,7 +20,7 @@ module ApplicationHelper
|
|
18
20
|
def logged_in?
|
19
21
|
!current_user.nil?
|
20
22
|
end
|
21
|
-
|
23
|
+
|
22
24
|
def save_model_button(model)
|
23
25
|
label = if model.new_record?
|
24
26
|
"Create #{model.class.name}"
|
@@ -31,7 +33,7 @@ module ApplicationHelper
|
|
31
33
|
def save_model_and_continue_editing_button(model)
|
32
34
|
submit_tag 'Save and Continue Editing', :name => 'continue', :class => 'button'
|
33
35
|
end
|
34
|
-
|
36
|
+
|
35
37
|
# Redefine pluralize() so that it doesn't put the count at the beginning of
|
36
38
|
# the string.
|
37
39
|
def pluralize(count, singular, plural = nil)
|
@@ -57,7 +59,7 @@ module ApplicationHelper
|
|
57
59
|
def separator
|
58
60
|
%{ <span class="separator"> | </span> }
|
59
61
|
end
|
60
|
-
|
62
|
+
|
61
63
|
def current_url?(options)
|
62
64
|
url = case
|
63
65
|
when Hash
|
@@ -76,10 +78,10 @@ module ApplicationHelper
|
|
76
78
|
def nav_link_to(name, options)
|
77
79
|
logger.debug 'options are: ' + options.to_s
|
78
80
|
if current_url?(options)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
%{<strong>#{ link_to name, options }</strong>}
|
82
|
+
else
|
83
|
+
link_to name, options
|
84
|
+
end
|
83
85
|
end
|
84
86
|
|
85
87
|
def admin?
|
@@ -94,7 +96,7 @@ module ApplicationHelper
|
|
94
96
|
%{
|
95
97
|
<script type="text/javascript">
|
96
98
|
// <![CDATA[
|
97
|
-
|
99
|
+
Field.activate('#{field_name}');
|
98
100
|
// ]]>
|
99
101
|
</script>
|
100
102
|
}
|
@@ -108,7 +110,7 @@ module ApplicationHelper
|
|
108
110
|
if login or time
|
109
111
|
html = %{<p style="clear: left"><small>Last updated }
|
110
112
|
html << %{by #{login} } if login
|
111
|
-
html << %{at #{ time
|
113
|
+
html << %{at #{ timestamp(time) }} if time
|
112
114
|
html << %{</small></p>}
|
113
115
|
html
|
114
116
|
end
|
@@ -116,6 +118,10 @@ module ApplicationHelper
|
|
116
118
|
%{<p class="clear"> </p>}
|
117
119
|
end
|
118
120
|
end
|
121
|
+
|
122
|
+
def timestamp(time)
|
123
|
+
adjust_time(time).strftime("%I:%M <small>%p</small> on %B %d, %Y")
|
124
|
+
end
|
119
125
|
|
120
126
|
def meta_visible(symbol)
|
121
127
|
v = case symbol
|
@@ -10,7 +10,7 @@ class FileNotFoundPage < Page
|
|
10
10
|
}
|
11
11
|
|
12
12
|
tag "attempted_url" do
|
13
|
-
request.request_uri unless request.nil?
|
13
|
+
CGI.escapeHTML(request.request_uri) unless request.nil?
|
14
14
|
end
|
15
15
|
|
16
16
|
def virtual?
|
@@ -25,4 +25,4 @@ class FileNotFoundPage < Page
|
|
25
25
|
false
|
26
26
|
end
|
27
27
|
|
28
|
-
end
|
28
|
+
end
|
data/app/models/page.rb
CHANGED
@@ -57,7 +57,23 @@ class Page < ActiveRecord::Base
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def part(name)
|
60
|
-
parts.
|
60
|
+
if new_record? or parts.to_a.any?(&:new_record?)
|
61
|
+
parts.to_a.find {|p| p.name == name.to_s }
|
62
|
+
else
|
63
|
+
parts.find_by_name name.to_s
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def has_part?(name)
|
68
|
+
!part(name).nil?
|
69
|
+
end
|
70
|
+
|
71
|
+
def has_or_inherits_part?(name)
|
72
|
+
has_part?(name) || inherits_part?(name)
|
73
|
+
end
|
74
|
+
|
75
|
+
def inherits_part?(name)
|
76
|
+
!has_part?(name) && self.ancestors.any? {|page| page.has_part?(name)}
|
61
77
|
end
|
62
78
|
|
63
79
|
def published?
|
@@ -95,7 +111,6 @@ class Page < ActiveRecord::Base
|
|
95
111
|
end
|
96
112
|
|
97
113
|
def render
|
98
|
-
lazy_initialize_parser_and_context
|
99
114
|
if layout
|
100
115
|
parse_object(layout)
|
101
116
|
else
|
@@ -104,7 +119,6 @@ class Page < ActiveRecord::Base
|
|
104
119
|
end
|
105
120
|
|
106
121
|
def render_part(part_name)
|
107
|
-
lazy_initialize_parser_and_context
|
108
122
|
part = part(part_name)
|
109
123
|
if part
|
110
124
|
parse_object(part)
|
@@ -113,17 +127,10 @@ class Page < ActiveRecord::Base
|
|
113
127
|
end
|
114
128
|
end
|
115
129
|
|
116
|
-
def render_snippet(snippet
|
117
|
-
lazy_initialize_parser_and_context
|
118
|
-
@context.globals.actual_page = actual_page if actual_page
|
130
|
+
def render_snippet(snippet)
|
119
131
|
parse_object(snippet)
|
120
132
|
end
|
121
133
|
|
122
|
-
def render_text(text)
|
123
|
-
lazy_initialize_parser_and_context
|
124
|
-
parse(text)
|
125
|
-
end
|
126
|
-
|
127
134
|
def find_by_url(url, live = true, clean = true)
|
128
135
|
return nil if virtual?
|
129
136
|
url = clean_url(url) if clean
|
@@ -236,14 +243,15 @@ class Page < ActiveRecord::Base
|
|
236
243
|
end
|
237
244
|
|
238
245
|
def lazy_initialize_parser_and_context
|
239
|
-
unless @
|
246
|
+
unless @parser and @context
|
240
247
|
@context = PageContext.new(self)
|
241
248
|
@parser = Radius::Parser.new(@context, :tag_prefix => 'r')
|
242
|
-
end
|
249
|
+
end
|
250
|
+
@parser
|
243
251
|
end
|
244
252
|
|
245
253
|
def parse(text)
|
246
|
-
|
254
|
+
lazy_initialize_parser_and_context.parse(text)
|
247
255
|
end
|
248
256
|
|
249
257
|
def parse_object(object)
|
@@ -252,10 +260,6 @@ class Page < ActiveRecord::Base
|
|
252
260
|
text = object.filter.filter(text) if object.respond_to? :filter_id
|
253
261
|
text
|
254
262
|
end
|
255
|
-
|
256
|
-
def tag(*args, &block)
|
257
|
-
@context.define_tag(*args, &block)
|
258
|
-
end
|
259
263
|
|
260
264
|
end
|
261
265
|
|