Class: ODDB::View::Drugs::AtcHeader

Inherits:
HtmlGrid::Composite show all
Includes:
AdditionalInformation
Defined in:
src/view/drugs/resultlist.rb

Constant Summary

COMPONENTS =
{
  [0,0,0] => :atc_description,
  [0,0,2] => :atc_ddd_link,
  [1,0]   => :pages,
}
CSS_CLASS =
'composite'
CSS_MAP =
{
  [0,0,2] =>  'atc list',
}
LEGACY_INTERFACE =
false

Instance Method Summary (collapse)

Methods included from AdditionalInformation

#_fachinfo, #atc_ddd_link, #comarketing, #complementary_type, #compositions, #ddd_price, #deductible, #fachinfo, #feedback, #google_search, #ikscat, #limitation_link, #limitation_text, #minifi, #narcotic, #notify, #patent, #patinfo, #qty_unit, #square, #twitter_share

Methods included from PartSize

#comparable_size, #part_size

Methods included from AtcDddLink

#atc_ddd_link

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) atc_description(model, session = @session)



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'src/view/drugs/resultlist.rb', line 56

def atc_description(model, session=@session)
  code = model.code
  link = HtmlGrid::Link.new(code, model, @session, self)
  link.value = [
    super,
    model.package_count,
    @lookandfeel.lookup(:products),
    nil,
  ].join(' ')
  if(model.overflow?)
    args = []
    if(@session.persistent_user_input(:code) == code)
      args = [ :search_query, code ]
    else
      args = [
        :search_query, @session.persistent_user_input(:search_query).gsub('/', '%2F'),
        :search_type, @session.persistent_user_input(:search_type), 
        :code, code
      ]
    end
    link.css_class = 'list'
    link.href = @lookandfeel._event_url(:search, args, code)
  end
  link
end

- (Object) edit(model, session = @session)



81
82
83
84
85
86
# File 'src/view/drugs/resultlist.rb', line 81

def edit(model, session=@session)
  link = View::PointerLink.new(:code, model, session, self)
  link.value = @lookandfeel.lookup(:edit_atc_class) + " "
  link.attributes['class'] = 'small'
  link
end

- (Object) init



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'src/view/drugs/resultlist.rb', line 43

def init
  if(@session.allowed?('edit', 'org.oddb.model.!atc_class.*'))
    components.store([0,0,1], :edit)
  end
  if(@model.overflow? \
     && @session.cookie_set_or_get(:resultview) == "atc" \
     && @session.persistent_user_input(:code) == @model.code)
    @css_map = {
      [0,0,2] => 'migel-group list'
    }
  end
  super
end

- (Object) pages(model, session = @session)



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'src/view/drugs/resultlist.rb', line 87

def pages(model, session=@session)
  state = @session.state
  if(@session.cookie_set_or_get(:resultview) == "pages" \
     && state.respond_to?(:pages) \
     && (pages = state.pages) \
     && pages.size > 1)
    args = {
      :search_query => @session.persistent_user_input(:search_query).gsub('/', '%2F'),
      :search_type => @session.persistent_user_input(:search_type), 
    }
    View::Pager.new(pages, @session, self, :search, args)
  end
end