udongo 1.0.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/backend/tagbox_controller.rb +1 -1
  3. data/app/controllers/backend_controller.rb +1 -1
  4. data/app/decorators/page_decorator.rb +1 -1
  5. data/app/helpers/backend/dropdown_helper.rb +1 -1
  6. data/app/models/address.rb +1 -1
  7. data/app/models/admin.rb +1 -1
  8. data/app/models/application_record.rb +3 -0
  9. data/app/models/ckeditor/asset.rb +1 -1
  10. data/app/models/comment.rb +1 -1
  11. data/app/models/concerns/translatable.rb +1 -1
  12. data/app/models/content_column.rb +1 -1
  13. data/app/models/content_image.rb +1 -1
  14. data/app/models/content_row.rb +1 -1
  15. data/app/models/content_text.rb +1 -1
  16. data/app/models/email.rb +1 -1
  17. data/app/models/email_template.rb +1 -1
  18. data/app/models/form.rb +1 -1
  19. data/app/models/form_field.rb +1 -1
  20. data/app/models/form_field_validation.rb +1 -1
  21. data/app/models/form_submission.rb +1 -1
  22. data/app/models/form_submission_data.rb +1 -1
  23. data/app/models/log.rb +1 -1
  24. data/app/models/meta.rb +1 -1
  25. data/app/models/navigation.rb +1 -1
  26. data/app/models/navigation_item.rb +1 -1
  27. data/app/models/note.rb +1 -1
  28. data/app/models/page.rb +1 -1
  29. data/app/models/queued_task.rb +4 -2
  30. data/app/models/redirect.rb +1 -1
  31. data/app/models/setting.rb +1 -1
  32. data/app/models/snippet.rb +1 -1
  33. data/app/models/store.rb +1 -1
  34. data/app/models/tag.rb +1 -1
  35. data/app/models/tagged_item.rb +1 -1
  36. data/app/views/backend/_navigation.html.erb +1 -1
  37. data/app/views/backend/content/_rows.html.erb +1 -1
  38. data/app/views/backend/email_templates/_tabs.html.erb +1 -1
  39. data/app/views/backend/navigation/items/_tabs.html.erb +1 -1
  40. data/app/views/backend/pages/_tabs.html.erb +1 -1
  41. data/app/views/backend/snippets/_tabs.html.erb +1 -1
  42. data/app/views/layouts/backend/application.html.erb +1 -1
  43. data/app/views/layouts/backend/login.html.erb +1 -1
  44. data/changelog.md +10 -0
  45. data/config/locales/en_general.yml +16 -0
  46. data/config/locales/nl_general.yml +16 -0
  47. data/config/routes.rb +1 -1
  48. data/lib/generators/udongo/form/form_generator.rb +2 -2
  49. data/lib/udongo/config.rb +8 -18
  50. data/lib/udongo/configs/base.rb +11 -0
  51. data/lib/udongo/configs/flexible_content.rb +9 -0
  52. data/lib/udongo/configs/forms.rb +7 -3
  53. data/lib/udongo/configs/i18n.rb +10 -0
  54. data/lib/udongo/configs/routes.rb +13 -0
  55. data/lib/udongo/configs/tags.rb +13 -0
  56. data/lib/udongo/forms/submission_datagrid.rb +2 -4
  57. data/lib/udongo/forms/submission_filter.rb +1 -3
  58. data/lib/udongo/version.rb +1 -1
  59. data/readme.md +71 -1
  60. metadata +17 -17
  61. data/MIT-LICENSE +0 -20
  62. data/lib/udongo/forms/config.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a9d78af6af9e79dc93e988f912f0dc35cf63c32
4
- data.tar.gz: 77387997bf2df93647585e6a8c980002d688999a
3
+ metadata.gz: 4fbb1c7e76d62edf99a32169e1d0e4f6da43865f
4
+ data.tar.gz: 8954163c3455ffb5335ad212a2ab555a1a800dab
5
5
  SHA512:
