view · edit · sidebar · attach · print · history

20120306-modify-grid-layout-try-chapter-link

<< | Index | >>


summary

  • fixed layout for grid layout (htmlgrid.rb).
  • tried converter for fachinfo.yml (to csv/html)
  • tried link-navigation for patinfo (NOT YET FIXED)

commits

index


modified grid layout

Problem(target)

http://ch.oddb.org/de/gcc/download_export/

(Services > Stammdaten Download)

correct html (with htmlgrid.so)

<td class="list">
<input type="radio" checked="checked" value="1" name="months[fachinfo.yaml]">
</td>
<td class="list">EUR 800.00</td>
<td class="list">
<input type="radio" value="12" name="months[fachinfo.yaml]">
</td>

rendered html.

<td class="list">
<input type="radio" checked="" value="1" name="months[fachinfo.yaml]">
EUR 800.00
<input type="radio" value="12" name="months[fachinfo.yaml]">
EUR 1400.00
</td>
Before

I think (Maybe) if array are in COMPONENTS of HtmlGrid::Composite, it expected mapping to td, like this.
htmlgrid(gem)/grid.rb

  def add(arg, x, y, col=false)
    if arg.kind_of? Enumerable
      if arg.kind_of? String
        add_field(arg, x, y)
      elsif arg.kind_of? Array
        #arg.each do |item|
        #  add_field(item, x, y) 
        #end
        arg.each_with_index do |item, index|
          add_field(item, x + index, y)  
        end 
      else
    ...

It works in this page.
But, This chane breake another pages.

Another Problem

This (another problem) cased by new src for htmlgrid.rb. I have to update target page src of ODDB exclude htmlgrid.rb.
Then, I updated finaly src code in ODDB.

Fixed

fachinfo.yaml to csv/html

source

pat2csv

refs

suspend


patinfo chapter navigation

tried chapter-chooser (like fachinfo).
But my current sample code stop in htmlgrid.

class PatinfoChapterLinkComposite < HtmlGrid::Composite
  CHAPTERS = [ 
    ...
  ]
  COMPONENTS = {}
  CSS_CLASS = 'composite'
  DEFAULT_CLASS = View::Chapter
  def init
    yy = 0 
    self::class::CHAPTERS.each do |chapter|
      key = "pi_" << chapter.to_s
      name = @lookandfeel.lookup(key)
      link = HtmlGrid::Link.new(name, model, session, self)
      args = [ 
        :reg, model.sequences.first.registration.iksnr,
        :seq, model.sequences.first.seqnr
      ]   
      link.set_attribute('title', chapter)
      link.href = @lookandfeel._event_url(:patinfo, args, chapter)
      link.value = name
      components.store([0,yy], link)
      yy += 1
    end 
    super
  end 
end

output error.

error in SBSM::Session#to_html: /de/gcc/patinfo/reg/30785/seq/01
NameError
undefined local variable or method `session' for #<ODDB::View::Drugs::PatinfoChapterLinkComposite:0xfcde150>
/var/www/oddb.org/src/view/drugs/patinfo.rb:42:in `block in init'
/var/www/oddb.org/src/view/drugs/patinfo.rb:39:in `each'
/var/www/oddb.org/src/view/drugs/patinfo.rb:39:in `init'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/component.rb:139:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:60:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:60:in `create'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:281:in `compose_component'
...

Once, this problem caused, I have to kill process.(I could not shutdown process with Ctrl-C)
(This problem caused also after I cleaned htmlgrid gem. The matter is in my code.)

Attach:patinfo-chapter-link-error_20120306.txt

Tomorrow, I will try again.

TODO
  • put anchor link in patinfo document(If I could, chapter-chooser navication)
  • layout navigation links in head Table.
NOTE
  • SBSM::Lookandfeel#_event_url
    • parameters are event(direct_event), args(Array), anchor, block
  • SBSM::Lookandfeel#lookup
    • :symbol or string
view · edit · sidebar · attach · print · history
Page last modified on March 08, 2012, at 07:19 PM