administrate 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -2
- data/app/assets/javascripts/administrate/application.js +0 -2
- data/app/assets/stylesheets/administrate/application.scss +0 -1
- data/app/assets/stylesheets/administrate/base/_forms.scss +1 -1
- data/app/assets/stylesheets/administrate/components/_buttons.scss +9 -0
- data/app/assets/stylesheets/administrate/components/_flashes.scss +2 -2
- data/app/assets/stylesheets/administrate/library/_variables.scss +1 -1
- data/app/controllers/administrate/application_controller.rb +78 -13
- data/app/controllers/concerns/administrate/punditize.rb +4 -2
- data/app/helpers/administrate/application_helper.rb +24 -6
- data/app/views/administrate/application/_collection.html.erb +3 -3
- data/app/views/administrate/application/_collection_header_actions.html.erb +2 -2
- data/app/views/administrate/application/_collection_item_actions.html.erb +4 -4
- data/app/views/administrate/application/_index_header.html.erb +1 -1
- data/app/views/administrate/application/_navigation.html.erb +1 -1
- data/app/views/administrate/application/_pagination.html.erb +1 -0
- data/app/views/administrate/application/edit.html.erb +1 -1
- data/app/views/administrate/application/index.html.erb +1 -1
- data/app/views/administrate/application/show.html.erb +9 -1
- data/app/views/fields/belongs_to/_index.html.erb +1 -1
- data/app/views/fields/belongs_to/_show.html.erb +1 -1
- data/app/views/fields/date/_form.html.erb +1 -3
- data/app/views/fields/date_time/_form.html.erb +1 -3
- data/app/views/fields/has_many/_index.html.erb +1 -1
- data/app/views/fields/has_one/_form.html.erb +1 -1
- data/app/views/fields/has_one/_index.html.erb +2 -1
- data/app/views/fields/has_one/_show.html.erb +3 -2
- data/app/views/fields/polymorphic/_index.html.erb +2 -1
- data/app/views/fields/polymorphic/_show.html.erb +1 -1
- data/app/views/fields/time/_form.html.erb +2 -3
- data/app/views/fields/url/_index.html.erb +1 -1
- data/app/views/fields/url/_show.html.erb +1 -1
- data/config/locales/administrate.de.yml +2 -2
- data/config/locales/administrate.sl.yml +30 -0
- data/docs/adding_controllers_without_related_model.md +2 -2
- data/docs/authorization.md +25 -12
- data/docs/customizing_controller_actions.md +11 -6
- data/docs/customizing_dashboards.md +17 -2
- data/docs/getting_started.md +1 -1
- data/docs/guides/customising_search.md +149 -0
- data/docs/guides/hiding_dashboards_from_sidebar.md +4 -2
- data/docs/guides/scoping_has_many_relations.md +27 -0
- data/docs/guides.md +3 -1
- data/lib/administrate/base_dashboard.rb +14 -0
- data/lib/administrate/engine.rb +2 -2
- data/lib/administrate/field/associative.rb +7 -7
- data/lib/administrate/field/base.rb +4 -0
- data/lib/administrate/field/belongs_to.rb +4 -0
- data/lib/administrate/field/deferred.rb +4 -0
- data/lib/administrate/field/has_one.rb +4 -0
- data/lib/administrate/field/url.rb +4 -0
- data/lib/administrate/not_authorized_error.rb +18 -0
- data/lib/administrate/order.rb +35 -5
- data/lib/administrate/page/base.rb +4 -0
- data/lib/administrate/version.rb +1 -1
- data/lib/administrate.rb +18 -0
- data/lib/generators/administrate/dashboard/dashboard_generator.rb +14 -1
- metadata +7 -34
- data/app/assets/javascripts/administrate/components/date_time_picker.js +0 -14
- data/config/i18n-tasks.yml +0 -18
- data/config/routes.rb +0 -2
- data/config/unicorn.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6711a800e61649dffc4e96f9ddfaf3af21d364a1cfc659959dc5496357af262
|
4
|
+
data.tar.gz: 3dc0046165d843a60359343d756b584cb7d5a8a505c5ba4c2858749b4aceba28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88099b1defc211784c017a82dc2a4f90d91599f664a768acb652dd5a9ac3358b00180bc1f7da7b072e26cb1412b967fb7c244096005ee782fb1719340a832f3b
|
7
|
+
data.tar.gz: 2d01b4c1131ed1a7c2d9f70756c5d9b0b442abf846425c486ae0d9b5ee6d65c9d3e0e3f45b1d9864749c6901cc29cc90f3261c229ba8ba96e26ee552f92e9d88
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ $heading-line-height: 1.2 !default;
|
|
14
14
|
// Other Sizes
|
15
15
|
$base-border-radius: 4px !default;
|
16
16
|
$base-spacing: $base-line-height * 1em !default;
|
17
|
-
$small-spacing: $base-spacing
|
17
|
+
$small-spacing: $base-spacing * 0.5 !default;
|
18
18
|
|
19
19
|
// Colors
|
20
20
|
$white: #fff !default;
|
@@ -5,12 +5,10 @@ module Administrate
|
|
5
5
|
def index
|
6
6
|
authorize_resource(resource_class)
|
7
7
|
search_term = params[:search].to_s.strip
|
8
|
-
resources =
|
9
|
-
dashboard,
|
10
|
-
search_term).run
|
8
|
+
resources = filter_resources(scoped_resource, search_term: search_term)
|
11
9
|
resources = apply_collection_includes(resources)
|
12
10
|
resources = order.apply(resources)
|
13
|
-
resources = resources
|
11
|
+
resources = paginate_resources(resources)
|
14
12
|
page = Administrate::Page::Collection.new(dashboard, order: order)
|
15
13
|
|
16
14
|
render locals: {
|
@@ -81,6 +79,14 @@ module Administrate
|
|
81
79
|
|
82
80
|
private
|
83
81
|
|
82
|
+
def filter_resources(resources, search_term:)
|
83
|
+
Administrate::Search.new(
|
84
|
+
resources,
|
85
|
+
dashboard,
|
86
|
+
search_term,
|
87
|
+
).run
|
88
|
+
end
|
89
|
+
|
84
90
|
def after_resource_destroyed_path(_requested_resource)
|
85
91
|
{ action: :index }
|
86
92
|
end
|
@@ -99,15 +105,30 @@ module Administrate
|
|
99
105
|
resource_name.to_s.pluralize == underscore_resource ? :active : :inactive
|
100
106
|
end
|
101
107
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
108
|
+
# Whether the named action route exists for the resource class.
|
109
|
+
#
|
110
|
+
# @param resource [Class, String, Symbol] A class of resources, or the name
|
111
|
+
# of a class of resources.
|
112
|
+
# @param action_name [String, Symbol] The name of an action that might be
|
113
|
+
# possible to perform on a resource or resource class.
|
114
|
+
# @return [Boolean] `true` if a route exists for the resource class and the
|
115
|
+
# action. `false` otherwise.
|
116
|
+
def existing_action?(resource, action_name)
|
117
|
+
routes.include?([resource.to_s.underscore.pluralize, action_name.to_s])
|
118
|
+
end
|
119
|
+
helper_method :existing_action?
|
120
|
+
|
121
|
+
# @deprecated Use {#existing_action} instead. Note that, in
|
122
|
+
# {#existing_action}, the order of parameters is reversed and
|
123
|
+
# there is no default value for the `resource` parameter.
|
124
|
+
def valid_action?(action_name, resource = resource_class)
|
125
|
+
Administrate.warn_of_deprecated_authorization_method(__method__)
|
126
|
+
existing_action?(resource, action_name)
|
107
127
|
end
|
128
|
+
helper_method :valid_action?
|
108
129
|
|
109
130
|
def routes
|
110
|
-
@routes ||= Namespace.new(namespace).routes
|
131
|
+
@routes ||= Namespace.new(namespace).routes.to_set
|
111
132
|
end
|
112
133
|
|
113
134
|
def records_per_page
|
@@ -115,7 +136,23 @@ module Administrate
|
|
115
136
|
end
|
116
137
|
|
117
138
|
def order
|
118
|
-
@order ||= Administrate::Order.new(
|
139
|
+
@order ||= Administrate::Order.new(
|
140
|
+
sorting_attribute,
|
141
|
+
sorting_direction,
|
142
|
+
association_attribute: order_by_field(
|
143
|
+
dashboard_attribute(sorting_attribute),
|
144
|
+
),
|
145
|
+
)
|
146
|
+
end
|
147
|
+
|
148
|
+
def order_by_field(dashboard)
|
149
|
+
return unless dashboard.try(:options)
|
150
|
+
|
151
|
+
dashboard.options.fetch(:order, nil)
|
152
|
+
end
|
153
|
+
|
154
|
+
def dashboard_attribute(attribute)
|
155
|
+
dashboard.attribute_types[attribute.to_sym] if attribute
|
119
156
|
end
|
120
157
|
|
121
158
|
def sorting_attribute
|
@@ -206,9 +243,26 @@ module Administrate
|
|
206
243
|
).any? { |_name, attribute| attribute.searchable? }
|
207
244
|
end
|
208
245
|
|
209
|
-
|
246
|
+
# Whether the current user is authorized to perform the named action on the
|
247
|
+
# resource.
|
248
|
+
#
|
249
|
+
# @param _resource [ActiveRecord::Base, Class, String, Symbol] The
|
250
|
+
# temptative target of the action, or the name of its class.
|
251
|
+
# @param _action_name [String, Symbol] The name of an action that might be
|
252
|
+
# possible to perform on a resource or resource class.
|
253
|
+
# @return [Boolean] `true` if the current user is authorized to perform the
|
254
|
+
# action on the resource. `false` otherwise.
|
255
|
+
def authorized_action?(_resource, _action_name)
|
210
256
|
true
|
211
257
|
end
|
258
|
+
helper_method :authorized_action?
|
259
|
+
|
260
|
+
# @deprecated Use {#authorized_action} instead. Note that the order of
|
261
|
+
# parameters is reversed in {#authorized_action}.
|
262
|
+
def show_action?(action, resource)
|
263
|
+
Administrate.warn_of_deprecated_authorization_method(__method__)
|
264
|
+
authorized_action?(resource, action)
|
265
|
+
end
|
212
266
|
helper_method :show_action?
|
213
267
|
|
214
268
|
def new_resource
|
@@ -217,7 +271,18 @@ module Administrate
|
|
217
271
|
helper_method :new_resource
|
218
272
|
|
219
273
|
def authorize_resource(resource)
|
220
|
-
resource
|
274
|
+
if authorized_action?(resource, action_name)
|
275
|
+
resource
|
276
|
+
else
|
277
|
+
raise Administrate::NotAuthorizedError.new(
|
278
|
+
action: action_name,
|
279
|
+
resource: resource,
|
280
|
+
)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
def paginate_resources(resources)
|
285
|
+
resources.page(params[:_page]).per(records_per_page)
|
221
286
|
end
|
222
287
|
end
|
223
288
|
end
|
@@ -2,9 +2,11 @@ module Administrate
|
|
2
2
|
module Punditize
|
3
3
|
if Object.const_defined?("Pundit")
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
include Pundit
|
5
|
+
include Pundit::Authorization
|
6
6
|
|
7
7
|
included do
|
8
|
+
private
|
9
|
+
|
8
10
|
def scoped_resource
|
9
11
|
policy_scope_admin super
|
10
12
|
end
|
@@ -13,7 +15,7 @@ module Administrate
|
|
13
15
|
authorize resource
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
18
|
+
def authorized_action?(resource, action)
|
17
19
|
Pundit.policy!(pundit_user, resource).send("#{action}?".to_sym)
|
18
20
|
end
|
19
21
|
end
|
@@ -4,11 +4,7 @@ module Administrate
|
|
4
4
|
SINGULAR_COUNT = 1
|
5
5
|
|
6
6
|
def application_title
|
7
|
-
|
8
|
-
Rails.application.class.parent_name.titlecase
|
9
|
-
else
|
10
|
-
Rails.application.class.module_parent_name.titlecase
|
11
|
-
end
|
7
|
+
Rails.application.class.module_parent_name.titlecase
|
12
8
|
end
|
13
9
|
|
14
10
|
def render_field(field, locals = {})
|
@@ -29,6 +25,28 @@ module Administrate
|
|
29
25
|
dashboard.try(:model) || resource_name.to_sym
|
30
26
|
end
|
31
27
|
|
28
|
+
# Unification of
|
29
|
+
# {Administrate::ApplicationController#existing_action? existing_action?}
|
30
|
+
# and
|
31
|
+
# {Administrate::ApplicationController#authorized_action?
|
32
|
+
# authorized_action?}
|
33
|
+
#
|
34
|
+
# @param target [ActiveRecord::Base, Class, Symbol, String] A resource,
|
35
|
+
# a class of resources, or the name of a class of resources.
|
36
|
+
# @param action_name [String, Symbol] The name of an action that might be
|
37
|
+
# possible to perform on a resource or resource class.
|
38
|
+
# @return [Boolean] Whether the action both (a) exists for the record class,
|
39
|
+
# and (b) the current user is authorized to perform it on the record
|
40
|
+
# instance or class.
|
41
|
+
def accessible_action?(target, action_name)
|
42
|
+
target = target.to_sym if target.is_a?(String)
|
43
|
+
target_class_or_class_name =
|
44
|
+
target.is_a?(ActiveRecord::Base) ? target.class : target
|
45
|
+
|
46
|
+
existing_action?(target_class_or_class_name, action_name) &&
|
47
|
+
authorized_action?(target, action_name)
|
48
|
+
end
|
49
|
+
|
32
50
|
def display_resource_name(resource_name, opts = {})
|
33
51
|
dashboard_from_resource(resource_name).resource_name(
|
34
52
|
count: opts[:singular] ? SINGULAR_COUNT : PLURAL_MANY_COUNT,
|
@@ -52,7 +70,7 @@ module Administrate
|
|
52
70
|
end
|
53
71
|
|
54
72
|
def sanitized_order_params(page, current_field_name)
|
55
|
-
collection_names = page.
|
73
|
+
collection_names = page.item_associations + [current_field_name]
|
56
74
|
association_params = collection_names.map do |assoc_name|
|
57
75
|
{ assoc_name => %i[order direction page per_page] }
|
58
76
|
end
|
@@ -25,7 +25,7 @@ to display a collection of resources in an HTML table.
|
|
25
25
|
<th class="cell-label
|
26
26
|
cell-label--<%= attr_type.html_class %>
|
27
27
|
cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
|
28
|
-
cell-label--<%= "#{resource_name}_#{attr_name}" %>"
|
28
|
+
cell-label--<%= "#{collection_presenter.resource_name}_#{attr_name}" %>"
|
29
29
|
scope="col"
|
30
30
|
role="columnheader"
|
31
31
|
aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>">
|
@@ -59,13 +59,13 @@ to display a collection of resources in an HTML table.
|
|
59
59
|
<tbody>
|
60
60
|
<% resources.each do |resource| %>
|
61
61
|
<tr class="js-table-row"
|
62
|
-
<% if
|
62
|
+
<% if accessible_action?(resource, :show) %>
|
63
63
|
<%= %(tabindex=0 role=link data-url=#{polymorphic_path([namespace, resource])}) %>
|
64
64
|
<% end %>
|
65
65
|
>
|
66
66
|
<% collection_presenter.attributes_for(resource).each do |attribute| %>
|
67
67
|
<td class="cell-data cell-data--<%= attribute.html_class %>">
|
68
|
-
<% if
|
68
|
+
<% if accessible_action?(resource, :show) -%>
|
69
69
|
<a href="<%= polymorphic_path([namespace, resource]) -%>"
|
70
70
|
tabindex="-1"
|
71
71
|
class="action-show"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% [
|
2
|
-
|
1
|
+
<% [existing_action?(collection_presenter.resource_name, :edit),
|
2
|
+
existing_action?(collection_presenter.resource_name, :destroy)].count(true).times do %>
|
3
3
|
<th scope="col"></th>
|
4
4
|
<% end %>
|
@@ -1,17 +1,17 @@
|
|
1
|
-
<% if
|
1
|
+
<% if existing_action?(collection_presenter.resource_name, :edit) %>
|
2
2
|
<td><%= link_to(
|
3
3
|
t("administrate.actions.edit"),
|
4
4
|
[:edit, namespace, resource],
|
5
5
|
class: "action-edit",
|
6
|
-
) if
|
6
|
+
) if accessible_action?(resource, :edit) %></td>
|
7
7
|
<% end %>
|
8
8
|
|
9
|
-
<% if
|
9
|
+
<% if existing_action?(collection_presenter.resource_name, :destroy) %>
|
10
10
|
<td><%= link_to(
|
11
11
|
t("administrate.actions.destroy"),
|
12
12
|
[namespace, resource],
|
13
13
|
class: "text-color-red",
|
14
14
|
method: :delete,
|
15
15
|
data: { confirm: t("administrate.actions.confirm") }
|
16
|
-
) if
|
16
|
+
) if accessible_action?(resource, :destroy) %></td>
|
17
17
|
<% end %>
|
@@ -15,6 +15,6 @@ as defined by the routes in the `admin/` namespace
|
|
15
15
|
display_resource_name(resource),
|
16
16
|
resource_index_route(resource),
|
17
17
|
class: "navigation__link navigation__link--#{nav_link_state(resource)}"
|
18
|
-
) if
|
18
|
+
) if accessible_action?(model_from_resource(resource), :index) %>
|
19
19
|
<% end %>
|
20
20
|
</nav>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= paginate resources, param_name: '_page' %>
|
@@ -27,7 +27,7 @@ It displays a header, and renders the `_form` partial to do the heavy lifting.
|
|
27
27
|
t("administrate.actions.show_resource", name: page.page_title),
|
28
28
|
[namespace, page.resource],
|
29
29
|
class: "button",
|
30
|
-
) if
|
30
|
+
) if accessible_action?(page.resource, :show) %>
|
31
31
|
</div>
|
32
32
|
</header>
|
33
33
|
|
@@ -28,7 +28,15 @@ as well as a link to its edit page.
|
|
28
28
|
t("administrate.actions.edit_resource", name: page.page_title),
|
29
29
|
[:edit, namespace, page.resource],
|
30
30
|
class: "button",
|
31
|
-
) if
|
31
|
+
) if accessible_action?(page.resource, :edit) %>
|
32
|
+
|
33
|
+
<%= link_to(
|
34
|
+
t("administrate.actions.destroy"),
|
35
|
+
[namespace, page.resource],
|
36
|
+
class: "button button--danger",
|
37
|
+
method: :delete,
|
38
|
+
data: { confirm: t("administrate.actions.confirm") }
|
39
|
+
) if accessible_action?(page.resource, :destroy) %>
|
32
40
|
</div>
|
33
41
|
</header>
|
34
42
|
|
@@ -16,7 +16,7 @@ By default, the relationship is rendered as a link to the associated object.
|
|
16
16
|
%>
|
17
17
|
|
18
18
|
<% if field.data %>
|
19
|
-
<% if
|
19
|
+
<% if accessible_action?(field.data, :show) %>
|
20
20
|
<%= link_to(
|
21
21
|
field.display_associated_resource,
|
22
22
|
[namespace, field.data],
|
@@ -16,7 +16,7 @@ By default, the relationship is rendered as a link to the associated object.
|
|
16
16
|
%>
|
17
17
|
|
18
18
|
<% if field.data %>
|
19
|
-
<% if
|
19
|
+
<% if accessible_action?(field.data, :show) %>
|
20
20
|
<%= link_to(
|
21
21
|
field.display_associated_resource,
|
22
22
|
[namespace, field.data],
|
@@ -2,7 +2,6 @@
|
|
2
2
|
# Date Form Partial
|
3
3
|
|
4
4
|
This partial renders an input element for a date attribute.
|
5
|
-
By default, the input is a text field that is augmented with [DateTimePicker].
|
6
5
|
|
7
6
|
## Local variables:
|
8
7
|
|
@@ -13,12 +12,11 @@ By default, the input is a text field that is augmented with [DateTimePicker].
|
|
13
12
|
A wrapper around the Date value pulled from the database.
|
14
13
|
|
15
14
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Date
|
16
|
-
[DateTimePicker]: https://github.com/Eonasdan/bootstrap-datetimepicker
|
17
15
|
%>
|
18
16
|
|
19
17
|
<div class="field-unit__label">
|
20
18
|
<%= f.label field.attribute %>
|
21
19
|
</div>
|
22
20
|
<div class="field-unit__field">
|
23
|
-
<%= f.
|
21
|
+
<%= f.date_field field.attribute %>
|
24
22
|
</div>
|
@@ -2,7 +2,6 @@
|
|
2
2
|
# DateTime Form Partial
|
3
3
|
|
4
4
|
This partial renders an input element for a datetime attribute.
|
5
|
-
By default, the input is a text field that is augmented with [DateTimePicker].
|
6
5
|
|
7
6
|
## Local variables:
|
8
7
|
|
@@ -13,12 +12,11 @@ By default, the input is a text field that is augmented with [DateTimePicker].
|
|
13
12
|
A wrapper around the DateTime value pulled from the database.
|
14
13
|
|
15
14
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/DateTime
|
16
|
-
[DateTimePicker]: https://github.com/Eonasdan/bootstrap-datetimepicker
|
17
15
|
%>
|
18
16
|
|
19
17
|
<div class="field-unit__label">
|
20
18
|
<%= f.label field.attribute %>
|
21
19
|
</div>
|
22
20
|
<div class="field-unit__field">
|
23
|
-
<%= f.
|
21
|
+
<%= f.datetime_local_field field.attribute, step: 1 %>
|
24
22
|
</div>
|
@@ -16,4 +16,4 @@ as a count of how many objects are associated through the relationship.
|
|
16
16
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
|
17
17
|
%>
|
18
18
|
|
19
|
-
<%= pluralize(field.data.size, field.attribute.to_s.humanize.downcase.singularize) %>
|
19
|
+
<%= pluralize(field.data.size, t("activerecord.models.#{field.attribute.to_s.singularize}", default: field.attribute.to_s.humanize.downcase.singularize, count: field.data.size)) %>
|
@@ -18,7 +18,7 @@ The form will be rendered as nested_from to parent relationship.
|
|
18
18
|
|
19
19
|
<%= f.fields_for field.attribute, field.data || field.nested_form.resource.class.new do |has_one_f| %>
|
20
20
|
<fieldset class="field-unit--nested">
|
21
|
-
<legend><%= t "helpers.label.#{f.object_name}.#{field.
|
21
|
+
<legend><%= t "helpers.label.#{f.object_name}.#{field.name}", default: field.name.titleize %></legend>
|
22
22
|
<% field.nested_form.attributes.each do |attribute| -%>
|
23
23
|
<div class="field-unit field-unit--<%= attribute.html_class %>">
|
24
24
|
<%= render_field attribute, f: has_one_f %>
|
@@ -16,7 +16,8 @@ By default, the relationship is rendered as a link to the associated object.
|
|
16
16
|
%>
|
17
17
|
|
18
18
|
<% if field.linkable? %>
|
19
|
-
<%=
|
19
|
+
<%= link_to_if(
|
20
|
+
accessible_action?(field.data, :show),
|
20
21
|
field.display_associated_resource,
|
21
22
|
[namespace, field.data],
|
22
23
|
) %>
|
@@ -18,7 +18,8 @@ All show page attributes of has_one relationship would be rendered
|
|
18
18
|
<% if field.linkable? %>
|
19
19
|
<fieldset class="attribute--nested">
|
20
20
|
<legend>
|
21
|
-
<%=
|
21
|
+
<%= link_to_if(
|
22
|
+
accessible_action?(field.data, :show),
|
22
23
|
field.display_associated_resource,
|
23
24
|
[namespace, field.data],
|
24
25
|
) %>
|
@@ -27,7 +28,7 @@ All show page attributes of has_one relationship would be rendered
|
|
27
28
|
<div>
|
28
29
|
<dt class="attribute-label">
|
29
30
|
<%= t(
|
30
|
-
"helpers.label.#{
|
31
|
+
"helpers.label.#{field.associated_class_name.underscore}.#{attribute.name}",
|
31
32
|
default: attribute.name.titleize,
|
32
33
|
) %>
|
33
34
|
</dt>
|
@@ -17,7 +17,8 @@ By default, the relationship is rendered as a link to the associated object.
|
|
17
17
|
%>
|
18
18
|
|
19
19
|
<% if field.data %>
|
20
|
-
<%=
|
20
|
+
<%= link_to_if(
|
21
|
+
accessible_action?(field.data, :show),
|
21
22
|
field.display_associated_resource,
|
22
23
|
[namespace, field.data]
|
23
24
|
) %>
|
@@ -17,7 +17,7 @@ By default, the relationship is rendered as a link to the associated object.
|
|
17
17
|
%>
|
18
18
|
|
19
19
|
<% if field.data %>
|
20
|
-
<% if
|
20
|
+
<% if accessible_action?(field.data, :show) %>
|
21
21
|
<%= link_to(
|
22
22
|
field.display_associated_resource,
|
23
23
|
[namespace, field.data],
|
@@ -2,7 +2,6 @@
|
|
2
2
|
# Time Form Partial
|
3
3
|
|
4
4
|
This partial renders an input element for time attributes.
|
5
|
-
By default, the input is a text field that is augmented with [DateTimePicker].
|
6
5
|
|
7
6
|
## Local variables:
|
8
7
|
|
@@ -12,12 +11,12 @@ By default, the input is a text field that is augmented with [DateTimePicker].
|
|
12
11
|
An instance of [Administrate::Field::Time][1].
|
13
12
|
A wrapper around the tmie attributes pulled from the model.
|
14
13
|
|
15
|
-
[
|
14
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Time
|
16
15
|
%>
|
17
16
|
|
18
17
|
<div class="field-unit__label">
|
19
18
|
<%= f.label field.attribute %>
|
20
19
|
</div>
|
21
20
|
<div class="field-unit__field">
|
22
|
-
<%= f.
|
21
|
+
<%= f.time_field field.attribute, step: 1 %>
|
23
22
|
</div>
|
@@ -15,6 +15,6 @@ By default, the value is rendered as an `a` element.
|
|
15
15
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Url
|
16
16
|
%>
|
17
17
|
|
18
|
-
<%= content_tag :a, href: field.data do %>
|
18
|
+
<%= content_tag :a, href: field.data, **field.html_options do %>
|
19
19
|
<%= field.data %>
|
20
20
|
<% end %>
|
@@ -15,6 +15,6 @@ By default, the value is rendered as an `a` element.
|
|
15
15
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Url
|
16
16
|
%>
|
17
17
|
|
18
|
-
<%= content_tag :a, href: field.data do %>
|
18
|
+
<%= content_tag :a, href: field.data, **field.html_options do %>
|
19
19
|
<%= field.data %>
|
20
20
|
<% end %>
|
@@ -21,8 +21,8 @@ de:
|
|
21
21
|
more: "%{count} von %{total_count}"
|
22
22
|
none: Keine
|
23
23
|
form:
|
24
|
-
error:
|
25
|
-
errors: "%{
|
24
|
+
error: Fehler
|
25
|
+
errors: "%{resource_name} konnte nicht gespeichert werden, es gab %{pluralized_errors}."
|
26
26
|
navigation:
|
27
27
|
back_to_app: Zurück zur App
|
28
28
|
search:
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
sl:
|
3
|
+
administrate:
|
4
|
+
actions:
|
5
|
+
confirm: Ali ste preričani?
|
6
|
+
destroy: Izbriši
|
7
|
+
edit: Uredi
|
8
|
+
edit_resource: Uredi %{name}
|
9
|
+
show_resource: Prikaži %{name}
|
10
|
+
new_resource: Dodaj %{name}
|
11
|
+
back: Nazaj
|
12
|
+
controller:
|
13
|
+
create:
|
14
|
+
success: "%{resource} je dodan."
|
15
|
+
destroy:
|
16
|
+
success: "%{resource} je izbrisan."
|
17
|
+
update:
|
18
|
+
success: "%{resource} je posodobljen."
|
19
|
+
fields:
|
20
|
+
has_many:
|
21
|
+
more: Prikazanih %{count} od %{total_count}
|
22
|
+
none: Nobene
|
23
|
+
form:
|
24
|
+
error: napaka
|
25
|
+
errors: "%{resource_name} ni mogoče shraniti zaradi:"
|
26
|
+
navigation:
|
27
|
+
back_to_app: Nazaj v aplikacijo
|
28
|
+
search:
|
29
|
+
clear: Počisti iskanje
|
30
|
+
label: Išči %{resource}
|
@@ -14,9 +14,9 @@ routes are displayed in the sidebar and then add a custom dashboard:
|
|
14
14
|
<div style="padding: 20px">
|
15
15
|
<h1>Stats</h1>
|
16
16
|
<br>
|
17
|
-
<p><b>Total Customers:</b> <%= @stats[:customer_count] %></
|
17
|
+
<p><b>Total Customers:</b> <%= @stats[:customer_count] %></p>
|
18
18
|
<br>
|
19
|
-
<p><b>Total Orders:</b> <%= @stats[:order_count] %></
|
19
|
+
<p><b>Total Orders:</b> <%= @stats[:order_count] %></p>
|
20
20
|
</div>
|
21
21
|
```
|
22
22
|
|