Class: ODDB::Html::View::Drugs::Admin::SequenceInnerForm

Inherits:
HtmlGrid::Composite
  • Object
show all
Includes:
HtmlGrid::ErrorMessage
Defined in:
lib/oddb/html/view/drugs/admin/sequence.rb

Constant Summary collapse

COLSPAN_MAP =
{
=begin ## temporarily disabled: this should be recoded to work with swiss infos
     #  in 2.0
  [1,3] => 3,
  [1,4] => 3,
=end
}
COMPONENTS =

# in 2.0

[1,3] => 3,
[1,4] => 3,
{
  [0,0] => :atc,
  [2,0] => :show_atc_name,
  [0,1] => :registration,
  [1,2,0] => :submit,
  [1,2,1] => :delete,
=begin ## temporarily disabled: this should be recoded to work with swiss infos
     #  in 2.0
  [1,2,0] => :fachinfo_link,
  [1,2,1] => :patinfo_link,
  [0,3] => :fachinfo_url,
  [0,4] => :patinfo_url,
  [1,5,0] => :submit, 
  [1,5,1] => :delete, 
=end
}
COMPONENT_CSS_MAP =

# in 2.0

[1,2,0] => :fachinfo_link,
[1,2,1] => :patinfo_link,
[0,3] => :fachinfo_url,
[0,4] => :patinfo_url,
[1,5,0] => :submit, 
[1,5,1] => :delete,
{
=begin ## temporarily disabled: this should be recoded to work with swiss infos
     #  in 2.0
  [1,3] => 'url',
  [1,4] => 'url',
=end
}
LABELS =

# in 2.0

[1,3] => 'url',
[1,4] => 'url',
true
LEGACY_INTERFACE =
false

Instance Method Summary collapse

Instance Method Details

#atc_name(model) ⇒ Object



202
203
204
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 202

def atc_name(model)
  HtmlGrid::InputText.new(:atc_name, model, @session, self)
end

#delete(model) ⇒ Object



205
206
207
208
209
210
211
212
213
214
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 205

def delete(model)
  button = HtmlGrid::Button.new(:delete, model, @session, self)
  script = "this.form.event.value = 'delete'; this.form.submit();" 
  if(model.saved?)
    confirm = @lookandfeel.lookup(:delete_sequence_confirm)
    script = "if(confirm('#{confirm}')) { #{script} };"
  end
  button.onclick = script
  button
end


215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 215

def fachinfo_link(model)
  url = if model.respond_to?(:fachinfo) \
           && model.fachinfo.send(@session.language)
          @lookandfeel._event_url(:fachinfo, [:uid, model.uid])
        elsif model.respond_to?(:fachinfo_url)
          model.fachinfo_url
        end
  if url
    link = HtmlGrid::Link.new(:square_fachinfo, model, @session, self)
    link.css_class = 'square fachinfo'
    link.href = url
    link
  end
end

#initObject



195
196
197
198
199
200
201
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 195

def init
  if(@session.errors.any? { |err| err.message == "e_unknown_atc" })
    components.store([2,0], :atc_name)
  end
  super
  error_message
end


229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 229

def patinfo_link(model)
  url = if model.respond_to?(:patinfo) && model.patinfo.send(@session.language)
          @lookandfeel._event_url(:patinfo, [:uid, model.uid])
        elsif model.respond_to?(:patinfo_url)
          model.patinfo_url
        end
  if url
    link = HtmlGrid::Link.new(:square_patinfo, model, @session, self)
    link.css_class = 'square patinfo'
    link.href = url
    link
  end
end

#show_atc_name(model) ⇒ Object



242
243
244
245
246
247
248
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 242

def show_atc_name(model)
  if(atc = model.atc)
    value = HtmlGrid::Value.new(:atc_name, atc, @session, self)
    value.value = atc.name.de
    value
  end
end