scrivito_crm_form_widget 0.9.0.beta4 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/styles/scrivito_crm_form_widget.scss +0 -1
- data/app/models/crm_form_level_widget.rb +17 -0
- data/app/models/crm_form_widget.rb +12 -2
- data/app/views/crm_form_level_widget/details.html.erb +6 -0
- data/app/views/crm_form_widget/_attributes.html.erb +4 -0
- data/app/views/crm_form_widget/_dynamic_attributes.html.erb +3 -4
- data/app/views/crm_form_widget/_file_upload.html.erb +7 -0
- data/app/views/crm_form_widget/_form.html.erb +41 -23
- data/app/views/crm_form_widget/details.html.erb +37 -6
- data/lib/scrivito_crm_form_widget/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d8010804a45532c3f11197e5d06246b4e11af0
|
4
|
+
data.tar.gz: 92dd9c97509bf20c400931907b4734fa42d66239
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172167c6bd997f23fdd63dbca8a548bb1192c4be39ffc76f3d54d63db249a22aaf1ea3abfa960f488a6691029af51449f1b9b5330837e0a98fb9d81afe89a162
|
7
|
+
data.tar.gz: 2588fa8bd49632eefc827f443e4147dd6c7fb9a57d638ed4c1696844de6fd56b80929a71dee28660092649170e99f6f7575411f9a5f442c460c159a8016a5fb3
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CrmFormLevelWidget < Widget
|
2
|
+
attribute :fields, :stringlist
|
3
|
+
attribute :headline, :string
|
4
|
+
|
5
|
+
def self.valid_container_classes
|
6
|
+
[CrmFormWidget]
|
7
|
+
end
|
8
|
+
|
9
|
+
def attributes
|
10
|
+
Hash[fields.map {|f| [f, container.attributes[f]] }]
|
11
|
+
end
|
12
|
+
|
13
|
+
def selectable
|
14
|
+
elems = container.attributes.map(&:first)
|
15
|
+
return elems
|
16
|
+
end
|
17
|
+
end
|
@@ -11,6 +11,12 @@ class CrmFormWidget < Widget
|
|
11
11
|
attribute :label_position, :enum, values: ['left','top'], default: 'left'
|
12
12
|
attribute :columns, :enum, values: ['one','two'], default: 'one'
|
13
13
|
|
14
|
+
attribute :multilevel, :enum, values: ['Yes','No'], default: 'No'
|
15
|
+
attribute :levels, :widgetlist
|
16
|
+
attribute :multilevel_dynamic, :string, default: 'More attributes'
|
17
|
+
attribute :multilevel_file, :string, default: 'File upload'
|
18
|
+
attribute :multilevel_send, :string, default: 'Send'
|
19
|
+
|
14
20
|
attribute :file_upload, :enum, values: ['Yes','No'], default: 'No'
|
15
21
|
attribute :styles, :stringlist
|
16
22
|
|
@@ -23,7 +29,7 @@ class CrmFormWidget < Widget
|
|
23
29
|
end
|
24
30
|
|
25
31
|
def valid_widget_classes_for(field_name)
|
26
|
-
[DynamicAttributeWidget]
|
32
|
+
[field_name == 'levels' ? CrmFormLevelWidget : DynamicAttributeWidget]
|
27
33
|
end
|
28
34
|
|
29
35
|
def self.activities
|
@@ -42,6 +48,10 @@ class CrmFormWidget < Widget
|
|
42
48
|
self.activity_id != ""
|
43
49
|
end
|
44
50
|
|
51
|
+
def multilevel?
|
52
|
+
multilevel == 'Yes'
|
53
|
+
end
|
54
|
+
|
45
55
|
def submit_button
|
46
56
|
submit_button_text.present? ? submit_button_text : "send"
|
47
57
|
end
|
@@ -67,7 +77,7 @@ class CrmFormWidget < Widget
|
|
67
77
|
end
|
68
78
|
|
69
79
|
def field_as_select?(options)
|
70
|
-
columns == 'two' || options['valid_values'].count >
|
80
|
+
columns == 'two' || options['valid_values'].count > 4
|
71
81
|
end
|
72
82
|
|
73
83
|
def file_upload?
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.attributes', default: 'Attribuets for this level') do %>
|
2
|
+
<%= scrivito_details_for do %>
|
3
|
+
<%= scrivito_tag :div, widget, :headline %>
|
4
|
+
<% end %>
|
5
|
+
<%= scrivito_tag :div, widget, :fields, data: { multi_select_list: widget.selectable } %>
|
6
|
+
<% end %>
|
@@ -1,5 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
<%
|
3
|
-
<%= name %>
|
4
|
-
<%= type %>
|
1
|
+
<% widget.dynamic_attributes.each do |attribute| %>
|
2
|
+
<% CrmFormPresenter.send(:attr_accessor, attribute.field_name.to_sym) %>
|
3
|
+
<%= render "crm_form_widget/crm_#{attribute.type}", form: form, name: attribute.field_name, options: attribute.options || {}, label: attribute.label, widget: widget %>
|
5
4
|
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div class="form-group form-field-custom-file">
|
2
|
+
<% CrmFormPresenter.send(:attr_accessor, :custom_file) %>
|
3
|
+
<%= form.label :custom_file, t('scrivito_crm_form_widget.view.file', default: 'File upload'), class: "control-label col-sm-3" %>
|
4
|
+
<div class="col-sm-9">
|
5
|
+
<%= form.file_field :custom_file, class: "form-control" %>
|
6
|
+
</div>
|
7
|
+
</div>
|
@@ -5,26 +5,6 @@
|
|
5
5
|
|
6
6
|
<%= form.hidden_field(:widget_id, value: widget.id) %>
|
7
7
|
|
8
|
-
<% widget.attributes.each do |name, options| %>
|
9
|
-
<% CrmFormPresenter.send(:attr_accessor, name.to_sym) %>
|
10
|
-
<%= render "crm_form_widget/crm_#{options["attribute_type"]}", form: form, name: name, options: options, label: nil, widget: widget %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<% widget.dynamic_attributes.each do |attribute| %>
|
14
|
-
<% CrmFormPresenter.send(:attr_accessor, attribute.field_name.to_sym) %>
|
15
|
-
<%= render "crm_form_widget/crm_#{attribute.type}", form: form, name: attribute.field_name, options: attribute.options || {}, label: attribute.label, widget: widget %>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<% if widget.file_upload? %>
|
19
|
-
<div class="form-group form-field-custom-file">
|
20
|
-
<% CrmFormPresenter.send(:attr_accessor, :custom_file) %>
|
21
|
-
<%= form.label :custom_file, t('scrivito_crm_form_widget.view.file', default: 'File upload'), class: "control-label col-sm-3" %>
|
22
|
-
<div class="col-sm-9">
|
23
|
-
<%= form.file_field :custom_file, class: "form-control" %>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
<% end %>
|
27
|
-
|
28
8
|
<div class="form-group last">
|
29
9
|
<label class="control-label col-sm-3" for="crm_form_presenter_email">Email</label>
|
30
10
|
<div class="col-sm-9">
|
@@ -32,7 +12,45 @@
|
|
32
12
|
</div>
|
33
13
|
</div>
|
34
14
|
|
35
|
-
|
36
|
-
|
37
|
-
|
15
|
+
<% if widget.multilevel? %>
|
16
|
+
<div class="crm-form-widget-multilevel">
|
17
|
+
<% widget.levels.each do |level| %>
|
18
|
+
<fieldset>
|
19
|
+
<%= scrivito_tag :legend, level, :headline %>
|
20
|
+
<%= render 'crm_form_widget/attributes', widget: widget, form: form, attributes: level.attributes %>
|
21
|
+
</fieldset>
|
22
|
+
|
23
|
+
<% if widget.dynamic_attributes.any? %>
|
24
|
+
<fieldset>
|
25
|
+
<%= scrivito_tag :legend, widget, :multilevel_dynamic %>
|
26
|
+
<%= render 'crm_form_widget/dynamic_attributes', widget: widget, form: form %>
|
27
|
+
</fieldset>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<% if widget.file_upload? %>
|
31
|
+
<fieldset>
|
32
|
+
<%= scrivito_tag :legend, widget, :multilevel_file %>
|
33
|
+
<%= render 'crm_form_widget/file_upload', widget: widget, form: form %>
|
34
|
+
</fieldset>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<fieldset>
|
39
|
+
<%= scrivito_tag :legend, widget, :multilevel_send %>
|
40
|
+
<div class="form-submit-button-container clearfix">
|
41
|
+
<%= form.submit widget.submit_button, class: "btn btn-primary pull-right" %>
|
42
|
+
</div>
|
43
|
+
</fieldset>
|
44
|
+
</div>
|
45
|
+
<% else %>
|
46
|
+
<%= render 'crm_form_widget/attributes', widget: widget, form: form, attributes: widget.attributes %>
|
47
|
+
<%= render 'crm_form_widget/dynamic_attributes', widget: widget, form: form %>
|
48
|
+
<% if widget.file_upload? %>
|
49
|
+
<%= render 'crm_form_widget/file_upload', widget: widget, form: form %>
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
<div class="form-submit-button-container clearfix">
|
53
|
+
<%= form.submit widget.submit_button, class: "btn btn-primary pull-right" %>
|
54
|
+
</div>
|
55
|
+
<% end %>
|
38
56
|
<% end %>
|
@@ -1,10 +1,14 @@
|
|
1
1
|
<%= scrivito_large_dialog do %>
|
2
2
|
<ul class="tab-list">
|
3
3
|
<li class="active" data-panel-target="#edit-general">General</li>
|
4
|
+
<li data-panel-target="#edit-options">Options</li>
|
4
5
|
<li data-panel-target="#edit-tags">Tags</li>
|
5
6
|
<li data-panel-target="#edit-activity">Activity</li>
|
6
7
|
<li data-panel-target="#edit-event">Event</li>
|
7
|
-
<li data-panel-target="#edit-dynamic">
|
8
|
+
<li data-panel-target="#edit-dynamic">Dynamic fields</li>
|
9
|
+
<% if widget.multilevel? %>
|
10
|
+
<li data-panel-target="#edit-multilevel">Levels</li>
|
11
|
+
<% end %>
|
8
12
|
</ul>
|
9
13
|
|
10
14
|
<div class="tab-panels">
|
@@ -12,6 +16,7 @@
|
|
12
16
|
<%= scrivito_details_for t('scrivito_crm_form_widget.details.subject', default: 'Subject') do %>
|
13
17
|
<%= scrivito_tag :div, widget, :subject %>
|
14
18
|
<% end %>
|
19
|
+
|
15
20
|
<%= scrivito_details_for t('scrivito_crm_form_widget.details.redirect_to', default: 'Redirect after submit') do %>
|
16
21
|
<%= scrivito_tag :div, widget, :redirect_to %>
|
17
22
|
<% end %>
|
@@ -20,6 +25,16 @@
|
|
20
25
|
<%= scrivito_tag :div, widget, :submit_button_text %>
|
21
26
|
<% end %>
|
22
27
|
|
28
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.file_upload', default: 'File upload') do %>
|
29
|
+
<%= scrivito_tag :div, widget, :file_upload %>
|
30
|
+
<% end %>
|
31
|
+
|
32
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.styles', default: 'Styles') do %>
|
33
|
+
<%= scrivito_tag :div, widget, :styles, data: { multi_select_list: widget.scrivito_selectable_style_classes } %>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="tab-panel" id="edit-options">
|
23
38
|
<%= scrivito_details_for t('scrivito_crm_form_widget.details.label_position', default: 'Label Position') do %>
|
24
39
|
<%= scrivito_tag :div, widget, :label_position %>
|
25
40
|
<% end %>
|
@@ -28,12 +43,22 @@
|
|
28
43
|
<%= scrivito_tag :div, widget, :columns %>
|
29
44
|
<% end %>
|
30
45
|
|
31
|
-
<%= scrivito_details_for t('scrivito_crm_form_widget.details.
|
32
|
-
<%= scrivito_tag :div, widget, :
|
46
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.multilevel', default: 'Is a multilevel form') do %>
|
47
|
+
<%= scrivito_tag :div, widget, :multilevel, data: { scrivito_editors_reload: true } %>
|
33
48
|
<% end %>
|
34
49
|
|
35
|
-
|
36
|
-
<%=
|
50
|
+
<% if widget.multilevel? %>
|
51
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.multilevel_dynamic', default: 'Dynamic headline') do %>
|
52
|
+
<%= scrivito_tag :div, widget, :multilevel_dynamic %>
|
53
|
+
<% end %>
|
54
|
+
|
55
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.multilevel_file', default: 'File updload headline') do %>
|
56
|
+
<%= scrivito_tag :div, widget, :multilevel_file %>
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.multilevel_send', default: 'Send Headline') do %>
|
60
|
+
<%= scrivito_tag :div, widget, :multilevel_send %>
|
61
|
+
<% end %>
|
37
62
|
<% end %>
|
38
63
|
</div>
|
39
64
|
|
@@ -63,5 +88,11 @@
|
|
63
88
|
<div class="tab-panel" id="edit-dynamic">
|
64
89
|
<%= scrivito_tag :div, widget, :dynamic_attributes %>
|
65
90
|
</div>
|
91
|
+
|
92
|
+
<% if widget.multilevel? %>
|
93
|
+
<div class="tab-panel" id="edit-multilevel">
|
94
|
+
<%= scrivito_tag :div, widget, :levels %>
|
95
|
+
</div>
|
96
|
+
<% end %>
|
66
97
|
</div>
|
67
|
-
<% end %>
|
98
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_crm_form_widget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scrivito
|
@@ -79,14 +79,18 @@ files:
|
|
79
79
|
- app/assets/scripts/scrivito_crm_form_widget.js
|
80
80
|
- app/assets/styles/scrivito_crm_form_widget.scss
|
81
81
|
- app/controllers/scrivito_crm_form_widget/application_controller.rb
|
82
|
+
- app/models/crm_form_level_widget.rb
|
82
83
|
- app/models/crm_form_widget.rb
|
83
84
|
- app/models/dynamic_attribute_widget.rb
|
84
85
|
- app/presenter/crm_form_presenter.rb
|
86
|
+
- app/views/crm_form_level_widget/details.html.erb
|
87
|
+
- app/views/crm_form_widget/_attributes.html.erb
|
85
88
|
- app/views/crm_form_widget/_crm_enum.html.erb
|
86
89
|
- app/views/crm_form_widget/_crm_multienum.html.erb
|
87
90
|
- app/views/crm_form_widget/_crm_string.html.erb
|
88
91
|
- app/views/crm_form_widget/_crm_text.html.erb
|
89
92
|
- app/views/crm_form_widget/_dynamic_attributes.html.erb
|
93
|
+
- app/views/crm_form_widget/_file_upload.html.erb
|
90
94
|
- app/views/crm_form_widget/_form.html.erb
|
91
95
|
- app/views/crm_form_widget/details.html.erb
|
92
96
|
- app/views/crm_form_widget/show.html.erb
|