Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 12 files changed
  • 0 commit comments
  • 1 contributor
View
7 .gitmodules
@@ -10,9 +10,6 @@
[submodule "vendor/extensions/mailer"]
path = vendor/extensions/mailer
url = git://github.com/spanner/radiant-mailer-extension.git
-[submodule "vendor/extensions/navigation_tags"]
- path = vendor/extensions/navigation_tags
- url = git://github.com/gunn/navigation_tags.git
[submodule "vendor/extensions/paperclipped"]
path = vendor/extensions/paperclipped
url = git://github.com/spanner/paperclipped.git
@@ -23,5 +20,5 @@
path = vendor/extensions/direct_link
url = git@github.com:gunn/radiant-direct_link-extension.git
[submodule "vendor/extensions/drag_order"]
- path = vendor/extensions/drag_order
- url = git://github.com/bright4/radiant-drag-order.git
+ path = vendor/extensions/drag_order
+ url = git://github.com/bright4/radiant-drag-order.git
View
12 README
@@ -15,3 +15,15 @@ Install capistrano and extensions on your local machine:
gem install capistrano capistrano-ext
+== ENSPIRAL STAGING SERVER
+
+To access:
+
+ssh nzffa@nzffa.org.nz
+
+Contact Craig to get your public ssh key on that server first.
+
+To update the staging server to match production
+
+cd ~/staging/current
+bundle exec rake sync RAILS_ENV=staging
View
15 config/deploy/staging.rb
@@ -1,5 +1,6 @@
-set :deploy_env, 'staging'
-set :deploy_to, "/home/#{user}/#{deploy_env}"
+set :rails_env, 'staging'
+set :rack_env, rails_env
+set :deploy_to, "/home/#{user}/#{rails_env}"
set :solo_host, 'nzffa.enspiral.info'
role :web, solo_host
@@ -10,3 +11,13 @@
set :git_enable_submodules, 1
set :ssh_options, {:forward_agent => true}
+
+task :setup_env do
+ run "RACK_ENV=#{rails_env}"
+ run "RAILS_ENV=#{rails_env}"
+
+ run "echo 'RackEnv #{rails_env}' >> #{File.join(current_path, '.htaccess')}"
+ run "echo 'RailsEnv #{rails_env}' >> #{File.join(current_path, '.htaccess')}"
+end
+
+before "restart", "setup_env"
View
2  lib/tasks/sync.rake
@@ -16,7 +16,7 @@ task :sync => [:environment] do
when 'development'
"./shared/"
when 'staging'
- "./../shared/public/"
+ Rails.root.join('../../shared/public/').to_s
else
raise ArgumentError, "Environment #{Rails.env.inspect} not supported"
end
1  vendor/extensions/navigation_tags
@@ -1 +0,0 @@
-Subproject commit 516a6664921121234bf84808d88ebd9e672d5ab4
View
13 vendor/extensions/navigation_tags/CHANGELOG
@@ -0,0 +1,13 @@
+[Saturday; June 20, 2009]
+
+Added only and except options to limit included pages
+
+
+[Tuesday; October 9, 2007]
+
+Added 3 optional parameters; "root", "include_root" and "depth"
+- By default, root is still "/", otherwise you can use this to build sub-nav's
+- You can still include the root_page by setting include_root to true
+- Default depth is 1, which means no sub-ul's
+
+Thanks for the patch: Benny Degezelle
View
21 vendor/extensions/navigation_tags/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2007 Ryan Heneise (http://www.artofmission.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice, and every other copyright notice found in this
+software, and all the attributions in every file, and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
View
57 vendor/extensions/navigation_tags/README.rdoc
@@ -0,0 +1,57 @@
+= Navigation Tags
+
+Provides hierarchical tree navigation based on Radiant's site structure. Outputs navigation in the form of a -very flexible and CSS'able- unordered list. Also provides r:if_self and r:if_ancestor_or_self
+
+== Usage
+
+<r:nav [root="/"] [include_root="true"] [depth="2"] [expand_all="true"] [ids_for_lis="true"] />
+
+Given this directory tree:
+
+* Home
+ * About
+ * Contact us
+ * Blog
+ * First Article
+ * Second Article
+ * Catalog
+
+<r:nav depth="2" /> would output a navigation list like:
+
+<ul>
+ <li class="parent_of_current has_children"><a href="/about/">About</a>
+ <ul>
+ <li class="current"><a href="/about/contact">Contact Us</a></li>
+ </ul>
+ </li>
+ <li class="has_children"><a href="/blog/">Blog</a></li>
+ <li class="has_children"><a href="/catalogue">Catalogue</a></li>
+</ul>
+
+Use only and except to filter which pages are included.
+The following would output a navigation list only containing only the pages articles, or notices, or their descendants, and which aren't css, javascript, or xml pages:
+
+<r:nav only="^/(articles|notices)/" except="\.(css|js|xml)/*$" />
+
+
+== Available tag attributes:
+
+* root defaults: to "/", where to start building the navigation from, you can i.e. use "/products" to build a subnav
+* include_root: defaults to false, set to true to include the root page (i.e. Home)
+* ids_for_lis: defaults to false, enable this to give each li an id (it's slug prefixed with nav_)
+* ids_for_links: defaults to false, enable this to give each link an id (it's slug prefixed with nav_)
+
+* depth: defaults to 1, which means no sub-ul's, set to 2 or more for a nested list
+* expand_all: defaults to false, enable this to have all li's create sub-ul's of their children, i.o. only the currently active li
+
+* only: a string or regular expresssion. only pages whose urls match this are included
+* except: a string or regular expresssion. pages whose urls match this are not shown. except will override only. use to eliminate non-content file-types
+
+* id, class, monkeyballs, ... will be used as html attributes for the ul
+
+= CREDITS
+
+* Ryan Heneise
+* Marty Haught
+* Benny Degezelle
+* Arthur Gunn
View
25 vendor/extensions/navigation_tags/Rakefile
@@ -0,0 +1,25 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the navigation_tags extension.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the navigation_tags extension.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'NavigationTagsExtension'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+# Load any custom rakefiles for extension
+Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
View
149 vendor/extensions/navigation_tags/lib/navigation_tags.rb
@@ -0,0 +1,149 @@
+module NavigationTags
+ include Radiant::Taggable
+ include ActionView::Helpers::TagHelper
+
+ class NavTagError < StandardError; end
+
+ desc %{
+ Render a navigation menu. Walks down the directory tree, expanding the tree up to the current page.
+
+ *Usage:*
+ <pre><code><r:nav [id="subnav"] [root="/products"] [include_root="true"] [depth="2"] [expand_all="true"]
+ [only="^/(articles|notices)"] [except="\.(css|js|xml)/*$"] /></code></pre>
+ *Attributes:*
+
+ * @root@ defaults to "/", where to start building the navigation from, you can i.e. use "/products" to build a subnav
+ * @include_root@ defaults to false, set to true to include the root page (i.e. Home)
+ * @ids_for_lis@ defaults to false, enable this to give each li an id (it's slug prefixed with nav_)
+ * @ids_for_links@ defaults to false, enable this to give each link an id (it's slug prefixed with nav_)
+
+ * @depth@ defaults to 1, which means no sub-ul's, set to 2 or more for a nested list
+ * @expand_all@ defaults to false, enable this to have all li's create sub-ul's of their children, i.o. only the currently active li
+
+ * @only@ a string or regular expresssion. only pages whose urls match this are included
+ * @except@ a string or regular expresssion. pages whose urls match this are not shown. except will override only. use to eliminate non-content file-types
+
+ * @id@, @class@,..: go as html attributes of the outer ul
+ }
+
+ tag "nav" do |tag|
+ root = Page.find_by_url(root_url = tag.attr.delete('root') || "/")
+
+ raise NavTagError, "No page found at \"#{root_url}\" to build navigation from." if root.class.name.eql?('FileNotFoundPage')
+
+ depth = tag.attr.delete('depth') || 1
+ ['include_root', 'ids_for_lis', 'ids_for_links', 'expand_all', 'first_set', 'only', 'except'].each do |prop|
+ eval "@#{prop} = tag.attr.delete('#{prop}') || false"
+ end
+
+ if @include_root
+ css_class = [("current" if tag.locals.page == root), "first"].compact
+ @first_set = true
+ url = (defined?(SiteLanguage) && SiteLanguage.count > 0) ? "/#{Locale.language.code}#{root.url}" : root.url
+ tree = %{<li#{" class=\"#{css_class.join(" ")}\"" unless css_class.empty?}#{" id=\"" +
+ (root.slug == "/" ? 'home' : root.slug) + "\"" if @ids_for_lis}><a href="#{url}"#{" id=\"link_" + (root.slug == "/" ? 'home' : root.slug) + "\"" if @ids_for_links}>#{escape_once(root.breadcrumb)}</a></li>\n}
+ else
+ tree = ""
+ end
+
+ if root
+ for child in root.children
+ tree << tag.render('sub-nav', {:page => child, :depth => depth.to_i - 1 })
+ end
+ end
+
+ if tag.attr
+ html_options = tag.attr.stringify_keys
+ tag_options = tag_options(html_options)
+ else
+ tag_options = nil
+ end
+
+ %{<ul#{tag_options}>
+ #{tree}
+ </ul>}
+
+ end
+
+ tag "sub-nav" do |tag|
+ current_page = tag.locals.page
+ child_page = tag.attr[:page]
+ depth = tag.attr[:depth]
+
+ return if not_allowed? child_page
+
+ css_class = [("current" if current_page == child_page), ("has_children" if child_page.children.size > 0), ("parent_of_current" if current_page.url.starts_with?(child_page.url) and current_page != child_page)].compact
+ if !@first_set
+ css_class << 'first'
+ @first_set = true
+ end
+ url = (defined?(SiteLanguage) && SiteLanguage.count > 0) ? "/#{Locale.language.code}#{child_page.url}" : child_page.url
+ r = %{\t<li#{" class=\"#{css_class.join(" ")}\"" unless css_class.empty?}#{" id=\"nav_" + child_page.slug + "\"" if @ids_for_lis}>
+ <a href="#{url}"#{" id=\"link_" + (child_page.slug == "/" ? 'home' : child_page.slug) + "\"" if @ids_for_links}>#{escape_once(child_page.breadcrumb)}</a>}
+
+ allowed_children = child_page.children.delete_if{|c| not_allowed? c }
+
+ if allowed_children.size > 0 and depth.to_i > 0 and
+ child_page.class_name != 'ArchivePage' and
+ (@expand_all || current_page.url.starts_with?(child_page.url) )
+ r << "<ul>\n"
+ child_page.children.each do |child|
+ r << tag.render('sub-nav', :page => child, :depth => depth.to_i - 1 )
+ end
+ r << "</ul>\n"
+ end
+ r << "</li>\n"
+ end
+
+
+ def not_allowed? child_page
+ (@only and !child_page.url.match(@only)) or
+ (@except and child_page.url.match(@except)) or
+ child_page.part("no-map") or child_page.virtual? or !child_page.published? or child_page.class_name.eql? "FileNotFoundPage"
+ end
+
+
+ # Inspired by this thread:
+ # http://www.mail-archive.com/radiant@lists.radiantcms.org/msg03234.html
+ # Author: Marty Haught
+ desc %{
+ Renders the contained element if the current item is an ancestor of the current page or if it is the page itself.
+ }
+ tag "if_ancestor_or_self" do |tag|
+ Page.benchmark "TAG: if_ancestor_or_self - #{tag.locals.page.url}" do
+ tag.expand if tag.globals.actual_page.url.starts_with?(tag.locals.page.url)
+ end
+ end
+
+ desc %{
+ Renders the contained element if the current item is also the current page.
+ }
+ tag "if_self" do |tag|
+ Page.benchmark "TAG: if_self - #{tag.locals.page.url}" do
+ tag.expand if tag.locals.page == tag.globals.page
+ end
+ end
+
+ desc %{
+ Renders the contained elements only if the current contextual page has children.
+
+ *Usage:*
+ <pre><code><r:if_children>...</r:if_children></code></pre>
+ }
+ tag "if_children" do |tag|
+ Page.benchmark "TAG: if_children - #{tag.locals.page.url}" do
+ tag.expand if tag.locals.page.children.size > 0
+ end
+ end
+
+ tag "unless_children" do |tag|
+ tag.expand unless tag.locals.page.children.size > 0
+ end
+
+ tag "benchmark" do |tag|
+ Page.benchmark "BENCHMARK: #{tag.attr['name']}"do
+ tag.expand
+ end
+ end
+
+end
View
17 vendor/extensions/navigation_tags/lib/tasks/navigation_tags_extension_tasks.rake
@@ -0,0 +1,17 @@
+namespace :radiant do
+ namespace :extensions do
+ namespace :navigation_tags do
+
+ desc "Runs the migration of the Navigation Tags extension"
+ task :migrate => :environment do
+ require 'radiant/extension_migrator'
+ if ENV["VERSION"]
+ NavigationTagsExtension.migrator.migrate(ENV["VERSION"].to_i)
+ else
+ NavigationTagsExtension.migrator.migrate
+ end
+ end
+
+ end
+ end
+end
View
21 vendor/extensions/navigation_tags/navigation_tags_extension.rb
@@ -0,0 +1,21 @@
+# Uncomment this if you reference any of your controllers in activate
+# require_dependency 'application'
+
+class NavigationTagsExtension < Radiant::Extension
+ version "2.0"
+ description "Makes building navigations much easier."
+ url "http://yourwebsite.com/navigation_tags"
+
+ # define_routes do |map|
+ # map.connect 'admin/navigation_tags/:action', :controller => 'admin/navigation_tags'
+ # end
+
+ def activate
+ Page.send :include, NavigationTags
+ end
+
+ def deactivate
+ # admin.tabs.remove "Navigation Tags"
+ end
+
+end

No commit comments for this range

Something went wrong with that request. Please try again.