Initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
module Carto
|
||||
module Api
|
||||
class WidgetPresenter
|
||||
|
||||
def initialize(widget)
|
||||
@widget = widget
|
||||
end
|
||||
|
||||
def to_poro
|
||||
return {} unless @widget
|
||||
|
||||
poro = {
|
||||
id: @widget.id,
|
||||
type: @widget.type,
|
||||
title: @widget.title,
|
||||
order: @widget.order,
|
||||
layer_id: @widget.layer_id,
|
||||
options: @widget.options,
|
||||
style: @widget.style
|
||||
}
|
||||
|
||||
poro[:source] = { id: @widget.source_id } if @widget.source_id.present?
|
||||
|
||||
poro
|
||||
end
|
||||
|
||||
alias_method :to_vizjson, :to_poro
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user