administrate_exportable 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8daac2aef4cda63848b4ba2646021b424c598dfb05ba152bd3ddafc1e81c7a84
|
4
|
+
data.tar.gz: efe0a0bef2ae8ac4293ade2a990477e21fdefbc44bd2cd80cca7c00d784c499c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d4e9fc50fa6e17d34ffd36afe982506c0b72fd801b78ce85f6a1071642fa6f65bf636109692d47e92aa5a7186bf900ada11b926d54e633289dd8a8208710e67
|
7
|
+
data.tar.gz: 6b7735fa0be5f7f7cc32dd8241ceabb715153d6a27cce8a877fd087a1209ed0121bea8e29f0e33b2692170fce36ed237ae5db3e7319588305ebe72d7c1ac763f
|
data/README.md
CHANGED
@@ -54,7 +54,7 @@ ATTRIBUTE_TYPES = {
|
|
54
54
|
created_at: Field::DateTime.with_options(transform_on_export: -> (field) { field.data.strftime("%F") })
|
55
55
|
```
|
56
56
|
|
57
|
-
By default the gem adds the Export button to the
|
57
|
+
By default the gem adds the Export button to the partial `views/admin/application/_index_header.html.erb`. But if you have your own Administrate `index` views or override that partial in your application you can add the link manually:
|
58
58
|
```ruby
|
59
59
|
link_to('Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if valid_action?(:export)
|
60
60
|
```
|
@@ -77,7 +77,7 @@ Example:
|
|
77
77
|
'Export',
|
78
78
|
[:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
|
79
79
|
class: 'button'
|
80
|
-
) if valid_action?(:export) %>
|
80
|
+
) if valid_action?(:export) %>
|
81
81
|
</div>
|
82
82
|
....
|
83
83
|
```
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% content_for(:title) do %>
|
2
|
+
<%= display_resource_name(page.resource_name) %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<header class="main-content__header">
|
6
|
+
<h1 class="main-content__page-title" id="page-title">
|
7
|
+
<%= content_for(:title) %>
|
8
|
+
</h1>
|
9
|
+
|
10
|
+
<% if show_search_bar %>
|
11
|
+
<%= render(
|
12
|
+
"search",
|
13
|
+
search_term: search_term,
|
14
|
+
resource_name: display_resource_name(page.resource_name)
|
15
|
+
) %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<div>
|
19
|
+
<%= link_to(
|
20
|
+
t(
|
21
|
+
"administrate.actions.new_resource",
|
22
|
+
name: display_resource_name(page.resource_name, singular: true).downcase
|
23
|
+
),
|
24
|
+
[:new, namespace, page.resource_path.to_sym],
|
25
|
+
class: "button",
|
26
|
+
) if accessible_action?(new_resource, :new) %>
|
27
|
+
|
28
|
+
<%= link_to(
|
29
|
+
'Export',
|
30
|
+
[:export, namespace, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
|
31
|
+
class: 'button',
|
32
|
+
target: '_blank'
|
33
|
+
) if valid_action?(:export) && show_action?(:export, resource_name) %>
|
34
|
+
</div>
|
35
|
+
</header>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate_exportable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jônatas Rancan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-02-
|
12
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -140,8 +140,8 @@ files:
|
|
140
140
|
- README.md
|
141
141
|
- Rakefile
|
142
142
|
- administrate_exportable.gemspec
|
143
|
+
- app/views/admin/application/_index_header.html.erb
|
143
144
|
- app/views/admin/application/_pagination.html.erb
|
144
|
-
- app/views/admin/application/index.html.erb
|
145
145
|
- bin/console
|
146
146
|
- bin/setup
|
147
147
|
- lib/administrate_exportable.rb
|
@@ -1,68 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
# Index
|
3
|
-
This view is the template for the index page.
|
4
|
-
It is responsible for rendering the search bar, header and pagination.
|
5
|
-
It renders the `_table` partial to display details about the resources.
|
6
|
-
## Local variables:
|
7
|
-
- `page`:
|
8
|
-
An instance of [Administrate::Page::Collection][1].
|
9
|
-
Contains helper methods to help display a table,
|
10
|
-
and knows which attributes should be displayed in the resource's table.
|
11
|
-
- `resources`:
|
12
|
-
An instance of `ActiveRecord::Relation` containing the resources
|
13
|
-
that match the user's search criteria.
|
14
|
-
By default, these resources are passed to the table partial to be displayed.
|
15
|
-
- `search_term`:
|
16
|
-
A string containing the term the user has searched for, if any.
|
17
|
-
- `show_search_bar`:
|
18
|
-
A boolean that determines if the search bar should be shown.
|
19
|
-
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
|
20
|
-
%>
|
21
|
-
|
22
|
-
<% content_for(:title) do %>
|
23
|
-
<%= display_resource_name(page.resource_name) %>
|
24
|
-
<% end %>
|
25
|
-
|
26
|
-
<header class="main-content__header" role="banner">
|
27
|
-
<h1 class="main-content__page-title" id="page-title">
|
28
|
-
<%= content_for(:title) %>
|
29
|
-
</h1>
|
30
|
-
|
31
|
-
<% if show_search_bar %>
|
32
|
-
<%= render(
|
33
|
-
"search",
|
34
|
-
search_term: search_term,
|
35
|
-
resource_name: display_resource_name(page.resource_name)
|
36
|
-
) %>
|
37
|
-
<% end %>
|
38
|
-
|
39
|
-
<div>
|
40
|
-
<%= link_to(
|
41
|
-
t(
|
42
|
-
"administrate.actions.new_resource",
|
43
|
-
name: page.resource_name.titleize.downcase
|
44
|
-
),
|
45
|
-
[:new, namespace, page.resource_path.to_sym],
|
46
|
-
class: "button",
|
47
|
-
) if valid_action?(:new) && show_action?(:new, new_resource) %>
|
48
|
-
<%= link_to(
|
49
|
-
'Export',
|
50
|
-
[:export, namespace, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
|
51
|
-
class: 'button',
|
52
|
-
target: '_blank'
|
53
|
-
) if valid_action?(:export) && show_action?(:export, resource_name) %>
|
54
|
-
</div>
|
55
|
-
</header>
|
56
|
-
|
57
|
-
<section class="main-content__body main-content__body--flush">
|
58
|
-
<%= render(
|
59
|
-
"collection",
|
60
|
-
collection_presenter: page,
|
61
|
-
collection_field_name: resource_name,
|
62
|
-
page: page,
|
63
|
-
resources: resources,
|
64
|
-
table_title: "page-title"
|
65
|
-
) %>
|
66
|
-
|
67
|
-
<%= render("pagination", resources: resources) %>
|
68
|
-
</section>
|