Skip to content

Using <columns> as rails partials mess with column order classes. #49

@renatodeleao

Description

@renatodeleao

Heys, i'm building a modular newsletter where each block is a <column> module. Since this module has a lot of variants for its data and appearance, i've abstracted it as partial.

Default and working as Expected

<row>
  <!--each block-->
   <column small="6" large="4" class="block">block data</column>
   <column small="6" large="4" class="block">block data</column>
   <column small="6" large="4" class="block">block data</column>
</row>

<!--produces the expected, and abbreviated for demo purposes  -->

<table class="row">
  <tbody><tr>
    <th class="block small-6 large-4 columns first">block data</th>
    <th class="block small-6 large-4 columns">block data</th>
    <th class="block small-6 large-4 columns last">block data</th>
 ...

Using columns as partials produces unexpected order classes

<!-- some_mailer/partials/block.htmk.inky -->
<columns small="<%= block_grid_size[0] %>" large="<%= block_grid_size[1] %>" class="block 
	<% if defined? block_size_mod %>block--<%= block_size_mod %><% end %> 
	<% if defined? block_look_mod %>block--<%= block_look_mod %><% end %>
	">
	<table class="block__inner">
		...block data
	</table>
</columns>

<!-- Section partial -->
<row>
   <%= render partial: 'some_mailer/partials/block', 
	  		locals: {
	  			block_grid_size: ["6","4"],
                                block_size_mod: "big",
                                block_look_mod: "primary",
	  			...
	  		}
	  	%>
  <%= render partial: 'some_mailer/partials/block', 
	  		locals: {
	  			block_grid_size: ["6","4"],
	  			...
	  		}
	  	%>
<%= render partial: 'some_mailer/partials/block', 
	  		locals: {
	  			block_grid_size: ["6","4"],
	  			...
	  		}
	  	%>
</row>

<!--produces unexpected first and last class for each column  -->
<table class="row">
  <tbody><tr>
    <th class="block block--big block--primary small-6 large-4 columns first last">block data</th>
    <th class="block small-6 large-4 columns first last">block data</th>
    <th class="block small-6 large-4 columns first last">block data</th>
 ...

setup:

  • macOS El Capitan 10.11.6 (15G1004)
  • ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
  • rails 4.2.5.1
  • inky-rb 1.3.7.2
  • premailer-rails 1.9.5

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions