lib/fabulator/radiant/actions.rb in radiant-fabulator-extension-0.0.8 vs lib/fabulator/radiant/actions.rb in radiant-fabulator-extension-0.0.9
- old
+ new
@@ -1,28 +1,40 @@
require 'fabulator/tag_lib'
-#require 'fabulator/radiant/actions/require_auth'
module Fabulator
RADIANT_NS="http://dh.tamu.edu/ns/fabulator/radiant/1.0#"
class FabulatorRequireAuth < StandardError
def initialize(message = "") super; end
end
+ #require 'fabulator/radiant/actions/require_auth'
+ require 'fabulator/radiant/actions/page'
+ require 'fabulator/radiant/actions/page_part'
+
module Radiant
class Lib < Fabulator::TagLib
namespace RADIANT_NS
#action 'require-auth', Fabulator::Radiant::Actions::RequireAuth
+ # used to create/update pages
+ action 'page', Fabulator::Radiant::Actions::Page
+ action 'page-part', Fabulator::Radiant::Actions::PagePart
#register_type 'user', {
#}
has_type :page do
method :CHILDREN do |p|
Page.find(p.value.to_i).children.collect { |c| Lib.page_to_node(c, p) }
end
+ coming_from [ FAB_NS, 'string' ] do
+ weight 0.9
+ converting do |p|
+ Lib.page_to_node(Page.find_by_parent_id(nil).find_by_url(p.root.value), p.root)
+ end
+ end
end
# page parts are attributes of a page
# as are @name, @breadcrumb, @description, @keywords
# @layout, @page-type, @status
@@ -44,10 +56,10 @@
# Lib.page_to_node(Page.find_by_parent_id(nil), ctx)
#end
function 'find', [ RADIANT_NS, 'page' ] do |ctx, args|
args[0].collect { |a|
- Lib.page_to_node(Page.find_by_parent_id(nil).find_by_url(a.to_s), ctx.root)
+ a.to([ RADIANT_NS, 'page'], ctx)
}
end
function 'current-user' do |ctx, args|
u = UserActionObserver.current_user