vols = DxVolume.find(:all)
@vols = Array.new
vols.each do |vol|
+ voltitle = get_voltitle(vol)
radicals = DxRadical.find(:all, :conditions =>
["volume_id = ?", vol.id])
- @vols.push([vol, radicals])
+ @vols.push([voltitle, radicals])
end
end
def radical
wordid = word.wordid
rad = DxRadical.find(:first, :conditions => ["id = ?", word.radical_id])
vol = DxVolume.find(:first, :conditions => ["id = ?", rad.volume_id])
+ voltitle = get_voltitle(vol)
exp = hilighted_exp(word.exp, @extext)
- @dxexp_words.push([vol, rad, word, exp])
+ @dxexp_words.push([voltitle, rad, word, exp])
end
end
+ def get_voltitle(vol)
+ return vol.title.sub(/說文解字第/u, "")
+ end
def hilighted_exp(exp, pattern)
# span = "<span style='background-color:peachpuff;'>%s</span>"
span = "<span style='background-color:lightpink;'>%s</span>"
</div>
<div id="sidebar">
- <h3>検索</h3>
- <ul>
- <li>
- <% form_tag(:controller => "daxu", :action => "word", :method => "get") do %>
- <%= label_tag(:char, "親字検索:") %>
- <%= text_field_tag(:char, "", :size => "5") %>
- <%= submit_tag("Search") %>
- <% end %>
- </li>
- <li>
- <% form_tag(:controller => "daxu", :action => "word", :method => "get") do %>
- <%= hidden_field_tag(:char, @char) %>
- <%= label_tag(:extext, "説解検索:") %>
- <%= text_field_tag(:extext, "", :size => "20") %>
- <%= submit_tag("Search") %>
- <% end %>
- </li>
- </ul>
+ <%= render :partial => "dxsearch" %>
</div>
<div id="content">
- <h2>部首</h2>
+ <h2>説文解字 部首</h2>
<ul>
<% @vols.each do |volinfo|%>
- <% (vol, radicals) = volinfo %>
+ <% (voltitle, radicals) = volinfo %>
<li>
- <%= vol.title %>
+ <%= voltitle %>
<% radicals.each do |rad| %>
- <%= link_to(rad.name, :controller => "daxu",
- :action => "radical", :id => rad.id) %>
+ <span style="font-size: 120%">
+ <%= link_to(rad.name, :controller => "daxu",
+ :action => "radical", :id => rad.id) %>
+ </span>
<% end %>
</li>
<% end %>
</div>
<div id="sidebar">
- <h3>検索</h3>
- <ul>
- <li>
- <% form_tag(:controller => "daxu", :action => "word", :method => "get") do %>
- <%= label_tag(:char, "親字検索:") %>
- <%= text_field_tag(:char, "", :size => "5") %>
- <%= submit_tag("Search") %>
- <% end %>
- </li>
- <li>
- <% form_tag(:controller => "daxu", :action => "word", :method => "get") do %>
- <%= hidden_field_tag(:char, @char) %>
- <%= label_tag(:extext, "説解検索:") %>
- <%= text_field_tag(:extext, "", :size => "20") %>
- <%= submit_tag("Search") %>
- <% end %>
- </li>
- </ul>
+ <%= render :partial => "dxsearch" %>
</div>
<div id="content">
</div>
<div id="sidebar">
- <h3>検索</h3>
- <ul>
- <li>
- <% form_tag(:controller => "daxu", :action => "word", :method => "get") do %>
- <%= label_tag(:char, "親字検索:") %>
- <%= text_field_tag(:char, "", :size => "5") %>
- <%= submit_tag("Search") %>
- <% end %>
- </li>
- <li>
- <% form_tag(:controller => "daxu", :action => "word", :method => "get") do %>
- <%= hidden_field_tag(:char, @char) %>
- <%= label_tag(:extext, "説解検索:") %>
- <%= text_field_tag(:extext, "", :size => "20") %>
- <%= submit_tag("Search") %>
- <% end %>
- </li>
- </ul>
-
+ <%= render :partial => "dxsearch" %>
<h3>
説文解字(大徐本)
<%= link_to_function "▲▼", "new Effect.toggle('sw', 'blind')" %>
<div id="result">
<ol>
<% @dxexp_words.each do |wordinfo|%>
- <li><% (vol, rad, word, exp) = wordinfo %>
- <%= vol.title %>
+ <li><% (voltitle, rad, word, exp) = wordinfo %>
+ <%= voltitle %>
<%= link_to(rad.name + "部", :controller => "daxu",
:action => "radical", :id => rad.id) %>
<span class="swlist"><%= word.sw %></span>
- <span style="font-size: 80%">(<%= word.name %>)</span>
+ <span style="font-size: 100%">
+ (<%= link_to(word.name, :controller => "daxu",
+ :action => "word", :char => word.name) %>)
+ </span>
<span style="font-size: 110%"><%= exp %></span>
[<%= word.fanqie %> <%= word.pinyin %>]
</li>