administrate 0.0.12 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of administrate might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/images/administrate/dropdown.svg +3 -0
- data/app/assets/javascripts/administrate/components/_search.js +2 -1
- data/app/assets/javascripts/administrate/components/has_many_form.js +1 -1
- data/app/assets/stylesheets/administrate/application.scss +0 -1
- data/app/assets/stylesheets/administrate/base/_forms.scss +3 -3
- data/app/assets/stylesheets/administrate/base/_lists.scss +7 -7
- data/app/assets/stylesheets/administrate/base/_variables.scss +3 -0
- data/app/assets/stylesheets/administrate/components/_attributes.scss +13 -0
- data/app/assets/stylesheets/administrate/components/_cells.scss +2 -8
- data/app/assets/stylesheets/administrate/components/_form.scss +32 -25
- data/app/assets/stylesheets/administrate/components/_header.scss +1 -1
- data/app/assets/stylesheets/administrate/components/_search.scss +1 -1
- data/app/assets/stylesheets/administrate/components/_table.scss +4 -0
- data/app/assets/stylesheets/administrate/mixins/_data_label.scss +8 -0
- data/app/assets/stylesheets/administrate/mixins/_mixins.scss +1 -0
- data/app/controllers/administrate/application_controller.rb +35 -38
- data/app/views/administrate/application/{_table.html.erb → _collection.html.erb} +26 -6
- data/app/views/administrate/application/_flashes.html.erb +13 -0
- data/app/views/administrate/application/_form.html.erb +23 -7
- data/app/views/administrate/application/_javascript.html.erb +9 -0
- data/app/views/administrate/application/_sidebar.html.erb +9 -0
- data/app/views/administrate/application/edit.html.erb +22 -3
- data/app/views/administrate/application/index.html.erb +31 -6
- data/app/views/administrate/application/new.html.erb +22 -3
- data/app/views/administrate/application/show.html.erb +24 -4
- data/app/views/fields/belongs_to/_form.html.erb +18 -0
- data/app/views/fields/belongs_to/_index.html.erb +17 -0
- data/app/views/fields/belongs_to/_show.html.erb +17 -0
- data/app/views/fields/boolean/_form.html.erb +17 -0
- data/app/views/fields/boolean/_index.html.erb +19 -1
- data/app/views/fields/boolean/_show.html.erb +19 -1
- data/app/views/fields/date_time/_form.html.erb +18 -0
- data/app/views/fields/date_time/_index.html.erb +18 -0
- data/app/views/fields/date_time/_show.html.erb +18 -0
- data/app/views/fields/email/_form.html.erb +17 -0
- data/app/views/fields/email/_index.html.erb +17 -0
- data/app/views/fields/email/_show.html.erb +17 -0
- data/app/views/fields/has_many/_form.html.erb +21 -0
- data/app/views/fields/has_many/_index.html.erb +18 -0
- data/app/views/fields/has_many/_show.html.erb +33 -3
- data/app/views/fields/has_one/_form.html.erb +21 -1
- data/app/views/fields/has_one/_index.html.erb +17 -0
- data/app/views/fields/has_one/_show.html.erb +17 -0
- data/app/views/fields/image/_form.html.erb +17 -0
- data/app/views/fields/image/_index.html.erb +17 -0
- data/app/views/fields/image/_show.html.erb +17 -0
- data/app/views/fields/number/_form.html.erb +17 -0
- data/app/views/fields/number/_index.html.erb +19 -1
- data/app/views/fields/number/_show.html.erb +19 -1
- data/app/views/fields/polymorphic/_form.html.erb +20 -0
- data/app/views/fields/polymorphic/_index.html.erb +18 -0
- data/app/views/fields/polymorphic/_show.html.erb +18 -0
- data/app/views/fields/string/_form.html.erb +17 -0
- data/app/views/fields/string/_index.html.erb +17 -0
- data/app/views/fields/string/_show.html.erb +17 -0
- data/app/views/fields/text/_form.html.erb +2 -0
- data/app/views/fields/text/_index.html.erb +1 -0
- data/app/views/fields/text/_show.html.erb +1 -0
- data/app/views/layouts/administrate/application.html.erb +15 -1
- data/config/locales/administrate.en.yml +14 -10
- data/lib/administrate/base_dashboard.rb +3 -2
- data/lib/administrate/engine.rb +1 -1
- data/lib/administrate/fields/has_many.rb +7 -3
- data/lib/administrate/fields/text.rb +21 -0
- data/lib/administrate/page/{table.rb → collection.rb} +2 -6
- data/lib/administrate/version.rb +1 -1
- data/lib/administrate/view_generator.rb +27 -0
- data/lib/generators/administrate/dashboard/dashboard_generator.rb +7 -1
- data/lib/generators/administrate/dashboard/templates/dashboard.rb.erb +16 -10
- data/lib/generators/administrate/field/field_generator.rb +31 -0
- data/lib/generators/administrate/field/templates/_form.html.erb +2 -0
- data/lib/generators/administrate/field/templates/_index.html.erb +1 -0
- data/lib/generators/administrate/field/templates/_show.html.erb +1 -0
- data/lib/generators/administrate/field/templates/field_object.rb.erb +7 -0
- data/lib/generators/administrate/views/edit_generator.rb +16 -0
- data/lib/generators/administrate/views/field_generator.rb +36 -0
- data/lib/generators/administrate/views/form_generator.rb +15 -0
- data/lib/generators/administrate/views/index_generator.rb +16 -0
- data/lib/generators/administrate/views/new_generator.rb +16 -0
- data/lib/generators/administrate/views/show_generator.rb +15 -0
- data/lib/generators/administrate/views/views_generator.rb +14 -0
- metadata +33 -15
- data/app/assets/stylesheets/administrate/_show.sass +0 -16
@@ -1 +1,18 @@
|
|
1
|
+
<%#
|
2
|
+
# Email Index Partial
|
3
|
+
|
4
|
+
This partial renders an email address,
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered as a `mailto` link.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Email][1].
|
13
|
+
A wrapper around the email pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Email
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= mail_to field.data %>
|
@@ -1 +1,18 @@
|
|
1
|
+
<%#
|
2
|
+
# Email Show Partial
|
3
|
+
|
4
|
+
This partial renders an email address,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered as a `mailto` link.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Email][1].
|
13
|
+
A wrapper around the email pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Email
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= mail_to field.data %>
|
@@ -1,3 +1,24 @@
|
|
1
|
+
<%#
|
2
|
+
# HasMany Form Partial
|
3
|
+
|
4
|
+
This partial renders an input element for belongs_to relationships.
|
5
|
+
By default, the input is a collection select box
|
6
|
+
that displays all possible records to associate with.
|
7
|
+
The collection select box supports multiple inputs,
|
8
|
+
and is augmented with [Selectize].
|
9
|
+
|
10
|
+
## Local variables:
|
11
|
+
|
12
|
+
- `f`:
|
13
|
+
A Rails form generator, used to help create the appropriate input fields.
|
14
|
+
- `field`:
|
15
|
+
An instance of [Administrate::Field::HasMany][1].
|
16
|
+
Contains helper methods for displaying a collection select box.
|
17
|
+
|
18
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
|
19
|
+
[Selectize]: http://brianreavis.github.io/selectize.js
|
20
|
+
%>
|
21
|
+
|
1
22
|
<%= f.label field.attribute_key %>
|
2
23
|
|
3
24
|
<%= f.collection_select(
|
@@ -1 +1,19 @@
|
|
1
|
+
<%#
|
2
|
+
# HasMany Index Partial
|
3
|
+
|
4
|
+
This partial renders a has_many relationship,
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered
|
8
|
+
as a count of how many objects are associated through the relationship.
|
9
|
+
|
10
|
+
## Local variables:
|
11
|
+
|
12
|
+
- `field`:
|
13
|
+
An instance of [Administrate::Field::HasMany][1].
|
14
|
+
A wrapper around the has_many relationship pulled from the database.
|
15
|
+
|
16
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
|
17
|
+
%>
|
18
|
+
|
1
19
|
<%= pluralize(field.data.count, field.attribute.to_s.humanize.downcase) %>
|
@@ -1,10 +1,40 @@
|
|
1
|
+
<%#
|
2
|
+
# HasMany Show Partial
|
3
|
+
|
4
|
+
This partial renders a has_many relationship,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered
|
8
|
+
as a table of the first few associated resources.
|
9
|
+
The columns of the table are taken
|
10
|
+
from the associated resource class's dashboard.
|
11
|
+
|
12
|
+
## Local variables:
|
13
|
+
|
14
|
+
- `field`:
|
15
|
+
An instance of [Administrate::Field::HasMany][1].
|
16
|
+
Contains methods to help display a table of associated resources.
|
17
|
+
|
18
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
|
19
|
+
%>
|
20
|
+
|
1
21
|
<% if field.resources.any? %>
|
2
22
|
<%= render(
|
3
|
-
"
|
4
|
-
|
23
|
+
"collection",
|
24
|
+
collection_presenter: field.associated_collection,
|
5
25
|
resources: field.resources
|
6
26
|
) %>
|
7
|
-
|
27
|
+
|
28
|
+
<% if field.more_than_limit? %>
|
29
|
+
<span>
|
30
|
+
<%= t(
|
31
|
+
'administrate.fields.has_many.more',
|
32
|
+
count: field.limit,
|
33
|
+
total_count: field.data.count,
|
34
|
+
) %>
|
35
|
+
</span>
|
36
|
+
<% end %>
|
37
|
+
|
8
38
|
<% else %>
|
9
39
|
<%= t("administrate.fields.has_many.none") %>
|
10
40
|
<% end %>
|
@@ -1,2 +1,22 @@
|
|
1
|
+
<%#
|
2
|
+
# HasOne Form Partial
|
3
|
+
|
4
|
+
This partial renders an input element for has_one relationships.
|
5
|
+
|
6
|
+
At the moment, has_one form fields are not supported,
|
7
|
+
so this partial renders a message to that effect.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `f`:
|
12
|
+
A Rails form generator, used to help create the appropriate input fields.
|
13
|
+
- `field`:
|
14
|
+
An instance of [Administrate::Field::HasOne][1].
|
15
|
+
A wrapper around the has_one relationship pulled from the database.
|
16
|
+
|
17
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasOne
|
18
|
+
%>
|
19
|
+
|
1
20
|
<%= f.label field.permitted_attribute %>
|
2
|
-
|
21
|
+
|
22
|
+
<%= t("administrate.fields.has_one.not_supported") %>
|
@@ -1,3 +1,20 @@
|
|
1
|
+
<%#
|
2
|
+
# HasOne Index Partial
|
3
|
+
|
4
|
+
This partial renders a has_one relationship,
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered as a link to the associated object.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::HasOne][1].
|
13
|
+
A wrapper around the has_one relationship pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasOne
|
16
|
+
%>
|
17
|
+
|
1
18
|
<% if field.data %>
|
2
19
|
<%= link_to field.data, [Administrate::NAMESPACE, field.data] %>
|
3
20
|
<% end %>
|
@@ -1,3 +1,20 @@
|
|
1
|
+
<%#
|
2
|
+
# HasOne Show Partial
|
3
|
+
|
4
|
+
This partial renders a has_one relationship,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered as a link to the associated object.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::HasOne][1].
|
13
|
+
A wrapper around the has_one relationship pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasOne
|
16
|
+
%>
|
17
|
+
|
1
18
|
<% if field.data %>
|
2
19
|
<%= link_to field.data, [Administrate::NAMESPACE, field.data] %>
|
3
20
|
<% end %>
|
@@ -1,2 +1,19 @@
|
|
1
|
+
<%#
|
2
|
+
# Image Form Partial
|
3
|
+
|
4
|
+
This partial renders an input element for image attributes.
|
5
|
+
By default, the input is a text field for the image's URL.
|
6
|
+
|
7
|
+
## Local variables:
|
8
|
+
|
9
|
+
- `f`:
|
10
|
+
A Rails form generator, used to help create the appropriate input fields.
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Image][1].
|
13
|
+
A wrapper around the image url pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= f.label field.attribute %>
|
2
19
|
<%= f.text_field field.attribute %>
|
@@ -1 +1,18 @@
|
|
1
|
+
<%#
|
2
|
+
# Image Index Partial
|
3
|
+
|
4
|
+
This partial renders an image attribute
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as an image tag.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Image][1].
|
13
|
+
A wrapper around the image url pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= image_tag field.data %>
|
@@ -1 +1,18 @@
|
|
1
|
+
<%#
|
2
|
+
# Image Show Partial
|
3
|
+
|
4
|
+
This partial renders an image attribute,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as an image tag.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Image][1].
|
13
|
+
A wrapper around the image url pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= image_tag field.data %>
|
@@ -1,2 +1,19 @@
|
|
1
|
+
<%#
|
2
|
+
# Number Form Partial
|
3
|
+
|
4
|
+
This partial renders an input element for number attributes.
|
5
|
+
By default, the input is a text field.
|
6
|
+
|
7
|
+
## Local variables:
|
8
|
+
|
9
|
+
- `f`:
|
10
|
+
A Rails form generator, used to help create the appropriate input fields.
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Number][1].
|
13
|
+
A wrapper around the number pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Number
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= f.label field.attribute %>
|
2
19
|
<%= f.text_field field.attribute %>
|
@@ -1 +1,19 @@
|
|
1
|
-
|
1
|
+
<%#
|
2
|
+
# Number Index Partial
|
3
|
+
|
4
|
+
This partial renders a number attribute,
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered
|
8
|
+
using the formatting options given in the resource's dashboard.
|
9
|
+
|
10
|
+
## Local variables:
|
11
|
+
|
12
|
+
- `field`:
|
13
|
+
An instance of [Administrate::Field::Number][1].
|
14
|
+
A wrapper around the number pulled from the database.
|
15
|
+
|
16
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Number
|
17
|
+
%>
|
18
|
+
|
19
|
+
<%= field.to_s %>
|
@@ -1 +1,19 @@
|
|
1
|
-
|
1
|
+
<%#
|
2
|
+
# Number Show Partial
|
3
|
+
|
4
|
+
This partial renders a number attribute,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered
|
8
|
+
using the formatting options given in the resource's dashboard.
|
9
|
+
|
10
|
+
## Local variables:
|
11
|
+
|
12
|
+
- `field`:
|
13
|
+
An instance of [Administrate::Field::Number][1].
|
14
|
+
A wrapper around the number pulled from the database.
|
15
|
+
|
16
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Number
|
17
|
+
%>
|
18
|
+
|
19
|
+
<%= field.to_s %>
|
@@ -1,3 +1,23 @@
|
|
1
|
+
<%#
|
2
|
+
# Polymorphic Form Partial
|
3
|
+
|
4
|
+
This partial renders an input element for polymorphic relationships.
|
5
|
+
|
6
|
+
At the moment, polymorphic form fields are not supported,
|
7
|
+
so this partial renders a message to that effect.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `f`:
|
12
|
+
A Rails form generator, used to help create the appropriate input fields.
|
13
|
+
- `field`:
|
14
|
+
An instance of [Administrate::Field::Polymorphic][1].
|
15
|
+
A wrapper around the polymorphic belongs_to relationship
|
16
|
+
pulled from the database.
|
17
|
+
|
18
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Polymorphic
|
19
|
+
%>
|
20
|
+
|
1
21
|
<%= f.label field.name %>
|
2
22
|
|
3
23
|
<%= t("administrate.fields.polymorphic.not_supported") %>
|
@@ -1,3 +1,21 @@
|
|
1
|
+
<%#
|
2
|
+
# Polymorphic Index Partial
|
3
|
+
|
4
|
+
This partial renders a polymorphic relationship,
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered as a link to the associated object.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Polymorphic][1].
|
13
|
+
A wrapper around the polymorphic belongs_to relationship
|
14
|
+
pulled from the database.
|
15
|
+
|
16
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Polymorphic
|
17
|
+
%>
|
18
|
+
|
1
19
|
<% if field.data %>
|
2
20
|
<%= link_to(
|
3
21
|
field.data.to_s,
|
@@ -1,3 +1,21 @@
|
|
1
|
+
<%#
|
2
|
+
# Polymorphic Show Partial
|
3
|
+
|
4
|
+
This partial renders a polymorphic relationship,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the relationship is rendered as a link to the associated object.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::Polymorphic][1].
|
13
|
+
A wrapper around the polymorphic belongs_to relationship
|
14
|
+
pulled from the database.
|
15
|
+
|
16
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Polymorphic
|
17
|
+
%>
|
18
|
+
|
1
19
|
<% if field.data %>
|
2
20
|
<%= link_to(
|
3
21
|
field.data.to_s,
|
@@ -1,2 +1,19 @@
|
|
1
|
+
<%#
|
2
|
+
# String Form Partial
|
3
|
+
|
4
|
+
This partial renders an input element for a string attribute.
|
5
|
+
By default, the input is a text field.
|
6
|
+
|
7
|
+
## Local variables:
|
8
|
+
|
9
|
+
- `f`:
|
10
|
+
A Rails form generator, used to help create the appropriate input fields.
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::String][1].
|
13
|
+
A wrapper around the String pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/String
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= f.label field.attribute %>
|
2
19
|
<%= f.text_field field.attribute %>
|
@@ -1 +1,18 @@
|
|
1
|
+
<%#
|
2
|
+
# String Index Partial
|
3
|
+
|
4
|
+
This partial renders a string attribute
|
5
|
+
to be displayed on a resource's index page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as a truncated string.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::String][1].
|
13
|
+
A wrapper around the String pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/String
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= field.truncate %>
|
@@ -1 +1,18 @@
|
|
1
|
+
<%#
|
2
|
+
# String Show Partial
|
3
|
+
|
4
|
+
This partial renders a string attribute,
|
5
|
+
to be displayed on a resource's show page.
|
6
|
+
|
7
|
+
By default, the attribute is rendered as an unformatted string.
|
8
|
+
|
9
|
+
## Local variables:
|
10
|
+
|
11
|
+
- `field`:
|
12
|
+
An instance of [Administrate::Field::String][1].
|
13
|
+
A wrapper around the String pulled from the database.
|
14
|
+
|
15
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/String
|
16
|
+
%>
|
17
|
+
|
1
18
|
<%= field.data %>
|