Add manager controller for bill signatures
This commit is contained in:
parent
925edb01c7
commit
eb592f8ddf
7 changed files with 115 additions and 0 deletions
4
app/controllers/manager/bill_signatures_controller.rb
Normal file
4
app/controllers/manager/bill_signatures_controller.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module Manager
|
||||||
|
class BillSignaturesController < Manager::ApplicationController
|
||||||
|
end
|
||||||
|
end
|
22
app/dashboards/bill_signature_dashboard.rb
Normal file
22
app/dashboards/bill_signature_dashboard.rb
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
require "administrate/base_dashboard"
|
||||||
|
|
||||||
|
class BillSignatureDashboard < Administrate::BaseDashboard
|
||||||
|
ATTRIBUTE_TYPES = {
|
||||||
|
dossier_operation_logs: Field::HasMany,
|
||||||
|
id: Field::Number,
|
||||||
|
digest: Field::String,
|
||||||
|
created_at: Field::DateTime,
|
||||||
|
updated_at: Field::DateTime,
|
||||||
|
serialized: AttachmentField,
|
||||||
|
signature: AttachmentField
|
||||||
|
}.freeze
|
||||||
|
|
||||||
|
COLLECTION_ATTRIBUTES = [
|
||||||
|
:id,
|
||||||
|
:created_at,
|
||||||
|
:dossier_operation_logs,
|
||||||
|
:digest,
|
||||||
|
:serialized,
|
||||||
|
:signature
|
||||||
|
].freeze
|
||||||
|
end
|
11
app/fields/attachment_field.rb
Normal file
11
app/fields/attachment_field.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
require "administrate/field/base"
|
||||||
|
|
||||||
|
class AttachmentField < Administrate::Field::Base
|
||||||
|
def to_s
|
||||||
|
data.filename.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
def blob_path
|
||||||
|
Rails.application.routes.url_helpers.rails_blob_path(data)
|
||||||
|
end
|
||||||
|
end
|
1
app/views/fields/attachment_field/_index.html.haml
Normal file
1
app/views/fields/attachment_field/_index.html.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
= link_to(field.to_s, field.blob_path)
|
68
app/views/manager/bill_signatures/_collection.html.erb
Normal file
68
app/views/manager/bill_signatures/_collection.html.erb
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<%#
|
||||||
|
# Collection
|
||||||
|
|
||||||
|
This partial is used on the `index` and `show` pages
|
||||||
|
to display a collection of resources in an HTML table.
|
||||||
|
|
||||||
|
## Local variables:
|
||||||
|
|
||||||
|
- `collection_presenter`:
|
||||||
|
An instance of [Administrate::Page::Collection][1].
|
||||||
|
The table presenter uses `ResourceDashboard::COLLECTION_ATTRIBUTES` to determine
|
||||||
|
the columns displayed in the table
|
||||||
|
- `resources`:
|
||||||
|
An ActiveModel::Relation collection of resources to be displayed in the table.
|
||||||
|
By default, the number of resources is limited by pagination
|
||||||
|
or by a hard limit to prevent excessive page load times
|
||||||
|
|
||||||
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
|
||||||
|
%>
|
||||||
|
|
||||||
|
<table aria-labelledby="<%= table_title %>">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
|
||||||
|
<th class="cell-label
|
||||||
|
cell-label--<%= attr_type.html_class %>
|
||||||
|
cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>"
|
||||||
|
scope="col"
|
||||||
|
role="columnheader"
|
||||||
|
aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>">
|
||||||
|
<%= link_to(sanitized_order_params(page, collection_field_name).merge(
|
||||||
|
collection_presenter.order_params_for(attr_name, key: collection_field_name)
|
||||||
|
)) do %>
|
||||||
|
<%= t(
|
||||||
|
"helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
|
||||||
|
default: attr_name.to_s,
|
||||||
|
).titleize %>
|
||||||
|
<% if collection_presenter.ordered_by?(attr_name) %>
|
||||||
|
<span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">
|
||||||
|
<svg aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-up-caret" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</th>
|
||||||
|
<% end %>
|
||||||
|
<% [valid_action?(:edit, collection_presenter.resource_name),
|
||||||
|
valid_action?(:destroy, collection_presenter.resource_name)].count(true).times do %>
|
||||||
|
<th scope="col"></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% resources.each do |resource| %>
|
||||||
|
<tr class="js-table-row"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<% collection_presenter.attributes_for(resource).each do |attribute| %>
|
||||||
|
<td class="cell-data cell-data--<%= attribute.html_class %>">
|
||||||
|
<%= render_field attribute %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -25,3 +25,10 @@ fr:
|
||||||
bill_signature:
|
bill_signature:
|
||||||
one: Horodatage
|
one: Horodatage
|
||||||
other: Horodatages
|
other: Horodatages
|
||||||
|
helpers:
|
||||||
|
label:
|
||||||
|
bill_signature:
|
||||||
|
dossier_operation_logs: opérations
|
||||||
|
digest: empreinte
|
||||||
|
serialized: liasse
|
||||||
|
signature: signature
|
||||||
|
|
|
@ -37,6 +37,8 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :demandes, only: [:index]
|
resources :demandes, only: [:index]
|
||||||
|
|
||||||
|
resources :bill_signatures, only: [:index]
|
||||||
|
|
||||||
resources :services, only: [:index, :show]
|
resources :services, only: [:index, :show]
|
||||||
|
|
||||||
post 'demandes/create_administrateur'
|
post 'demandes/create_administrateur'
|
||||||
|
|
Loading…
Add table
Reference in a new issue