Class: Glib::JsonUi::ViewBuilder::Icon

Inherits:
View show all
Defined in:
app/helpers/glib/json_ui/view_builder.rb

Instance Attribute Summary

Attributes inherited from JsonUiElement

#json, #page

Instance Method Summary collapse

Methods inherited from View

component_name

Methods inherited from JsonUiElement

action, any, array, badgeable, bool, color, component_name, date, date_time, enum, float, hash, icon, #initialize, int, length, menu, panels_builder, #props, required, singleton_array, string, text, url, views

Constructor Details

This class inherits a constructor from Glib::JsonUi::JsonUiElement

Instance Method Details

#createdObject

Override



275
276
277
278
279
280
281
282
283
284
285
# File 'app/helpers/glib/json_ui/view_builder.rb', line 275

def created
  if @name
    icon_type = @family == 'fontawesome' ? 'fa' :
                @family == 'custom' ? 'custom' : 'material'

    json.set!(icon_type) do
      json.name @name
      json.size @size if @size
    end
  end
end

#family(value) ⇒ Object



270
271
272
# File 'app/helpers/glib/json_ui/view_builder.rb', line 270

def family(value)
  @family = value.to_s
end

#name(value) ⇒ Object



262
263
264
# File 'app/helpers/glib/json_ui/view_builder.rb', line 262

def name(value)
  @name = value
end

#size(value) ⇒ Object



266
267
268
# File 'app/helpers/glib/json_ui/view_builder.rb', line 266

def size(value)
  @size = value
end