Merge branch 'master' into add_image_to_legislation_processes

This commit is contained in:
Alberto
2019-01-28 14:49:19 +01:00
committed by GitHub
57 changed files with 1010 additions and 196 deletions

View File

@@ -6,7 +6,7 @@
<div class="margin-top">
<div class="small-12 medium-6 column">
<%= f.select :phase, budget_phases_select_options, selected: "drafting" %>
<%= f.select :phase, budget_phases_select_options %>
</div>
<div class="small-12 medium-3 column end">
<%= f.select :currency_symbol, budget_currency_symbol_select_options %>

View File

@@ -0,0 +1,12 @@
<% provide :title do %>
<%= "#{t("admin.header.title")} - #{t("admin.menu.legislation")}" %> -
<%= "#{@process.title} - #{t("admin.progress_bars.index.title")}" %>
<% end %>
<%= back_link_to admin_legislation_process_milestones_path(@progressable),
t("admin.legislation.processes.edit.back") %>
<h2><%= @process.title %></h2>
<%= render "admin/legislation/processes/subnav", process: @process, active: "milestones" %>
<%= render "admin/progress_bars/progress_bars", progressable: @process %>

View File

@@ -1,4 +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)]),
class: "button hollow float-right" %>
<% if milestoneable.milestones.any? %>
<table>

View File

@@ -14,18 +14,12 @@
<%= render 'shared/errors', resource: @answer %>
<div class="row">
<div class="small-12 column">
<div class="documents small-12">
<%= render 'documents/nested_documents', documentable: @answer, f: f %>
</div>
<div class="documents">
<%= render 'documents/nested_documents', documentable: @answer, f: f %>
</div>
<div class="row">
<div class="actions small-12 medium-4 margin-top">
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
</div>
</div>
</div>
<div class="small-12 medium-6 large-2">
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
</div>
<% end %>
@@ -42,11 +36,17 @@
<%= link_to document.title, document.attachment.url %>
</td>
<td class="text-right">
<%= link_to t('documents.buttons.download_document'),
<%= link_to t("documents.buttons.download_document"),
document.attachment.url,
target: "_blank",
rel: "nofollow",
class: 'button hollow' %>
class: "button hollow" %>
<%= link_to t("admin.shared.delete"),
document_path(document),
method: :delete,
class: "button hollow alert",
data: { confirm: t("admin.actions.confirm") } %>
</td>
</tr>
<% end %>

View File

@@ -0,0 +1,31 @@
<%= render "admin/shared/globalize_locales", resource: @progress_bar %>
<%= translatable_form_for [:admin, *resource_hierarchy_for(@progress_bar)] do |f| %>
<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 %>
</div>
<% end %>
<% progress_options = { min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 } %>
<div class="small-12 medium-6 large-2">
<%= 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" %>
<% end %>

View File

@@ -0,0 +1,57 @@
<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? %>
<table>
<thead>
<tr>
<th><%= t("admin.progress_bars.index.table_id") %></th>
<th><%= t("admin.progress_bars.index.table_kind") %></th>
<th><%= t("admin.progress_bars.index.table_title") %></th>
<th class="text-center"><%= t("admin.progress_bars.index.table_percentage") %></th>
<th><%= t("admin.actions.actions") %></th>
</tr>
</thead>
<tbody>
<% progressable.progress_bars.each do |progress_bar| %>
<tr id="<%= dom_id(progress_bar) %>" class="progress-bar">
<td>
<%= progress_bar.id %>
</td>
<td><%= ProgressBar.human_attribute_name("kind.#{progress_bar.kind}") %></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) %>
</td>
<td>
<%= link_to t("admin.actions.edit"),
polymorphic_path([:admin, *resource_hierarchy_for(progress_bar)],
action: :edit),
class: "button hollow" %>
<%= link_to t("admin.actions.delete"),
polymorphic_path([:admin, *resource_hierarchy_for(progress_bar)]),
method: :delete,
class: "button hollow alert" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="callout primary">
<%= t("admin.progress_bars.index.no_progress_bars") %>
</div>
<% end %>

View File

@@ -0,0 +1,15 @@
<% if @progress_bar.primary? %>
<% bar_title = t("admin.progress_bars.edit.title.primary") %>
<% else %>
<% bar_title = t("admin.progress_bars.edit.title.secondary", title: @progress_bar.title) %>
<% end %>
<% provide :title do %>
<%= "#{t("admin.header.title")} - #{bar_title}" %>
<% end %>
<%= back_link_to progress_bars_index %>
<h2><%= bar_title %></h2>
<%= render "form" %>

View File

@@ -0,0 +1,9 @@
<% provide :title do %>
<%= "#{t("admin.header.title")} - #{t("admin.progress_bars.index.title")}" %>
<% end %>
<%= back_link_to polymorphic_path([:admin, *resource_hierarchy_for(@progressable)]) %>
<div class="clear"></div>
<%= render "admin/progress_bars/progress_bars", progressable: @progressable %>

View File

@@ -0,0 +1,9 @@
<% provide :title do %>
<%= "#{t("admin.header.title")} - #{t("admin.progress_bars.new.creating")}" %>
<% end %>
<%= back_link_to progress_bars_index %>
<h2><%= t("admin.progress_bars.new.creating") %></h2>
<%= render "form" %>

View File

@@ -9,7 +9,7 @@
</thead>
<tbody>
<% @images.each do |image| %>
<tr class="<%= image.name %>">
<tr id="image_<%= image.name %>">
<td class="small-12 medium-4">
<strong><%= image.name %></strong> (<%= image.required_width %>x<%= image.required_height %>)
</td>