fullstack-admin 0.1.36 → 0.1.37
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO.tasks +19 -9
- data/VERSION +1 -1
- data/app/helpers/admin_form_helper.rb +69 -36
- data/app/models/ckeditor/attachment_file.rb +1 -3
- data/app/views/admin/base/_nested_form.html.erb +1 -1
- data/app/views/admin/base/destroy.js.coffee +1 -1
- data/config/locales/it.yml +1 -1
- data/config/locales/labels.it.yml +1 -1
- data/fullstack-admin.gemspec +1 -1
- metadata +2 -2
data/TODO.tasks
CHANGED
@@ -2,28 +2,38 @@
|
|
2
2
|
= Fullstack Admin Roadmap =
|
3
3
|
===========================
|
4
4
|
|
5
|
-
|
5
|
+
✓ fix delete not removing rows/thumbnails on success
|
6
6
|
|
7
7
|
✓ Better rendering for boolean input
|
8
8
|
|
9
|
-
|
9
|
+
✓ Nested forms for Has Many associations
|
10
10
|
✓ Sorting
|
11
11
|
✓ autogenerate from has_many
|
12
|
-
|
12
|
+
✓ skip input for associated model
|
13
13
|
|
14
14
|
✓ Fix production issues
|
15
15
|
|
16
16
|
✓ Multiple choice input with chosen
|
17
17
|
|
18
|
+
✓ Image inputs NB. Changed to file_input
|
19
|
+
✓ detect smaller image size for thumbnails
|
20
|
+
✓ inference of input type from model
|
21
|
+
|
22
|
+
✓ Ckeditor: upload assets to S3 according to app.config
|
23
|
+
|
24
|
+
- Localizable models
|
25
|
+
- Create Localized module: a model is localizable if has a :locale field (cms?)
|
26
|
+
- Add a scope to Localized to find models within the current locale (cms?)
|
27
|
+
|
28
|
+
- Create an option to specify the admin_locale
|
29
|
+
- add a before filter to Admin::BaseController that uses the default locale for the admin
|
30
|
+
- Split localized models index into tabs (either through ajax?)
|
31
|
+
- Let the programmer decide a default locale and a set of available locales
|
32
|
+
- Translations for locale codes
|
33
|
+
|
18
34
|
- Form for accepts_nested_attributes_for and has_one
|
19
|
-
|
20
|
-
- Image inputs
|
21
|
-
- detect smaller image size for thumbnails
|
22
|
-
- inference of input type from model
|
23
|
-
|
24
35
|
- Optional tracking of author/updaters for every model (CMS?)
|
25
36
|
|
26
|
-
|
27
37
|
==================
|
28
38
|
= Long Run Goals =
|
29
39
|
==================
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.37
|
@@ -51,18 +51,51 @@ module AdminFormHelper
|
|
51
51
|
except_arg = options[:except] || []
|
52
52
|
except_attributes = except_arg + model.protected_attributes.to_a + %W(created_at updated_at slug slugs lat lng position)
|
53
53
|
|
54
|
-
only_attributes.map! {|a|
|
55
|
-
except_attributes.map! {|a|
|
56
|
-
|
57
|
-
columns = model.schema.hierarchy_field_names
|
54
|
+
only_attributes.map! {|a| a.to_s}
|
55
|
+
except_attributes.map! {|a| a.to_s}
|
56
|
+
|
57
|
+
columns = model.schema.hierarchy_field_names
|
58
|
+
|
59
|
+
# ===============
|
60
|
+
# = Attachments =
|
61
|
+
# ===============
|
58
62
|
|
59
63
|
attachment_definitions = (model.attachment_definitions || {}).keys
|
60
64
|
attachment_columns = attachment_definitions.map {|a|
|
61
|
-
[
|
65
|
+
["#{a}_file_name", "#{a}_file_size", "#{a}_content_type", "#{a}_updated_at"]
|
62
66
|
}.flatten
|
63
|
-
|
67
|
+
|
64
68
|
columns -= attachment_columns
|
65
69
|
columns += attachment_definitions
|
70
|
+
|
71
|
+
|
72
|
+
# ================
|
73
|
+
# = Associations =
|
74
|
+
# ================
|
75
|
+
|
76
|
+
columns = columns.map {|field_name|
|
77
|
+
field_name.to_s.gsub(/_id$/, "").gsub(/_type$/, "")
|
78
|
+
}.uniq
|
79
|
+
|
80
|
+
belongs_to_associations = model.reflect_on_all_associations(:belongs_to).select {|a|
|
81
|
+
!a.options[:polymorphic]
|
82
|
+
}.map {|assoc| assoc.name.to_s}
|
83
|
+
|
84
|
+
polymorphic_associations = model.reflect_on_all_associations(:belongs_to).select {|a|
|
85
|
+
a.options[:polymorphic]
|
86
|
+
}.map {|assoc| assoc.name.to_s}
|
87
|
+
|
88
|
+
has_many_associations = model.reflect_on_all_associations(:has_many).select {|a|
|
89
|
+
a.options[:autosave]
|
90
|
+
}.map {|assoc| assoc.name.to_s}
|
91
|
+
|
92
|
+
columns -= polymorphic_associations
|
93
|
+
columns += has_many_associations
|
94
|
+
|
95
|
+
|
96
|
+
# ====================================
|
97
|
+
# = Intersect with :only and :except =
|
98
|
+
# ====================================
|
66
99
|
|
67
100
|
if only_attributes.any?
|
68
101
|
columns = columns.select {|k| only_attributes.include?(k)}
|
@@ -70,42 +103,42 @@ module AdminFormHelper
|
|
70
103
|
columns = columns.delete_if {|k| except_attributes.include?(k)}
|
71
104
|
end
|
72
105
|
|
106
|
+
|
107
|
+
# =============
|
108
|
+
# = Rendering =
|
109
|
+
# =============
|
110
|
+
|
73
111
|
buff = ""
|
74
112
|
|
75
|
-
columns.each
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
buff << @target.input(k, :as => :select)
|
81
|
-
end
|
82
|
-
else
|
83
|
-
|
84
|
-
if field = model.schema.hierarchy_fields[k]
|
85
|
-
if field.options[:markup]
|
86
|
-
buff << @target.input(k, :as => :markup)
|
87
|
-
elsif field.options[:simple_markup]
|
88
|
-
buff << @target.input(k, :as => :simple_markup)
|
89
|
-
else
|
90
|
-
buff << @target.input(k)
|
91
|
-
end
|
92
|
-
else
|
93
|
-
buff << @target.input(k)
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
113
|
+
columns.each do |column|
|
114
|
+
sym = column.to_sym
|
115
|
+
field = model.schema.hierarchy_fields[sym]
|
116
|
+
is_belongs_to_associaiton = belongs_to_associations.include?(column)
|
117
|
+
is_has_many_association = has_many_associations.include?(column)
|
97
118
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
119
|
+
buff << if is_belongs_to_associaiton
|
120
|
+
@target.input(sym, :as => :select)
|
121
|
+
|
122
|
+
elsif is_has_many_association
|
123
|
+
association_inputs(sym)
|
124
|
+
else
|
125
|
+
input_type = if field && field.options[:markup]
|
126
|
+
:markup
|
127
|
+
elsif field && field.options[:simple_markup]
|
128
|
+
:simple_markup
|
129
|
+
else
|
130
|
+
nil
|
131
|
+
end
|
132
|
+
|
133
|
+
@target.input(sym, :as => input_type)
|
134
|
+
|
135
|
+
end
|
102
136
|
end
|
103
137
|
|
104
|
-
|
105
|
-
buff
|
138
|
+
inputs do
|
139
|
+
buff.html_safe
|
106
140
|
end
|
107
|
-
|
108
|
-
buff
|
141
|
+
|
109
142
|
end
|
110
143
|
|
111
144
|
def resource_submit
|
@@ -1,7 +1,5 @@
|
|
1
1
|
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
-
|
3
|
-
:url => "/ckeditor_assets/attachments/:id/:filename",
|
4
|
-
:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
|
2
|
+
has_attached :data
|
5
3
|
|
6
4
|
validates_attachment_size :data, :less_than => 100.megabytes
|
7
5
|
validates_attachment_presence :data
|
@@ -40,7 +40,7 @@
|
|
40
40
|
<% begin %>
|
41
41
|
<%= render :partial => "admin/#{association}/associated_fields", :locals => {:f => f} %>
|
42
42
|
<% rescue ActionView::MissingTemplate %>
|
43
|
-
<%= f.resource_inputs %>
|
43
|
+
<%= f.resource_inputs :except => [resource_name] %>
|
44
44
|
<% end %>
|
45
45
|
|
46
46
|
<%= f.hidden_field(:_destroy, :class => "destroy-associated-resource") %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if
|
1
|
+
<% if current_resource.destroyed? %>
|
2
2
|
$("a[data-method='delete']").filter("[href='<%=j request.path %>']").closest("tr, li").remove()
|
3
3
|
notify_notice('<%=j t("fullstack.admin.flash.success.delete") %>')
|
4
4
|
<% else %>
|
data/config/locales/it.yml
CHANGED
@@ -37,7 +37,7 @@ it:
|
|
37
37
|
success:
|
38
38
|
generic: "Cambiamenti salvati con successo"
|
39
39
|
update: "Documento salvato con successo"
|
40
|
-
delete: "
|
40
|
+
delete: "Documento eliminato con successo"
|
41
41
|
|
42
42
|
error:
|
43
43
|
generic: "Cambiamenti non salvati a causa di un errore"
|
data/fullstack-admin.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fullstack-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.37
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -1329,7 +1329,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1329
1329
|
version: '0'
|
1330
1330
|
segments:
|
1331
1331
|
- 0
|
1332
|
-
hash: -
|
1332
|
+
hash: -4320214889325089488
|
1333
1333
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1334
1334
|
none: false
|
1335
1335
|
requirements:
|