caboose-cms 0.8.84 → 0.8.85

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14a12fad22edc7f59cff7fe4bdb5ca1da9f004f7
4
- data.tar.gz: e32519e73727ab75017a63cc29e7815487f65310
3
+ metadata.gz: 65c733a7f3995558a46f3453e11a29dd3f0c5a1d
4
+ data.tar.gz: 293ae7956fc12b5c071ec94650c59de6572ec6c8
5
5
  SHA512:
6
- metadata.gz: 25db246aa9baaf53310aec22e30039146f3cffeadcd5fe4f831f09709f19a9fbf75de7d20b0a4c6ff5d67a36c0bb70e20ae06afa05b479afc0bf0b56e1d87392
7
- data.tar.gz: a8e01d7f2079d5c4947ea2bfa2c2317110e06996a6f2131fe0a234063400df918793bf7a7faae53986314669ae840c304eb41656c2979cea4ce01a2c85266ad0
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.print_step1();
38
+ that.html_form();
39
39
  },
40
40
 
41
- print_step1: function()
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/>').append($('<input/>').attr('type', 'button').val("Parse!").click(function() {
64
- that.original_html = $('#html').val();
65
- $.each(that.parsable_tags, function(tag, name) { that.tags_to_parse[tag] = $('#'+tag).is(':checked'); });
66
- that.parse_tags();
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
- parse_tags: function(show_json)
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
- if (show_json)
95
- {
96
- $('#'+that.container).empty()
97
- .append($('<textarea/>').attr('id', 'json').css('width', '90%').css('height', '400px').html(JSON.stringify(that.last_response)))
98
- .append($('<p/>')
99
- .append($('<input/>').attr('type', 'button').val("< Back to HTML").click(function() { that.print_step1(); })).append(' ')
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('Field Type'))
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/>').attr('colspan', '2').append('Child Values'))
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
- var tr = $('<tr/>')
123
- .append(field_types[v.field_type])
124
- .append($('<td/>').attr('valign', 'top').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; })))
125
- .append($('<td/>').attr('valign', 'top').append($('<input/>').data('i', i).val(v.description ).on('keyup', function(e) { that.children[parseInt($(this).data('i'))].description = $(this).val(); })))
126
- .append($('<td/>').attr('valign', 'top').append($('<input/>').data('i', i).val(v.default ).on('keyup', function(e) { that.children[parseInt($(this).data('i'))].default = $(this).val(); })));
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
- if (j > 0)
133
- tr.append($('<td/>').attr('colspan', '4').html("&nbsp;"));
134
- tr.append($('<td/>').attr('align', 'right').append(k))
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
- tbody.append(tr);
137
- tr = $('<tr/>');
138
- j++;
146
+ tbody.append($('<tr/>')
147
+ .append($('<td/>').append(' - ' + k))
148
+ .append($('<td/>').html("&nbsp;"))
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("&nbsp;"))
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($('<textarea/>').attr('id', 'parsed').css('width', '90%').css('height', '400px').html(that.render_function))
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.print_step1(); })).append(' ')
151
- .append($('<input/>').attr('type', 'button').val("Re-parse with Updated Variables").click(function() { that.parse_tags(); })).append(' ')
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
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.8.84'
2
+ VERSION = '0.8.85'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.84
4
+ version: 0.8.85
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry