scrivito_crm_form_widget 1.0.0.beta3 → 1.0.0.beta4
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_widget.rb +5 -0
- data/app/views/crm_form_level_widget/details.html.erb +1 -1
- data/app/views/crm_form_widget/_attributes.html.erb +3 -1
- data/app/views/crm_form_widget/_crm_string.html.erb +1 -1
- data/app/views/crm_form_widget/show.html.erb +2 -1
- data/lib/scrivito_crm_form_widget/configuration.rb +9 -0
- data/lib/scrivito_crm_form_widget/version.rb +1 -1
- data/lib/scrivito_crm_form_widget.rb +16 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837f3a977ac51d6bd0604980465ca6cca0a98db2
|
4
|
+
data.tar.gz: b530390126b9be97bfa286b6da57e09d4d0b98d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbd9937102083a39fbfe6586730ef4e75d64144875dbf001fc2dae922ce1d99988504eb912fdfe27e8ad7ff8e3955b82e7c24ddb1007ba92f3c558c61d3568d4
|
7
|
+
data.tar.gz: c1b120d9957f2a8210fed86f9e758326c1a76e4513fcfa4b20316ba62d3dd42014e8c40deeb6b91e9218fe61ab97fb05a5aecd2b210e029e86681d443212ceec
|
@@ -88,4 +88,9 @@ class CrmFormWidget < Widget
|
|
88
88
|
local = "helpers.placeholder.crm_form_presenter.#{field}"
|
89
89
|
I18n.exists?(local) ? I18n.t(local) : nil
|
90
90
|
end
|
91
|
+
|
92
|
+
def hidden?(name, options, request)
|
93
|
+
param_given = !options[:visible_in_form] && request.params[name.sub(/^custom_/,'')].present?
|
94
|
+
param_given || ScrivitoCrmFormWidget.configuration.hidden_attributes.include?(name.sub(/^custom_/,''))
|
95
|
+
end
|
91
96
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= scrivito_details_for t('scrivito_crm_form_widget.details.attributes', default: '
|
1
|
+
<%= scrivito_details_for t('scrivito_crm_form_widget.details.attributes', default: 'Attributes for this level') do %>
|
2
2
|
<%= scrivito_details_for do %>
|
3
3
|
<%= scrivito_tag :div, widget, :headline %>
|
4
4
|
<% end %>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<% attributes.each do |name, options| %>
|
2
2
|
<% CrmFormPresenter.send(:attr_accessor, name.to_sym) %>
|
3
|
-
<% if options %>
|
3
|
+
<% if widget.hidden?(name, options, request) %>
|
4
|
+
<%= form.hidden_field(name.to_sym, value: request.params[name.sub(/^custom_/,'')]) %>
|
5
|
+
<% elsif options && options[:visible_in_form] %>
|
4
6
|
<%= render "crm_form_widget/crm_#{options["attribute_type"]}", form: form, name: name, options: options, label: nil, widget: widget %>
|
5
7
|
<% end %>
|
6
8
|
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="form-group form-field-<%= name %>">
|
2
2
|
<%= form.label name.to_sym, label, class: "control-label col-sm-3 #{options[:mandatory] ? 'mandatory' : ''}" %>
|
3
3
|
<div class="col-sm-9">
|
4
|
-
<%= form.text_field name.to_sym, class: "form-control", maxlength: options[:
|
4
|
+
<%= form.text_field name.to_sym, class: "form-control", maxlength: options[:max_length], placeholder: widget.placeholder(name.parameterize), required: options[:mandatory] %>
|
5
5
|
</div>
|
6
6
|
</div>
|
@@ -2,6 +2,7 @@
|
|
2
2
|
<%= render 'crm_form_widget/form', widget: widget %>
|
3
3
|
<% else %>
|
4
4
|
<div class="alert alert-warning">
|
5
|
-
Select an activty
|
5
|
+
<p><strong>Select an activty</strong></p>
|
6
|
+
<%= scrivito_tag(:div, widget, :activity_id, data: {toggle_button_list: CrmFormWidget.activity_ids, scrivito_editors_reload: true }) %>
|
6
7
|
</div>
|
7
8
|
<% end %>
|
@@ -1,4 +1,20 @@
|
|
1
1
|
require "scrivito_crm_form_widget/engine"
|
2
|
+
require "scrivito_crm_form_widget/configuration"
|
2
3
|
|
3
4
|
module ScrivitoCrmFormWidget
|
5
|
+
class << self
|
6
|
+
attr_writer :configuration
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.configuration
|
10
|
+
@configuration ||= Configuration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.reset
|
14
|
+
@configuration = Configuration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield(configuration)
|
19
|
+
end
|
4
20
|
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: 1.0.0.
|
4
|
+
version: 1.0.0.beta4
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scrivito
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- app/views/crm_form_widget/thumbnail.html.erb
|
98
98
|
- app/views/dynamic_attribute_widget/details.html.erb
|
99
99
|
- lib/scrivito_crm_form_widget.rb
|
100
|
+
- lib/scrivito_crm_form_widget/configuration.rb
|
100
101
|
- lib/scrivito_crm_form_widget/engine.rb
|
101
102
|
- lib/scrivito_crm_form_widget/version.rb
|
102
103
|
- lib/tasks/scrivito_crm_form_widget_tasks.rake
|