zencms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/zencms/application.js.coffee +19 -0
  6. data/app/assets/stylesheets/zencms/application.css.sass +6 -0
  7. data/app/controllers/zencms/application_controller.rb +4 -0
  8. data/app/controllers/zencms/backend/posts_controller.rb +37 -0
  9. data/app/controllers/zencms/posts_controller.rb +34 -0
  10. data/app/helpers/zencms/application_helper.rb +25 -0
  11. data/app/helpers/zencms/menu_items_helper.rb +15 -0
  12. data/app/helpers/zencms/posts_helper.rb +41 -0
  13. data/app/models/zencms/asset.rb +14 -0
  14. data/app/models/zencms/menu_item.rb +11 -0
  15. data/app/models/zencms/post.rb +48 -0
  16. data/app/models/zencms/post/audio.rb +8 -0
  17. data/app/models/zencms/post/image.rb +8 -0
  18. data/app/models/zencms/post_type.rb +5 -0
  19. data/app/views/layouts/zencms/application.html.haml +35 -0
  20. data/app/views/zencms/backend/posts/_audio_fields.html.haml +14 -0
  21. data/app/views/zencms/backend/posts/_form.html.haml +53 -0
  22. data/app/views/zencms/backend/posts/_image_fields.html.haml +14 -0
  23. data/app/views/zencms/backend/posts/edit.html.haml +1 -0
  24. data/app/views/zencms/backend/posts/index.html.haml +26 -0
  25. data/app/views/zencms/backend/posts/new.html.haml +1 -0
  26. data/app/views/zencms/posts/_post.html.haml +17 -0
  27. data/app/views/zencms/posts/_post_grid.html.haml +6 -0
  28. data/app/views/zencms/posts/_post_teaser.html.haml +6 -0
  29. data/app/views/zencms/posts/index.html.haml +6 -0
  30. data/app/views/zencms/posts/show.html.haml +1 -0
  31. data/app/views/zencms/shared/_block_archive.html.haml +6 -0
  32. data/app/views/zencms/shared/_block_categories.html.haml +6 -0
  33. data/app/views/zencms/shared/_block_tags.html.haml +7 -0
  34. data/app/views/zencms/shared/_images_carousel.html.haml +12 -0
  35. data/config/initializers/act_as_taggable_on.rb +10 -0
  36. data/config/initializers/friendly_id.rb +88 -0
  37. data/config/initializers/paperclip_defaults.rb +4 -0
  38. data/config/initializers/simple_form.rb +145 -0
  39. data/config/initializers/simple_form_bootstrap.rb +85 -0
  40. data/config/locales/simple_form.en.yml +26 -0
  41. data/config/routes.rb +17 -0
  42. data/db/migrate/20131222153742_create_zencms_posts.rb +15 -0
  43. data/db/migrate/20131222153810_create_zencms_assets.rb +13 -0
  44. data/db/migrate/20131222153844_acts_as_taggable_on_migration.rb +31 -0
  45. data/db/migrate/20131222154013_translate_posts.rb +14 -0
  46. data/db/migrate/20131222154211_create_friendly_id_slugs.rb +15 -0
  47. data/db/migrate/20131222161551_create_zencms_post_types.rb +11 -0
  48. data/db/migrate/20131223090443_create_zencms_menu_items.rb +13 -0
  49. data/lib/tasks/zencms_tasks.rake +4 -0
  50. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  51. data/lib/zencms.rb +4 -0
  52. data/lib/zencms/engine.rb +31 -0
  53. data/lib/zencms/version.rb +3 -0
  54. data/test/dummy/README.rdoc +28 -0
  55. data/test/dummy/Rakefile +6 -0
  56. data/test/dummy/app/assets/javascripts/application.js +13 -0
  57. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  58. data/test/dummy/app/controllers/application_controller.rb +5 -0
  59. data/test/dummy/app/helpers/application_helper.rb +2 -0
  60. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  61. data/test/dummy/bin/bundle +3 -0
  62. data/test/dummy/bin/rails +4 -0
  63. data/test/dummy/bin/rake +4 -0
  64. data/test/dummy/config.ru +4 -0
  65. data/test/dummy/config/application.rb +23 -0
  66. data/test/dummy/config/boot.rb +5 -0
  67. data/test/dummy/config/database.yml +25 -0
  68. data/test/dummy/config/environment.rb +5 -0
  69. data/test/dummy/config/environments/development.rb +29 -0
  70. data/test/dummy/config/environments/production.rb +80 -0
  71. data/test/dummy/config/environments/test.rb +36 -0
  72. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  73. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  74. data/test/dummy/config/initializers/inflections.rb +16 -0
  75. data/test/dummy/config/initializers/mime_types.rb +5 -0
  76. data/test/dummy/config/initializers/secret_token.rb +12 -0
  77. data/test/dummy/config/initializers/session_store.rb +3 -0
  78. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  79. data/test/dummy/config/locales/en.yml +23 -0
  80. data/test/dummy/config/routes.rb +4 -0
  81. data/test/dummy/db/development.sqlite3 +0 -0
  82. data/test/dummy/db/migrate/20131222160046_create_zencms_posts.zencms.rb +16 -0
  83. data/test/dummy/db/migrate/20131222160047_create_zencms_assets.zencms.rb +14 -0
  84. data/test/dummy/db/migrate/20131222160048_acts_as_taggable_on_migration.zencms.rb +31 -0
  85. data/test/dummy/db/migrate/20131222160049_translate_posts.zencms.rb +15 -0
  86. data/test/dummy/db/migrate/20131222160050_create_friendly_id_slugs.zencms.rb +16 -0
  87. data/test/dummy/db/schema.rb +88 -0
  88. data/test/dummy/db/test.sqlite3 +0 -0
  89. data/test/dummy/log/development.log +48 -0
  90. data/test/dummy/log/test.log +5 -0
  91. data/test/dummy/public/404.html +58 -0
  92. data/test/dummy/public/422.html +58 -0
  93. data/test/dummy/public/500.html +57 -0
  94. data/test/dummy/public/favicon.ico +0 -0
  95. data/test/fixtures/zencms/assets.yml +11 -0
  96. data/test/fixtures/zencms/menu_items.yml +11 -0
  97. data/test/fixtures/zencms/post_types.yml +11 -0
  98. data/test/fixtures/zencms/posts.yml +11 -0
  99. data/test/integration/navigation_test.rb +10 -0
  100. data/test/models/zencms/assets_test.rb +9 -0
  101. data/test/models/zencms/menu_item_test.rb +9 -0
  102. data/test/models/zencms/post_test.rb +9 -0
  103. data/test/models/zencms/post_type_test.rb +9 -0
  104. data/test/test_helper.rb +15 -0
  105. data/test/zencms_test.rb +7 -0
  106. metadata +478 -0
