scrivito_jr_form_widget 0.0.1 → 0.0.5

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: 0a06ab0c567c8525acc231eb17ae755f775def41
4
- data.tar.gz: b33289c2c441f0044f7343d05a869142210e5f49
3
+ metadata.gz: 68ee1a72684b73e424602646e50c8f183ae492e9
4
+ data.tar.gz: 95caeeab2477e3d6073f87e192b91ad97af27338
5
5
  SHA512:
6
- metadata.gz: d1ba1876ca4b22b7a6fb2a8f7b61c35f4873c29d966f8659a768e8c6ce30fff520ef005c5164d618d2add65b70a6008055339e39f96686db69bd9a3811c04c5b
7
- data.tar.gz: a7d2555d5d60baae5cb83305b4b006f5c52778523d0cdf71f3df09f9e9903399e29dc72dfd212d500d877166ba5b0972ea362ca932433b8af663c0d6b273b3dc
6
+ metadata.gz: fce92c28efc8c6fdc7b4f010e6ddf081a11e74bb3dffed16cf679a1191a0705d760bdb7adc72fbdc733972f2cd9c5a0108863ccca7ba285c152e6fc3a7005704
7
+ data.tar.gz: 520e9a656460de6c73ae5605706eadc7011b9eb2d329de6480daa90080e10601067bb300138205125da5002e1bfb8b3de9cf5927628cdd673e5825efc0056dbb
@@ -0,0 +1 @@
1
+ //= require scrivito_advanced_editors
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require scrivito_advanced_editors
3
+ */
@@ -1,4 +1,9 @@
1
1
  class JrFormPresenter < JrFormAttributes
2
+
3
+ def attribute_names
4
+ @type.standard_attrs.keys + @type.custom_attrs.keys
5
+ end
6
+
2
7
  def initialize(widget, request, controller)
3
8
  @widget = widget
4
9
  @activity = widget.activity
@@ -11,9 +16,19 @@ class JrFormPresenter < JrFormAttributes
11
16
  end
12
17
 
13
18
  def submit
14
- contact = manipulate_or_create_user
19
+ contact = nil
20
+
21
+ if @params['custom_email'] && @params['custom_last_name']
22
+ contact = manipulate_or_create_user
23
+ end
24
+
25
+ if contact
26
+ set_params_for_activty(contact)
27
+ end
15
28
 
16
- set_params_for_activty(contact)
29
+ @params["title"] = @params[:title].empty? ? @activity.id : @params[:title]
30
+ @params["type_id"] = @activity.id
31
+ @params["state"] = 'created'
17
32
 
18
33
  activity = JustRelate::Activity.create(@params)
19
34
 
@@ -50,8 +65,6 @@ class JrFormPresenter < JrFormAttributes
50
65
  end
51
66
 
52
67
  @params["contact_ids"] = contact.id
53
- @params["type_id"] = @activity.id
54
- @params["state"] = 'created'
55
68
  end
56
69
 
57
70
  def redirect_path(page, widget)
@@ -0,0 +1,13 @@
1
+ <div class="form-group">
2
+ <%= form.label name.to_sym, class: "control-label col-sm-3 #{options[:mandatory] ? 'mandatory' : ''}" %>
3
+ <div class="col-sm-9">
4
+ <% options['valid_values'].each do |value| %>
5
+ <div class="radio">
6
+ <%= form.label "#{name}_#{value.downcase}" do %>
7
+ <%= form.radio_button name.to_sym, value %>
8
+ <%= t("helpers.label.jr_form_presenter.#{name}_option.#{value.downcase}") %>
9
+ <% end %>
10
+ </div>
11
+ <% end %>
12
+ </div>
13
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="form-group">
2
+ <%= form.label name.to_sym, class: "control-label col-sm-3 #{options[:mandatory] ? 'mandatory' : ''}" %>
3
+ <div class="col-sm-9">
4
+ <%= form.select name.to_sym, options['valid_values'], {}, {multiple: true, class: 'form-control'} %>
5
+ </div>
6
+ </div>
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
 
19
19
  <div class="tab-panel" id="edit-tags">
20
- <h4>Tags <abbr title="optional attribute. can be used to add tags to a contact like has_visited_event. contatc will be calculated by the custom attributes email and last_name of your selected activtiy. If this fields do not exist, this field has no effect." class="initialism"></abbr></h4>
20
+ <h4>Tags for Contact <abbr title="optional attribute. can be used to add tags to a contact like has_visited_event. contatc will be calculated by the custom attributes email and last_name of your selected activtiy. If this fields do not exist, this field has no effect." class="initialism"></abbr></h4>
21
21
  <%= scrivito_tag :div, widget, :tags, data: {editor: 'scrivito-list-editor'} %>
22
22
  </div>
23
23
 
@@ -1,3 +1,6 @@
1
+ require 'scrivito_advanced_editors'
2
+ require 'active_attr'
3
+
1
4
  module ScrivitoJrFormWidget
2
5
  class Engine < ::Rails::Engine
3
6
  isolate_namespace ScrivitoJrFormWidget
@@ -1,3 +1,3 @@
1
1
  module ScrivitoJrFormWidget
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_jr_form_widget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: active_attr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -76,12 +90,14 @@ files:
76
90
  - LICENSE
77
91
  - Rakefile
78
92
  - app/assets/images/form.png
93
+ - app/assets/scripts/scrivito_jr_form_widget.js
94
+ - app/assets/styles/scrivito_jr_form_widget.css
79
95
  - app/controllers/scrivito_jr_form_widget/application_controller.rb
80
96
  - app/models/jr_form_widget.rb
81
97
  - app/presenter/jr_form_presenter.rb
82
98
  - app/views/jr_form_widget/_form.html.erb
83
99
  - app/views/jr_form_widget/_jr_enum.html.erb
84
- - app/views/jr_form_widget/_jr_multienum.ht.erb
100
+ - app/views/jr_form_widget/_jr_multienum.html.erb
85
101
  - app/views/jr_form_widget/_jr_string.html.erb
86
102
  - app/views/jr_form_widget/_jr_text.html.erb
87
103
  - app/views/jr_form_widget/details.html.erb
File without changes