Ruby on rails Radiant CMS:如何使用form_表示内部半径标记,如何使用fields_表示内部半径标记
我正在为辐射CMS做一个扩展,处理调查数据。我尝试使用表单、字段以及rails在预定义的radius标记中提供的各种帮助程序。这些标记将在页面上生成调查 以下是我对与Radiant集成的想法:Ruby on rails Radiant CMS:如何使用form_表示内部半径标记,如何使用fields_表示内部半径标记,ruby-on-rails,ruby,content-management-system,radiant,Ruby On Rails,Ruby,Content Management System,Radiant,我正在为辐射CMS做一个扩展,处理调查数据。我尝试使用表单、字段以及rails在预定义的radius标记中提供的各种帮助程序。这些标记将在页面上生成调查 以下是我对与Radiant集成的想法: <r:survey id="200"> <r:survey:form> #<-- call to form_for <r:survey:questions:each> # <-- calls fields_
<r:survey id="200">
<r:survey:form> #<-- call to form_for
<r:survey:questions:each> # <-- calls fields_for
<r:question> # <-- renders question
<r:answer_field> #<-- renders input via text_field, text_area, etc
</r:survey:questions:each>
</r:survey:form>
</r:survey>
# 您应该能够只包含Helper模块,并在标记定义中直接使用Helper,类似于这样
module CustomTags
include Radiant::Taggable
include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper
tag "my_tag" do |tag|
javascript_include_tag :some_js_file
end
end
我能想到的最好方法是在标记块内调用呈现模板,如下所示:response.template.render:partial=>'partial_name',:locals=>{:var=>val,:tag=>tag}
然后在partial内调用tag.expand
来展开任何内部标记。不是很优雅,但很管用。
module CustomTags
include Radiant::Taggable
include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper
tag "my_tag" do |tag|
javascript_include_tag :some_js_file
end
end