2011-03-06 6 views
0

메일 링리스트에 간단한 양식을 설정하려고합니다.Radiant CMS에서 레일 변수를 전달할 수 있습니까?

그리고 모든 레일 도우미가 form_for를 작성하고 인증 토큰을 수행하는 것을 허용하지 않는 것 같습니다.

누구나 Radiant에서 간단한 form_for를 설치하는 행운이 있습니까? 당신의 /your_extension.rb에서

답변

1

:

def activate 
    Page.send :include, YourCustomTags 
end 

your_custom_tags.rb

module YourCustomTags 
    include Radiant::Taggable 

    tag 'custom' do |tag| 
    tag.expand 
    end 

    tag "custom:form" do |tag| 
    tag.attr['id'] ||= 'newsletter' 
    results = [] 
    action = "/newsletters/" 
    results << %(<form action="#{action}" method="post" #{newsletter_attrs(tag)}>) 
    results << %(<input name="authenticity_token" type="hidden" value="#{response.instance_variable_get(:@session)[:_csrf_token]}" />) 
    results << tag.expand 
    results << %(</form>) 
    end 

이 진정성을 전달합니다.

관련 문제