Skip to content

Commit

Permalink
Added "setting" tag
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGossett committed Jul 5, 2008
1 parent b826fbb commit 63dc5de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/settings_tags.rb
@@ -0,0 +1,18 @@
module SettingsTags
include Radiant::Taggable

class TagError < StandardError; end

desc %{
Renders the Radiant::Config setting specified by the required 'name' attribute.
*Usage*:
<pre><code><r:setting name="admin.title" /></code></pre>
}
tag "setting" do |tag|
raise TagError, "'name' attribute required" unless name = tag.attr['name']
Radiant::Config["#{name}"]
end

end
4 changes: 4 additions & 0 deletions settings_extension.rb
Expand Up @@ -15,6 +15,10 @@ class SettingsExtension < Radiant::Extension
def activate
Radiant::Config.extend ConfigFindAllAsTree
admin.tabs.add "Settings", "/admin/settings", :after => "Layouts" #, :visibility => [:developer]

Page.class_eval {
include SettingsTags
}
end

def deactivate
Expand Down

0 comments on commit 63dc5de

Please sign in to comment.