From 95cd56cba2e2015626117ec06b2e2bbe1f5820d0 Mon Sep 17 00:00:00 2001 From: Dirk Kelly Date: Wed, 2 Mar 2011 11:28:54 +0800 Subject: [PATCH] sending a default tag will call the method on the page. Ignoring the default text in the tags. {% editable_short_text coolertitle, default: title %}{% endeditable_short_text %} --- lib/locomotive/liquid/tags/editable/base.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/locomotive/liquid/tags/editable/base.rb b/lib/locomotive/liquid/tags/editable/base.rb index 03e82ad7..ef6b3813 100644 --- a/lib/locomotive/liquid/tags/editable/base.rb +++ b/lib/locomotive/liquid/tags/editable/base.rb @@ -26,7 +26,7 @@ module Locomotive :block => @context[:current_block].try(:name), :slug => @slug, :hint => @options[:hint], - :default_content => @nodelist.first.to_s, + :default_content => default_content, :assignable => @options[:assignable], :disabled => false, :from_parent => false @@ -56,6 +56,15 @@ module Locomotive def document_type raise 'FIXME: has to be overidden' end + + + def default_content + if @options[:default].present? + @context[:page].send(@options[:default]) + else + @nodelist.first.to_s + end + end end