rx/presenters

View on GitHub
views/mdc/components/buttons/image.erb

Summary

Maintainability
Test Coverage
<% class_name = '' unless local_variables.include? :class_name
   position_classes = comp.position.map {|p| "v-button-position-#{p}"}.join(' ')
   event_parent_id = nil unless local_variables.include? :event_parent_id
   data_attributes = '' unless local_variables.include? :data_attributes
%>

<button
  id="<%= comp.id %>"
  class="v-button v-button--image mdc-button <%=class_name%>
          <%= 'v-hidden' if comp.hidden %>
          <%= 'mdc-button--raised' if eq(comp.button_type, :raised) %>
          <%= 'v-secondary-filled-button' if eq(comp.button_type, :raised) && eq(comp.color, :secondary) %>
          <%= 'v-secondary-text-button' if eq(comp.button_type, :flat) && eq(comp.color, :secondary) %>
          <%=  position_classes %>
          <%= 'v-menu-click' if comp.menu%>"
  style="background-image: url(<%= comp.image.url %>);"
  <%= data_attributes %>
  data-disabled-on-post-finished="<%= comp.disabled_on_post_finished %>"
  <%= 'disabled' if comp.disabled %>
  <%= "type='#{eq(comp.button_type, :raised) ? 'submit' : 'button'}'" %>
  <%= erb :"components/event", :locals => {comp: comp, events: comp.events, parent_id: event_parent_id || comp.event_parent_id} %>>
  <%= erb :"components/icon", :locals => {comp: comp.icon, class_name: 'mdc-button__icon', position: [:right, :center]} %>
</button>
<%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
<%= erb :"components/menu", :locals => {comp: comp.menu, parent_id: comp.id} %>