Class: DrawSmd::DiagramController

Inherits:
ApplicationController show all
Defined in:
app/controllers/draw_smd/diagram_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/draw_smd/diagram_controller.rb', line 3

def index
  @schemas = DrawSmd::Diagram.schemas

  title = 'smd'
  path = 'draw-smd'
  @image_file = File.join(path, "#{title}.png")

  @schema = ''
  @schema = params['schema'] if params.key?('schema')
  @schema = params['check']['schema'] if params.key?('check')

  diagram = DrawSmd::Diagram.new(File.join('public', 'images', path))
  diagram.create(title, @schema)
end