6
- metadata.gz: ad09958982bbb2913c20486dcce2b295c6c96533199bc1f79d0684e6875dccbc25a09a7d0aa3b25f382f02584bb2e803480989b7c72575503ab248e01b91cc93
7
- data.tar.gz: 08666441135710beb54f0baa767f14c3c3d5a081ac937eb652cf1e0209dd39a2545be838aa4f826ed132f7009aa029bacb2a0a8c7ac666bcb58221ea3e5776af
6
+ metadata.gz: 1aa37c0ce82e1d12c69e03895a2e7695aff9e73f3684e3e91e610e57c413a8da02def97e115dfc7fcf0a0c2d05cbeaaaa5982c7b185f174086568ccd847a039a
7
+ data.tar.gz: fe36374e10c09d60bc0d78dc694fd9e1a8d48c9f5e36b68cc98499738e89b125f9a30193fe6b145e36c1ef32fadd98b91651191dd53172d80b75896b8db9ae99
@@ -29,7 +29,7 @@ class Backend::TagboxController < BackendController
29
29
  end
30
30
 
31
31
  def tag_creatable?
32
- !Tag.exists?(tag_params) && Udongo.config.allow_new_tags?
32
+ !Tag.exists?(tag_params) && Udongo.config.tags.allow_new?
33
33
  end
34
34
 
35
35
  def create_tag
@@ -19,7 +19,7 @@ class BackendController < ActionController::Base
19
19
  end
20
20
 
21
21
  def default_locale
22
- Udongo.config.default_locale
22
+ Udongo.config.i18n.default_locale
23
23
  end
24
24
  helper_method :default_locale
25
25
 
@@ -22,7 +22,7 @@ class PageDecorator < ApplicationDecorator
22
22
  end
23
23
 
24
24
  str = ''
25
- str << "/#{locale}" if Udongo.config.prefix_routes_with_locale?
25
+ str << "/#{locale}" if Udongo.config.routes.prefix_with_locale?
26
26
  str << "/#{slugs.reverse.join('/')}"
27
27
  str
28
28
  end
@@ -1,7 +1,7 @@
1
1
  module Backend
2
2
  module DropdownHelper
3
3
  def options_for_content_types
4
- Udongo.config.flexible_content_types.map do |content_type|
4
+ Udongo.config.flexible_content.types.map do |content_type|
5
5
  [I18n.t("b.msg.content_types.#{content_type}"), "Content#{content_type.to_s.camelcase}"]
6
6
  end
7
7
  end
@@ -1,4 +1,4 @@
1
- class Address < ActiveRecord::Base
1
+ class Address < ApplicationRecord
2
2
  include Concerns::Emailable
3
3
 
4
4
  belongs_to :addressable, polymorphic: true
data/app/models/admin.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Admin < ActiveRecord::Base
1
+ class Admin < ApplicationRecord
2
2
  include Concerns::Person
3
3
  has_secure_password
4
4
 
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,4 +1,4 @@
1
- class Ckeditor::Asset < ActiveRecord::Base
1
+ class Ckeditor::Asset < ApplicationRecord
2
2
  include Ckeditor::Orm::ActiveRecord::AssetBase
3
3
 
4
4
  delegate :url, :current_path, :content_type, to: :data
@@ -1,4 +1,4 @@
1
- class Comment < ActiveRecord::Base
1
+ class Comment < ApplicationRecord
2
2
  include Concerns::Parentable
3
3
  include Concerns::Locale
4
4
  include Concerns::Spammable
@@ -10,7 +10,7 @@ module Concerns
10
10
 
11
11
  after_save do
12
12
  locales = Store.where(
13
- storable_type: self.class,
13
+ storable_type: self.class.to_s,
14
14
  storable_id: self.id,
15
15
  name: self.class.translatable_fields_list
16
16
  ).pluck(:collection).uniq
@@ -1,4 +1,4 @@
1
- class ContentColumn < ActiveRecord::Base
1
+ class ContentColumn < ApplicationRecord
2
2
  include Concerns::Sortable
3
3
  sortable(scope: :row_id)
4
4
 
@@ -1,4 +1,4 @@
1
- class ContentImage < ActiveRecord::Base
1
+ class ContentImage < ApplicationRecord
2
2
  include Concerns::ContentType
3
3
 
4
4
  mount_uploader :file, ContentImageUploader
@@ -1,4 +1,4 @@
1
- class ContentRow < ActiveRecord::Base
1
+ class ContentRow < ApplicationRecord
2
2
  include Concerns::Locale
3
3
 
4
4
  include Concerns::Sortable
@@ -1,4 +1,4 @@
1
- class ContentText < ActiveRecord::Base
1
+ class ContentText < ApplicationRecord
2
2
  include Concerns::ContentType
3
3
 
4
4
  def content_type
data/app/models/email.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Email < ActiveRecord::Base
1
+ class Email < ApplicationRecord
2
2
  validates :from_name, :to_name, :subject, :plain_content, :html_content,
3
3
  presence: true
4
4
  validates :from_email, :to_email,
@@ -1,4 +1,4 @@
1
- class EmailTemplate < ActiveRecord::Base
1
+ class EmailTemplate < ApplicationRecord
2
2
  include Concerns::Translatable
3
3
  translatable_fields :subject, :plain_content, :html_content
4
4
 
data/app/models/form.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Form < ActiveRecord::Base
1
+ class Form < ApplicationRecord
2
2
  include Concerns::Translatable
3
3
  translatable_fields :success_message
4
4
 
@@ -1,4 +1,4 @@
1
- class FormField < ActiveRecord::Base
1
+ class FormField < ApplicationRecord
2
2
  include Concerns::Sortable
3
3
  sortable scope: [:form_id]
4
4
 
@@ -1,4 +1,4 @@
1
- class FormFieldValidation < ActiveRecord::Base
1
+ class FormFieldValidation < ApplicationRecord
2
2
  include Concerns::Sortable
3
3
  sortable scope: [:field_id]
4
4
 
@@ -1,4 +1,4 @@
1
- class FormSubmission < ActiveRecord::Base
1
+ class FormSubmission < ApplicationRecord
2
2
  include Concerns::Emailable
3
3
 
4
4
  belongs_to :form
@@ -1,4 +1,4 @@
1
- class FormSubmissionData < ActiveRecord::Base
1
+ class FormSubmissionData < ApplicationRecord
2
2
  belongs_to :submission, class_name: 'FormSubmission'
3
3
 
4
4
  validates :submission, presence: true
data/app/models/log.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Log < ActiveRecord::Base
1
+ class Log < ApplicationRecord
2
2
  serialize :data, Hash
3
3
 
4
4
  belongs_to :loggable, polymorphic: true
data/app/models/meta.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Meta < ActiveRecord::Base
1
+ class Meta < ApplicationRecord
2
2
  include Concerns::Locale
3
3
 
4
4
  belongs_to :sluggable, polymorphic: true, touch: true
@@ -1,4 +1,4 @@
1
- class Navigation < ActiveRecord::Base
1
+ class Navigation < ApplicationRecord
2
2
  has_many :items, class_name: 'NavigationItem', dependent: :destroy
3
3
 
4
4
  validates :description, presence: true
@@ -1,4 +1,4 @@
1
- class NavigationItem < ActiveRecord::Base
1
+ class NavigationItem < ApplicationRecord
2
2
  include Concerns::Sortable
3
3
  sortable scope: :navigation_id
4
4
 
data/app/models/note.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Note < ActiveRecord::Base
1
+ class Note < ApplicationRecord
2
2
  belongs_to :notable, polymorphic: true
3
3
 
4
4
  validates :content, presence: true
data/app/models/page.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Page < ActiveRecord::Base
1
+ class Page < ApplicationRecord
2
2
  include Concerns::Taggable
3
3
  include Concerns::Parentable
4
4
  include Concerns::Visible
@@ -1,4 +1,4 @@
1
- class QueuedTask < ActiveRecord::Base
1
+ class QueuedTask < ApplicationRecord
2
2
  validates :klass, presence: true
3
3
 
4
4
  serialize :data, Hash
@@ -23,7 +23,9 @@ class QueuedTask < ActiveRecord::Base
23
23
  end
24
24
 
