Adds styles to admin progress bars views

This commit is contained in:
decabeza
2019-01-08 18:21:16 +01:00
parent dfdf0b0636
commit 7c0fb96b02
8 changed files with 58 additions and 21 deletions

View File

@@ -251,6 +251,13 @@ $sidebar-active: #f4fcd0;
max-width: none; max-width: none;
} }
form {
.input-group-label {
height: $line-height * 2;
}
}
.menu.simple { .menu.simple {
margin-bottom: $line-height / 2; margin-bottom: $line-height / 2;

View File

@@ -1,6 +1,8 @@
<h2><%= t("admin.milestones.index.milestone") %></h2> <h2 class="inline-block"><%= t("admin.milestones.index.milestone") %></h2>
<%= link_to t("admin.progress_bars.manage"), polymorphic_path([:admin, *resource_hierarchy_for(milestoneable.progress_bars.new)]) %> <%= link_to t("admin.progress_bars.manage"),
polymorphic_path([:admin, *resource_hierarchy_for(milestoneable.progress_bars.new)]),
class: "button hollow float-right" %>
<% if milestoneable.milestones.any? %> <% if milestoneable.milestones.any? %>
<table> <table>

View File

@@ -2,15 +2,30 @@
<%= translatable_form_for [:admin, *resource_hierarchy_for(@progress_bar)] do |f| %> <%= translatable_form_for [:admin, *resource_hierarchy_for(@progress_bar)] do |f| %>
<%= f.enum_select :kind %> <div class="small-12 medium-6">
<%= f.enum_select :kind %>
</div>
<%= f.translatable_fields do |translations_form| %> <div class="small-12 medium-6">
<%= translations_form.text_field :title %> <%= f.translatable_fields do |translations_form| %>
<% end %> <%= translations_form.text_field :title %>
<% end %>
</div>
<% progress_options = { min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 } %> <% progress_options = { min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 } %>
<%= f.text_field :percentage, { type: :range, id: "percentage_range" }.merge(progress_options) %> <div class="small-12 medium-6 large-2">
<%= f.text_field :percentage, { type: :number, label: false }.merge(progress_options) %> <%= f.text_field :percentage, { type: :range,
id: "percentage_range",
class: "column" }.merge(progress_options) %>
</div>
<div class="small-12 medium-6 large-2">
<div class="input-group">
<%= f.text_field :percentage, { type: :number,
label: false,
class: "input-group-field" }.merge(progress_options) %>
<span class="input-group-label">%</span>
</div>
</div>
<%= f.submit nil, class: "button success" %> <%= f.submit nil, class: "button success" %>
<% end %> <% end %>

View File

@@ -1,4 +1,11 @@
<h2><%= t("admin.progress_bars.index.title") %></h2> <h2 class="inline-block"><%= t("admin.progress_bars.index.title") %></h2>
<%= link_to t("admin.progress_bars.index.new_progress_bar"),
polymorphic_path(
[:admin, *resource_hierarchy_for(ProgressBar.new(progressable: progressable))],
action: :new
),
class: "button float-right" %>
<% if progressable.progress_bars.any? %> <% if progressable.progress_bars.any? %>
<table> <table>
@@ -7,7 +14,7 @@
<th><%= ProgressBar.human_attribute_name("id") %></th> <th><%= ProgressBar.human_attribute_name("id") %></th>
<th><%= ProgressBar.human_attribute_name("kind") %></th> <th><%= ProgressBar.human_attribute_name("kind") %></th>
<th><%= ProgressBar.human_attribute_name("title") %></th> <th><%= ProgressBar.human_attribute_name("title") %></th>
<th><%= ProgressBar.human_attribute_name("percentage") %></th> <th class="text-center"><%= ProgressBar.human_attribute_name("percentage") %></th>
<th><%= t("admin.actions.actions") %></th> <th><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>
@@ -18,32 +25,33 @@
<%= progress_bar.id %> <%= progress_bar.id %>
</td> </td>
<td><%= ProgressBar.human_attribute_name("kind.#{progress_bar.kind}") %></td> <td><%= ProgressBar.human_attribute_name("kind.#{progress_bar.kind}") %></td>
<td><%= progress_bar.title %></td>
<td> <td>
<% if progress_bar.title.present? %>
<%= progress_bar.title %>
<% else %>
<strong><%= t("admin.progress_bars.index.primary") %></strong>
<% end %>
</td>
<td class="text-center">
<%= number_to_percentage(progress_bar.percentage, strip_insignificant_zeros: true) %> <%= number_to_percentage(progress_bar.percentage, strip_insignificant_zeros: true) %>
</td> </td>
<td> <td>
<%= link_to t("admin.actions.edit"), <%= link_to t("admin.actions.edit"),
polymorphic_path([:admin, *resource_hierarchy_for(progress_bar)], polymorphic_path([:admin, *resource_hierarchy_for(progress_bar)],
action: :edit), action: :edit),
class: "button hollow expanded" %> class: "button hollow" %>
<%= link_to t("admin.actions.delete"), <%= link_to t("admin.actions.delete"),
polymorphic_path([:admin, *resource_hierarchy_for(progress_bar)]), polymorphic_path([:admin, *resource_hierarchy_for(progress_bar)]),
method: :delete, method: :delete,
class: "button hollow alert expanded" %> class: "button hollow alert" %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<% else %> <% else %>
<p><%= t("admin.progress_bars.index.no_progress_bars") %></p> <div class="callout primary">
<%= t("admin.progress_bars.index.no_progress_bars") %>
</div>
<% end %> <% end %>
<p>
<%= link_to t("admin.progress_bars.index.new_progress_bar"),
polymorphic_path([:admin, *resource_hierarchy_for(progressable.progress_bars.new)],
action: :new),
class: "button hollow" %>
</p>

View File

@@ -4,4 +4,6 @@
<%= back_link_to polymorphic_path([:admin, *resource_hierarchy_for(@progressable)]) %> <%= back_link_to polymorphic_path([:admin, *resource_hierarchy_for(@progressable)]) %>
<div class="clear"></div>
<%= render "admin/progress_bars/progress_bars", progressable: @progressable %> <%= render "admin/progress_bars/progress_bars", progressable: @progressable %>

View File

@@ -338,6 +338,7 @@ en:
title: "Progress bars" title: "Progress bars"
no_progress_bars: "There are no progress bars" no_progress_bars: "There are no progress bars"
new_progress_bar: "Create new progress bar" new_progress_bar: "Create new progress bar"
primary: "Primary progress bar"
new: new:
creating: "Create progress bar" creating: "Create progress bar"
edit: edit:

View File

@@ -338,6 +338,7 @@ es:
title: "Barras de progreso" title: "Barras de progreso"
no_progress_bars: "No hay barras de progreso" no_progress_bars: "No hay barras de progreso"
new_progress_bar: "Crear nueva barra de progreso" new_progress_bar: "Crear nueva barra de progreso"
primary: "Barra de progreso principal"
new: new:
creating: "Crear barra de progreso" creating: "Crear barra de progreso"
edit: edit:

View File

@@ -42,6 +42,7 @@ shared_examples "progressable" do |factory_name, path_name|
expect(page).to have_content "Progress bar created successfully" expect(page).to have_content "Progress bar created successfully"
expect(page).to have_content "43%" expect(page).to have_content "43%"
expect(page).to have_content "Primary" expect(page).to have_content "Primary"
expect(page).to have_content "Primary progress bar"
end end
scenario "Secondary progress bar", :js do scenario "Secondary progress bar", :js do