@@ -0,0 +1,14 @@
1
+ %tr
2
+ - unless f.object.new_record?
3
+ %td
4
+ = image_tag f.object.url(:thumb)
5
+ %td
6
+ = f.hidden_field :id
7
+ = f.input :title, label_html: {class: 'hidden'}
8
+ %td
9
+ = f.hidden_field :_destroy
10
+ = link_to raw("<i class='fa fa-trash-o'></i> Remove"), '#', class: "remove_fields btn btn-danger"
11
+ - else
12
+ %td{colspan: 3}
13
+ = f.hidden_field :id
14
+ = f.input :attachment
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1,26 @@
1
+ %ul.list-inline
2
+ %li= link_to 'Create', new_backend_post_path, class: 'btn btn-primary'
3
+
4
+ %table.table.table-bordered
5
+ %thead
6
+ %tr
7
+ %th Title
8
+ %th Promotion
9
+ %th Categories
10
+ %th Tags
11
+ %th Created at
12
+ %th Operations
13
+ %tbody
14
+ - collection.each do |resource|
15
+ %tr
16
+ %td= resource.title
17
+ %td
18
+ =content_tag(:span, 'Sticky', class: 'label label-info') if resource.sticky?
19
+ =content_tag(:span, 'Front', class: 'label label-info') if resource.frontpage?
20
+ =content_tag(:span, 'Draft', class: 'label label-danger') unless resource.published?
21
+ %td= post_categories(resource)
22
+ %td= post_tags(resource)
23
+ %td= time_tag resource.created_at
24
+ %td
25
+ =link_to raw("<i class='fa fa-edit'></i> Edit"), edit_backend_post_path(resource), class: 'btn btn-sm btn-primary'
26
+ =link_to raw("<i class='fa fa-trash-o'></i> Delete"), backend_post_path(resource), :'data-confirm' => 'Are you sure?', :method => :delete, class: 'btn btn-sm btn-danger'
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1,17 @@
1
+ %article.row
2
+ .col-md-5
3
+ %aside
4
+ = post_grid_images(post) if post.images.any?
5
+ = post_audios(post) if post.audios.any?
6
+ .col-md-7
7
+ %header.text-center
8
+ = content_tag :h1, link_to(post.title, post), title: "",class: 'post-title'
9
+ = content_tag :p, time_tag(post.created_at.to_date)
10
+ = content_tag :p, post.username if post.user.present?
11
+ = sanitize post.body
12
+ %footer
13
+ = post_categories(post) if post.categories.any?
14
+ = post_tags(post) if post.tags.any?
15
+ %ul.pager
16
+ = content_tag :li, link_to(post.previous.title, post.previous), class: 'previous' if post.previous
17
+ = content_tag :li, link_to(post.next.title, post.next), class: 'next' if post.next
@@ -0,0 +1,6 @@
1
+ .col-md-4
2
+ %article.thumbnail.post-grid
3
+ = image_tag post.images.first.url(:small) if post.images.first
4
+ .caption
5
+ = content_tag :h2, link_to(post.title, post), class: 'post-title'
6
+ = post_teaser(post, 140)
@@ -0,0 +1,6 @@
1
+ %article.post.post-teaser.media.well
2
+ - if post.images.first
3
+ .pull-left= image_tag post.images.first.url(:small), class: 'media-object'
4
+ .media-body
5
+ = content_tag :h2, link_to(post.title, post), class: 'media-heading post-title'
6
+ = post_teaser(post, 400)
@@ -0,0 +1,6 @@
1
+ = render partial: 'post_teaser', collection: collection, as: :post
2
+
3
+ - content_for :sidebar_first do
4
+ = render 'zencms/shared/block_categories'
5
+ = render 'zencms/shared/block_tags'
6
+ = render 'zencms/shared/block_archive', collection: @posts_by_month
@@ -0,0 +1 @@
1
+ = render resource
@@ -0,0 +1,6 @@
1
+ %section.panel.panel-default
2
+ .panel-heading
3
+ = content_tag :h3, t('.archives'), class: 'panel-title'
4
+ .list-group
5
+ - collection.each do |months, posts|
6
+ = link_to l(months.beginning_of_month, format: "%B %Y"), archive_posts_path(:year => months.year, :month => months.month), class: 'list-group-item'
@@ -0,0 +1,6 @@
1
+ %section.panel.panel-default
2
+ .panel-heading
3
+ = content_tag :h3, "Categories", class: 'panel-title'
4
+ .list-group
5
+ - Zencms::Post.all.tag_counts_on(:categories).each do |category|
6
+ = link_to category, category_posts_path(category), class: 'list-group-item'
@@ -0,0 +1,7 @@
1
+ %section.panel.panel-default
2
+ .panel-heading
3
+ = content_tag :h3, "Tags", class: 'panel-title'
4
+ .panel-body
5
+ %ul.list-inline
6
+ - Zencms::Post.all.tag_counts_on(:tags).each do |tag|
7
+ %li= link_to tag, tag_posts_path(tag)
@@ -0,0 +1,12 @@
1
+ .carousel.slide{id: "images-slide-#{resource.id}", :'data-ride' => 'carousel'}
2
+ %ol.carousel-indicators
3
+ - collection.each_with_index do |image, index|
4
+ %li{:'data-target' => "#images-slide-#{resource.id}", :"data-slide-to" => index, class: "#{ "active" if index == 0 }"}
5
+ .carousel-inner
6
+ - collection.each_with_index do |image, index|
7
+ .item{class: "#{ "active" if index == 0 }", style: "height: 400px; background: url(#{image.url(:original)}); background-size: cover;"}
8
+ .carousel-caption= image.title
9
+ %a.left.carousel-control{:'data-slide' => 'prev', href: "#images-slide-#{resource.id}"}
10
+ %i.icon-prev
11
+ %a.right.carousel-control{:'data-slide' => 'next', href: "#images-slide-#{resource.id}"}
12
+ %i.icon-next
@@ -0,0 +1,10 @@
1
+ ActsAsTaggableOn::Tag.class_eval do
2
+ extend FriendlyId
3
+ friendly_id :name,
4
+ :use => :slugged,
5
+ :reserved_words => ['show', 'edit', 'create', 'update', 'destroy']
6
+ end
7
+
8
+ ActsAsTaggableOn.remove_unused_tags = true
9
+ ActsAsTaggableOn.force_lowercase = false
10
+ ActsAsTaggableOn.force_parameterize = false
@@ -0,0 +1,88 @@
1
+ # FriendlyId Global Configuration
2
+ #
3
+ # Use this to set up shared configuration options for your entire application.
4
+ # Any of the configuration options shown here can also be applied to single
5
+ # models by passing arguments to the `friendly_id` class method or defining
6
+ # methods in your model.
7
+ #
8
+ # To learn more, check out the guide:
9
+ #
10
+ # http://norman.github.io/friendly_id/file.Guide.html
11
+
12
+ FriendlyId.defaults do |config|
13
+ # ## Reserved Words
14
+ #
15
+ # Some words could conflict with Rails's routes when used as slugs, or are
16
+ # undesirable to allow as slugs. Edit this list as needed for your app.
17
+ config.use :reserved
18
+
19
+ config.reserved_words = %w(new edit index session login logout users admin
20
+ stylesheets assets javascripts images)
21
+
22
+ # ## Friendly Finders
23
+ #
24
+ # Uncomment this to use friendly finders in all models. By default, if
25
+ # you wish to find a record by its friendly id, you must do:
26
+ #
27
+ # MyModel.friendly.find('foo')
28
+ #
29
+ # If you uncomment this, you can do:
30
+ #
31
+ # MyModel.find('foo')
32
+ #
33
+ # This is significantly more convenient but may not be appropriate for
34
+ # all applications, so you must explicity opt-in to this behavior. You can
35
+ # always also configure it on a per-model basis if you prefer.
36
+ #
37
+ # Something else to consider is that using the :finders addon boosts
38
+ # performance because it will avoid Rails-internal code that makes runtime
39
+ # calls to `Module.extend`.
40
+ #
41
+ # config.use :finders
42
+ #
43
+ # ## Slugs
44
+ #
45
+ # Most applications will use the :slugged module everywhere. If you wish
46
+ # to do so, uncomment the following line.
47
+ #
48
+ # config.use :slugged
49
+ #
50
+ # By default, FriendlyId's :slugged addon expects the slug column to be named
51
+ # 'slug', but you can change it if you wish.
52
+ #
53
+ # config.slug_column = 'slug'
54
+ #
55
+ # When FriendlyId can not generate a unique ID from your base method, it appends
56
+ # a UUID, separated by a single dash. You can configure the character used as the
57
+ # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
58
+ # with two dashes.
59
+ #
60
+ # config.sequence_separator = '-'
61
+ #
62
+ # ## Tips and Tricks
63
+ #
64
+ # ### Controlling when slugs are generated
65
+ #
66
+ # As of FriendlyId 5.0, new slugs are generated only when the slug field is
67
+ # nil, but you if you're using a column as your base method can change this
68
+ # behavior by overriding the `should_generate_new_friendly_id` method that
69
+ # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
70
+ # more like 4.0.
71
+ #
72
+ # config.use Module.new {
73
+ # def should_generate_new_friendly_id?
74
+ # slug.blank? || <your_column_name_here>_changed?
75
+ # end
76
+ # }
77
+ #
78
+ # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
79
+ # languages that don't use the Roman alphabet, that's not usually suffient. Here
80
+ # we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
81
+ # you use this, don't forget to add "babosa" to your Gemfile.
82
+ #
83
+ # config.use Module.new {
84
+ # def normalize_friendly_id(text)
85
+ # text.to_slug.normalize! :transliterations => [:russian, :latin]
86
+ # end
87
+ # }
88
+ end
@@ -0,0 +1,4 @@
1
+ Paperclip::Attachment.default_options.update({
2
+ :url => "/system/:attachment/:class/:id_partition/:basename-:style.:extension",
3
+ :path => ":rails_root/public/system/:attachment/:class/:id_partition/:basename-:style.:extension"
4
+ })
@@ -0,0 +1,145 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+ config.wrappers :default, class: :input,
9
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
+ ## Extensions enabled by default
11
+ # Any of these extensions can be disabled for a
12
+ # given input by passing: `f.input EXTENSION_NAME => false`.
13
+ # You can make any of these extensions optional by
14
+ # renaming `b.use` to `b.optional`.
15
+
16
+ # Determines whether to use HTML5 (:email, :url, ...)
17
+ # and required attributes
18
+ b.use :html5
19
+
20
+ # Calculates placeholders automatically from I18n
21
+ # You can also pass a string as f.input placeholder: "Placeholder"
22
+ b.use :placeholder
23
+
24
+ ## Optional extensions
25
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26
+ # to the input. If so, they will retrieve the values from the model
27
+ # if any exists. If you want to enable the lookup for any of those
28
+ # extensions by default, you can change `b.optional` to `b.use`.
29
+
30
+ # Calculates maxlength from length validations for string inputs
31
+ b.optional :maxlength
32
+
33
+ # Calculates pattern from format validations for string inputs
34
+ b.optional :pattern
35
+
36
+ # Calculates min and max from length validations for numeric inputs
37
+ b.optional :min_max
38
+
39
+ # Calculates readonly automatically from readonly attributes
40
+ b.optional :readonly
41
+
42
+ ## Inputs
43
+ b.use :label_input
44
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
45
+ b.use :error, wrap_with: { tag: :span, class: :error }
46
+ end
47
+
48
+ # The default wrapper to be used by the FormBuilder.
49
+ config.default_wrapper = :default
50
+
51
+ # Define the way to render check boxes / radio buttons with labels.
52
+ # Defaults to :nested for bootstrap config.
53
+ # inline: input + label
54
+ # nested: label > input
55
+ config.boolean_style = :nested
56
+
57
+ # Default class for buttons
58
+ config.button_class = 'btn btn-primary'
59
+
60
+ # Method used to tidy up errors. Specify any Rails Array method.
61
+ # :first lists the first message for each field.
62
+ # Use :to_sentence to list all errors for each field.
63
+ # config.error_method = :first
64
+
65
+ # Default tag used for error notification helper.
66
+ config.error_notification_tag = :div
67
+
68
+ # CSS class to add for error notification helper.
69
+ config.error_notification_class = 'alert alert-danger'
70
+
71
+ # ID to add for error notification helper.
72
+ # config.error_notification_id = nil
73
+
74
+ # Series of attempts to detect a default label method for collection.
75
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76
+
77
+ # Series of attempts to detect a default value method for collection.
78
+ # config.collection_value_methods = [ :id, :to_s ]
79
+
80
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81
+ # config.collection_wrapper_tag = nil
82
+
83
+ # You can define the class to use on all collection wrappers. Defaulting to none.
84
+ # config.collection_wrapper_class = nil
85
+
86
+ # You can wrap each item in a collection of radio/check boxes with a tag,
87
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
88
+ # SimpleForm will force this option to be a label.
89
+ # config.item_wrapper_tag = :span
90
+
91
+ # You can define a class to use in all item wrappers. Defaulting to none.
92
+ # config.item_wrapper_class = nil
93
+
94
+ # How the label text should be generated altogether with the required text.
95
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
+
97
+ # You can define the class to use on all labels. Default is nil.
98
+ # config.label_class = 'control-label'
99
+
100
+ # You can define the class to use on all forms. Default is simple_form.
101
+ # config.form_class = :simple_form
102
+
103
+ # You can define which elements should obtain additional classes
104
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
105
+
106
+ # Whether attributes are required by default (or not). Default is true.
107
+ # config.required_by_default = true
108
+
109
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110
+ # These validations are enabled in SimpleForm's internal config but disabled by default
111
+ # in this configuration, which is recommended due to some quirks from different browsers.
112
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113
+ # change this configuration to true.
114
+ config.browser_validations = false
115
+
116
+ # Collection of methods to detect if a file type was given.
117
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
118
+
119
+ # Custom mappings for input types. This should be a hash containing a regexp
120
+ # to match as key, and the input type that will be used when the field name
121
+ # matches the regexp as value.
122
+ # config.input_mappings = { /count/ => :integer }
123
+
124
+ # Custom wrappers for input types. This should be a hash containing an input
125
+ # type as key and the wrapper that will be used for all inputs with specified type.
126
+ # config.wrapper_mappings = { string: :prepend }
127
+
128
+ # Default priority for time_zone inputs.
129
+ # config.time_zone_priority = nil
130
+
131
+ # Default priority for country inputs.
132
+ # config.country_priority = nil
133
+
134
+ # When false, do not use translations for labels.
135
+ # config.translate_labels = true
136
+
137
+ # Automatically discover new inputs in Rails' autoload path.
138
+ # config.inputs_discovery = true
139
+
140
+ # Cache SimpleForm inputs discovery
141
+ # config.cache_discovery = !Rails.env.development?
142
+
143
+ # Default class for inputs
144
+ # config.input_class = nil
145
+ end
@@ -0,0 +1,85 @@
1
+ # http://stackoverflow.com/questions/14972253/simpleform-default-input-class
2
+ # https://github.com/plataformatec/simple_form/issues/316
3
+
4
+ inputs = %w[
5
+ CollectionSelectInput
6
+ DateTimeInput
7
+ FileInput
8
+ GroupedCollectionSelectInput
9
+ NumericInput
10
+ PasswordInput
11
+ RangeInput
12
+ StringInput
13
+ TextInput
14
+ ]
15
+
16
+ inputs.each do |input_type|
17
+ superclass = "SimpleForm::Inputs::#{input_type}".constantize
18
+
19
+ new_class = Class.new(superclass) do
20
+ def input_html_classes
21
+ super.push('form-control')
22
+ end
23
+ end
24
+
25
+ Object.const_set(input_type, new_class)
26
+ end
27
+
28
+ # Use this setup block to configure all options available in SimpleForm.
29
+ SimpleForm.setup do |config|
30
+ config.boolean_style = :nested
31
+
32
+ config.wrappers :bootstrap3, tag: 'div', class: 'form-group', error_class: 'has-error',
33
+ defaults: { input_html: { class: 'default_class' } } do |b|
34
+
35
+ b.use :html5
36
+ b.use :min_max
37
+ b.use :maxlength
38
+ b.use :placeholder
39
+
40
+ b.optional :pattern
41
+ b.optional :readonly
42
+
43
+ b.use :label_input
44
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
45
+ b.use :error, wrap_with: { tag: 'p', class: 'help-block has-error' }
46
+ end
47
+
48
+ config.wrappers :bootstrap3_horizontal, tag: 'div', class: 'form-group', error_class: 'has-error',
49
+ defaults: { input_html: { class: 'default-class '}, wrapper_html: { class: "col-lg-10 col-md-10"} } do |b|
50
+
51
+ b.use :html5
52
+ b.use :min_max
53
+ b.use :maxlength
54
+ b.use :placeholder
55
+
56
+ b.optional :pattern
57
+ b.optional :readonly
58
+
59
+ b.use :label
60
+ b.wrapper :right_column, tag: :div do |component|
61
+ component.use :input
62
+ end
63
+ b.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
64
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block has-error' }
65
+ end
66
+
67
+ config.wrappers :group, tag: 'div', class: "form-group", error_class: 'has-error',
68
+ defaults: { input_html: { class: 'default-class '} } do |b|
69
+
70
+ b.use :html5
71
+ b.use :min_max
72
+ b.use :maxlength
73
+ b.use :placeholder
74
+
75
+ b.optional :pattern
76
+ b.optional :readonly
77
+
78
+ b.use :label
79
+ b.use :input, wrap_with: { class: "input-group" }
80
+ b.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
81
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block has-error' }
82
+ end
83
+
84
+ config.default_wrapper = :bootstrap3
85
+ end