25
25
  def self.queue_unless_already_queued(klass, data)
26
- self.queue(klass, data) if where(klass: klass).where('data = ?', data.to_yaml).empty?
26
+ if where(klass: klass.to_s).where('data = ?', data.to_yaml).empty?
27
+ self.queue(klass.to_s, data)
28
+ end
27
29
  end
28
30
 
29
31
  def dequeue!
@@ -1,4 +1,4 @@
1
- class Redirect < ActiveRecord::Base
1
+ class Redirect < ApplicationRecord
2
2
  validates :source_uri, :destination_uri, :status_code, presence: true
3
3
  validates :source_uri, uniqueness: { case_sensitive: false }
4
4
 
@@ -1,4 +1,4 @@
1
- class Setting < ActiveRecord::Base
1
+ class Setting < ApplicationRecord
2
2
  validates :name,
3
3
  presence: true,
4
4
  uniqueness: { case_sensitive: false }
@@ -1,4 +1,4 @@
1
- class Snippet < ActiveRecord::Base
1
+ class Snippet < ApplicationRecord
2
2
  include Concerns::Translatable
3
3
  translatable_fields :title, :content
4
4
 
data/app/models/store.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Store < ActiveRecord::Base
1
+ class Store < ApplicationRecord
2
2
  belongs_to :storable, polymorphic: true, touch: true
3
3
 
4
4
  serialize :value
data/app/models/tag.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Tag < ActiveRecord::Base
1
+ class Tag < ApplicationRecord
2
2
  include Concerns::Locale
3
3
 
4
4
  validates :locale, :name, :slug, presence: true
@@ -1,4 +1,4 @@
1
- class TaggedItem < ActiveRecord::Base
1
+ class TaggedItem < ApplicationRecord
2
2
  belongs_to :taggable, polymorphic: true
3
3
  belongs_to :tag
4
4
 
@@ -1,6 +1,6 @@
1
1
  <nav class="navbar navbar-dark bg-inverse">
2
2
  <%= link_to backend_path, class: 'navbar-brand' do %>
3
- <%= Udongo.config.project_name %>
3
+ <%= Udongo.config.base.project_name %>
4
4
  <% end %>
5
5
 
6
6
  <%= render 'layouts/backend/top_navigation' %>
@@ -32,7 +32,7 @@
32
32
  <div class="content-column col-xs-<%= column.width_xs %> col-sm-<%= column.width_sm %> col-md-<%= column.width_md %> col-lg-<%= column.width_lg %> col-xl-<%= column.width_xl %>" data-update-position="<%= update_position_backend_content_row_column_path(row, column) %>">
33
33
  <div class="card handle">
34
34
  <div class="card-block">
35
- <% Udongo.config.flexible_content_types.each do |content_type| %>
35
+ <% Udongo.config.flexible_content.types.each do |content_type| %>
36
36
  <%= render("backend/content/#{content_type}", object: content) if content.content_type_is?(content_type) %>
37
37
  <% end %>
38
38
  </div>
@@ -8,7 +8,7 @@
8
8
  <%= link_to t('b.general'), edit_backend_email_template_path(@model), class: klass %>
9
9
  </li>
10
10
 
11
- <% Udongo.config.locales.each do |locale| %>
11
+ <% Udongo.config.i18n.locales.each do |locale| %>
12
12
  <li class="nav-item">
13
13
  <% klass = %w(nav-link) %>
14
14
  <% klass << 'active' if active == locale.to_sym %>
@@ -8,7 +8,7 @@
8
8
  <%= link_to t('b.general'), edit_backend_navigation_item_path(@navigation, @model), class: klass %>
9
9
  </li>
10
10
 
11
- <% Udongo.config.locales.each do |locale| %>
11
+ <% Udongo.config.i18n.locales.each do |locale| %>
12
12
  <li class="nav-item">
13
13
  <% klass = %w(nav-link) %>
14
14
  <% klass << 'active' if active == locale.to_sym %>
@@ -8,7 +8,7 @@
8
8
  <%= link_to t('b.general'), edit_backend_page_path(@model), class: klass %>
9
9
  </li>
10
10
 
11
- <% Udongo.config.locales.each do |locale| %>
11
+ <% Udongo.config.i18n.locales.each do |locale| %>
12
12
  <li class="nav-item">
13
13
  <% klass = %w(nav-link) %>
14
14
  <% klass << 'active' if active == locale.to_sym %>
@@ -8,7 +8,7 @@
8
8
  <%= link_to t('b.general'), edit_backend_snippet_path(@model), class: klass %>
9
9
  </li>
10
10
 
11
- <% Udongo.config.locales.each do |locale| %>
11
+ <% Udongo.config.i18n.locales.each do |locale| %>
12
12
  <li class="nav-item">
13
13
  <% klass = %w(nav-link) %>
14
14
  <% klass << 'active' if active == locale.to_sym %>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
- <title>Backend - <%= Udongo.config.project_name %></title>
6
+ <title>Backend - <%= Udongo.config.base.project_name %></title>
7
7
 
8
8
  <%= yield(:javascripts_head) %>
9
9
 
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
- <title>Login - <%= Udongo.config.project_name %></title>
6
+ <title>Login - <%= Udongo.config.base.project_name %></title>
7
7
 
8
8
  <%= stylesheet_link_tag 'backend/application', media: 'all' %>
9
9
  <%= javascript_include_tag 'backend/application' %>
data/changelog.md CHANGED
@@ -1,3 +1,13 @@
1
+ 2.0.0 - 2016-07-29
2
+ --
3
+ * The system for setting config variables has changed. Every setting has moved
4
+ into separate namespaced classes. See the docs configuration section
5
+ * Fix the form settings subclasses.
6
+ * Upgrade to rails 5.
7
+ * Add nl_general.
8
+ * Add the spec directory to the gem so you can use its factories and concerns.
9
+
10
+
1
11
  1.0.4 - 2016-07-23
2
12
  --
3
13
  * Add spec for the SnippetForm class.
@@ -0,0 +1,16 @@
1
+ en:
2
+ g:
3
+ address: Address
4
+ cancel: Cancel
5
+ category: Category
6
+ close: Close
7
+ first_name: First name
8
+ last_name: Last name
9
+ description: Description
10
+ email: E-mail
11
+ house_number: Housenumber
12
+ name: Name
13
+ save: Save
14
+ search: Search
15
+ subject: Subject
16
+ telephone: Telephone
@@ -0,0 +1,16 @@
1
+ nl:
2
+ g:
3
+ address: Adres
4
+ cancel: Annuleren
5
+ category: Categorie
6
+ close: Sluiten
7
+ first_name: Voornaam
8
+ last_name: Achternaam
9
+ description: Beschrijving
10
+ email: E-mail
11
+ house_number: Huisnummer
12
+ name: Naam
13
+ save: Opslaan
14
+ search: Zoeken
15
+ subject: Onderwerp
16
+ telephone: Telefoon
data/config/routes.rb CHANGED
@@ -71,7 +71,7 @@ Rails.application.routes.draw do
71
71
  end
72
72
 
73
73
  scope module: 'rows' do
74
- Udongo.config.flexible_content_types.each do |content_type|
74
+ Udongo.config.flexible_content.types.each do |content_type|
75
75
  resources content_type.to_s.pluralize.to_sym, only: [:edit, :update]
76
76
  end
77
77
  end
@@ -24,10 +24,10 @@ class Udongo::FormGenerator < Rails::Generators::Base
24
24
  end
25
25
 
26
26
  def create_database_records
27
- f = Form.create!(locales: Udongo.config.locales, identifier: name)
27
+ f = Form.create!(locales: Udongo.config.i18n.locales, identifier: name)
28
28
 
29
29
  @fields.each do |field|
30
- field_object = f.fields.create!(locales: Udongo.config.locales, name: field.name, field_type: field.type)
30
+ field_object = f.fields.create!(locales: Udongo.config.i18n.locales, name: field.name, field_type: field.type)
31
31
  #field_object.validations.create!(locales: Udongo.config.locales, validation_class: 'Udongo::FormValidations::Required')
32
32
  end
33
33
 
data/lib/udongo/config.rb CHANGED
@@ -1,27 +1,17 @@
1
1
  module Udongo
2
2
  class Config
3
- attr_accessor :default_locale, :locales, :prefix_routes_with_locale, :host,
4
- :time_zone, :allow_new_tags, :flexible_content_types,
5
- :project_name, :forms
6
-
7
3
  def initialize
8
- @default_locale = :nl
9
- @locales = %w(nl en fr de)
10
- @prefix_routes_with_locale = true
11
- @host = 'udongo.dev'
12
- @time_zone = 'Brussels'
13
- @allow_new_tags = true
14
- @flexible_content_types = %w(text image)
15
- @project_name = 'Udongo'
16
- @forms = Udongo::Configs::Forms.new
4
+ @configs = {}
17
5
  end
18
6
 
19
- def prefix_routes_with_locale?
20
- prefix_routes_with_locale === true
21
- end
7
+ def method_missing(method_name, *arguments, &block)
8
+ super if method_name.to_s.include?('=')
9
+
10
+ unless @configs[method_name]
11
+ @configs[method_name] = "Udongo::Configs::#{method_name.to_s.camelcase}".constantize.new
12
+ end
22
13
 
23
- def allow_new_tags?
24
- allow_new_tags === true
14
+ @configs[method_name]
25
15
  end
26
16
  end
27
17
  end
@@ -0,0 +1,11 @@
1
+ module Udongo
2
+ module Configs
3
+ class Base
4
+ include Virtus.model
5
+
6
+ attribute :host, String, default: 'udongo.dev'
7
+ attribute :project_name, String, default: 'Udongo'
8
+ attribute :time_zone, String, default: 'Brussels'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module Udongo
2
+ module Configs
3
+ class FlexibleContent
4
+ include Virtus.model
5
+
6
+ attribute :types, Array, default: %w(text image)
7
+ end
8
+ end
9
+ end
@@ -2,12 +2,16 @@ module Udongo
2
2
  module Configs
3
3
  class Forms
4
4
  def initialize
5
- @submission_datagrids = {}
5
+ @configs = {}
6
6
  end
7
7
 
8
8
  def method_missing(method, *args, &block)
9
- form = ::Form.find_by!(identifier: method)
10
- @submission_datagrids[form.identifier.to_sym] ||= OpenStruct.new(datagrid_fields: [], filter_fields: [])
9
+ unless @configs[method]
10
+ super unless ::Form.find_by(identifier: method)
11
+ @configs[method] = OpenStruct.new(datagrid_fields: [], filter_fields: [])
12
+ end
13
+
14
+ @configs[method]
11
15
  end
12
16
  end
13
17
  end
@@ -0,0 +1,10 @@
1
+ module Udongo
2
+ module Configs
3
+ class I18n
4
+ include Virtus.model
5
+
6
+ attribute :default_locale, String, default: 'nl'
7
+ attribute :locales, Array, default: %w(nl en fr de)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ module Udongo
2
+ module Configs
3
+ class Routes
4
+ include Virtus.model
5
+
6
+ attribute :prefix_with_locale, Axiom::Types::Boolean, default: true
7
+
8
+ def prefix_with_locale?
9
+ prefix_with_locale === true
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Udongo
2
+ module Configs
3
+ class Tags
4
+ include Virtus.model
5
+
6
+ attribute :allow_new, Axiom::Types::Boolean, default: true
7
+
8
+ def allow_new?
9
+ allow_new === true
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,7 +1,6 @@
1
1
  module Udongo
2
2
  module Forms
3
3
  class SubmissionDatagrid
4
- include Udongo::Forms::Config
5
4
  include ActionView::Helpers::TagHelper
6
5
 
7
6
  def initialize(form)
@@ -12,13 +11,12 @@ module Udongo
12
11
  map_fields { |field| content_tag(:td, submission.data_object.send(field)) }
13
12
  end
14
13
 
15
- def column_headers(filter)
14
+ def column_headers
16
15
  map_fields { |field| content_tag(:th, I18n.t("b.#{field}")) }
17
16
  end
18
17
 
19
18
  def fields
20
- return [] if config.nil?
21
- config.datagrid_fields
19
+ Udongo.config.forms.send(@form.identifier).datagrid_fields
22
20
  end
23
21
 
24
22
  def map_fields(&block)
@@ -1,7 +1,6 @@
1
1
  module Udongo
2
2
  module Forms
3
3
  class SubmissionFilter
4
- include Udongo::Forms::Config
5
4
  attr_reader :params
6
5
 
7
6
  def initialize(form, params = {})
@@ -10,8 +9,7 @@ module Udongo
10
9
  end
11
10
 
12
11
  def fields
13
- return [] if config.nil?
14
- config.filter_fields
12
+ Udongo.config.forms.send(@form.identifier).filter_fields
15
13
  end
16
14
 
17
15
  def result
@@ -1,3 +1,3 @@
1
1
  module Udongo
2
- VERSION = '1.0.4'
2
+ VERSION = '2.0.0'
3
3
  end
data/readme.md CHANGED
@@ -1,5 +1,75 @@
1
1
  [![Code Climate](https://codeclimate.com/github/udongo/udongo/badges/gpa.svg)](https://codeclimate.com/github/udongo/udongo)
2
2
 
3
+ # Configuration settings
4
+ Every configuration setting has been moved in groups within separate classes.
5
+ The syntax is always ```Udongo.config.[namespace].[setting]```
6
+
7
+ ## Base
8
+ ### host
9
+ ```ruby
10
+ Udongo.config.base.host = 'udongo.dev'
11
+ ```
12
+
13
+ ### project_name
14
+ ```ruby
15
+ Udongo.config.base.project_name = 'Udongo'
16
+ ```
17
+
18
+ ### time_zone
19
+ ```ruby
20
+ Udongo.config.base.time_zone = 'Brussels'
21
+ ```
22
+
23
+ ## Tags
24
+ ### allow_new
25
+ ```ruby
26
+ Udongo.config.tags.allow_new = false
27
+ ```
28
+
29
+ ## I18n
30
+ ### default_locale
31
+ ```ruby
32
+ Udongo.config.i18n.default_locale = :nl
33
+ ```
34
+
35
+ ### locales
36
+ ```ruby
37
+ Udongo.config.i18n.locales = %w(nl en fr de)
38
+ ```
39
+
40
+ ## Flexible content
41
+ ### types
42
+ ```ruby
43
+ Udongo.config.flexible_content.types = %w(text image)
44
+ ```
45
+
46
+ ## Routes
47
+ ### prefix_with_locale
48
+ ```ruby
49
+ Udongo.config.routes.prefix_with_locale = true
50
+ ```
51
+
52
+ ## Forms
53
+ At this moment configurations are always form specific. Let's assume you have a
54
+ form with ```contact``` as identifier.
55
+
56
+ ### filter_fields
57
+ ```ruby
58
+ Udongo.config.forms.contact.filter_fields = %w(first_name last_name email)
59
+ ```
60
+
61
+ In this scenario there will be 3 fields above the list of submissions for the
62
+ contact form that you can use to search through the data.
63
+
64
+ ### datagrid_fields
65
+ ```ruby
66
+ Udongo.config.forms.contact.datagrid_fields = %w(first_name last_name email)
67
+ ```
68
+
69
+ The datagrid will only contain those 3 fields. If no fields are defined we fall
70
+ back to displaying all fields within a single column named 'data'.
71
+
72
+
3
73
  # Concerns
4
74
  ## Storable concern
5
75
  ### Possible field types
@@ -13,7 +83,7 @@
13
83
 
14
84
  ### Setup
15
85
  ```ruby
16
- class User < ActiveRecord::Base
86
+ class User < ApplicationRecord
17
87
  include Concerns::Storable
18
88
 
19
89
  storable_field :gender, String, 'male'
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: 1.0.4
4
+ version: 2.0.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: 2016-07-23 00:00:00.000000000 Z
12
+ date: 2016-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 4.2.6
20
+ version: 5.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 4.2.6
27
+ version: 5.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: jquery-rails
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -269,22 +269,16 @@ dependencies:
269
269
  name: draper
270
270
  requirement: !ruby/object:Gem::Requirement
271
271
  requirements:
272
- - - "~>"
273
- - !ruby/object:Gem::Version
274
- version: '1.4'
275
- - - ">="
272
+ - - '='
276
273
  - !ruby/object:Gem::Version
277
- version: 1.4.0
274
+ version: 3.0.0.pre1
278
275
  type: :runtime
279
276
  prerelease: false
280
277
  version_requirements: !ruby/object:Gem::Requirement
281
278
  requirements:
282
- - - "~>"
283
- - !ruby/object:Gem::Version
284
- version: '1.4'
285
- - - ">="
279
+ - - '='
286
280
  - !ruby/object:Gem::Version
287
- version: 1.4.0
281
+ version: 3.0.0.pre1
288
282
  - !ruby/object:Gem::Dependency
289
283
  name: ransack
290
284
  requirement: !ruby/object:Gem::Requirement
@@ -447,7 +441,6 @@ executables: []
447
441
  extensions: []
448
442
  extra_rdoc_files: []
449
443
  files:
450
- - MIT-LICENSE
451
444
  - Rakefile
452
445
  - app/assets/fonts/FontAwesome.otf
453
446
  - app/assets/fonts/fontawesome-webfont.eot
@@ -532,6 +525,7 @@ files:
532
525
  - app/mailers/general_mailer.rb
533
526
  - app/models/address.rb
534
527
  - app/models/admin.rb
528
+ - app/models/application_record.rb
535
529
  - app/models/ckeditor/asset.rb
536
530
  - app/models/ckeditor/attachment_file.rb
537
531
  - app/models/ckeditor/picture.rb
@@ -657,10 +651,12 @@ files:
657
651
  - config/locales/en.yml
658
652
  - config/locales/en_backend.yml
659
653
  - config/locales/en_forms.yml
654
+ - config/locales/en_general.yml
660
655
  - config/locales/fr.yml
661
656
  - config/locales/nl.yml
662
657
  - config/locales/nl_backend.yml
663
658
  - config/locales/nl_forms.yml
659
+ - config/locales/nl_general.yml
664
660
  - config/routes.rb
665
661
  - config/spring.rb
666
662
  - db/migrate/20150404133314_create_udongo_admins.rb
@@ -733,7 +729,12 @@ files:
733
729
  - lib/udongo/assets/precompiler.rb
734
730
  - lib/udongo/breadcrumb.rb
735
731
  - lib/udongo/config.rb
732
+ - lib/udongo/configs/base.rb
733
+ - lib/udongo/configs/flexible_content.rb
736
734
  - lib/udongo/configs/forms.rb
735
+ - lib/udongo/configs/i18n.rb
736
+ - lib/udongo/configs/routes.rb
737
+ - lib/udongo/configs/tags.rb
737
738
  - lib/udongo/crypt.rb
738
739
  - lib/udongo/cryptography.rb
739
740
  - lib/udongo/email_vars/address.rb
@@ -742,7 +743,6 @@ files:
742
743
  - lib/udongo/engine.rb
743
744
  - lib/udongo/flexible_content/column_width_calculator.rb
744
745
  - lib/udongo/form.rb
745
- - lib/udongo/forms/config.rb
746
746
  - lib/udongo/forms/submission_datagrid.rb
747
747
  - lib/udongo/forms/submission_filter.rb
748
748
  - lib/udongo/meta_info.rb
@@ -786,7 +786,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
786
786
  version: '0'
787
787
  requirements: []
788
788
  rubyforge_project:
789
- rubygems_version: 2.5.1
789
+ rubygems_version: 2.6.6
790
790
  signing_key:
791
791
  specification_version: 4
792
792
  summary: Blimp CMS
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright 2015 Bauffman
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,11 +0,0 @@
1
- module Udongo
2
- module Forms
3
- module Config
4
- attr_reader :form
5
-
6
- def config
7
- Udongo.config.forms.send(form.identifier.to_sym)
8
- end
9
- end
10
- end
11
- end