caboose-cms 0.9.187 → 0.9.188

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: 015b443d62f5ea387d8114f221f49c1668b75046
4
- data.tar.gz: ee16f3a096800da8f8980642465443a413ec1060
3
+ metadata.gz: a7c4525d7d5ed779edc5c25e6a37dd29262323c9
4
+ data.tar.gz: b1b52dbf65395b217f8c4e854e72de6c515d21ef
5
5
  SHA512:
6
- metadata.gz: 6b5f39ab0427ffdca934b1c318ffd189b056cb75bad48dc8dbd2f11680dee9672195b38133657b709a9f304a1aefe43637710ee11af6d526ee34f149664218df
7
- data.tar.gz: a2f53f506c63eebd45016721d81d0844e3e167f1b07ba70b76294b3d4fa80601aa2df4d871a0a5368754e5e8b7f88186cf63c0b3bdab0f633b91713b18cebf6b
6
+ metadata.gz: c92c9b8d2e143a115ecbce0bf7c9aedfe549a49242e89db2f27299094ee937c611c0257e7e9538259f0d355b95d378d94898d6851669bdb92d6cb3387ecd5f4d
7
+ data.tar.gz: 835515f737dea95f203937ed5426c6c0450443099aea3e557549b545f54b5d780135a21bd04b638f4609c9bb8b8892e18982427b6a3242fe9922f63733f7f5e8
@@ -4,49 +4,35 @@ module Caboose
4
4
 
5
5
  # @route GET /admin/inbox
6
6
  def admin_index
7
- has_inbox = "Contact".constantize rescue false
8
- if has_inbox
9
- where = params[:exclude].blank? ? "(id is not null)" : "(sent_to != '#{params[:exclude]}')"
10
- @contacts = Contact.where(where).where(:site_id => @site.id, :captcha_valid => true, :deleted => false).order('date_submitted desc').all
11
- end
7
+ where = params[:exclude].blank? ? "(id is not null)" : "(sent_to != '#{params[:exclude]}')"
8
+ @contacts = Caboose::FormSubmission.where(where).where(:site_id => @site.id, :is_spam => false, :is_deleted => false).order('date_submitted desc').all
12
9
  end
13
10
 
14
11
  # @route GET /admin/inbox/spam
15
12
  def admin_spam
16
- has_inbox = "Contact".constantize rescue false
17
- if has_inbox
18
- @contacts = Contact.where(:site_id => @site.id, :captcha_valid => false, :deleted => false).order('date_submitted desc').all
19
- end
13
+ @contacts = Caboose::FormSubmission.where(:site_id => @site.id, :is_spam => true, :is_deleted => false).order('date_submitted desc').all
20
14
  end
21
15
 
22
16
  # @route GET /admin/inbox/:id
23
17
  def admin_show
24
- has_inbox = "Contact".constantize rescue false
25
- if has_inbox
26
- @contact = Contact.where(:site_id => @site.id, :id => params[:id], :deleted => false).first
27
- end
18
+ @contact = Caboose::FormSubmission.where(:site_id => @site.id, :id => params[:id], :is_deleted => false).first
28
19
  end
29
20
 
30
21
  # @route GET /admin/inbox/:id/delete
31
22
  def admin_delete
32
- has_inbox = "Contact".constantize rescue false
33
- if has_inbox
34
- @contact = Contact.where(:site_id => @site.id, :id => params[:id]).first
35
- @contact.deleted = true
36
- @contact.save
37
- redirect_to '/admin/inbox'
38
- end
23
+ @contact = Caboose::FormSubmission.where(:site_id => @site.id, :id => params[:id]).first
24
+ @contact.is_deleted = true
25
+ @contact.save
26
+
27
+ redirect_to '/admin/inbox'
39
28
  end
40
29
 
41
30
  # @route GET /admin/inbox/:id/spam
42
31
  def admin_update
