firstdraft / draft_generators

Rails generators that help beginners learn to program.
MIT License
2 stars 3 forks source link

Remove bootstrap3 shims #49

Closed murugan-r closed 6 years ago

murugan-r commented 6 years ago
murugan-r commented 6 years ago

@raghubetina Could you please take a look.

raghubetina commented 6 years ago

@murugan-r I wasn't very clear when I wrote the issue.

The task was not to replace btn-block with col. btn-block still exists in Bootstrap 4, so there's no need to replace it. And col is a grid class and thus not intended for use on <a>s.

The thing that was removed in Bootstrap 4 was btn-group-justified:

https://getbootstrap.com/docs/3.3/components/#btn-groups-justified

Thus I added the shim:

https://github.com/firstdraft/better_scaffold_templates/blob/master/app/assets/stylesheets/bootstrap3-shims.scss

Since Bootstrap 4 has the new col class for equal-sized cells in a row, I thought we could avoid the shim and instead replace

    <div class="btn-group btn-group-justified mt-auto">
      <%%= link_to_show_or_back <%= singular_table_name %>, '<i class="fas fa-search-plus"></i>'.html_safe, '<i class="fas fa-chevron-left"></i>'.html_safe, class: "btn btn-block btn-outline-secondary" %>

      <%%= link_to edit_<%= singular_table_name %>_url(<%= singular_table_name %>), class: "btn btn-block btn-outline-secondary" do %>
        <i class="fas fa-edit"></i>
      <%% end %>

      <%%= link_to <%= singular_table_name %>, method: :delete, data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" }, class: "btn btn-block btn-outline-secondary" do %>
        <i class="fas fa-trash-alt"></i>
      <%% end %>
    </div>

with

  <div class="row">
    <div class="col">
      <%%= link_to_show_or_back <%= singular_table_name %>, '<i class="fas fa-search-plus"></i>'.html_safe, '<i class="fas fa-chevron-left"></i>'.html_safe, class: "btn btn-outline-secondary" %>
    </div>

    <div class="col">
      <%%= link_to edit_<%= singular_table_name %>_url(<%= singular_table_name %>), class: "btn btn-outline-secondary" do %>
        <i class="fas fa-edit"></i>
      <%% end %>
    </div>

    <div class="col">
      <%%= link_to <%= singular_table_name %>, method: :delete, data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" }, class: "btn btn-outline-secondary" do %>
        <i class="fas fa-trash-alt"></i>
      <%% end %>
    </div>
  </div>

Does that make sense?

murugan-r commented 6 years ago

@raghubetina Could you please take a look.

raghubetina commented 6 years ago

LGTM :ship: