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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e10c7e5dc881380dc2c5c82c3d2fa6a1718a9d6
4
- data.tar.gz: bd08394ae29d3161ae58906f0f3b3ed2e9e8a5cc
3
+ metadata.gz: 837f3a977ac51d6bd0604980465ca6cca0a98db2
4
+ data.tar.gz: b530390126b9be97bfa286b6da57e09d4d0b98d5
5
5
  SHA512:
6
- metadata.gz: ad8c63bf236b9f72c83d9d3581990d3a2a6226d49e94ce794bdbcd319e7ad2a35679d1b84aeec1cf424a2e2b0b5ed9234a3b5cfbf7446a57517b0d786847102c
7
- data.tar.gz: 90e532041e9e0df416d654aed27ef658023451e4c67a9d7e666e34d8b69a497e5557fbb8f18b0806f2d5aabe98e465e97e3908855b53d47a1c256080310ffb84
6
+ metadata.gz: bbd9937102083a39fbfe6586730ef4e75d64144875dbf001fc2dae922ce1d99988504eb912fdfe27e8ad7ff8e3955b82e7c24ddb1007ba92f3c558c61d3568d4
7
+ data.tar.gz: c1b120d9957f2a8210fed86f9e758326c1a76e4513fcfa4b20316ba62d3dd42014e8c40deeb6b91e9218fe61ab97fb05a5aecd2b210e029e86681d443212ceec
@@ -16,7 +16,6 @@ form.form-horizontal.label-position-top {
16
16
 
17
17
  @media(min-width: 991px) {
18
18
  form.form-horizontal.two-column-layout {
19
- margin: 0 -15px;
20
19
  .form-group {
21
20
  width: 50%;
22
21
  float: left;
@@ -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: 'Attribuets for this level') do %>
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[:maxlength], placeholder: widget.placeholder(name.parameterize), required: options[:mandatory] %>
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 in the details view.
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 %>
@@ -0,0 +1,9 @@
1
+ module ScrivitoCrmFormWidget
2
+ class Configuration
3
+ attr_accessor :hidden_attributes
4
+
5
+ def initialize
6
+ @hidden_attributes = ['origin','referrer','tracking','service']
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module ScrivitoCrmFormWidget
2
- VERSION = "1.0.0.beta3"
2
+ VERSION = "1.0.0.beta4"
3
3
  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.beta3
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-22 00:00:00.000000000 Z
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