rails_admin_json_editor 0.0.13 → 0.0.14
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aa4afd9f01c476433ebae3221d370a416dc649e
|
4
|
+
data.tar.gz: 5dad5a0d49dfc8a562b5681dc8d07a4b351651be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 547b6cc3da9459664881963d7941c0ee704c4b1cc4a29debfae5b4f4f58d044f96b3f3ffe6da3dedb3c6de09723c87c314e3b000f7368a9524a7ebebda2b74a4
|
7
|
+
data.tar.gz: f7ea15755b4baa12c8923a38f79b17dd8e97457f83c2fe3e47094f8dc9cc74537b6fefbf4338e221bc7e8743722a03524d08ff452e390210ddd0ef191997042a
|
@@ -65,13 +65,17 @@
|
|
65
65
|
<input type="checkbox" v-model="component.properties.<%= f.name %>" class="form-control">
|
66
66
|
<% end %>
|
67
67
|
|
68
|
+
<% if f.type == :enum %>
|
69
|
+
<%= select_tag(nil, options_for_select(f.enum_options), include_blank: true, class: "form-control", "v-model" => "component.properties.#{f.name}") %>
|
70
|
+
<% end %>
|
71
|
+
|
68
72
|
<% if f.type == :picker %>
|
69
73
|
<select v-on="change: onChangePicker($event, '<%= f.name %>')" class="form-control record-picker">
|
70
74
|
<option value=""></option>
|
71
75
|
<%
|
72
|
-
records = Rails.cache.fetch("record-picker-#{f.picker_model_name}")
|
76
|
+
records = Rails.cache.fetch("record-picker-#{f.picker_model_name}") do
|
73
77
|
f.picker_model_name.constantize.send(:all)
|
74
|
-
|
78
|
+
end
|
75
79
|
%>
|
76
80
|
<% records.each do |record| %>
|
77
81
|
<option
|
@@ -92,32 +96,34 @@
|
|
92
96
|
</div>
|
93
97
|
</div>
|
94
98
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<
|
110
|
-
|
111
|
-
<
|
112
|
-
<
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
99
|
+
<div v-show="!component.properties.<%= f.name %> || component.properties.<%= f.name %>.length < <%= f.list_max_length.nil? ? 999999 : f.list_max_length %>">
|
100
|
+
<!-- Add nested component -- one model allowed -->
|
101
|
+
<% if f.list_model_names.count == 1 %>
|
102
|
+
<a href="#"
|
103
|
+
class="btn btn-info"
|
104
|
+
v-repeat="model: $root.scheme.models"
|
105
|
+
v-show="nestedModelIsAllowed(model, <%= f.list_model_names %>)"
|
106
|
+
v-on="click: addComponent($event, '<%= f.name %>', model)">
|
107
|
+
Add {{ model.label | lowercase }}
|
108
|
+
</a>
|
109
|
+
<% end %>
|
110
|
+
|
111
|
+
<!-- Add nested component -- multiple models allowed -->
|
112
|
+
<% if f.list_model_names.count > 1 %>
|
113
|
+
<div class="dropdown">
|
114
|
+
<a class="dropdown-toggle btn btn-info" data-toggle="dropdown" href="#">Add component <b class="caret"></b></a>
|
115
|
+
<ul class="dropdown-menu">
|
116
|
+
<li v-repeat="model: $root.scheme.models">
|
117
|
+
<a href="#"
|
118
|
+
v-if="nestedModelIsAllowed(model, <%= f.list_model_names %>)"
|
119
|
+
v-on="click: addComponent($event, '<%= f.name %>', model)">
|
120
|
+
{{ model.label }}
|
121
|
+
</a>
|
122
|
+
</li>
|
123
|
+
</ul>
|
124
|
+
</div>
|
125
|
+
<% end %>
|
126
|
+
</div>
|
121
127
|
<% end %>
|
122
128
|
|
123
129
|
<%= content_tag :p, f.help, class: "help-block" unless f.help.nil? %>
|
@@ -74,7 +74,10 @@ module RailsAdmin
|
|
74
74
|
attr_accessor :picker_label,
|
75
75
|
:picker_model_name
|
76
76
|
|
77
|
-
attr_accessor :list_model_names
|
77
|
+
attr_accessor :list_model_names,
|
78
|
+
:list_max_length
|
79
|
+
|
80
|
+
attr_accessor :enum_options
|
78
81
|
|
79
82
|
def initialize(name, type, options = {})
|
80
83
|
@name = name
|
@@ -99,8 +102,13 @@ module RailsAdmin
|
|
99
102
|
@picker_model_name = options[:model].name
|
100
103
|
end
|
101
104
|
|
102
|
-
def list(models)
|
105
|
+
def list(models, options = {})
|
103
106
|
@list_model_names = Array(models).map { |m| m.name.gsub("::","___") }
|
107
|
+
@list_max_length = options[:max_length]
|
108
|
+
end
|
109
|
+
|
110
|
+
def enum(options)
|
111
|
+
@enum_options = options
|
104
112
|
end
|
105
113
|
end
|
106
114
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_json_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jasper Haggenburg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|