43
- has_inbox = "Contact".constantize rescue false
44
- if has_inbox
45
- @contact = Contact.where(:site_id => @site.id, :id => params[:id]).first
46
- @contact.captcha_valid = !@contact.captcha_valid
47
- @contact.save
48
- redirect_to '/admin/inbox/' + params[:id]
49
- end
32
+ @contact = Caboose::FormSubmission.where(:site_id => @site.id, :id => params[:id]).first
33
+ @contact.is_spam = !@contact.is_spam
34
+ @contact.save
35
+ redirect_to '/admin/inbox/' + params[:id]
50
36
  end
51
37
 
52
38
  end
@@ -215,9 +215,9 @@ module Caboose
215
215
  when 'zip' then site.zip = value
216
216
  when 'fax' then site.fax = value
217
217
  when 'contact_email' then site.contact_email = value
218
- when 'head_code' then site.head_code = value
219
- when 'body_open_code' then site.body_open_code = value
220
- when 'body_close_code' then site.body_close_code = value
218
+ when 'head_code' then site.head_code = (value.blank? ? nil : value.gsub('<end/script>','</script>'))
219
+ when 'body_open_code' then site.body_open_code = (value.blank? ? nil : value.gsub('<end/script>','</script>'))
220
+ when 'body_close_code' then site.body_close_code = (value.blank? ? nil : value.gsub('<end/script>','</script>'))
221
221
  end
222
222
  end
223
223
  resp.success = save && site.save
@@ -5,13 +5,12 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
5
5
 
6
6
  # nav << { 'id' => 'logout' , 'text' => 'Logout' , 'href' => '/logout' , 'modal' => false }
7
7
  # nav << { 'id' => 'my-account' , 'text' => 'My Account' , 'href' => '/my-account' , 'modal' => true }
8
- has_inbox = "Contact".constantize rescue false
9
8
  item = { 'id' => 'content', 'text' => 'Content', 'children' => [] }
10
9
  item['children'] << { 'id' => 'media' , 'text' => 'Media' , 'href' => '/admin/media' , 'modal' => false } if user.is_allowed('media' , 'view')
11
10
  item['children'] << { 'id' => 'pages' , 'text' => 'Pages' , 'href' => '/admin/pages' , 'modal' => false } if user.is_allowed('pages' , 'view')
12
11
  item['children'] << { 'id' => 'posts' , 'text' => 'Posts' , 'href' => '/admin/posts' , 'modal' => false } if user.is_allowed('posts' , 'view')
13
12
  item['children'] << { 'id' => 'calendars' , 'text' => 'Calendars' , 'href' => '/admin/calendars' , 'modal' => false } if user.is_allowed('calendars' , 'view')
14
- item['children'] << { 'icon' => 'box', 'id' => 'inbox' , 'text' => 'Inbox' , 'href' => '/admin/inbox' , 'modal' => false } if user.is_allowed('contacts' , 'view') && has_inbox && Contact.where(:site_id => site.id).count > 0
13
+ item['children'] << { 'icon' => 'box', 'id' => 'inbox' , 'text' => 'Inbox' , 'href' => '/admin/inbox' , 'modal' => false } if user.is_allowed('contacts' , 'view') && Caboose::FormSubmission.where(:site_id => site.id).count > 0
15
14
  nav << item if item['children'].count > 0
16
15
 
17
16
  item = { 'id' => 'core', 'text' => 'Settings', 'children' => [] }
