radiant 0.6.6 → 0.6.7
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 +15 -0
- data/CONTRIBUTORS +8 -0
- data/app/controllers/admin/page_controller.rb +1 -11
- data/app/controllers/admin/welcome_controller.rb +5 -6
- data/app/controllers/application.rb +2 -0
- data/app/controllers/site_controller.rb +1 -0
- data/app/helpers/admin/page_helper.rb +36 -0
- data/app/helpers/admin/regions_helper.rb +28 -0
- data/app/helpers/admin/user_helper.rb +6 -0
- data/app/helpers/application_helper.rb +2 -1
- data/app/models/user.rb +7 -8
- data/app/views/admin/extension/index.html.haml +28 -0
- data/app/views/admin/layout/edit.html.haml +44 -0
- data/app/views/admin/layout/index.html.haml +25 -0
- data/app/views/admin/layout/remove.html.haml +16 -0
- data/app/views/admin/page/_meta_row.html.haml +6 -0
- data/app/views/admin/page/_node.html.haml +25 -0
- data/app/views/admin/page/_part.html.haml +17 -0
- data/app/views/admin/page/_tag_reference.html.haml +3 -0
- data/app/views/admin/page/children.html.haml +2 -0
- data/app/views/admin/page/edit.html.haml +114 -0
- data/app/views/admin/page/index.html.haml +28 -0
- data/app/views/admin/page/remove.html.haml +20 -0
- data/app/views/admin/snippet/edit.html.haml +36 -0
- data/app/views/admin/snippet/index.html.haml +20 -0
- data/app/views/admin/snippet/remove.html.haml +19 -0
- data/app/views/admin/user/edit.html.haml +80 -0
- data/app/views/admin/user/index.html.haml +23 -0
- data/app/views/admin/user/preferences.html.haml +28 -0
- data/app/views/admin/user/remove.html.haml +18 -0
- data/app/views/admin/welcome/login.html.haml +44 -0
- data/app/views/layouts/application.html.haml +54 -0
- data/app/views/site/not_found.html.haml +3 -0
- data/db/migrate/019_add_salt_to_users.rb +11 -0
- data/db/schema.rb +2 -1
- data/lib/login_system.rb +1 -0
- data/lib/radiant.rb +1 -1
- data/lib/radiant/admin_ui.rb +65 -0
- data/lib/radiant/admin_ui/region_partials.rb +18 -0
- data/lib/radiant/admin_ui/region_set.rb +35 -0
- data/lib/tasks/extensions.rake +33 -0
- data/public/javascripts/admin/admin.js +8 -2
- data/public/javascripts/admin/sitemap.js +2 -1
- data/public/stylesheets/admin/main.css +4 -0
- data/spec/controllers/admin/abstract_model_controller_spec.rb +2 -0
- data/spec/controllers/admin/page_controller_spec.rb +3 -28
- data/spec/controllers/admin/user_controller_spec.rb +1 -1
- data/spec/controllers/admin/welcome_controller_spec.rb +26 -0
- data/spec/helpers/admin/page_helper_spec.rb +4 -0
- data/spec/helpers/admin/regions_helper_spec.rb +47 -0
- data/spec/helpers/admin/user_helper_spec.rb +7 -0
- data/spec/helpers/application_helper_spec.rb +7 -3
- data/spec/lib/login_system_spec.rb +5 -0
- data/spec/lib/radiant/admin_ui/region_partials_spec.rb +35 -0
- data/spec/lib/radiant/admin_ui/region_set_spec.rb +61 -0
- data/spec/lib/radiant/admin_ui_spec.rb +74 -18
- data/spec/models/user_spec.rb +11 -4
- data/spec/scenarios/users_scenario.rb +2 -2
- data/vendor/plugins/haml/MIT-LICENSE +20 -0
- data/vendor/plugins/haml/README.rdoc +319 -0
- data/vendor/plugins/haml/Rakefile +158 -0
- data/vendor/plugins/haml/TODO +9 -0
- data/vendor/plugins/haml/VERSION +1 -0
- data/vendor/plugins/haml/bin/css2sass +7 -0
- data/vendor/plugins/haml/bin/haml +8 -0
- data/vendor/plugins/haml/bin/html2haml +7 -0
- data/vendor/plugins/haml/bin/sass +8 -0
- data/vendor/plugins/haml/extra/haml-mode.el +328 -0
- data/vendor/plugins/haml/extra/sass-mode.el +88 -0
- data/vendor/plugins/haml/init.rb +2 -0
- data/vendor/plugins/haml/lib/haml.rb +977 -0
- data/vendor/plugins/haml/lib/haml/buffer.rb +229 -0
- data/vendor/plugins/haml/lib/haml/engine.rb +274 -0
- data/vendor/plugins/haml/lib/haml/error.rb +23 -0
- data/vendor/plugins/haml/lib/haml/exec.rb +347 -0
- data/vendor/plugins/haml/lib/haml/filters.rb +249 -0
- data/vendor/plugins/haml/lib/haml/helpers.rb +413 -0
- data/vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb +45 -0
- data/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb +122 -0
- data/vendor/plugins/haml/lib/haml/html.rb +188 -0
- data/vendor/plugins/haml/lib/haml/precompiler.rb +757 -0
- data/vendor/plugins/haml/lib/haml/template.rb +43 -0
- data/vendor/plugins/haml/lib/haml/template/patch.rb +58 -0
- data/vendor/plugins/haml/lib/haml/template/plugin.rb +72 -0
- data/vendor/plugins/haml/lib/sass.rb +833 -0
- data/vendor/plugins/haml/lib/sass/constant.rb +245 -0
- data/vendor/plugins/haml/lib/sass/constant/color.rb +101 -0
- data/vendor/plugins/haml/lib/sass/constant/literal.rb +53 -0
- data/vendor/plugins/haml/lib/sass/constant/number.rb +87 -0
- data/vendor/plugins/haml/lib/sass/constant/operation.rb +30 -0
- data/vendor/plugins/haml/lib/sass/constant/string.rb +22 -0
- data/vendor/plugins/haml/lib/sass/css.rb +378 -0
- data/vendor/plugins/haml/lib/sass/engine.rb +459 -0
- data/vendor/plugins/haml/lib/sass/error.rb +35 -0
- data/vendor/plugins/haml/lib/sass/plugin.rb +165 -0
- data/vendor/plugins/haml/lib/sass/plugin/merb.rb +56 -0
- data/vendor/plugins/haml/lib/sass/plugin/rails.rb +24 -0
- data/vendor/plugins/haml/lib/sass/tree/attr_node.rb +53 -0
- data/vendor/plugins/haml/lib/sass/tree/comment_node.rb +20 -0
- data/vendor/plugins/haml/lib/sass/tree/directive_node.rb +46 -0
- data/vendor/plugins/haml/lib/sass/tree/node.rb +42 -0
- data/vendor/plugins/haml/lib/sass/tree/rule_node.rb +89 -0
- data/vendor/plugins/haml/lib/sass/tree/value_node.rb +16 -0
- data/vendor/plugins/haml/test/benchmark.rb +82 -0
- data/vendor/plugins/haml/test/haml/engine_test.rb +587 -0
- data/vendor/plugins/haml/test/haml/helper_test.rb +187 -0
- data/vendor/plugins/haml/test/haml/html2haml_test.rb +60 -0
- data/vendor/plugins/haml/test/haml/markaby/standard.mab +52 -0
- data/vendor/plugins/haml/test/haml/mocks/article.rb +6 -0
- data/vendor/plugins/haml/test/haml/results/content_for_layout.xhtml +16 -0
- data/vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml +11 -0
- data/vendor/plugins/haml/test/haml/results/filters.xhtml +82 -0
- data/vendor/plugins/haml/test/haml/results/helpers.xhtml +94 -0
- data/vendor/plugins/haml/test/haml/results/helpful.xhtml +10 -0
- data/vendor/plugins/haml/test/haml/results/just_stuff.xhtml +64 -0
- data/vendor/plugins/haml/test/haml/results/list.xhtml +12 -0
- data/vendor/plugins/haml/test/haml/results/original_engine.xhtml +22 -0
- data/vendor/plugins/haml/test/haml/results/partials.xhtml +21 -0
- data/vendor/plugins/haml/test/haml/results/silent_script.xhtml +74 -0
- data/vendor/plugins/haml/test/haml/results/standard.xhtml +42 -0
- data/vendor/plugins/haml/test/haml/results/tag_parsing.xhtml +28 -0
- data/vendor/plugins/haml/test/haml/results/very_basic.xhtml +7 -0
- data/vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml +94 -0
- data/vendor/plugins/haml/test/haml/rhtml/_av_partial_1.rhtml +12 -0
- data/vendor/plugins/haml/test/haml/rhtml/_av_partial_2.rhtml +8 -0
- data/vendor/plugins/haml/test/haml/rhtml/action_view.rhtml +62 -0
- data/vendor/plugins/haml/test/haml/rhtml/standard.rhtml +54 -0
- data/vendor/plugins/haml/test/haml/template_test.rb +168 -0
- data/vendor/plugins/haml/test/haml/templates/_av_partial_1.haml +9 -0
- data/vendor/plugins/haml/test/haml/templates/_av_partial_2.haml +5 -0
- data/vendor/plugins/haml/test/haml/templates/_partial.haml +8 -0
- data/vendor/plugins/haml/test/haml/templates/_text_area.haml +3 -0
- data/vendor/plugins/haml/test/haml/templates/action_view.haml +47 -0
- data/vendor/plugins/haml/test/haml/templates/breakage.haml +8 -0
- data/vendor/plugins/haml/test/haml/templates/content_for_layout.haml +10 -0
- data/vendor/plugins/haml/test/haml/templates/eval_suppressed.haml +11 -0
- data/vendor/plugins/haml/test/haml/templates/filters.haml +81 -0
- data/vendor/plugins/haml/test/haml/templates/helpers.haml +69 -0
- data/vendor/plugins/haml/test/haml/templates/helpful.haml +11 -0
- data/vendor/plugins/haml/test/haml/templates/just_stuff.haml +77 -0
- data/vendor/plugins/haml/test/haml/templates/list.haml +12 -0
- data/vendor/plugins/haml/test/haml/templates/original_engine.haml +17 -0
- data/vendor/plugins/haml/test/haml/templates/partialize.haml +1 -0
- data/vendor/plugins/haml/test/haml/templates/partials.haml +12 -0
- data/vendor/plugins/haml/test/haml/templates/silent_script.haml +40 -0
- data/vendor/plugins/haml/test/haml/templates/standard.haml +42 -0
- data/vendor/plugins/haml/test/haml/templates/tag_parsing.haml +24 -0
- data/vendor/plugins/haml/test/haml/templates/very_basic.haml +4 -0
- data/vendor/plugins/haml/test/haml/templates/whitespace_handling.haml +87 -0
- data/vendor/plugins/haml/test/haml/test_helper.rb +15 -0
- data/vendor/plugins/haml/test/profile.rb +65 -0
- data/vendor/plugins/haml/test/sass/engine_test.rb +276 -0
- data/vendor/plugins/haml/test/sass/plugin_test.rb +159 -0
- data/vendor/plugins/haml/test/sass/results/alt.css +4 -0
- data/vendor/plugins/haml/test/sass/results/basic.css +9 -0
- data/vendor/plugins/haml/test/sass/results/compact.css +5 -0
- data/vendor/plugins/haml/test/sass/results/complex.css +87 -0
- data/vendor/plugins/haml/test/sass/results/compressed.css +1 -0
- data/vendor/plugins/haml/test/sass/results/constants.css +14 -0
- data/vendor/plugins/haml/test/sass/results/expanded.css +19 -0
- data/vendor/plugins/haml/test/sass/results/import.css +29 -0
- data/vendor/plugins/haml/test/sass/results/mixins.css +95 -0
- data/vendor/plugins/haml/test/sass/results/multiline.css +24 -0
- data/vendor/plugins/haml/test/sass/results/nested.css +22 -0
- data/vendor/plugins/haml/test/sass/results/parent_ref.css +13 -0
- data/vendor/plugins/haml/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
- data/vendor/plugins/haml/test/sass/results/subdir/subdir.css +1 -0
- data/vendor/plugins/haml/test/sass/templates/_partial.sass +2 -0
- data/vendor/plugins/haml/test/sass/templates/alt.sass +16 -0
- data/vendor/plugins/haml/test/sass/templates/basic.sass +23 -0
- data/vendor/plugins/haml/test/sass/templates/bork.sass +2 -0
- data/vendor/plugins/haml/test/sass/templates/bork2.sass +2 -0
- data/vendor/plugins/haml/test/sass/templates/compact.sass +17 -0
- data/vendor/plugins/haml/test/sass/templates/complex.sass +310 -0
- data/vendor/plugins/haml/test/sass/templates/compressed.sass +15 -0
- data/vendor/plugins/haml/test/sass/templates/constants.sass +97 -0
- data/vendor/plugins/haml/test/sass/templates/expanded.sass +17 -0
- data/vendor/plugins/haml/test/sass/templates/import.sass +11 -0
- data/vendor/plugins/haml/test/sass/templates/importee.sass +14 -0
- data/vendor/plugins/haml/test/sass/templates/mixins.sass +76 -0
- data/vendor/plugins/haml/test/sass/templates/multiline.sass +20 -0
- data/vendor/plugins/haml/test/sass/templates/nested.sass +25 -0
- data/vendor/plugins/haml/test/sass/templates/parent_ref.sass +25 -0
- data/vendor/plugins/haml/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
- data/vendor/plugins/haml/test/sass/templates/subdir/subdir.sass +6 -0
- metadata +185 -24
- data/app/views/admin/extension/index.html.erb +0 -40
- data/app/views/admin/layout/edit.html.erb +0 -39
- data/app/views/admin/layout/index.html.erb +0 -38
- data/app/views/admin/layout/remove.html.erb +0 -17
- data/app/views/admin/page/_meta_row.html.erb +0 -4
- data/app/views/admin/page/_node.html.erb +0 -28
- data/app/views/admin/page/_part.html.erb +0 -13
- data/app/views/admin/page/_tag_reference.html.erb +0 -4
- data/app/views/admin/page/children.html.erb +0 -4
- data/app/views/admin/page/edit.html.erb +0 -140
- data/app/views/admin/page/index.html.erb +0 -31
- data/app/views/admin/page/remove.html.erb +0 -14
- data/app/views/admin/snippet/edit.html.erb +0 -29
- data/app/views/admin/snippet/index.html.erb +0 -36
- data/app/views/admin/snippet/remove.html.erb +0 -16
- data/app/views/admin/user/edit.html.erb +0 -54
- data/app/views/admin/user/index.html.erb +0 -43
- data/app/views/admin/user/preferences.html.erb +0 -29
- data/app/views/admin/user/remove.html.erb +0 -16
- data/app/views/admin/welcome/login.html.erb +0 -51
- data/app/views/layouts/application.html.erb +0 -83
- data/app/views/site/not_found.html.erb +0 -3
@@ -0,0 +1,18 @@
|
|
1
|
+
class Radiant::AdminUI::RegionPartials
|
2
|
+
def initialize(template)
|
3
|
+
@partials = Hash.new {|h,k| h[k] = "<strong>`#{k}' default partial not found!</strong>" }
|
4
|
+
@template = template
|
5
|
+
end
|
6
|
+
|
7
|
+
def [](key)
|
8
|
+
@partials[key.to_s]
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_missing(method, *args, &block)
|
12
|
+
if block_given?
|
13
|
+
@partials[method.to_s] = @template.capture(&block)
|
14
|
+
else
|
15
|
+
@partials[method.to_s]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Radiant::AdminUI::RegionSet
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@regions = Hash.new do |h,k|
|
5
|
+
h[k] = []
|
6
|
+
end
|
7
|
+
yield self if block_given?
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](region)
|
11
|
+
@regions[region.to_sym]
|
12
|
+
end
|
13
|
+
|
14
|
+
def add(region=nil, partial=nil, options={})
|
15
|
+
raise ArgumentError, "You must specify a region and a partial" unless region and partial
|
16
|
+
if options[:before]
|
17
|
+
index = @regions[region].empty? ? 0 : (@regions[region].index(options[:before]) || @regions[region].size)
|
18
|
+
self[region].insert(index, partial)
|
19
|
+
elsif options[:after]
|
20
|
+
index = @regions[region].empty? ? 0 : (@regions[region].index(options[:after]) || @regions[region].size - 1)
|
21
|
+
self[region].insert(index + 1, partial)
|
22
|
+
else
|
23
|
+
self[region] << partial
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def method_missing(method, *args, &block)
|
28
|
+
if args.empty?
|
29
|
+
self[method]
|
30
|
+
else
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/tasks/extensions.rake
CHANGED
@@ -69,6 +69,39 @@ namespace :spec do
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
namespace :radiant do
|
73
|
+
namespace :extensions do
|
74
|
+
desc "Runs update asset task for all extensions"
|
75
|
+
task :update_all => :environment do
|
76
|
+
extension_names = Radiant::ExtensionLoader.instance.extensions.map { |f| f.to_s.underscore.sub(/_extension$/, '') }
|
77
|
+
extension_update_tasks = extension_names.map { |n| "radiant:extensions:#{n}:update" }.select { |t| Rake::Task.task_defined?(t) }
|
78
|
+
extension_update_tasks.each {|t| Rake::Task[t].invoke }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
namespace :radiant do
|
84
|
+
namespace :extensions do
|
85
|
+
desc "Runs update asset task for all extensions"
|
86
|
+
task :update_all => :environment do
|
87
|
+
extension_names = Radiant::ExtensionLoader.instance.extensions.map { |f| f.to_s.underscore.sub(/_extension$/, '') }
|
88
|
+
extension_update_tasks = extension_names.map { |n| "radiant:extensions:#{n}:update" }.select { |t| Rake::Task.task_defined?(t) }
|
89
|
+
extension_update_tasks.each {|t| Rake::Task[t].invoke }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
namespace :radiant do
|
95
|
+
namespace :extensions do
|
96
|
+
desc "Runs update asset task for all extensions"
|
97
|
+
task :update_all => :environment do
|
98
|
+
extension_names = Radiant::ExtensionLoader.instance.extensions.map { |f| f.to_s.underscore.sub(/_extension$/, '') }
|
99
|
+
extension_update_tasks = extension_names.map { |n| "radiant:extensions:#{n}:update" }.select { |t| Rake::Task.task_defined?(t) }
|
100
|
+
extension_update_tasks.each {|t| Rake::Task[t].invoke }
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
72
105
|
# Load any custom rakefiles from extensions
|
73
106
|
[RAILS_ROOT, RADIANT_ROOT].uniq.each do |root|
|
74
107
|
Dir[root + '/vendor/extensions/*/lib/tasks/*.rake'].sort.each { |ext| load ext }
|
@@ -1,6 +1,12 @@
|
|
1
1
|
document.observe('dom:loaded', function() {
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
when('table.index', function(table){
|
4
|
+
if(table.identify() == 'site-map')
|
5
|
+
new SiteMap(table);
|
6
|
+
else
|
7
|
+
new RuledTable(table);
|
8
|
+
});
|
9
|
+
|
4
10
|
when('page_title', function(title) {
|
5
11
|
var slug = $('page_slug'),
|
6
12
|
breadcrumb = $('page_breadcrumb'),
|
@@ -117,7 +117,8 @@ var SiteMap = Class.create(RuledTable, {
|
|
117
117
|
{
|
118
118
|
insertion: "after",
|
119
119
|
onLoading: function() { spinner.show(); this.updating = true }.bind(this),
|
120
|
-
onComplete: function() { spinner.fade(); this.updating = false }.bind(this)
|
120
|
+
onComplete: function() { spinner.fade(); this.updating = false }.bind(this),
|
121
|
+
method: 'get'
|
121
122
|
}
|
122
123
|
);
|
123
124
|
},
|
@@ -80,6 +80,8 @@ table {
|
|
80
80
|
padding-left: .9em;
|
81
81
|
padding-right: .9em;
|
82
82
|
text-decoration: none;
|
83
|
+
outline: none;
|
84
|
+
-moz-outline: none;
|
83
85
|
}
|
84
86
|
#navigation a:hover, #navigation a:visited:hover {
|
85
87
|
text-decoration: underline;
|
@@ -445,6 +447,8 @@ h1 {
|
|
445
447
|
padding-bottom: 4px;
|
446
448
|
text-decoration: none;
|
447
449
|
text-transform: titlecase;
|
450
|
+
outline: none;
|
451
|
+
-moz-outline: none;
|
448
452
|
}
|
449
453
|
#content #tabs .tab.here {
|
450
454
|
background-color: white;
|
@@ -9,6 +9,8 @@ class TestModelController < Admin::AbstractModelController
|
|
9
9
|
def default_template_name(default_action_name = action_name)
|
10
10
|
"#{Admin::LayoutController.controller_path}/#{default_action_name}"
|
11
11
|
end
|
12
|
+
|
13
|
+
before_filter {|c| c.send(:instance_variable_set, "@controller_name", 'layout')}
|
12
14
|
end
|
13
15
|
|
14
16
|
#
|
@@ -95,7 +95,7 @@ describe Admin::PageController do
|
|
95
95
|
page.parts.size.should == 0
|
96
96
|
|
97
97
|
Page.find_by_title("New Page").should_not be_nil
|
98
|
-
@cache.
|
98
|
+
@cache.should be_cleared
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should show errors when you try and create a new page with invalid data" do
|
@@ -165,7 +165,7 @@ describe Admin::PageController do
|
|
165
165
|
response.should be_redirect
|
166
166
|
page = pages(:home)
|
167
167
|
page.title.should == "Updated Home Page"
|
168
|
-
@cache.
|
168
|
+
@cache.should be_cleared
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should re-render the form when the page fails to save" do
|
@@ -175,15 +175,6 @@ describe Admin::PageController do
|
|
175
175
|
assigns[:page].should == pages(:home)
|
176
176
|
end
|
177
177
|
|
178
|
-
it "should expire the cache correctly when you change a page's slug" do
|
179
|
-
@cache = @controller.cache = FakeResponseCache.new
|
180
|
-
post :edit, :id => page_id(:first), :page => { :slug => 'monkey' }
|
181
|
-
response.should be_redirect
|
182
|
-
page = pages(:first)
|
183
|
-
page.slug.should == 'monkey'
|
184
|
-
@cache.expired_path.should == '/first/'
|
185
|
-
end
|
186
|
-
|
187
178
|
it "should allow you to save changes to a page and its parts" do
|
188
179
|
create_page("New Page") do
|
189
180
|
create_page_part('test-part-1')
|
@@ -222,7 +213,7 @@ describe Admin::PageController do
|
|
222
213
|
# but must be rendered to page
|
223
214
|
response.should have_tag('textarea', 'changed-1')
|
224
215
|
end
|
225
|
-
|
216
|
+
|
226
217
|
it "should prompt you when deleting a page" do
|
227
218
|
page = pages(:first)
|
228
219
|
get :remove, :id => page.id
|
@@ -248,22 +239,6 @@ describe Admin::PageController do
|
|
248
239
|
Page.find_by_id(page.id).should be_nil
|
249
240
|
end
|
250
241
|
|
251
|
-
it "should prompt you when clearing the page cache" do
|
252
|
-
@cache = @controller.cache = FakeResponseCache.new
|
253
|
-
get :clear_cache
|
254
|
-
response.should be_success
|
255
|
-
@response.body.should match(/Do.*?not.*?access/i)
|
256
|
-
@cache.should_not be_cleared
|
257
|
-
end
|
258
|
-
|
259
|
-
it "should allow you to clear the page cache" do
|
260
|
-
@cache = @controller.cache = FakeResponseCache.new
|
261
|
-
post :clear_cache
|
262
|
-
response.should redirect_to(page_index_url)
|
263
|
-
flash[:notice].should match(/cache.*clear/i)
|
264
|
-
@cache.should be_cleared
|
265
|
-
end
|
266
|
-
|
267
242
|
it "should use the _part template when adding a part with AJAX" do
|
268
243
|
xml_http_request :get, :add_part
|
269
244
|
response.should be_success
|
@@ -63,7 +63,7 @@ describe Admin::UserController do
|
|
63
63
|
login_as :non_admin
|
64
64
|
post :preferences, { :user => { :password => 'funtimes', :password_confirmation => 'funtimes' } }
|
65
65
|
user = users(:non_admin)
|
66
|
-
user.password.should ==
|
66
|
+
user.password.should == user.sha1('funtimes')
|
67
67
|
|
68
68
|
rails_log.should_not match(/"password"=>"funtimes"/)
|
69
69
|
rails_log.should_not match(/"password_confirmation"=>"funtimes"/)
|
@@ -34,4 +34,30 @@ describe Admin::WelcomeController do
|
|
34
34
|
response.should be_redirect
|
35
35
|
response.should redirect_to(login_url)
|
36
36
|
end
|
37
|
+
|
38
|
+
describe "with a logged-in user" do
|
39
|
+
before do
|
40
|
+
login_as :admin
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should not show /login again" do
|
44
|
+
get :login
|
45
|
+
response.should redirect_to(welcome_url)
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "and a stored location" do
|
49
|
+
before do
|
50
|
+
session[:return_to] = '/stored/path'
|
51
|
+
post :login, :user => {:login => "admin", :password => "password"}
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should redirect" do
|
55
|
+
response.should redirect_to('/stored/path')
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should clear session[:return_to]" do
|
59
|
+
session[:return_to].should be_nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
37
63
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../spec_helper"
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
describe Admin::RegionsHelper do
|
5
|
+
before :each do
|
6
|
+
@controller = mock('controller')
|
7
|
+
@controller.stub!(:controller_name).and_return('page')
|
8
|
+
@first_render = "admin/page/edit"
|
9
|
+
@admin = Radiant::AdminUI.instance
|
10
|
+
stub!(:admin).and_return(@admin)
|
11
|
+
@region_set_mock = Radiant::AdminUI::RegionSet.new
|
12
|
+
@admin.stub!(:page).and_return(OpenStruct.new(:edit => @region_set_mock))
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should initialize relevant region variables" do
|
16
|
+
lazy_initialize_region_set
|
17
|
+
@controller_name.should == 'page'
|
18
|
+
@template_name.should == 'edit'
|
19
|
+
@region_set.should === @region_set_mock
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "rendering a region" do
|
23
|
+
before :each do
|
24
|
+
@region_set_mock.add :main, "test"
|
25
|
+
@template = mock('template')
|
26
|
+
@template.stub!(:capture).and_return("foo")
|
27
|
+
lazy_initialize_region_set
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should render a region with no default partials" do
|
31
|
+
should_receive(:render).with(:partial => "test").and_return("foo")
|
32
|
+
render_region(:main).should == "foo"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should capture the passed block, yielding the RegionPartials object and concatenating" do
|
36
|
+
should_receive(:render).and_raise(::ActionView::ActionViewError)
|
37
|
+
should_receive(:concat).with("foo", anything)
|
38
|
+
@template.should_receive(:capture).and_return("foo")
|
39
|
+
render_region(:main) do |main|
|
40
|
+
main.should be_kind_of(Radiant::AdminUI::RegionPartials)
|
41
|
+
main.test do
|
42
|
+
"foo"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,4 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + "/../../spec_helper"
|
2
2
|
|
3
3
|
describe Admin::UserHelper do
|
4
|
+
scenario :users
|
5
|
+
|
6
|
+
it "should render a string containing the user's roles" do
|
7
|
+
roles(users(:admin)).should == "Administrator"
|
8
|
+
roles(users(:developer)).should == "Developer"
|
9
|
+
roles(users(:existing)).should == ''
|
10
|
+
end
|
4
11
|
end
|
@@ -137,9 +137,9 @@ describe ApplicationHelper do
|
|
137
137
|
end
|
138
138
|
|
139
139
|
it "should determine whether a meta area item should be visible" do
|
140
|
-
meta_visible(:meta_more).should
|
141
|
-
meta_visible(:meta_less).should ==
|
142
|
-
meta_visible(:meta).should ==
|
140
|
+
meta_visible(:meta_more).should be_empty
|
141
|
+
meta_visible(:meta_less).should == {:style => "display:none"}
|
142
|
+
meta_visible(:meta).should == {:style => "display:none"}
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should not have meta errors" do
|
@@ -163,4 +163,8 @@ describe ApplicationHelper do
|
|
163
163
|
it "should provide the admin object" do
|
164
164
|
admin.should == Radiant::AdminUI.instance
|
165
165
|
end
|
166
|
+
|
167
|
+
it "should include the regions helper" do
|
168
|
+
ApplicationHelper.included_modules.should include(Admin::RegionsHelper)
|
169
|
+
end
|
166
170
|
end
|
@@ -69,6 +69,11 @@ describe LoginRequiredController, :type => :controller do
|
|
69
69
|
get :index
|
70
70
|
response.should redirect_to(login_url)
|
71
71
|
end
|
72
|
+
|
73
|
+
it "should store location" do
|
74
|
+
get 'protected_action'
|
75
|
+
session[:return_to].should match(/login_required\/protected_action/)
|
76
|
+
end
|
72
77
|
end
|
73
78
|
|
74
79
|
class OnlyAllowAccessToWhenController < LoginRequiredController
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../../spec_helper"
|
2
|
+
|
3
|
+
class TemplateStub
|
4
|
+
attr_accessor :block
|
5
|
+
def capture(&block)
|
6
|
+
@block = block
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe Radiant::AdminUI::RegionPartials do
|
11
|
+
before :each do
|
12
|
+
@template = TemplateStub.new
|
13
|
+
@rp = Radiant::AdminUI::RegionPartials.new(@template)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return a string when the specified partial does not exist" do
|
17
|
+
@rp['foo'].should == "<strong>`foo' default partial not found!</strong>"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should expose partials via bracket accessor" do
|
21
|
+
block = lambda { "Hello World!" }
|
22
|
+
@rp.main(&block)
|
23
|
+
@rp['main'].should === block
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should capture a block when passed" do
|
27
|
+
@rp.edit_extended_metadata do
|
28
|
+
"Hello, World!"
|
29
|
+
end
|
30
|
+
|
31
|
+
@template.block.should be_kind_of(Proc)
|
32
|
+
@template.block.should === @rp.edit_extended_metadata
|
33
|
+
@template.block.call.should == "Hello, World!"
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../../spec_helper"
|
2
|
+
|
3
|
+
describe Radiant::AdminUI::RegionSet do
|
4
|
+
before :each do
|
5
|
+
@region_set = Radiant::AdminUI::RegionSet.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should create empty regions on first access" do
|
9
|
+
@region_set["new_region"].should == []
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should use indifferent access on regions" do
|
13
|
+
@region_set["new_region"].should === @region_set[:new_region]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should access regions as methods" do
|
17
|
+
@region_set.new_region.should === @region_set["new_region"]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should yield itself to a passed block when initializing" do
|
21
|
+
@set = Radiant::AdminUI::RegionSet.new do |s|
|
22
|
+
@yielded = s
|
23
|
+
end
|
24
|
+
@set.should === @yielded
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "adding partials" do
|
28
|
+
before :each do
|
29
|
+
@region_set["main"] << "one"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should add to the end of a region by default" do
|
33
|
+
@region_set.add :main, "two"
|
34
|
+
@region_set.main.should == ["one", "two"]
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should add a partial before a specified partial" do
|
38
|
+
@region_set.add :main, "two"
|
39
|
+
@region_set.add :main, "three", :before => "two"
|
40
|
+
@region_set.main.should == ["one", "three", "two"]
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should add a partial after a specified partial" do
|
44
|
+
@region_set.add :main, "two"
|
45
|
+
@region_set.add :main, "three", :after => "one"
|
46
|
+
@region_set.main.should == ["one", "three", "two"]
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should add a partial at the end if the before partial is not found" do
|
50
|
+
@region_set.add :main, "two"
|
51
|
+
@region_set.add :main, "three", :before => "foo"
|
52
|
+
@region_set.main.should == ["one", "two", "three"]
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should add a partial at the end if the after partial is not found" do
|
56
|
+
@region_set.add :main, "two"
|
57
|
+
@region_set.add :main, "three", :after => "foo"
|
58
|
+
@region_set.main.should == ["one", "two", "three"]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|