Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
renatodeleao opened this issue Dec 27, 2016 · 0 comments
Open

Comments

@renatodeleao
Copy link

renatodeleao commented Dec 27, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant