udongo 6.1.0 → 6.2.0

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: 9058d4a4ae9f7e8f0d6c0f5ed60ae902559997cd
4
- data.tar.gz: 4267002ee525804b74f0c38a0770d16a45d85ef1
3
+ metadata.gz: e45537b4c9cf7da08281cc79305ebc6dea5a94b5
4
+ data.tar.gz: 8c70624b93fa57b91de7803df1886a2b922c36c0
5
5
  SHA512:
6
- metadata.gz: 7366fc2a16e78da7725965fdab5542763945380da67c3d1e73f23fd4d1d6e6db4c19560a2c5c297aa9aabd7b85e4053116426eed2fdd354b2da8efb0838ce39f
7
- data.tar.gz: e96c73705f470b513397a3f5e1cb650235ea9d457130d057d1f5b6b98aada21de3f0cff88a63f82732476f98f9f3c0d90253d20c5e7ebad93d298ebe77df3a59
6
+ metadata.gz: d39657ebe57454cbb324c764d0800416156bddeaf4902d5cd7653c2bf08c51847ac4a9588c576d235200880071c4f95ed8e87d73b684b2dd3c7899068479c5b6
7
+ data.tar.gz: 96ac9430540f0abe52e3c1643205686029678e760efd07655be0915eec2ac20161d83461eff94aaada2d4b516f6a265b1d949a161c44938ca2170506449cbf83
@@ -12,9 +12,9 @@
12
12
  //
13
13
  //= require jquery3
14
14
  //= require jquery_ujs
15
- //= require jquery-ui/autocomplete
15
+ //= require jquery-ui/widgets/sortable
16
+ //= require jquery-ui/widgets/autocomplete
16
17
  //= require jquery-ui.autocomplete.html.js
17
- //= require jquery-ui/sortable
18
18
  //= require backend/tether.min
19
19
  //= require backend/bootstrap
20
20
  //= require backend/jquery.throttle-debounce.min.js
@@ -9317,4 +9317,3 @@ a.text-gray-dark:focus, a.text-gray-dark:hover {
9317
9317
  display: none !important;
9318
9318
  }
9319
9319
  }
9320
- /*# sourceMappingURL=bootstrap.css.map */
@@ -0,0 +1,11 @@
1
+ class Backend::Content::Rows::FormsController < Backend::BaseController
2
+ include Concerns::Backend::ContentTypeController
3
+
4
+ model ContentForm
5
+ allowed_params :form_id
6
+
7
+ def forms_collection
8
+ Form.order(:description).map { |f| [f.description, f.id] }
9
+ end
10
+ helper_method :forms_collection
11
+ end
@@ -35,7 +35,7 @@ class Backend::FormsController < Backend::BaseController
35
35
  end
36
36
 
37
37
  def destroy
38
- @model.destroy
38
+ @model.destroy if @model.deletable?
39
39
  redirect_to backend_forms_path, notice: translate_notice(:deleted, :form)
40
40
  end
41
41
 
@@ -0,0 +1,3 @@
1
+ class ContentFormDecorator < ApplicationDecorator
2
+ delegate_all
3
+ end
@@ -0,0 +1,7 @@
1
+ module CollectionHelper
2
+ def options_for_collection(field_name, collection)
3
+ collection.map do |item|
4
+ [t("g.collections.#{field_name}.#{item}"), item]
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ class ContentForm < ApplicationRecord
2
+ include Concerns::ContentType
3
+
4
+ belongs_to :form
5
+
6
+ def content_type
7
+ :form
8
+ end
9
+ end
data/app/models/form.rb CHANGED
@@ -5,6 +5,11 @@ class Form < ApplicationRecord
5
5
  has_many :fields, class_name: 'FormField', dependent: :destroy
6
6
  has_many :submissions, class_name: 'FormSubmission', dependent: :destroy
7
7
  has_many :data, through: :submissions
8
+ has_many :content_forms, dependent: :destroy
8
9
 
9
10
  validates :description, presence: true
11
+
12
+ def deletable?
13
+ content_forms.empty?
14
+ end
10
15
  end
@@ -5,6 +5,8 @@ class FormField < ApplicationRecord
5
5
  include Concerns::Translatable
6
6
  translatable_fields :label, :default_value
7
7
 
8
+ FIELD_TYPES = %w(string text integer collection)
9
+
8
10
  belongs_to :form
9
11
 
10
12
  validates :form, :identifier, :field_type, presence: true
@@ -0,0 +1,5 @@
1
+ <% if object.present? && object.form.present? %>
2
+ <%= t 'b.form' %> &gt; <%= object.form.description %>
3
+ <% else %>
4
+ <%= t 'b.msg.flexible_content.no_form_present' %>
5
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <%= simple_form_for [:backend, @model] do |f| %>
2
+ <div class="card">
3
+ <div class="card-header">
4
+ <%= t 'b.msg.flexible_content.edit_form' %>
5
+ </div>
6
+
7
+ <div class="card-block">
8
+ <div class="row">
9
+ <div class="col-6">
10
+ <%= f.input :form_id, collection: forms_collection %>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </div>
15
+
16
+ <%= render 'backend/form_actions', cancel_url: content_path %>
17
+ <% end %>
@@ -10,8 +10,7 @@
10
10
 
11
11
  <div class="card-block">
12
12
  <%= f.input :identifier %>
13
- <%# FIXME: This should be a dropdown once we know the exact types to use. %>
14
- <%= f.input :field_type %>
13
+ <%= f.input :field_type, collection: options_for_collection(:form_field_type, FormField::FIELD_TYPES) %>
15
14
  </div>
16
15
  </div>
17
16
  </div>
@@ -35,7 +35,7 @@
35
35
  <% if f.submissions.any? %>
36
36
  <%= link_to icon(:trash), '#', data: { toggle: 'tooltip' }, title: t('b.msg.forms.removal_warning', submissions: f.submissions.size) %>
37
37
  <% else %>
38
- <%= link_to_delete [:backend, f] %>
38
+ <%= link_to_delete [:backend, f] if f.deletable? %>
39
39
  <% end %>
40
40
  </td>
41
41
  </tr>
data/changelog.md CHANGED
@@ -1,3 +1,14 @@
1
+ 6.2.0 - 2017-06-02
2
+ --
3
+ * Removed the bootstrap source mapping reference in backend/bootstrap.scss.
4
+ * Upgraded jquery-ui-rails to 6.0.1 to fix autocomplete issues with jquery3.
5
+ * Add the ```CollectionHelper``` which allows you to use ```options_for_collection```
6
+ to easily create collections for simple form.
7
+ * The form field types are now a dropdown instead of a text field.
8
+ * A form widget has been added. This makes it possible to include a form on a
9
+ specific location in the flexible content.
10
+
11
+
1
12
  6.1.0 - 2017-05-16
2
13
  --
3
14
  * The obsolete top navigation markup has been cleaned up.
@@ -110,6 +110,7 @@ en:
110
110
  changes_saved: The changes have been saved.
111
111
  confirm: Are you sure?
112
112
  content_types:
113
+ form: Form
113
114
  image: Image (deprecated!)
114
115
  picture: Picture
115
116
  text: Text
@@ -128,12 +129,14 @@ en:
128
129
  align_vertical_center: Align vertically
129
130
  align_vertical_top: Align vertical top
130
131
  edit_column: Edit column
132
+ edit_form: Edit form
131
133
  edit_image: Edit image
132
134
  edit_picture: Edit picture
133
135
  edit_text: Edit text
134
136
  edit_video: Edit video
135
137
  explanation: With this module you can create flexible responsive content. Click the button below to create the first row.
136
138
  full_width: Full width
139
+ no_form_present: No form has been linked yet.
137
140
  no_picture_present: No picture has been uploaded/linked yet.
138
141
  no_video_present: No valid video URL was given.
139
142
  width_explanation: For the flexible content we use a grid layout. This works with rows and columns. Every row can contain at most 12 columns. That's why the column width is expressed as a fracture.
@@ -110,6 +110,7 @@ nl:
110
110
  changes_saved: De wijzigingen werden opgeslagen.
111
111
  confirm: Ben je zeker?
112
112
  content_types:
113
+ form: Formulier
113
114
  image: Afbeelding (niet meer gebruiken!)
114
115
  picture: Foto
115
116
  text: Tekst
@@ -128,12 +129,14 @@ nl:
128
129
  align_vertical_center: Vertikaal centreren
129
130
  align_vertical_top: Vertikaal bovenaan uitlijnen
130
131
  edit_column: Kolom bewerken
132
+ edit_form: Formulier bewerken
131
133
  edit_image: Afbeelding bewerken
132
134
  edit_picture: Foto bewerken
133
135
  edit_text: Tekst bewerken
134
136
  edit_video: Video bewerken
135
137
  explanation: Met deze module kan je flexibele, responsive inhoud toevoegen. Klik op onderstaande knop om een eerste rij toe te voegen.
136
138
  full_width: Volledige breedte
139
+ no_form_present: Er werd nog geen formulier gelinkt.
137
140
  no_picture_present: Er werd nog geen foto geüpload of gelinkt.
138
141
  no_video_present: Er werd nog geen geldige URL voor een video opgegeven.
139
142
  width_explanation: Voor de flexibele inhoud wordt er gebruikt gemaakt van een grid layout. Deze werkt met rijen en kolommen. Iedere rij kan maximaal 12 kolommen bevatten. Daarom dat de breedte uitgedrukt is in een breuk op 12.
@@ -1,3 +1,10 @@
1
1
  nl:
2
2
  g:
3
+ collections:
4
+ form_field_type:
5
+ collection: Collectie
6
+ integer: Getal
7
+ string: Tekstregel
8
+ text: Tekstvak
9
+
3
10
  type: Type
@@ -0,0 +1,9 @@
1
+ class CreateContentForms < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :content_forms do |t|
4
+ t.references :form
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -6,7 +6,7 @@ module Udongo
6
6
  BREAKPOINTS = %w(xs sm md lg xl)
7
7
  DEFAULT_BREAKPOINT = 'md'
8
8
 
9
- attribute :types, Array, default: %w(text picture video image)
9
+ attribute :types, Array, default: %w(text picture video form image)
10
10
  attribute :picture_caption_editor, Axiom::Types::Boolean, default: false
11
11
 
12
12
  def picture_caption_editor?
@@ -1,3 +1,3 @@
1
1
  module Udongo
2
- VERSION = '6.1.0'
2
+ VERSION = '6.2.0'
3
3
  end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :content_form do
3
+ form
4
+ end
5
+ end
@@ -28,46 +28,50 @@ ul.tagit li.tagit-new {
28
28
  padding: .25em 4px .25em 0;
29
29
  }
30
30
 
31
- ul.tagit li.tagit-choice a.tagit-label {
31
+ ul.tagit li.tagit-choice {
32
+ a.tagit-label {
32
33
  cursor: pointer;
33
34
  text-decoration: none;
34
- }
35
- ul.tagit li.tagit-choice .tagit-close {
35
+ }
36
+
37
+ input {
38
+ display: block;
39
+ float: left;
40
+ margin: 2px 5px 2px 0;
41
+ }
42
+
43
+ .tagit-close {
36
44
  cursor: pointer;
37
45
  position: absolute;
38
- right: .1em;
39
- top: 50%;
46
+ right: .3rem;
47
+ top: 1rem;
40
48
  margin-top: -8px;
41
49
  line-height: 17px;
42
- }
43
50
 
44
- /* used for some custom themes that don't need image icons */
45
- ul.tagit li.tagit-choice .tagit-close .text-icon {
46
- display: inline;
47
- }
51
+ /* used for some custom themes that don't need image icons */
52
+ .text-icon {
53
+ display: inline;
54
+ }
48
55
 
49
- ul.tagit li.tagit-choice .tagit-close .ui-icon-close {
50
- display: none;
56
+ .ui-icon-close {
57
+ display: none;
58
+ }
59
+ }
51
60
  }
52
61
 
53
- ul.tagit li.tagit-choice input {
54
- display: block;
55
- float: left;
56
- margin: 2px 5px 2px 0;
57
- }
58
62
  ul.tagit input[type="text"] {
59
- -moz-box-sizing: border-box;
60
- -webkit-box-sizing: border-box;
61
- box-sizing: border-box;
63
+ -moz-box-sizing: border-box;
64
+ -webkit-box-sizing: border-box;
65
+ box-sizing: border-box;
62
66
 
63
- -moz-box-shadow: none;
64
- -webkit-box-shadow: none;
65
- box-shadow: none;
67
+ -moz-box-shadow: none;
68
+ -webkit-box-shadow: none;
69
+ box-shadow: none;
66
70
 
67
- border: none;
68
- margin: 0;
69
- padding: 0;
70
- width: inherit;
71
- background-color: inherit;
72
- outline: none;
71
+ border: none;
72
+ margin: 0;
73
+ padding: 0;
74
+ width: inherit;
75
+ background-color: inherit;
76
+ outline: none;
73
77
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: udongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davy Hellemans
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-16 00:00:00.000000000 Z
12
+ date: 2017-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -51,20 +51,20 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '5.0'
54
+ version: '6.0'
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: 5.0.5
57
+ version: 6.0.1
58
58
  type: :runtime
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
- version: '5.0'
64
+ version: '6.0'
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 5.0.5
67
+ version: 6.0.1
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: sass-rails
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -462,6 +462,7 @@ files:
462
462
  - app/controllers/backend/assets_controller.rb
463
463
  - app/controllers/backend/base_controller.rb
464
464
  - app/controllers/backend/content/rows/columns_controller.rb
465
+ - app/controllers/backend/content/rows/forms_controller.rb
465
466
  - app/controllers/backend/content/rows/images_controller.rb
466
467
  - app/controllers/backend/content/rows/pictures_controller.rb
467
468
  - app/controllers/backend/content/rows/texts_controller.rb
@@ -494,6 +495,7 @@ files:
494
495
  - app/controllers/concerns/pagination_controller.rb
495
496
  - app/controllers/redirects_controller.rb
496
497
  - app/decorators/application_decorator.rb
498
+ - app/decorators/content_form_decorator.rb
497
499
  - app/decorators/content_image_decorator.rb
498
500
  - app/decorators/content_picture_decorator.rb
499
501
  - app/decorators/content_row_decorator.rb
@@ -518,6 +520,7 @@ files:
518
520
  - app/helpers/backend/dropdown_helper.rb
519
521
  - app/helpers/backend/form_helper.rb
520
522
  - app/helpers/backend/pagination_helper.rb
523
+ - app/helpers/collection_helper.rb
521
524
  - app/helpers/icon_helper.rb
522
525
  - app/helpers/link_helper.rb
523
526
  - app/helpers/navigation_helper.rb
@@ -563,6 +566,7 @@ files:
563
566
  - app/models/concerns/translatable.rb
564
567
  - app/models/concerns/visible.rb
565
568
  - app/models/content_column.rb
569
+ - app/models/content_form.rb
566
570
  - app/models/content_image.rb
567
571
  - app/models/content_picture.rb
568
572
  - app/models/content_row.rb
@@ -622,6 +626,7 @@ files:
622
626
  - app/views/backend/assets/edit.html.erb
623
627
  - app/views/backend/assets/index.html.erb
624
628
  - app/views/backend/assets/new.html.erb
629
+ - app/views/backend/content/_form.html.erb
625
630
  - app/views/backend/content/_image.html.erb
626
631
  - app/views/backend/content/_picture.html.erb
627
632
  - app/views/backend/content/_rows.html.erb
@@ -631,6 +636,7 @@ files:
631
636
  - app/views/backend/content/rows/columns/_dimension_fields.html.erb
632
637
  - app/views/backend/content/rows/columns/edit.html.erb
633
638
  - app/views/backend/content/rows/columns/new.html.erb
639
+ - app/views/backend/content/rows/forms/edit.html.erb
634
640
  - app/views/backend/content/rows/images/edit.html.erb
635
641
  - app/views/backend/content/rows/pictures/_filter.html.erb
636
642
  - app/views/backend/content/rows/pictures/edit.html.erb
@@ -809,6 +815,7 @@ files:
809
815
  - db/migrate/20170507092541_add_alignment_options_to_content_rows.rb
810
816
  - db/migrate/20170507163532_create_content_videos.rb
811
817
  - db/migrate/20170516092845_add_sitemap_to_page.rb
818
+ - db/migrate/20170602114411_create_content_forms.rb
812
819
  - lib/tasks/task_extras.rb
813
820
  - lib/tasks/udongo_tasks.rake
814
821
  - lib/udongo.rb
@@ -861,6 +868,7 @@ files:
861
868
  - spec/factories/assets.rb
862
869
  - spec/factories/comments.rb
863
870
  - spec/factories/content_columns.rb
871
+ - spec/factories/content_forms.rb
864
872
  - spec/factories/content_images.rb
865
873
  - spec/factories/content_pictures.rb
866
874
  - spec/factories/content_rows.rb