administrate 1.0.0.beta2 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/builds/administrate/application.js +329 -299
- data/app/assets/builds/administrate/application.js.map +4 -4
- data/app/views/administrate/application/new.html.erb +1 -1
- data/app/views/fields/rich_text/_form.html.erb +16 -0
- data/docs/customizing_dashboards.md +5 -5
- data/docs/customizing_page_views.md +22 -0
- data/docs/guides/scoping_has_many_relations.md +2 -2
- data/lib/administrate/field/associative.rb +1 -1
- data/lib/administrate/version.rb +1 -1
- data/lib/generators/administrate/views/index_generator.rb +4 -0
- metadata +8 -8
@@ -1,3 +1,19 @@
|
|
1
|
+
<%#
|
2
|
+
# Rich Text Form Partial
|
3
|
+
|
4
|
+
This partial renders a trix-editor element for ActionText::RichText attributes.
|
5
|
+
|
6
|
+
## Local variables:
|
7
|
+
|
8
|
+
- `f`:
|
9
|
+
A Rails form generator, used to help create the appropriate trix-editor fields.
|
10
|
+
- `field`:
|
11
|
+
An instance of [Administrate::Field::RichText][1].
|
12
|
+
A wrapper around the tmie attributes pulled from the model.
|
13
|
+
|
14
|
+
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/RichText
|
15
|
+
%>
|
16
|
+
|
1
17
|
<div class="field-unit__label">
|
2
18
|
<%= f.label field.attribute %>
|
3
19
|
</div>
|
@@ -106,12 +106,12 @@ For example:
|
|
106
106
|
with this, you will be able to search through the column `name` from the
|
107
107
|
association `belongs_to :country`, from your model.
|
108
108
|
|
109
|
+
`:class_name` - Specifies the name of the associated class.
|
110
|
+
|
109
111
|
`:primary_key` (deprecated) - Specifies the association's primary_key.
|
110
112
|
|
111
113
|
`:foreign_key` (deprecated) - Specifies the name of the foreign key directly.
|
112
114
|
|
113
|
-
`:class_name` (deprecated) - Specifies the name of the associated class.
|
114
|
-
|
115
115
|
**Field::HasMany**
|
116
116
|
|
117
117
|
`:collection_attributes` - Set the columns to display in the show view.
|
@@ -124,12 +124,12 @@ set this to `0` or `false`. Default is `5`.
|
|
124
124
|
|
125
125
|
`:direction` - What direction the sort should be in, `:asc` (default) or `:desc`.
|
126
126
|
|
127
|
+
`:class_name` - Specifies the name of the associated class.
|
128
|
+
|
127
129
|
`:primary_key` (deprecated) - Specifies object's primary_key.
|
128
130
|
|
129
131
|
`:foreign_key` (deprecated) - Specifies the name of the foreign key directly.
|
130
132
|
|
131
|
-
`:class_name` (deprecated) - Specifies the name of the associated class.
|
132
|
-
|
133
133
|
**Field::HasOne**
|
134
134
|
|
135
135
|
`:order` - Specifies the column used to order the records. It will apply both in
|
@@ -154,7 +154,7 @@ For example:
|
|
154
154
|
with this, you will be able to search through the column `name` from the
|
155
155
|
association `has_one :city`, from your model.
|
156
156
|
|
157
|
-
`:class_name`
|
157
|
+
`:class_name` - Specifies the name of the associated class.
|
158
158
|
|
159
159
|
**Field::Number**
|
160
160
|
|
@@ -119,3 +119,25 @@ For example, you can add a button in the middle of the header as follows:
|
|
119
119
|
|
120
120
|
<%= render template: 'administrate/application/_index_header', locals: local_assigns %>
|
121
121
|
```
|
122
|
+
|
123
|
+
## Adding custom CSS and JS
|
124
|
+
|
125
|
+
You can add custom CSS and JS to Administrate. Put the files in the
|
126
|
+
appropriate folders (typically under `assets`) and point Administrate to them
|
127
|
+
using the following API, preferably in an initializer. For example, if your
|
128
|
+
files are called `admin.css` and `admin.js`:
|
129
|
+
|
130
|
+
```
|
131
|
+
/// config/initializers/administrate.rb
|
132
|
+
Administrate::Engine.add_stylesheet("admin")
|
133
|
+
Administrate::Engine.add_javascript("admin")
|
134
|
+
```
|
135
|
+
|
136
|
+
Then make sure to list them in your manifest file (Rails will helpfully remind
|
137
|
+
you of this step if you miss it):
|
138
|
+
|
139
|
+
```
|
140
|
+
/// app/assets/config/manifest.js
|
141
|
+
//= link admin.css
|
142
|
+
//= link admin.js
|
143
|
+
```
|
@@ -18,10 +18,10 @@ Since ActiveRecord infers the class name from the first argument, the new `has_m
|
|
18
18
|
|
19
19
|
## Add new relationship to dashboard
|
20
20
|
|
21
|
-
Your new scoped relation can be used in the dashboard just like the original `HasMany`.
|
21
|
+
Your new scoped relation can be used in the dashboard just like the original `HasMany`.
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
ATTRIBUTE_TYPES = {
|
25
25
|
orders: Field::HasMany,
|
26
|
-
processed_orders: Field::HasMany
|
26
|
+
processed_orders: Field::HasMany
|
27
27
|
```
|
data/lib/administrate/version.rb
CHANGED
@@ -9,7 +9,11 @@ module Administrate
|
|
9
9
|
def copy_template
|
10
10
|
copy_resource_template("index")
|
11
11
|
copy_resource_template("_collection")
|
12
|
+
copy_resource_template("_collection_header_actions")
|
13
|
+
copy_resource_template("_collection_item_actions")
|
12
14
|
copy_resource_template("_index_header")
|
15
|
+
copy_resource_template("_pagination")
|
16
|
+
copy_resource_template("_search")
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Charlton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '6.0'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '9.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '6.0'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '9.0'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: actionview
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '6.0'
|
41
41
|
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '9.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
version: '6.0'
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '9.0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: activerecord
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
version: '6.0'
|
61
61
|
- - "<"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
63
|
+
version: '9.0'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -70,7 +70,7 @@ dependencies:
|
|
70
70
|
version: '6.0'
|
71
71
|
- - "<"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '9.0'
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: kaminari
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|