@@ -0,0 +1,78 @@
1
+ class Caboose::FormSubmission < ActiveRecord::Base
2
+
3
+ self.table_name = "form_submissions"
4
+
5
+ belongs_to :site, :class_name => 'Caboose::Site'
6
+
7
+ attr_accessible :id,
8
+ :site_id,
9
+ :block_id,
10
+ :form_name,
11
+ :sent_to,
12
+ :bcc_to,
13
+ :category,
14
+ :date_submitted,
15
+ :is_spam,
16
+ :is_deleted,
17
+ :field1_name,
18
+ :field1_description,
19
+ :field1_value,
20
+ :field2_name,
21
+ :field2_description,
22
+ :field2_value,
23
+ :field3_name,
24
+ :field3_description,
25
+ :field3_value,
26
+ :field4_name,
27
+ :field4_description,
28
+ :field4_value,
29
+ :field5_name,
30
+ :field5_description,
31
+ :field5_value,
32
+ :field6_name,
33
+ :field6_description,
34
+ :field6_value,
35
+ :field7_name,
36
+ :field7_description,
37
+ :field7_value,
38
+ :field8_name,
39
+ :field8_description,
40
+ :field8_value,
41
+ :field9_name,
42
+ :field9_description,
43
+ :field9_value,
44
+ :field10_name,
45
+ :field10_description,
46
+ :field10_value,
47
+ :field11_name,
48
+ :field11_description,
49
+ :field11_value,
50
+ :field12_name,
51
+ :field12_description,
52
+ :field12_value,
53
+ :field13_name,
54
+ :field13_description,
55
+ :field13_value,
56
+ :field14_name,
57
+ :field14_description,
58
+ :field14_value,
59
+ :field15_name,
60
+ :field15_description,
61
+ :field15_value,
62
+ :field16_name,
63
+ :field16_description,
64
+ :field16_value,
65
+ :field17_name,
66
+ :field17_description,
67
+ :field17_value,
68
+ :field18_name,
69
+ :field18_description,
70
+ :field18_value,
71
+ :field19_name,
72
+ :field19_description,
73
+ :field19_value,
74
+ :field20_name,
75
+ :field20_description,
76
+ :field20_value
77
+
78
+ end
@@ -336,6 +336,77 @@ class Caboose::Schema < Caboose::Utilities::Schema
336
336
  [ :style , :string ],
337
337
  [ :sort_order , :integer ]
338
338
  ],
