caboose-cms 0.8.84 → 0.8.85
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: 65c733a7f3995558a46f3453e11a29dd3f0c5a1d
|
4
|
+
data.tar.gz: 293ae7956fc12b5c071ec94650c59de6572ec6c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61ec5173bb6007cae13d6130e6ad0ee37d23a132693ba4df015fdf056b7478671811948a60f0eb5292aa33541f76f30b13c419df576695e15e456b3299e68dcb
|
7
|
+
data.tar.gz: 355fedb418323553d24700e953e018ac7c4b007410625747ebe9aac9a08635c4a7990a0a4aee0ef4141edb4999a70fc45423c48a233af94aecbec03c5e9397c2
|
@@ -35,10 +35,10 @@ AdminBlockTypeParserController.prototype = {
|
|
35
35
|
for (var i in params)
|
36
36
|
this[i] = params[i];
|
37
37
|
|
38
|
-
that.
|
38
|
+
that.html_form();
|
39
39
|
},
|
40
40
|
|
41
|
-
|
41
|
+
html_form: function()
|
42
42
|
{
|
43
43
|
var that = this;
|
44
44
|
|
@@ -58,20 +58,40 @@ AdminBlockTypeParserController.prototype = {
|
|
58
58
|
|
59
59
|
var div = $('<div/>')
|
60
60
|
.append(tags_table)
|
61
|
-
.append($('<p/>').append($('<textarea/>').attr('id', 'html').css('width', '90%').css('height', '400px').attr('placeholder', 'HTML to Parse').html(that.original_html)))
|
61
|
+
.append($('<p/>').append($('<textarea/>').attr('id', 'html').css('width', '90%').css('height', '400px').attr('placeholder', 'HTML or JSON to Parse').html(that.original_html)))
|
62
62
|
.append($('<div/>').attr('id', 'message'))
|
63
|
-
.append($('<p/>')
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
.append($('<p/>')
|
64
|
+
.append($('<input/>').attr('type', 'button').val("Parse as HTML").click(function() {
|
65
|
+
that.original_html = $('#html').val();
|
66
|
+
$.each(that.parsable_tags, function(tag, name) { that.tags_to_parse[tag] = $('#'+tag).is(':checked'); });
|
67
|
+
that.parse_html(function() { that.render_function_form(); });
|
68
|
+
})).append(' ')
|
69
|
+
.append($('<input/>').attr('type', 'button').val("Parse as JSON" ).click(function() {
|
70
|
+
var resp = false;
|
71
|
+
try { resp = JSON.parse($('#html').val()); }
|
72
|
+
catch (ex) {
|
73
|
+
$('#message').html("<p class='note error'>There was an error parsing the JSON. It doesn't appear to be valid.</p>");
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
that.last_response = resp;
|
77
|
+
that.original_html = resp.original_html;
|
78
|
+
that.render_function = resp.render_function;
|
79
|
+
that.children = resp.children;
|
80
|
+
that.render_function_form();
|
81
|
+
}))
|
82
|
+
);
|
68
83
|
$('#'+that.container).empty().append(div);
|
69
84
|
},
|
70
85
|
|
71
|
-
|
86
|
+
parse_html: function(callback)
|
72
87
|
{
|
73
|
-
var that = this;
|
74
|
-
|
88
|
+
var that = this;
|
89
|
+
if (!that.original_html || that.original_html.trim().length == 0)
|
90
|
+
{
|
91
|
+
$('#message').html("<p class='note error'>HTML to parse can't be empty.</p>");
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
|
75
95
|
var tags = [];
|
76
96
|
$.each(that.tags_to_parse, function(tag, checked) { if (checked) tags.push(tag); });
|
77
97
|
$.ajax({
|
@@ -90,25 +110,19 @@ AdminBlockTypeParserController.prototype = {
|
|
90
110
|
},
|
91
111
|
async: false
|
92
112
|
});
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
.append($('<input/>').attr('type', 'button').val("Show Parsed").click(function() { that.parse_tags(); }))
|
101
|
-
);
|
102
|
-
return;
|
103
|
-
}
|
104
|
-
|
113
|
+
if (callback)
|
114
|
+
callback();
|
115
|
+
},
|
116
|
+
|
117
|
+
render_function_form: function()
|
118
|
+
{
|
119
|
+
var that = this;
|
105
120
|
var tbody = $('<tbody/>')
|
106
121
|
.append($('<tr/>')
|
107
|
-
.append($('<th/>').append('
|
108
|
-
.append($('<th/>').append('Name'))
|
122
|
+
.append($('<th/>').append('Name'))
|
109
123
|
.append($('<th/>').append('Description'))
|
110
124
|
.append($('<th/>').append('Default Value'))
|
111
|
-
.append($('<th/>').
|
125
|
+
.append($('<th/>').append('Field Type'))
|
112
126
|
);
|
113
127
|
|
114
128
|
var field_types = {
|
@@ -119,39 +133,40 @@ AdminBlockTypeParserController.prototype = {
|
|
119
133
|
};
|
120
134
|
$.each(that.children, function(i, v) {
|
121
135
|
|
122
|
-
|
123
|
-
.append(
|
124
|
-
.append($('<td/>').
|
125
|
-
.append($('<td/>').
|
126
|
-
.append($('<td/>').
|
136
|
+
tbody.append($('<tr/>')
|
137
|
+
.append($('<td/>').append($('<input/>').data('i', i).val(v.name ).on('keyup', function(e) { var x = $(this).val().toLowerCase().replace(' ', '_'); $(this).val(x); that.children[parseInt($(this).data('i'))].name = x; })))
|
138
|
+
.append($('<td/>').append($('<input/>').data('i', i).val(v.description ).on('keyup', function(e) { that.children[parseInt($(this).data('i'))].description = $(this).val(); })))
|
139
|
+
.append($('<td/>').append($('<input/>').data('i', i).val(v.default ).on('keyup', function(e) { that.children[parseInt($(this).data('i'))].default = $(this).val(); })))
|
140
|
+
.append($('<td/>').append(field_types[v.field_type]))
|
141
|
+
);
|
127
142
|
|
128
143
|
if (v.child_values)
|
129
144
|
{
|
130
|
-
j = 0;
|
131
145
|
$.each(v.child_values, function(k,v) {
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
.append($('<td/>').append($('<input/>').data('i', i).data('k', k).val(v).on('keyup', function(e) { that.children[parseInt($(this).data('i'))].child_values[$(this).data('k')] = $(this).val(); })))
|
136
|
-
|
137
|
-
|
138
|
-
j++;
|
146
|
+
tbody.append($('<tr/>')
|
147
|
+
.append($('<td/>').append(' - ' + k))
|
148
|
+
.append($('<td/>').html(" "))
|
149
|
+
.append($('<td/>').append($('<input/>').data('i', i).data('k', k).val(v).on('keyup', function(e) { that.children[parseInt($(this).data('i'))].child_values[$(this).data('k')] = $(this).val(); })))
|
150
|
+
.append($('<td/>').html(" "))
|
151
|
+
)
|
139
152
|
});
|
140
|
-
}
|
141
|
-
else
|
142
|
-
tbody.append(tr);
|
153
|
+
}
|
143
154
|
});
|
144
155
|
var vars_table = $('<table/>').append(tbody);
|
145
156
|
|
146
157
|
$('#'+that.container).empty()
|
158
|
+
.append($('<h2/>').append("Variables"))
|
147
159
|
.append(vars_table)
|
148
|
-
.append($('<
|
160
|
+
.append($('<h2/>').append("Render Function"))
|
161
|
+
.append($('<textarea/>').attr('id', 'parsed').css('width', '90%').css('height', '200px').html(that.render_function))
|
162
|
+
.append($('<h2/>').append("JSON"))
|
163
|
+
.append($('<p/>').append('Copy to save for future use.'))
|
164
|
+
.append($('<textarea/>').attr('id', 'json' ).css('width', '90%').css('height', '100px').html(JSON.stringify(that.last_response)))
|
149
165
|
.append($('<p/>')
|
150
|
-
.append($('<input/>').attr('type', 'button').val("< Back to HTML").click(function() { that.
|
151
|
-
.append($('<input/>').attr('type', 'button').val("Re-parse with Updated Variables").click(function() { that.
|
152
|
-
.append($('<input/>').attr('type', 'button').val("Show JSON").click(function() { that.parse_tags(true); }))
|
166
|
+
.append($('<input/>').attr('type', 'button').val("< Back to HTML").click(function() { that.html_form(); })).append(' ')
|
167
|
+
.append($('<input/>').attr('type', 'button').val("Re-parse HTML with Updated Variables" ).click(function() { that.parse_html(function() { that.render_function_form(); }); })).append(' ')
|
153
168
|
);
|
154
|
-
}
|
169
|
+
}
|
155
170
|
};
|
156
171
|
|
157
172
|
|
@@ -745,7 +745,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
745
745
|
[ :password , :string ],
|
746
746
|
[ :authentication , :string ], # :plain, :login, :cram_md5.
|
747
747
|
[ :enable_starttls_auto , :boolean , { :default => true }],
|
748
|
-
[ :from_address , :string ]
|
748
|
+
[ :from_address , :string ],
|
749
|
+
[ :reply_to_address , :string ]
|
749
750
|
],
|
750
751
|
Caboose::SocialConfig => [
|
751
752
|
[ :site_id , :integer ],
|
@@ -1154,5 +1155,12 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
1154
1155
|
if Caboose::ShippingMethod.all.count == 0
|
1155
1156
|
Caboose::ShippingMethodLoader.load_shipping_methods
|
1156
1157
|
end
|
1158
|
+
|
1159
|
+
# Make sure all the reply-to addresses are populated
|
1160
|
+
Caboose::SmtpConfig.where('reply_to_address is null and from_address is not null').all.each do |smtp|
|
1161
|
+
smtp.reply_to_address = smtp.from_address
|
1162
|
+
smtp.save
|
1163
|
+
end
|
1164
|
+
|
1157
1165
|
end
|
1158
1166
|
end
|
data/lib/caboose/version.rb
CHANGED