Tag 'link'

This commit is contained in:
chris2tof 2011-06-01 15:49:21 +08:00
parent 7b5ea870a0
commit c7fc7084d5
2 changed files with 19 additions and 25 deletions

View File

@ -80,6 +80,13 @@ module Parser
ret << tag.expand
ret << '</div>'
end
c.define_tag 'link' do |tag|
item = Item.first(:conditions => { :full_name => tag.attr['name'] })
ret = ''
ret << "<a href='#{tag.attr['name']}'>"
ret << item.i18n_variable[I18n.locale]
ret << '</a>'
end
end
end
@ -165,6 +172,15 @@ module Parser
ret << tag.expand
ret << '</div>'
end
c.define_tag 'link' do |tag|
item = Item.first(:conditions => { :full_name => tag.attr['name'] })
ret = ''
ret << "<a href='"
ret << eval("admin_#{item._type.downcase}_path(item.id)")
ret << "' class='nav'>"
ret << item.i18n_variable[I18n.locale]
ret << "</a>"
end
end
end

View File

@ -1,27 +1,5 @@
<ul>
<li>
<a href='/'>
<r:multi_lang>
<r:lang name='en'>
Home
</r:lang>
<r:lang name='zh_tw'>
首頁
</r:lang>
</r:multi_lang>
</a>
</li>
<li>
<a href='/about'>
<r:multi_lang>
<r:lang name='en'>
About
</r:lang>
<r:lang name='zh_tw'>
關於我們
</r:lang>
</r:multi_lang>
</a>
</li>
<li><a href='/google'>Google</a></li>
<li><r:link name='home' /></li>
<li><r:link name='about' /></li>
<li><r:link name='google' /></li>
</ul>