| |   |
| 391 | 391 | desc %{ |
| 392 | 392 | Renders a trail of breadcrumbs to the current page. The separator attribute |
| 393 | 393 | specifies the HTML fragment that is inserted between each of the breadcrumbs. By |
| 394 | | default it is set to @>@. |
| 394 | default it is set to @>@. The boolean nolinks attribute can be specified to render |
| 395 | breadcrumbs in plain text, without any links (useful when generating title tag). |
| 395 | 396 | |
| 396 | 397 | *Usage:* |
| 397 | | <pre><code><r:breadcrumbs [separator="separator_string"] /></code></pre> |
| 398 | <pre><code><r:breadcrumbs [separator="separator_string"] [nolinks="true"] /></code></pre> |
| 398 | 399 | } |
| 399 | 400 | tag 'breadcrumbs' do |tag| |
| 400 | 401 | page = tag.locals.page |
| 401 | 402 | breadcrumbs = [page.breadcrumb] |
| 403 | nolinks = (tag.attr['nolinks'] == 'true') |
| 402 | 404 | page.ancestors.each do |ancestor| |
| 403 | | breadcrumbs.unshift %{<a href="#{ancestor.url}">#{ancestor.breadcrumb}</a>} |
| 405 | if nolinks |
| 406 | breadcrumbs.unshift ancestor.breadcrumb |
| 407 | else |
| 408 | breadcrumbs.unshift %{<a href="#{ancestor.url}">#{ancestor.breadcrumb}</a>} |
| 409 | end |
| 404 | 410 | end |
| 405 | 411 | separator = tag.attr['separator'] || ' > ' |
| 406 | 412 | breadcrumbs.join(separator) |
| … | … | |
| 551 | 551 | end |
| 552 | 552 | end |
| 553 | 553 | between = hash.has_key?(:between) ? hash[:between].call : ' ' |
| 554 | | result.join(between) |
| 554 | result.reject { |i| i.blank? }.join(between) |
| 555 | 555 | end |
| 556 | 556 | [:normal, :here, :selected, :between].each do |symbol| |
| 557 | 557 | tag "navigation:#{symbol}" do |tag| |
| … | … | |
| 602 | 602 | end |
| 603 | 603 | end |
| 604 | 604 | |
| 605 | desc %{ |
| 606 | Prints the page's status as a string. Optional attribute 'downcase' |
| 607 | will cause the status to be all lowercase. |
| 608 | |
| 609 | *Usage:* |
| 610 | <pre><code><r:status [downcase='true'] /></code></pre> |
| 611 | } |
| 612 | tag 'status' do |tag| |
| 613 | status = tag.globals.page.status.name |
| 614 | return status.downcase if tag.attr['downcase'] |
| 615 | status |
| 616 | end |
| 617 | |
| 605 | 618 | private |
| 606 | 619 | |
| 607 | 620 | def children_find_options(tag) |
| toggle raw diff |
--- a/app/models/standard_tags.rb
+++ b/app/models/standard_tags.rb
@@ -391,16 +391,22 @@ module StandardTags
desc %{
Renders a trail of breadcrumbs to the current page. The separator attribute
specifies the HTML fragment that is inserted between each of the breadcrumbs. By
- default it is set to @>@.
+ default it is set to @>@. The boolean nolinks attribute can be specified to render
+ breadcrumbs in plain text, without any links (useful when generating title tag).
*Usage:*
- <pre><code><r:breadcrumbs [separator="separator_string"] /></code></pre>
+ <pre><code><r:breadcrumbs [separator="separator_string"] [nolinks="true"] /></code></pre>
}
tag 'breadcrumbs' do |tag|
page = tag.locals.page
breadcrumbs = [page.breadcrumb]
+ nolinks = (tag.attr['nolinks'] == 'true')
page.ancestors.each do |ancestor|
- breadcrumbs.unshift %{<a href="#{ancestor.url}">#{ancestor.breadcrumb}</a>}
+ if nolinks
+ breadcrumbs.unshift ancestor.breadcrumb
+ else
+ breadcrumbs.unshift %{<a href="#{ancestor.url}">#{ancestor.breadcrumb}</a>}
+ end
end
separator = tag.attr['separator'] || ' > '
breadcrumbs.join(separator)
@@ -545,7 +551,7 @@ module StandardTags
end
end
between = hash.has_key?(:between) ? hash[:between].call : ' '
- result.join(between)
+ result.reject { |i| i.blank? }.join(between)
end
[:normal, :here, :selected, :between].each do |symbol|
tag "navigation:#{symbol}" do |tag|
@@ -596,6 +602,19 @@ module StandardTags
end
end
+ desc %{
+ Prints the page's status as a string. Optional attribute 'downcase'
+ will cause the status to be all lowercase.
+
+ *Usage:*
+ <pre><code><r:status [downcase='true'] /></code></pre>
+ }
+ tag 'status' do |tag|
+ status = tag.globals.page.status.name
+ return status.downcase if tag.attr['downcase']
+ status
+ end
+
private
def children_find_options(tag) |
| |   |
| 91 | 91 | <p><label for="page_class_name">Page Type</label> |
| 92 | 92 | <%= select "page", "class_name", [['<normal>', 'Page']] + Page.descendants.map { |p| [p.display_name, p.name] }.sort_by { |p| p.first } %></p> |
| 93 | 93 | <p><label for="page_status_id">Status</label> |
| 94 | | <%= select "page", "status_id", Status.find_all.map { |s| [s.name, s.id] } %></p> |
| 94 | <%= select "page", "status_id", Status.find_all.map { |s| [s.name, s.id] }, {} %></p> |
| 95 | <p id="publication-date" style="display: none;"><label for="page_published_at">Published At</label> |
| 96 | <%= datetime_select "page", "published_at", :disabled => true %></p> |
| 95 | 97 | </div> |
| 96 | 98 | <span class="clear"> </span> |
| 97 | 99 | <%= updated_stamp @page %> |
| toggle raw diff |
--- a/app/views/admin/page/edit.html.erb
+++ b/app/views/admin/page/edit.html.erb
@@ -91,7 +91,9 @@
<p><label for="page_class_name">Page Type</label>
<%= select "page", "class_name", [['<normal>', 'Page']] + Page.descendants.map { |p| [p.display_name, p.name] }.sort_by { |p| p.first } %></p>
<p><label for="page_status_id">Status</label>
- <%= select "page", "status_id", Status.find_all.map { |s| [s.name, s.id] } %></p>
+ <%= select "page", "status_id", Status.find_all.map { |s| [s.name, s.id] }, {} %></p>
+ <p id="publication-date" style="display: none;"><label for="page_published_at">Published At</label>
+ <%= datetime_select "page", "published_at", :disabled => true %></p>
</div>
<span class="clear"> </span>
<%= updated_stamp @page %> |
| |   |
| 43 | 43 | end |
| 44 | 44 | end |
| 45 | 45 | |
| 46 | namespace :spec do |
| 47 | desc "Runs specs on all available Radiant extensions, pass EXT=extension_name to test a single extension" |
| 48 | task :extensions => "db:test:prepare" do |
| 49 | extension_roots = Radiant::Extension.descendants.map(&:root) |
| 50 | if ENV["EXT"] |
| 51 | extension_roots = extension_roots.select {|x| /\/(\d+_)?#{ENV["EXT"]}$/ === x } |
| 52 | if extension_roots.empty? |
| 53 | puts "Sorry, that extension is not installed." |
| 54 | end |
| 55 | end |
| 56 | extension_roots.each do |directory| |
| 57 | chdir directory do |
| 58 | if RUBY_PLATFORM =~ /win32/ |
| 59 | system "rake.cmd spec" |
| 60 | else |
| 61 | system "rake spec" |
| 62 | end |
| 63 | end |
| 64 | end |
| 65 | end |
| 66 | end |
| 67 | |
| 46 | 68 | # Load any custom rakefiles from extensions |
| 47 | 69 | [RAILS_ROOT, RADIANT_ROOT].uniq.each do |root| |
| 48 | 70 | Dir[root + '/vendor/extensions/**/tasks/**/*.rake'].sort.each { |ext| load ext } |
| 49 | | end |
| 71 | end |
| toggle raw diff |
--- a/lib/tasks/extensions.rake
+++ b/lib/tasks/extensions.rake
@@ -43,7 +43,29 @@ namespace :test do
end
end
+namespace :spec do
+ desc "Runs specs on all available Radiant extensions, pass EXT=extension_name to test a single extension"
+ task :extensions => "db:test:prepare" do
+ extension_roots = Radiant::Extension.descendants.map(&:root)
+ if ENV["EXT"]
+ extension_roots = extension_roots.select {|x| /\/(\d+_)?#{ENV["EXT"]}$/ === x }
+ if extension_roots.empty?
+ puts "Sorry, that extension is not installed."
+ end
+ end
+ extension_roots.each do |directory|
+ chdir directory do
+ if RUBY_PLATFORM =~ /win32/
+ system "rake.cmd spec"
+ else
+ system "rake spec"
+ end
+ end
+ end
+ end
+end
+
# Load any custom rakefiles from extensions
[RAILS_ROOT, RADIANT_ROOT].uniq.each do |root|
Dir[root + '/vendor/extensions/**/tasks/**/*.rake'].sort.each { |ext| load ext }
-end
\ No newline at end of file
+end |
| |   |
| 103 | 103 | desc "Update config/boot.rb from your current radiant install" |
| 104 | 104 | task :configs do |
| 105 | 105 | FileUtils.cp("#{File.dirname(__FILE__)}/../generators/instance/templates/instance_boot.rb", RAILS_ROOT + '/config/boot.rb') |
| 106 | instance_env = "#{RAILS_ROOT}/config/environment.rb" |
| 107 | gen_env = "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_environment.rb" |
| 108 | backup_env = "#{RAILS_ROOT}/config/environment.bak" |
| 109 | unless FileUtils.compare_file(instance_env, gen_env) |
| 110 | FileUtils.cp(instance_env, backup_env) |
| 111 | FileUtils.cp(gen_env, instance_env) |
| 112 | puts "** WARNING ** |
| 113 | config/environment.rb has changed in Radiant 0.6.5. Your original has been |
| 114 | backed up to config/environment.bak and replaced with the packaged version. |
| 115 | Please copy your customizations to the new file." |
| 116 | end |
| 106 | 117 | end |
| 107 | 118 | |
| 108 | 119 | desc "Update admin images from your current radiant install" |
| … | … | |
| 131 | 131 | end |
| 132 | 132 | end |
| 133 | 133 | end |
| 134 | | end |
| 134 | end |
| toggle raw diff |
--- a/lib/tasks/framework.rake
+++ b/lib/tasks/framework.rake
@@ -103,6 +103,17 @@ unless File.directory? "#{RAILS_ROOT}/app"
desc "Update config/boot.rb from your current radiant install"
task :configs do
FileUtils.cp("#{File.dirname(__FILE__)}/../generators/instance/templates/instance_boot.rb", RAILS_ROOT + '/config/boot.rb')
+ instance_env = "#{RAILS_ROOT}/config/environment.rb"
+ gen_env = "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_environment.rb"
+ backup_env = "#{RAILS_ROOT}/config/environment.bak"
+ unless FileUtils.compare_file(instance_env, gen_env)
+ FileUtils.cp(instance_env, backup_env)
+ FileUtils.cp(gen_env, instance_env)
+ puts "** WARNING **
+config/environment.rb has changed in Radiant 0.6.5. Your original has been
+backed up to config/environment.bak and replaced with the packaged version.
+Please copy your customizations to the new file."
+ end
end
desc "Update admin images from your current radiant install"
@@ -120,4 +131,4 @@ unless File.directory? "#{RAILS_ROOT}/app"
end
end
end
-end
\ No newline at end of file
+end |
| |   |
| 4 | 4 | |
| 5 | 5 | ENV['RADIANT_ENV_FILE'] = File.join(RAILS_ROOT, 'config', 'environment') |
| 6 | 6 | |
| 7 | | Dir["#{RADIANT_ROOT}/vendor/rails/railties/lib/tasks/*.rake"].each do |rake| |
| 7 | Dir["#{RADIANT_ROOT}/vendor/rails/railties/lib/tasks/*.rake", "#{RADIANT_ROOT}/vendor/plugins/rspec_on_rails/tasks/*.rake"].each do |rake| |
| 8 | 8 | lines = IO.readlines(rake) |
| 9 | 9 | lines.map! do |line| |
| 10 | | line.gsub!('RAILS_ROOT', 'RADIANT_ROOT') unless rake =~ /misc\.rake$/ |
| 10 | line.gsub!('RAILS_ROOT', 'RADIANT_ROOT') unless rake =~ /(misc|rspec)\.rake$/ |
| 11 | 11 | case rake |
| 12 | 12 | when /testing\.rake$/ |
| 13 | 13 | line.gsub!(/t.libs << (["'])/, 't.libs << \1' + RADIANT_ROOT + '/') |
| … | … | |
| 15 | 15 | when /databases\.rake$/ |
| 16 | 16 | line.gsub!(/migrate\((["'])/, 'migrate(\1' + RADIANT_ROOT + '/') |
| 17 | 17 | line.sub!("db/schema.rb", "#{RAILS_ROOT}/db/schema.rb") |
| 18 | when /rspec\.rake$/ |
| 19 | line.gsub!('RAILS_ROOT', 'RADIANT_ROOT') unless line =~ /:noop/ |
| 20 | line.gsub!(/FileList\[(["'])/, "FileList[\\1#{RADIANT_ROOT}/") |
| 18 | 21 | end |
| 19 | 22 | line |
| 20 | 23 | end |
| 21 | 24 | eval(lines.join("\n"), binding, rake) |
| 22 | 25 | end |
| 23 | | end |
| 26 | end |
| toggle raw diff |
--- a/lib/tasks/instance.rake
+++ b/lib/tasks/instance.rake
@@ -4,10 +4,10 @@ unless File.directory? "#{RAILS_ROOT}/app"
ENV['RADIANT_ENV_FILE'] = File.join(RAILS_ROOT, 'config', 'environment')
- Dir["#{RADIANT_ROOT}/vendor/rails/railties/lib/tasks/*.rake"].each do |rake|
+ Dir["#{RADIANT_ROOT}/vendor/rails/railties/lib/tasks/*.rake", "#{RADIANT_ROOT}/vendor/plugins/rspec_on_rails/tasks/*.rake"].each do |rake|
lines = IO.readlines(rake)
lines.map! do |line|
- line.gsub!('RAILS_ROOT', 'RADIANT_ROOT') unless rake =~ /misc\.rake$/
+ line.gsub!('RAILS_ROOT', 'RADIANT_ROOT') unless rake =~ /(misc|rspec)\.rake$/
case rake
when /testing\.rake$/
line.gsub!(/t.libs << (["'])/, 't.libs << \1' + RADIANT_ROOT + '/')
@@ -15,9 +15,12 @@ unless File.directory? "#{RAILS_ROOT}/app"
when /databases\.rake$/
line.gsub!(/migrate\((["'])/, 'migrate(\1' + RADIANT_ROOT + '/')
line.sub!("db/schema.rb", "#{RAILS_ROOT}/db/schema.rb")
+ when /rspec\.rake$/
+ line.gsub!('RAILS_ROOT', 'RADIANT_ROOT') unless line =~ /:noop/
+ line.gsub!(/FileList\[(["'])/, "FileList[\\1#{RADIANT_ROOT}/")
end
line
end
eval(lines.join("\n"), binding, rake)
end
-end
\ No newline at end of file
+end |
| |   |
| 48 | 48 | e.stop(); |
| 49 | 49 | }); |
| 50 | 50 | }); |
| 51 | |
| 52 | when('page_status_id', function(select){ |
| 53 | if($F('page_status_id') == '100') |
| 54 | $('publication-date').show().select('select').invoke('enable'); |
| 55 | |
| 56 | select.observe('change', function(){ |
| 57 | if($F(this) == '100') |
| 58 | $('publication-date').show().select('select').invoke('enable'); |
| 59 | else |
| 60 | $('publication-date').hide().select('select').invoke('disable'); |
| 61 | }) |
| 62 | }); |
| 51 | 63 | }); |
| 52 | 64 | |
| 53 | 65 | Element.addMethods({ |
| toggle raw diff |
--- a/public/javascripts/admin.js
+++ b/public/javascripts/admin.js
@@ -48,6 +48,18 @@ document.observe('dom:loaded', function() {
e.stop();
});
});
+
+ when('page_status_id', function(select){
+ if($F('page_status_id') == '100')
+ $('publication-date').show().select('select').invoke('enable');
+
+ select.observe('change', function(){
+ if($F(this) == '100')
+ $('publication-date').show().select('select').invoke('enable');
+ else
+ $('publication-date').hide().select('select').invoke('disable');
+ })
+ });
});
Element.addMethods({ |