339
+ Caboose::FormSubmission => [
340
+ [ :site_id, :integer ],
341
+ [ :block_id, :integer ],
342
+ [ :form_name, :string ],
343
+ [ :sent_to, :string ],
344
+ [ :date_submitted, :datetime ],
345
+ [ :bcc_to, :string ],
346
+ [ :category, :string ],
347
+ [ :is_spam, :boolean , { :default => false }],
348
+ [ :is_deleted, :boolean , { :default => false }],
349
+ [ :field1_name, :string ],
350
+ [ :field1_description, :string ],
351
+ [ :field1_value, :text ],
352
+ [ :field2_name, :string ],
353
+ [ :field2_description, :string ],
354
+ [ :field2_value, :text ],
355
+ [ :field3_name, :string ],
356
+ [ :field3_description, :string ],
357
+ [ :field3_value, :text ],
358
+ [ :field4_name, :string ],
359
+ [ :field4_description, :string ],
360
+ [ :field4_value, :text ],
361
+ [ :field5_name, :string ],
362
+ [ :field5_description, :string ],
363
+ [ :field5_value, :text ],
364
+ [ :field6_name, :string ],
365
+ [ :field6_description, :string ],
366
+ [ :field6_value, :text ],
367
+ [ :field7_name, :string ],
368
+ [ :field7_description, :string ],
369
+ [ :field7_value, :text ],
370
+ [ :field8_name, :string ],
371
+ [ :field8_description, :string ],
372
+ [ :field8_value, :text ],
373
+ [ :field9_name, :string ],
374
+ [ :field9_description, :string ],
375
+ [ :field9_value, :text ],
376
+ [ :field10_name, :string ],
377
+ [ :field10_description, :string ],
378
+ [ :field10_value, :text ],
379
+ [ :field11_name, :string ],
380
+ [ :field11_description, :string ],
381
+ [ :field11_value, :text ],
382
+ [ :field12_name, :string ],
383
+ [ :field12_description, :string ],
384
+ [ :field12_value, :text ],
385
+ [ :field13_name, :string ],
386
+ [ :field13_description, :string ],
387
+ [ :field13_value, :text ],
388
+ [ :field14_name, :string ],
389
+ [ :field14_description, :string ],
390
+ [ :field14_value, :text ],
391
+ [ :field15_name, :string ],
392
+ [ :field15_description, :string ],
393
+ [ :field15_value, :text ],
394
+ [ :field16_name, :string ],
395
+ [ :field16_description, :string ],
396
+ [ :field16_value, :text ],
397
+ [ :field17_name, :string ],
398
+ [ :field17_description, :string ],
399
+ [ :field17_value, :text ],
400
+ [ :field18_name, :string ],
401
+ [ :field18_description, :string ],
402
+ [ :field18_value, :text ],
403
+ [ :field19_name, :string ],
404
+ [ :field19_description, :string ],
405
+ [ :field19_value, :text ],
406
+ [ :field20_name, :string ],
407
+ [ :field20_description, :string ],
408
+ [ :field20_value, :text ]
409
+ ],
339
410
  Caboose::GiftCard => [
340
411
  [ :site_id , :integer ],
341
412
  [ :name , :string ],
@@ -1,3 +1,39 @@
1
+ <%
2
+ def get_name(fs)
3
+ (1..20).each do |ind|
4
+ field = "field#{ind}_name".to_sym
5
+ value = "field#{ind}_value".to_sym
6
+ if fs[field] == 'name' || fs[field] == 'name_required'
7
+ return fs[value]
8
+ break
9
+ end
10
+ end
11
+ return
12
+ end
13
+ def get_subject(fs)
14
+ (1..20).each do |ind|
15
+ field = "field#{ind}_name".to_sym
16
+ value = "field#{ind}_value".to_sym
17
+ if fs[field] == 'subject' || fs[field] == 'subject_required'
18
+ return fs[value]
19
+ break
20
+ end
21
+ end
22
+ return ''
23
+ end
24
+ def get_message(fs)
25
+ (1..20).each do |ind|
26
+ field = "field#{ind}_name".to_sym
27
+ value = "field#{ind}_value".to_sym
28
+ if fs[field] == 'message' || fs[field] == 'message_required'
29
+ return fs[value]
30
+ break
31
+ end
32
+ end
33
+ return ''
34
+ end
35
+ %>
36
+
1
37
  <h1>Inbox</h1>
2
38
 
3
39
  <div class="constrain clearfix" style="padding:0 40px 0 10px;">
@@ -11,12 +47,12 @@
11
47
  <th>Message</th>
12
48
  <th>Date</th>
13
49
  </tr>
14
- <% @contacts.each do |c| %>
15
- <tr data-id="<%= c.id %>">
16
- <td><%= c.name %></td>
17
- <td><%= c.subject %></td>
18
- <td><%= c.message ? c.message.truncate(60) : '' %></td>
19
- <td><%= c.date_submitted.strftime('%-m/%-d/%Y') %></td>
50
+ <% @contacts.each do |fs| %>
51
+ <tr data-id="<%= fs.id %>">
52
+ <td><%= get_name(fs) %></td>
53
+ <td><%= get_subject(fs) %></td>
54
+ <td><%= get_message(fs).truncate(60) %></td>
55
+ <td><%= fs.date_submitted.strftime('%-m/%-d/%Y') %></td>
20
56
  </tr>
21
57
  <% end %>
22
58
  </table>
@@ -1,40 +1,52 @@
1
+ <%
2
+ email = nil
3
+ subject = 'Inquiry'
4
+ %>
5
+
1
6
  <h1>Inbox - Message</h1>
2
7
 
3
8
  <div class="constrain">
4
9
  <div class="inbox-message">
5
- <% if !@contact.captcha_valid %>
10
+ <% if @contact.is_spam %>
6
11
  <p class="spam">SPAM</p>
7
12
  <% end %>
8
13
  <table cellspacing="0" cellpadding="0">
9
- <tr>
10
- <td>Name</td>
11
- <td><%= @contact.name %></td>
12
- </tr>
13
- <tr>
14
- <td>Email</td>
15
- <td><a href="mailto:<%= @contact.email %>?subject=Re: <%= @contact.subject %>"><%= @contact.email %></a></td>
16
- </tr>
17
- <tr>
18
- <td>Sent To</td>
19
- <td><a href="mailto:<%= @contact.sent_to %>?subject=Re: <%= @contact.subject %>"><%= @contact.sent_to %></a></td>
20
- </tr>
21
14
  <tr>
22
15
  <td>Date Submitted</td>
23
16
  <td><%= @contact.date_submitted.strftime('%-m/%-d/%Y') %></td>
24
17
  </tr>
18
+ <% (1..20).each do |ind| %>
19
+ <%
20
+ field_name = "field#{ind}_name".to_s
21
+ field_desc = "field#{ind}_description".to_s
22
+ field_value = "field#{ind}_value".to_s
23
+ next if @contact[field_desc].nil?
24
+ if ['email','email_required','email_address','email_address_required'].include?(@contact[field_name])
25
+ email = @contact[field_value]
26
+ elsif ['subject','subject_required'].include?(@contact[field_name])
27
+ email = @contact[field_value]
28
+ end
29
+ %>
30
+ <tr>
31
+ <td><%= @contact[field_desc] %></td>
32
+ <td><%= @contact[field_value] %></td>
33
+ </tr>
34
+ <% end %>
25
35
  <tr>
26
- <td>Subject</td>
27
- <td><%= @contact.subject %></td>
36
+ <td>Sent To</td>
37
+ <td><a href="mailto:<%= @contact.sent_to %>?subject=Re: <%= subject %>"><%= @contact.sent_to %></a></td>
28
38
  </tr>
39
+ <% if !@contact.bcc_to.blank? %>
29
40
  <tr>
30
- <td>Message</td>
31
- <td><%= @contact.message %></td>
41
+ <td>BCC To</td>
42
+ <td><a href="mailto:<%= @contact.bcc_to %>?subject=Re: <%= subject %>"><%= @contact.bcc_to %></a></td>
32
43
  </tr>
44
+ <% end %>
33
45
  </table>
34
46
  <div class="buttons">
35
- <a href="mailto:<%= @contact.email %>?subject=Re: <%= @contact.subject %>" class="caboose-btn">Reply</a>
47
+ <a href="mailto:<%= email %>?subject=Re: <%= subject %>" class="caboose-btn">Reply</a>
36
48
  <a href="/admin/inbox/<%= @contact.id %>/delete" class="caboose-btn">Delete</a>
37
- <% if @contact.captcha_valid %>
49
+ <% if !@contact.is_spam %>
38
50
  <a href="/admin/inbox/<%= @contact.id %>/spam" class="caboose-btn">Mark as Spam</a>
39
51
  <% else %>
40
52
  <a href="/admin/inbox/<%= @contact.id %>/spam" class="caboose-btn">Mark as Not Spam</a>
@@ -1,3 +1,39 @@
1
+ <%
2
+ def get_name(fs)
3
+ (1..20).each do |ind|
4
+ field = "field#{ind}_name".to_sym
5
+ value = "field#{ind}_value".to_sym
6
+ if fs[field] == 'name' || fs[field] == 'name_required'
7
+ return fs[value]
8
+ break
9
+ end
10
+ end
11
+ return
12
+ end
13
+ def get_subject(fs)
14
+ (1..20).each do |ind|
15
+ field = "field#{ind}_name".to_sym
16
+ value = "field#{ind}_value".to_sym
17
+ if fs[field] == 'subject' || fs[field] == 'subject_required'
18
+ return fs[value]
19
+ break
20
+ end
21
+ end
22
+ return ''
23
+ end
24
+ def get_message(fs)
25
+ (1..20).each do |ind|
26
+ field = "field#{ind}_name".to_sym
27
+ value = "field#{ind}_value".to_sym
28
+ if fs[field] == 'message' || fs[field] == 'message_required'
29
+ return fs[value]
30
+ break
31
+ end
32
+ end
33
+ return ''
34
+ end
35
+ %>
36
+
1
37
  <h1>Inbox - Spam</h1>
2
38
 
3
39
  <div class="constrain clearfix" style="padding:0 40px 0 10px;">
@@ -11,12 +47,12 @@
11
47
  <th>Message</th>
12
48
  <th>Date</th>
13
49
  </tr>
14
- <% @contacts.each do |c| %>
15
- <tr data-id="<%= c.id %>">
16
- <td><%= c.name %></td>
17
- <td><%= c.subject %></td>
18
- <td><%= c.message ? c.message.truncate(60) : '' %></td>
19
- <td><%= c.date_submitted.strftime('%-m/%-d/%Y') %></td>
50
+ <% @contacts.each do |fs| %>
51
+ <tr data-id="<%= fs.id %>">
52
+ <td><%= get_name(fs) %></td>
53
+ <td><%= get_subject(fs) %></td>
54
+ <td><%= get_message(fs).truncate(60) %></td>
55
+ <td><%= fs.date_submitted.strftime('%-m/%-d/%Y') %></td>
20
56
  </tr>
21
57
  <% end %>
22
58
  </table>
@@ -28,9 +28,9 @@ $(document).ready(function() {
28
28
  update_url: '/admin/sites/<%= @site.id %>',
29
29
  authenticity_token: '<%= form_authenticity_token %>',
30
30
  attributes: [
31
- { name: 'head_code', nice_name: 'Code for &lt;head&gt;', type: 'textarea', value: <%== Caboose.json(@site.head_code) %>, width: 600, height: 300 },
32
- { name: 'body_open_code', nice_name: 'Code for after &lt;body&gt;', type: 'textarea', value: <%== Caboose.json(@site.body_open_code) %>, width: 600, height: 300 },
33
- { name: 'body_close_code', nice_name: 'Code for before &lt;/body&gt;', type: 'textarea', value: <%== Caboose.json(@site.body_close_code) %>, width: 600, height: 300 }
31
+ { name: 'head_code', nice_name: 'Code for &lt;head&gt;', type: 'textarea', value: <%== Caboose.json(@site.head_code.blank? ? '' : @site.head_code.gsub('</script>','<end/script>')) %>, width: 600, height: 300 },
32
+ { name: 'body_open_code', nice_name: 'Code for after &lt;body&gt;', type: 'textarea', value: <%== Caboose.json(@site.body_open_code.blank? ? '' : @site.body_open_code.gsub('</script>','<end/script>')) %>, width: 600, height: 300 },
33
+ { name: 'body_close_code', nice_name: 'Code for before &lt;/body&gt;', type: 'textarea', value: <%== Caboose.json(@site.body_close_code.blank? ? '' : @site.body_close_code.gsub('</script>','<end/script>')) %>, width: 600, height: 300 }
34
34
  ]
35
35
  });
36
36
  });
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.187'
2
+ VERSION = '0.9.188'
3
3
  end
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.9.187
4
+ version: 0.9.188
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -804,6 +804,7 @@ files:
804
804
  - app/models/caboose/font.rb
805
805
  - app/models/caboose/font_family.rb
806
806
  - app/models/caboose/font_variant.rb
807
+ - app/models/caboose/form_submission.rb
807
808
  - app/models/caboose/ga.rb
808
809
  - app/models/caboose/gift_card.rb
809
810
  - app/models/caboose/invoice.rb