rx/presenters

View on GitHub
views/mdc/components/button.erb

Summary

Maintainability
Test Coverage
<%
  class_name = '' unless local_variables.include? :class_name
  event_parent_id = nil unless local_variables.include? :event_parent_id
  data_attributes = '' unless local_variables.include? :data_attributes
%>
<% if comp
     class_name = "#{class_name} #{comp.full_width ? 'v-button-full-width' : nil}"
%>
  <% if comp.menu %>
    <div class="mdc-menu-anchor">
  <% end %>
  <% case comp.button_type.to_sym
        when :fab %>
            <%= erb :"components/buttons/fab", :locals => {:comp => comp, class_name: class_name, event_parent_id: event_parent_id, data_attributes: data_attributes} %>
     <% when :icon %>
            <%= erb :"components/buttons/icon", :locals => {:comp => comp, class_name: class_name, event_parent_id: event_parent_id, data_attributes: data_attributes} %>
    <% when :image %>
            <%= erb :"components/buttons/image", :locals => {:comp => comp, class_name: class_name, event_parent_id: event_parent_id, data_attributes: data_attributes} %>
    <% else  %>
            <%= erb :"components/buttons/button", :locals => {:comp => comp, class_name: class_name, event_parent_id: event_parent_id, data_attributes: data_attributes} %>
  <% end %>
  <% if comp.menu %>
    </div>
  <% end %>
<% end %>