mongoid_document_editor 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e667df0d6895b145154012579487f4b1d413a07a
4
- data.tar.gz: 42c750a2a40fd1587c1a294e1b2ce7ec5338a261
3
+ metadata.gz: 315b498c71c33efea421f4fb5c441d7e1e2dc114
4
+ data.tar.gz: d6cc5ac3cb3b39af545236e2c5213229865ec547
5
5
  SHA512:
6
- metadata.gz: 93b81f2ea431ef08d9abe74bbad8b6dabac909c081fea369c445460af1128983b3b7b9bec37d43dd3dfb6fabfdfab6ec17d0bc3a447e5670f465b632755d8df0
7
- data.tar.gz: a63c8ca121a2026fcd949de0d746f77d314d25e0d162a4c8c2d4ba762eeed264294325c931bf21eb03a18696bae872254b332e1935aa75bf632ec720007f72c5
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`
@@ -1,3 +1,3 @@
1
- <% Mongoid.models.each do |model| %>
1
+ <% Mongoid::DocumentEditor.models.each do |model| %>
2
2
  <p><%= link_to model_param(model), documents_path(model_param(model)) %></p>
3
3
  <% end %>
@@ -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(value.class_name), relation.send(:id)) %></p>
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(value.class_name), relation.send(:id)) %></p>
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
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module DocumentEditor
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -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
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-08-03 00:00:00.000000000 Z
11
+ date: 2013-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails