cama_contact_form 0.0.21 → 0.0.22

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: aeeebe970c4ef3669393d2f08f7021376e25918e
4
- data.tar.gz: 12338ea8e74945bda54bb49ce32c95b979b272de
3
+ metadata.gz: e857bfd46d47e32d37dbbae8d46117d36d3a2e79
4
+ data.tar.gz: 8b82e5eac78c251375927f40ff745e71d1025c3f
5
5
  SHA512:
6
- metadata.gz: 84950c0821f38ce1c7490ddcbb1bf386e9bcc63002a0cf33b99e6eec583c4f2731c939e47877ed4debae5287aa206f6b2c9ab8318f3eedaeaa466369f2ba4361
7
- data.tar.gz: 9ee6c393a414f60919ed6744b7eccb845dd22d8ebb4fca21489e6b21b9b21236cd8912113f73fcb8801cd56c97ca5efa9599ed9f0a7084f6dbcff18f9bc11698
6
+ metadata.gz: c657a6a584448301ed06e4046eefd93e5a87e1d5de0ba23cf47ac7ba1e644485bcd099e1c983c42f018e3a2b045a05d70818977a9677cf121142a1745b5c260e
7
+ data.tar.gz: 9f0a1b3b02df99b2cb76073bab6e2f6d4d6c1d0b9c908f1b7c6d03cbcdf81cfc7b1bb85f42cebe55d93978496323a3aa697ff36a12f92fcbf6a76eb3b5452c7c
@@ -54,6 +54,14 @@ class Plugins::CamaContactForm::AdminFormsController < CamaleonCms::Apps::Plugin
54
54
  @forms = @forms.paginate(:page => params[:page], :per_page => current_site.admin_per_page)
55
55
  end
56
56
 
57
+ def del_response
58
+ response = current_site.contact_forms.find_by_id(params[:response_id])
59
+ if response.present? && response.destroy
60
+ flash[:notice] = "#{t('.actions.msg_deleted', default: 'The response has been deleted')}"
61
+ end
62
+ redirect_to action: :responses
63
+ end
64
+
57
65
  def manual
58
66
 
59
67
  end
@@ -82,6 +82,7 @@ module Plugins::CamaContactForm::MainHelper
82
82
  ob = r[:field]
83
83
  ob[:custom_class] = r[:custom_class]
84
84
  ob[:custom_attrs] = r[:custom_attrs]
85
+ ob[:custom_attrs][:required] = 'true' if ob[:required].present? && ob[:required].to_bool
85
86
  field_options = ob[:field_options]
86
87
  for_name = ob[:label].to_s
87
88
  f_name = "fields[#{ob[:cid]}]"
@@ -22,6 +22,7 @@
22
22
  <th><%= f[:label].to_s.translate %></th>
23
23
  <% end %>
24
24
  <th><%= t('.created_at', default: 'Registered at') %></th>
25
+ <th></th>
25
26
  </tr>
26
27
  </thead>
27
28
  <tbody>
@@ -39,6 +40,12 @@
39
40
  <% end %>
40
41
  <% end %>
41
42
  <td><%= value[:created_at] %></td>
43
+ <td>
44
+ <%= link_to raw('<i class="fa fa-times"></i>'),
45
+ { action: :del_response, response_id: form.id },
46
+ method: :delete, data: { confirm: t('.actions.confirm_delete', default: 'Are you sure?') },
47
+ class: 'btn btn-danger btn-xs', title: t('.actions.delete', default: 'Delete') %>
48
+ </td>
42
49
  </tr>
43
50
  <% end %>
44
51
  </tbody>
@@ -84,6 +84,8 @@ es:
84
84
  back_btn: 'Volver al listado'
85
85
  created_at: 'Fecha de Registro'
86
86
  list_responses: 'Lista de Registros'
87
+ actions:
88
+ delete: 'Borrar'
87
89
 
88
90
  create:
89
91
  created: 'Formulario creado correctamente'
data/config/routes.rb CHANGED
@@ -15,6 +15,7 @@ Rails.application.routes.draw do
15
15
  namespace 'plugins' do
16
16
  namespace 'cama_contact_form' do
17
17
  resources :admin_forms do
18
+ delete 'del_response'
18
19
  get 'responses'
19
20
  get 'item_field', on: :collection
20
21
  end
@@ -1,3 +1,3 @@
1
1
  module CamaContactForm
2
- VERSION = "0.0.21"
2
+ VERSION = "0.0.22"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cama_contact_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-26 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails