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



282
283
284
285
286
287
288
289
290
291
292
# File 'app/helpers/glib/json_ui/view_builder.rb', line 282

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



277
278
279
# File 'app/helpers/glib/json_ui/view_builder.rb', line 277

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

#name(value) ⇒ Object



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

def name(value)
  @name = value
end

#size(value) ⇒ Object



273
274
275
# File 'app/helpers/glib/json_ui/view_builder.rb', line 273

def size(value)
  @size = value
end