caboose-cms 0.3.91 → 0.3.92
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/model/bound_select.js +9 -1
- data/app/controllers/caboose/page_block_fields_controller.rb +14 -31
- data/app/models/caboose/page_block.rb +1 -2
- data/app/models/caboose/page_block_field.rb +13 -1
- data/app/models/caboose/schema.rb +1 -0
- data/app/views/caboose/page_block_fields/admin_edit.html.erb +7 -0
- data/app/views/caboose/page_block_types/admin_edit.html.erb +5 -0
- data/app/views/caboose/page_blocks/admin_edit.html.erb +2 -2
- data/lib/caboose/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2I0NjQ2MWY3OGM0NDY4ODc1OTUzMmIyNzJlMjhkM2Y3ZDMyZDBhMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWU1OGQ1MzllYjVkYTY1NjNjNWQzYjU0MWIwMTEyMGVkZDM0YzYzYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzJkMmUwMmFlNmIxOWQ3OTVmMjc4NzU0YzNmMGE5YzJlMTU4NGFlYmU5NWZj
|
10
|
+
NmE3M2ExYzVmODAyYmYzODA0YTBmOTM0NmY3ZGQ4ZDgwY2JmZjRhNzIxNjA2
|
11
|
+
MzdiZDI3MTU2YzgwYjY5OTUwYjIwNWI4YmNmMmRkMzZlOTYwMTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTg4NmZmNTM3ZGE4N2QyNjc1MmFhYzg1M2MwNzViMjA5Mjg3OTFiMWEyNjQz
|
14
|
+
M2EyZTkzZjI4MzhhOGIxNWQ2NGFlOTk1MTJiZGI5MTY2MWJlODcxMWM4YmU0
|
15
|
+
YmJmYTEzMDA5MWFjNTAyMGU0YzhlYjdiM2MzZmY3Nzg2MDM0M2I=
|
@@ -89,7 +89,11 @@ BoundSelect = BoundControl.extend({
|
|
89
89
|
.val(option.value)
|
90
90
|
.html(option.text);
|
91
91
|
if (option.value == this2.attribute.value)
|
92
|
+
{
|
93
|
+
this2.attribute.text = option.text;
|
94
|
+
$('#'+this2.el).val(this2.attribute.text);
|
92
95
|
opt.attr('selected', 'true');
|
96
|
+
}
|
93
97
|
select.append(opt);
|
94
98
|
});
|
95
99
|
$('#'+this2.el+'_container').append(select);
|
@@ -136,7 +140,11 @@ BoundSelect = BoundControl.extend({
|
|
136
140
|
save: function() {
|
137
141
|
this.attribute.value = $('#'+this.el).val();
|
138
142
|
var this2 = this;
|
139
|
-
this.model.save(this.attribute, function(resp) {
|
143
|
+
this.model.save(this.attribute, function(resp) {
|
144
|
+
$(this2.attribute.options).each(function(i,opt) {
|
145
|
+
if (opt.value == this2.attribute.value)
|
146
|
+
this2.attribute.text = opt.text;
|
147
|
+
});
|
140
148
|
if (this2.attribute.text)
|
141
149
|
$('#'+this2.el).val(this2.attribute.text);
|
142
150
|
$('#'+this2.el+'_check a').removeClass('loading');
|
@@ -62,36 +62,17 @@ module Caboose
|
|
62
62
|
|
63
63
|
params.each do |k,v|
|
64
64
|
case k
|
65
|
-
when 'page_block_type_id'
|
66
|
-
|
67
|
-
|
68
|
-
when '
|
69
|
-
field.
|
70
|
-
|
71
|
-
when '
|
72
|
-
|
73
|
-
|
74
|
-
when '
|
75
|
-
|
76
|
-
break
|
77
|
-
when 'default'
|
78
|
-
field.default = v
|
79
|
-
break
|
80
|
-
when 'width'
|
81
|
-
field.width = v
|
82
|
-
break
|
83
|
-
when 'height'
|
84
|
-
field.height = v
|
85
|
-
break
|
86
|
-
when 'fixed_placeholder'
|
87
|
-
field.fixed_placeholder = v
|
88
|
-
break
|
89
|
-
when 'options'
|
90
|
-
field.options = v
|
91
|
-
break
|
92
|
-
when 'options_url'
|
93
|
-
field.options_url = v
|
94
|
-
break
|
65
|
+
when 'page_block_type_id' then field.page_block_type_id = v
|
66
|
+
when 'name' then field.name = v
|
67
|
+
when 'field_type' then field.field_type = v
|
68
|
+
when 'nice_name' then field.nice_name = v
|
69
|
+
when 'default' then field.default = v
|
70
|
+
when 'width' then field.width = v
|
71
|
+
when 'height' then field.height = v
|
72
|
+
when 'fixed_placeholder' then field.fixed_placeholder = v
|
73
|
+
when 'options' then field.options = v
|
74
|
+
when 'options_function' then field.options_function = v
|
75
|
+
when 'options_url' then field.options_url = v
|
95
76
|
end
|
96
77
|
end
|
97
78
|
|
@@ -130,7 +111,9 @@ module Caboose
|
|
130
111
|
return unless user_is_allowed('pages', 'edit')
|
131
112
|
f = PageBlockField.find(params[:id])
|
132
113
|
options = []
|
133
|
-
if f.
|
114
|
+
if f.options_function
|
115
|
+
options = f.render_options
|
116
|
+
elsif f.options
|
134
117
|
options = f.options.strip.split("\n").collect { |line| { 'value' => line, 'text' => line }}
|
135
118
|
end
|
136
119
|
render :json => options
|
@@ -40,8 +40,7 @@ class Caboose::PageBlock < ActiveRecord::Base
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def render_from_function(empty_text = nil, editing = false)
|
44
|
-
Caboose.log("editing = #{editing}")
|
43
|
+
def render_from_function(empty_text = nil, editing = false)
|
45
44
|
locals = OpenStruct.new(:block => self, :empty_text => empty_text, :editing => editing)
|
46
45
|
erb = ERB.new(page_block_type.render_function)
|
47
46
|
return erb.result(locals.instance_eval { binding })
|
@@ -4,6 +4,18 @@ class Caboose::PageBlockField < ActiveRecord::Base
|
|
4
4
|
|
5
5
|
belongs_to :page_block_type
|
6
6
|
has_many :page_block_field_values, :dependent => :destroy
|
7
|
-
attr_accessible :id,
|
7
|
+
attr_accessible :id,
|
8
|
+
:page_block_type_id,
|
9
|
+
:name, :field_type,
|
10
|
+
:nice_name, :default,
|
11
|
+
:width, :height,
|
12
|
+
:fixed_placeholder,
|
13
|
+
:options,
|
14
|
+
:options_function,
|
15
|
+
:options_url
|
16
|
+
|
17
|
+
def render_options(empty_text = nil)
|
18
|
+
return eval(self.options_function)
|
19
|
+
end
|
8
20
|
|
9
21
|
end
|
@@ -128,6 +128,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
128
128
|
[ :height , :integer ],
|
129
129
|
[ :fixed_placeholder , :boolean ],
|
130
130
|
[ :options , :text ],
|
131
|
+
[ :options_function , :text ],
|
131
132
|
[ :options_url , :string ]
|
132
133
|
],
|
133
134
|
Caboose::PageBlockFieldValue => [
|
@@ -11,6 +11,7 @@ block_type_id = @field.page_block_type.id
|
|
11
11
|
<div id='pageblockfield_<%= @field.id %>_height'></div>
|
12
12
|
<div id='pageblockfield_<%= @field.id %>_fixed_placeholder'></div>
|
13
13
|
<div id='pageblockfield_<%= @field.id %>_options_url'></div>
|
14
|
+
<div id='pageblockfield_<%= @field.id %>_options_function'></div>
|
14
15
|
<div id='pageblockfield_<%= @field.id %>_options'></div>
|
15
16
|
<br />
|
16
17
|
|
@@ -20,6 +21,11 @@ block_type_id = @field.page_block_type.id
|
|
20
21
|
<input type='button' value='Delete Field' onclick="delete_field(<%= @field.id %>);" />
|
21
22
|
</p>
|
22
23
|
|
24
|
+
<% content_for :caboose_css do %>
|
25
|
+
<style type='text/css'>
|
26
|
+
#pageblockfield_<%= @field.id %>_options_function { font-family: Courier; font-size: 80%; }
|
27
|
+
</style>
|
28
|
+
<% end %>
|
23
29
|
<% content_for :caboose_js do %>
|
24
30
|
<%= javascript_include_tag "caboose/model/all" %>
|
25
31
|
<script type="text/javascript">
|
@@ -61,6 +67,7 @@ $(document).ready(function() {
|
|
61
67
|
{ name: 'height' , nice_name: 'Height' , type: 'text' , value: <%= raw Caboose.json(@field.height) %>, width: 400 },
|
62
68
|
{ name: 'fixed_placeholder' , nice_name: 'Fixed placeholder' , type: 'checkbox' , value: <%= raw Caboose.json(@field.fixed_placeholder) %>, width: 400 },
|
63
69
|
{ name: 'options_url' , nice_name: 'Options URL' , type: 'text' , value: <%= raw Caboose.json(@field.options_url) %>, width: 400 },
|
70
|
+
{ name: 'options_function' , nice_name: 'Options Function' , type: 'textarea' , value: <%= raw Caboose.json(@field.options_function) %>, width: 400, height: 100 },
|
64
71
|
{ name: 'options' , nice_name: 'Options' , type: 'textarea' , value: <%= raw Caboose.json(@field.options) %>, width: 400, height: 100 }
|
65
72
|
]
|
66
73
|
});
|
@@ -32,6 +32,11 @@
|
|
32
32
|
<input type='button' value='Delete Block Type' onclick="delete_block_type(<%= @block_type.id %>);" />
|
33
33
|
</p>
|
34
34
|
|
35
|
+
<% content_for :caboose_css do %>
|
36
|
+
<style type='text/css'>
|
37
|
+
#pageblocktype_<%= @block_type.id %>_render_function { font-family: Courier; font-size: 80%; }
|
38
|
+
</style>
|
39
|
+
<% end %>
|
35
40
|
<% content_for :caboose_js do %>
|
36
41
|
<%= javascript_include_tag "caboose/model/all" %>
|
37
42
|
<script type="text/javascript">
|
@@ -44,8 +44,8 @@ $(document).ready(function() {
|
|
44
44
|
width: <% if f.width %><%= raw Caboose.json(f.width) %><% else %>780<% end %>,
|
45
45
|
<% if f.height %>height: <%= raw Caboose.json(f.height) %>,<% end %>
|
46
46
|
<% if f.fixed_placeholder %>fixed_placeholder: <%= raw Caboose.json(f.fixed_placeholder) %>,<% end %>
|
47
|
-
<% if f.options
|
48
|
-
elsif f.options_url %>options_url: <%= raw Caboose.json(f.options_url)
|
47
|
+
<% if f.options || f.options_function %>options_url: '/admin/page-block-fields/<%= f.id %>/options',<%
|
48
|
+
elsif f.options_url %>options_url: <%= raw Caboose.json(f.options_url) %>,<% end %>
|
49
49
|
<% if f.field_type == 'image' %>update_url: '/admin/page-block-field-values/<%= fv.id %>/image',
|
50
50
|
image_refresh_delay: 100,
|
51
51
|
<% end %>
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.92
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|