mongoid_document_editor 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/app/views/mongoid/document_editor/documents/all.html.erb +1 -1
- data/app/views/mongoid/document_editor/documents/show.html.erb +2 -2
- data/lib/mongoid/document_editor/engine.rb +0 -1
- data/lib/mongoid/document_editor/version.rb +1 -1
- data/lib/mongoid/document_editor.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 315b498c71c33efea421f4fb5c441d7e1e2dc114
|
4
|
+
data.tar.gz: d6cc5ac3cb3b39af545236e2c5213229865ec547
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a37ead5afdf640322f335a85421824e69d45c28b3bd938879a343d8d2c8e7027e14feb42197f32d7f7276d0f8191ca98d6e7830e7917bcfde9af3b05d9584ac6
|
7
|
+
data.tar.gz: d65768557bceea31bc9abace587e125ddb7c9ab6638851ff866862d94de319e41a6d0643459a4b4079f5fc155864fe2669c40d7c19e39c8cd4eb26b57336b91d
|
data/README.md
CHANGED
@@ -11,6 +11,8 @@ Mongoid::DocumentEditor.configure do
|
|
11
11
|
authenticate_with :admin_required
|
12
12
|
|
13
13
|
mount_at "/admin/documents"
|
14
|
+
|
15
|
+
resources exclude: [:user_roles]
|
14
16
|
|
15
17
|
form_configuration_for User do
|
16
18
|
field :first_name
|
@@ -38,7 +40,8 @@ In your application visit: **/documents**
|
|
38
40
|
`authenticate_with`: Provide a controller filter for granting / denying access
|
39
41
|
`form_configuration_for Class`: Allows you to specify the fields that you want on the form for the specified class
|
40
42
|
`index_configuration_for Class`: Allows you to specify the columns that are displayed on the index page
|
41
|
-
`mount_at`: Endpoint where editor is mounted (default is **/documents**)
|
43
|
+
`mount_at`: Endpoint where editor is mounted (default is **/documents**)
|
44
|
+
`resources`: Include or exclude specific models from the editor interface
|
42
45
|
|
43
46
|
### Notes
|
44
47
|
In development mode set `preload_models: true`
|
@@ -15,11 +15,11 @@
|
|
15
15
|
<h3><%= key %></h3>
|
16
16
|
<% if [:has_many, :has_and_belongs_to_many].include?(@document.relations[key].macro) %>
|
17
17
|
<% @document.send(key).each do |relation| %>
|
18
|
-
<p><%= link_to relation.send(:id), document_path(model_param(
|
18
|
+
<p><%= link_to relation.send(:id), document_path(model_param(relation.class.name), relation.send(:id)) %></p>
|
19
19
|
<% end %>
|
20
20
|
<% elsif [:has_one, :belongs_to].include?(@document.relations[key].macro) %>
|
21
21
|
<% if relation = @document.send(key) %>
|
22
|
-
<p><%= link_to relation.send(:id), document_path(model_param(
|
22
|
+
<p><%= link_to relation.send(:id), document_path(model_param(relation.class.name), relation.send(:id)) %></p>
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
@@ -4,7 +4,6 @@ module Mongoid
|
|
4
4
|
isolate_namespace Mongoid::DocumentEditor
|
5
5
|
|
6
6
|
initializer :assets, group: :all do |app|
|
7
|
-
app.config.assets.paths += ["vendor/assets/stylesheets/base"]
|
8
7
|
app.config.assets.precompile += ["base/style.css", "base/doc.css", "jquery.js", "jquery_ujs.js"]
|
9
8
|
end
|
10
9
|
|
@@ -20,6 +20,9 @@ module Mongoid
|
|
20
20
|
mattr_accessor :endpoint
|
21
21
|
@@endpoint = "/documents"
|
22
22
|
|
23
|
+
mattr_accessor :models
|
24
|
+
@@models = Mongoid.models
|
25
|
+
|
23
26
|
def self.configure(&block)
|
24
27
|
instance_eval(&block)
|
25
28
|
end
|
@@ -61,5 +64,16 @@ module Mongoid
|
|
61
64
|
@@endpoint = endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
def self.resources(options={})
|
68
|
+
::Rails::Mongoid.load_models(Rails.application)
|
69
|
+
if options[:include]
|
70
|
+
@@models = Mongoid.models.select{ |model| Array(options[:include]).include?(model.to_s.underscore.downcase.to_sym) }
|
71
|
+
elsif options[:exclude]
|
72
|
+
@@models = Mongoid.models.reject{ |model| Array(options[:exclude]).include?(model.to_s.underscore.downcase.to_sym) }
|
73
|
+
else
|
74
|
+
@@models = Mongoid.models
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
64
78
|
end
|
65
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_document_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick DeSteffen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|