Browse Source

Replaced table with flex grid

pull/45/head
Stephen 3 months ago
parent
commit
400ef89bd5
3 changed files with 45 additions and 29 deletions
  1. +4
    -1
      .gitignore
  2. +15
    -0
      app/assets/stylesheets/application.scss
  3. +26
    -28
      app/views/category/manage.html.erb

+ 4
- 1
.gitignore View File

@@ -88,4 +88,7 @@ flycheck_*.el
/public/uploads/*

# simplecov
/coverage
/coverage

# Rubymine
.idea

+ 15
- 0
app/assets/stylesheets/application.scss View File

@@ -176,6 +176,21 @@ img, video {
margin: 10px;
}

.flex-row {
display: flex;
flex-direction: row;
margin: 8px;
}

.flex-column {
display: flex;
flex-direction: column;
}

.flex-row > * {
margin: auto 8px auto 8px;
}

/* Code formatting */
.CodeRay {
background-color: hsl(0,0%,95%);


+ 26
- 28
app/views/category/manage.html.erb View File

@@ -1,31 +1,29 @@
<h2 style="margin-bottom: 0px;">
<%= @blog.title %>'s Categories
<%= @blog.title %>'s Categories
</h2>
<br>
<% #if @pages.length > 0 %>
<table style="margin-top: 15px;">
<tr>
<th>Name</th>
</tr>
<tr>
<%= form_for @category, url: manage_category_path do |f| %>
<td><%= f.text_field :name %></td>
<td><%= f.submit "Add", class: "btn btn-sm btn-primary" %></td>
<% end %>
</tr>
<% @cats.each do |c| %>
<tr>
<%= form_for c, url: update_category_path(c.to_param) do |f| %>
<td><%= f.text_field :name %></td>
<td><%= f.submit "Update", class: "btn btn-sm btn-primary" %></td>
<% end %>
<td>
<%= link_to 'Delete',
delete_category_path(c.to_param),
method: :delete,
data: {confirm: "Are you sure?"},
class: "btn btn-sm btn-danger" %>
</td>
</tr>
<% end %>
</table>

<div class="flex-column">
<%= form_for @category, url: manage_category_path do |f| %>
<div class="flex-row">
<div><%= f.text_field :name %></div>
<div><%= f.submit "Add", class: "btn btn-sm btn-primary" %></div>
</div>
<% end %>

<% @cats.each do |c| %>
<%= form_for c, url: update_category_path(c.to_param) do |f| %>
<div class="flex-row">
<div><%= f.text_field :name %></div>
<div><%= f.submit "Update", class: "btn btn-sm btn-primary" %></div>
<div>
<%= link_to 'Delete',
delete_category_path(c.to_param),
method: :delete,
data: {confirm: "Are you sure?"},
class: "btn btn-sm btn-danger" %>
</div>
</div>
<% end %>
<% end %>
</div>

Loading…
Cancel
Save