administrate 0.0.7 → 0.0.8
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/helpers/administrate/application_helper.rb +2 -1
- data/app/views/administrate/application/_sidebar.html.erb +1 -1
- data/app/views/fields/belongs_to/_form.html.erb +7 -0
- data/app/views/fields/belongs_to/_index.html.erb +3 -0
- data/app/views/fields/belongs_to/_show.html.erb +3 -0
- data/app/views/fields/email/_form.html.erb +2 -0
- data/app/views/fields/email/_index.html.erb +1 -0
- data/app/views/fields/email/_show.html.erb +1 -0
- data/app/views/fields/has_many/_form.html.erb +11 -0
- data/app/views/fields/has_many/_index.html.erb +1 -0
- data/app/views/fields/has_many/_show.html.erb +9 -0
- data/app/views/fields/has_one/_form.html.erb +7 -0
- data/app/views/fields/has_one/_index.html.erb +3 -0
- data/app/views/fields/has_one/_show.html.erb +3 -0
- data/app/views/fields/image/_form.html.erb +2 -0
- data/app/views/fields/image/_index.html.erb +1 -0
- data/app/views/fields/image/_show.html.erb +1 -0
- data/app/views/fields/string/_form.html.erb +2 -0
- data/app/views/fields/string/_index.html.erb +1 -0
- data/app/views/fields/string/_show.html.erb +1 -0
- data/lib/administrate/base_dashboard.rb +16 -0
- data/lib/administrate/fields/base.rb +1 -1
- data/lib/administrate/version.rb +1 -1
- data/lib/generators/administrate/dashboard/templates/dashboard.rb.erb +24 -40
- data/lib/generators/administrate/install/templates/dashboard_manifest.rb.erb +8 -12
- data/lib/generators/administrate/install/templates/routes.rb +2 -2
- metadata +20 -20
- data/app/views/fields/form/_belongs_to.html.erb +0 -7
- data/app/views/fields/form/_email.html.erb +0 -2
- data/app/views/fields/form/_has_many.html.erb +0 -11
- data/app/views/fields/form/_has_one.html.erb +0 -7
- data/app/views/fields/form/_image.html.erb +0 -2
- data/app/views/fields/form/_string.html.erb +0 -2
- data/app/views/fields/index/_belongs_to.html.erb +0 -3
- data/app/views/fields/index/_email.html.erb +0 -1
- data/app/views/fields/index/_has_many.html.erb +0 -1
- data/app/views/fields/index/_has_one.html.erb +0 -3
- data/app/views/fields/index/_image.html.erb +0 -1
- data/app/views/fields/index/_string.html.erb +0 -1
- data/app/views/fields/show/_belongs_to.html.erb +0 -3
- data/app/views/fields/show/_email.html.erb +0 -1
- data/app/views/fields/show/_has_many.html.erb +0 -9
- data/app/views/fields/show/_has_one.html.erb +0 -3
- data/app/views/fields/show/_image.html.erb +0 -1
- data/app/views/fields/show/_string.html.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f7b0d12f02edff96609479df3375a76f8416daa
|
4
|
+
data.tar.gz: c40ce457633bb9ae64f34313d058917986d8944e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd8f1d80fa12320624e3c4c630ece69e5379a934f3ca22952648f9b42fd3f3aac5d3b99e146827a5f0732f825c6f9152e1f7a1fb7d348ffc55e690aae317232f
|
7
|
+
data.tar.gz: 682b91038a806ca8bfe0b0c1584eb6c9b95399bee08ee9ab35e39b864b3fa294d892bd7b38b007aeab85da2d71a32c6a01164b23f11ebef5f19ee90bacf21cb5
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= mail_to field.data %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= mail_to field.data %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= pluralize(field.data.count, field.attribute.to_s.humanize.downcase) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= image_tag field.data %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= image_tag field.data %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.data %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.data %>
|
@@ -9,10 +9,26 @@ module Administrate
|
|
9
9
|
class BaseDashboard
|
10
10
|
include Administrate
|
11
11
|
|
12
|
+
def attribute_types
|
13
|
+
self.class::ATTRIBUTE_TYPES
|
14
|
+
end
|
15
|
+
|
16
|
+
def form_attributes
|
17
|
+
self.class::FORM_ATTRIBUTES
|
18
|
+
end
|
19
|
+
|
12
20
|
def permitted_attributes
|
13
21
|
form_attributes.map do |attr|
|
14
22
|
attribute_types[attr].permitted_attribute(attr)
|
15
23
|
end.uniq
|
16
24
|
end
|
25
|
+
|
26
|
+
def show_page_attributes
|
27
|
+
self.class::SHOW_PAGE_ATTRIBUTES
|
28
|
+
end
|
29
|
+
|
30
|
+
def table_attributes
|
31
|
+
self.class::TABLE_ATTRIBUTES
|
32
|
+
end
|
17
33
|
end
|
18
34
|
end
|
data/lib/administrate/version.rb
CHANGED
@@ -1,53 +1,37 @@
|
|
1
1
|
require "administrate/base_dashboard"
|
2
2
|
|
3
3
|
class <%= class_name %>Dashboard < Administrate::BaseDashboard
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
READ_ONLY_ATTRIBUTES = [
|
5
|
+
:id,
|
6
|
+
:created_at,
|
7
|
+
:updated_at,
|
8
|
+
]
|
9
|
+
|
10
|
+
# ATTRIBUTE_TYPES
|
11
|
+
# a hash that describes the type of each of the model's fields.
|
7
12
|
#
|
8
13
|
# Each different type represents an Administrate::Field object,
|
9
14
|
# which determines how the attribute is displayed
|
10
15
|
# on pages throughout the dashboard.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
# that will be displayed on the model's index page.
|
16
|
+
ATTRIBUTE_TYPES = {
|
17
|
+
<% attributes.each do |attr| -%>
|
18
|
+
<%= attr %>: <%= field_type(attr) %>,
|
19
|
+
<% end -%>
|
20
|
+
}
|
21
|
+
|
22
|
+
# TABLE_ATTRIBUTES
|
23
|
+
# an array of attributes that will be displayed on the model's index page.
|
19
24
|
#
|
20
25
|
# By default, it's limited to four items to reduce clutter on index pages.
|
21
26
|
# Feel free to remove the limit or customize the returned array.
|
22
|
-
|
23
|
-
attributes.first(<%= TABLE_ATTRIBUTE_LIMIT %>)
|
24
|
-
end
|
25
|
-
|
26
|
-
# This method returns an array of attributes
|
27
|
-
# that will be displayed on the model's show page
|
28
|
-
def show_page_attributes
|
29
|
-
attributes
|
30
|
-
end
|
31
|
-
|
32
|
-
# This method returns an array of attributes
|
33
|
-
# that will be displayed on the model's form pages (`new` and `edit`)
|
34
|
-
def form_attributes
|
35
|
-
attributes - read_only_attributes
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
27
|
+
TABLE_ATTRIBUTES = ATTRIBUTE_TYPES.keys.first(<%= TABLE_ATTRIBUTE_LIMIT %>)
|
39
28
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
]
|
44
|
-
end
|
29
|
+
# SHOW_PAGE_ATTRIBUTES
|
30
|
+
# an array of attributes that will be displayed on the model's show page.
|
31
|
+
SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys
|
45
32
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
:updated_at,
|
51
|
-
]
|
52
|
-
end
|
33
|
+
# FORM_ATTRIBUTES
|
34
|
+
# an array of attributes that will be displayed
|
35
|
+
# on the model's form (`new` and `edit`) pages.
|
36
|
+
FORM_ATTRIBUTES = ATTRIBUTE_TYPES.keys - READ_ONLY_ATTRIBUTES
|
53
37
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# DashboardManifest tells Administrate which dashboards to display
|
2
2
|
class DashboardManifest
|
3
|
-
#
|
4
|
-
#
|
3
|
+
# `DASHBOARDS`
|
4
|
+
# a list of dashboards to display in the side navigation menu
|
5
5
|
#
|
6
6
|
# These are all of the rails models that we found in your database
|
7
7
|
# at the time you installed Administrate.
|
@@ -9,21 +9,17 @@ class DashboardManifest
|
|
9
9
|
# To show or hide dashboards, add or remove the model name from this list.
|
10
10
|
# Dashboards returned from this method must be Rails models for Administrate
|
11
11
|
# to work correctly.
|
12
|
-
|
13
|
-
[
|
12
|
+
DASHBOARDS = [
|
14
13
|
<% dashboard_resources.each do |model| -%>
|
15
|
-
|
14
|
+
:<%= model %>,
|
16
15
|
<% end -%>
|
17
|
-
|
18
|
-
end
|
16
|
+
]
|
19
17
|
|
20
|
-
#
|
21
|
-
#
|
18
|
+
# `ROOT_DASHBOARD`
|
19
|
+
# the name of the dashboard that will be displayed
|
22
20
|
# at "http://your_site.com/admin"
|
23
21
|
#
|
24
22
|
# This dashboard will likely be the first page that admins see
|
25
23
|
# when they log into the dashboard.
|
26
|
-
|
27
|
-
dashboards.first
|
28
|
-
end
|
24
|
+
ROOT_DASHBOARD = DASHBOARDS.first
|
29
25
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
namespace :admin do
|
2
|
-
DashboardManifest.
|
2
|
+
DashboardManifest::DASHBOARDS.each do |dashboard_resource|
|
3
3
|
resources dashboard_resource
|
4
4
|
end
|
5
5
|
|
6
|
-
root controller: DashboardManifest
|
6
|
+
root controller: DashboardManifest::ROOT_DASHBOARD, action: :index
|
7
7
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grayson Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neat
|
@@ -138,24 +138,24 @@ files:
|
|
138
138
|
- app/views/administrate/application/index.html.erb
|
139
139
|
- app/views/administrate/application/new.html.erb
|
140
140
|
- app/views/administrate/application/show.html.erb
|
141
|
-
- app/views/fields/
|
142
|
-
- app/views/fields/
|
143
|
-
- app/views/fields/
|
144
|
-
- app/views/fields/
|
145
|
-
- app/views/fields/
|
146
|
-
- app/views/fields/
|
147
|
-
- app/views/fields/
|
148
|
-
- app/views/fields/
|
149
|
-
- app/views/fields/
|
150
|
-
- app/views/fields/
|
151
|
-
- app/views/fields/
|
152
|
-
- app/views/fields/
|
153
|
-
- app/views/fields/
|
154
|
-
- app/views/fields/
|
155
|
-
- app/views/fields/
|
156
|
-
- app/views/fields/
|
157
|
-
- app/views/fields/
|
158
|
-
- app/views/fields/
|
141
|
+
- app/views/fields/belongs_to/_form.html.erb
|
142
|
+
- app/views/fields/belongs_to/_index.html.erb
|
143
|
+
- app/views/fields/belongs_to/_show.html.erb
|
144
|
+
- app/views/fields/email/_form.html.erb
|
145
|
+
- app/views/fields/email/_index.html.erb
|
146
|
+
- app/views/fields/email/_show.html.erb
|
147
|
+
- app/views/fields/has_many/_form.html.erb
|
148
|
+
- app/views/fields/has_many/_index.html.erb
|
149
|
+
- app/views/fields/has_many/_show.html.erb
|
150
|
+
- app/views/fields/has_one/_form.html.erb
|
151
|
+
- app/views/fields/has_one/_index.html.erb
|
152
|
+
- app/views/fields/has_one/_show.html.erb
|
153
|
+
- app/views/fields/image/_form.html.erb
|
154
|
+
- app/views/fields/image/_index.html.erb
|
155
|
+
- app/views/fields/image/_show.html.erb
|
156
|
+
- app/views/fields/string/_form.html.erb
|
157
|
+
- app/views/fields/string/_index.html.erb
|
158
|
+
- app/views/fields/string/_show.html.erb
|
159
159
|
- app/views/layouts/administrate/application.html.erb
|
160
160
|
- config/locales/administrate.en.yml
|
161
161
|
- config/routes.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= mail_to email.data %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= pluralize(has_many.data.count, has_many.attribute.to_s.humanize.downcase) %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= image_tag image.data %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= string.data %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= mail_to email.data %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= image_tag image.data %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= string.data %>
|