mgwidmann/scrivener_html

Scrivener HTML for Bootstrap style grids or with rows (or flexbox) and cards?

Closed this issue · 2 comments

hi

apologies if I am looking/asking in the wrong place

can I use Scrivener.HTML for create rows with cards for Bootstrap style responsive grids?

i.e. Flexbox or Grids ?

am hacking through a solution but I would of thought this is a common scenario

used card columns and will try scrivener.html next

Grid Posts


<div class="card-columns">
<%= for post <- @posts do %>
  <div class="card">
    <img class="card-img-top img-fluid" src="..." alt="Card image cap">
    <div class="card-block">
      <h4 class="card-title"><%= post.title %></h4>
      <p class="card-text"><%= post.body %></p>
            <%= post.slug %>
            <%= post.intro %>
            <%= post.description %>
        <span><%= link "Show", to: post_path(@conn, :show, post), class: "btn btn-default btn-xs" %></span>
        <span><%= link "Edit", to: post_path(@conn, :edit, post), class: "btn btn-default btn-xs" %></span>
        <span><%= link "Delete", to: post_path(@conn, :delete, post), method: :delete, data: [confirm: "Are you sure?"], class: "btn btn-danger btn-xs" %></span>

    </div>
  </div>
<% end %>
</div>
<span><%= link "New Post", to: post_path(@conn, :new) %></span>

So bootstrap and bootstrap v4 are both view styles supported by Scrivener.HTML. You can see what they produce here:
https://github.com/mgwidmann/scrivener_html/blob/master/lib/scrivener/html.ex#L143
https://github.com/mgwidmann/scrivener_html/blob/master/lib/scrivener/html.ex#L154

If you don't like those or wish to do something custom, you can implement your own helper method which calls Scrivener.HTML.raw_pagination_links/2 and produce your own HTML output from that. See here: https://github.com/mgwidmann/scrivener_html/blob/master/lib/scrivener/html.ex#L302

If you think another view style should be added, I'm open to adding another if it makes sense.