rails_admin_featured_content_rails_6 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/CODE_OF_CONDUCT.md +74 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +92 -0
  7. data/Rakefile +2 -0
  8. data/app/assets/images/fc-image-default.jpg +0 -0
  9. data/app/assets/images/fc-loading.svg +1 -0
  10. data/app/assets/images/fc-snippet-float-one.jpg +0 -0
  11. data/app/assets/images/fc-snippet-float-one.psd +0 -0
  12. data/app/assets/images/fc-snippet-float-three.jpg +0 -0
  13. data/app/assets/images/fc-snippet-float-three.psd +0 -0
  14. data/app/assets/images/fc-snippet-float-two.jpg +0 -0
  15. data/app/assets/images/fc-snippet-float-two.psd +0 -0
  16. data/app/assets/images/fc-snippet-four.jpg +0 -0
  17. data/app/assets/images/fc-snippet-four.psd +0 -0
  18. data/app/assets/images/fc-snippet-highlight.jpg +0 -0
  19. data/app/assets/images/fc-snippet-highlight.psd +0 -0
  20. data/app/assets/images/fc-snippet-one.jpg +0 -0
  21. data/app/assets/images/fc-snippet-one.psd +0 -0
  22. data/app/assets/images/fc-snippet-slide.jpg +0 -0
  23. data/app/assets/images/fc-snippet-slide.psd +0 -0
  24. data/app/assets/images/fc-snippet-text-one.jpg +0 -0
  25. data/app/assets/images/fc-snippet-text-one.psd +0 -0
  26. data/app/assets/images/fc-snippet-text-three.jpg +0 -0
  27. data/app/assets/images/fc-snippet-text-three.psd +0 -0
  28. data/app/assets/images/fc-snippet-text-two.jpg +0 -0
  29. data/app/assets/images/fc-snippet-text-two.psd +0 -0
  30. data/app/assets/images/fc-snippet-text.jpg +0 -0
  31. data/app/assets/images/fc-snippet-text.psd +0 -0
  32. data/app/assets/images/fc-snippet-three.jpg +0 -0
  33. data/app/assets/images/fc-snippet-three.psd +0 -0
  34. data/app/assets/images/fc-snippet-two.jpg +0 -0
  35. data/app/assets/images/fc-snippet-two.psd +0 -0
  36. data/app/assets/javascripts/rails_admin/featured_content.js.erb +574 -0
  37. data/app/assets/javascripts/rails_admin/helpers/autocomplete.js +21 -0
  38. data/app/assets/javascripts/rails_admin/helpers/events.js +4 -0
  39. data/app/assets/javascripts/rails_admin/helpers/generate_radom_id.js +4 -0
  40. data/app/assets/javascripts/rails_admin/helpers/slide.js.erb +77 -0
  41. data/app/assets/javascripts/rails_admin/helpers/upload_file.js +32 -0
  42. data/app/assets/stylesheets/rails_admin/featured_content.scss +661 -0
  43. data/app/controllers/rails_admin_featured_content/featured_content_controller.rb +37 -0
  44. data/app/models/.keep +0 -0
  45. data/app/models/rails_admin_featured_content/featured_content.rb +16 -0
  46. data/app/models/rails_admin_featured_content/featured_content_image.rb +11 -0
  47. data/app/views/.gitkeep +0 -0
  48. data/app/views/rails_admin/main/featured_content.html.erb +113 -0
  49. data/bin/console +14 -0
  50. data/bin/setup +8 -0
  51. data/config/initializers/assets.rb +15 -0
  52. data/config/locales/featured_content.en.yml +32 -0
  53. data/config/locales/featured_content.pt-BR.yml +32 -0
  54. data/config/routes.rb +9 -0
  55. data/lib/generators/rails_admin_featured_content_generator.rb +36 -0
  56. data/lib/generators/templates/create_featured_content_images_migration.rb +10 -0
  57. data/lib/generators/templates/create_featured_content_migration.rb +11 -0
  58. data/lib/generators/templates/featured_content_image_uploader.rb +64 -0
  59. data/lib/generators/templates/rails_admin_featured_content.rb +22 -0
  60. data/lib/rails_admin_featured_content_rails_6.rb +55 -0
  61. data/lib/rails_admin_featured_content_rails_6/engine.rb +22 -0
  62. data/lib/rails_admin_featured_content_rails_6/version.rb +3 -0
  63. data/rails_admin_featured_content_rails_6.gemspec +45 -0
  64. data/screenshots/image-1.png +0 -0
  65. data/vendor/assets/stylesheets/rails_admin_featured_content.scss +459 -0
  66. metadata +426 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e8e635c362f8f4f839ebfcfa519220771fc4d7ee6325ac4a4ea5bfe2cf2981f1
4
+ data.tar.gz: 3b4d761b7fbb60ab67c8afb422fb758473980bedfe37d31afa07664172db98a7
5
+ SHA512:
6
+ metadata.gz: 96582b8d1da3e37ba6b7bb2e7aa72976a6afaa66e7747f165afa1f3a775f95615360fc8e1c6a37f27b2f78cf6c6d7642ee632451ff8930b8415677788857d03e
7
+ data.tar.gz: f04facd6c1c25ba69f398b61ee01d0ec1b4bae8ec162b1e382af0e5471d89c794fe066b4e15f10613ee9ed9ac84e3907c87a49ea60ecd5b2ca283f66d7c0adf7
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at giuliano@agenciaw3.digital. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rails_admin_featured_content_rails_6.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Giuliano Crivelli
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # Rails Admin Featured Content Rails 6
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rails_admin_featured_content_rails_6.svg)](https://badge.fury.io/rb/rails_admin_featured_content_rails_6)
4
+
5
+ An easy way for creating Featured Content using [rails_admin](https://github.com/sferik/rails_admin). This gem is an update of [rails_admin_featured_content](https://github.com/luizpicolo/rails_admin_featured_content), it has bugfixes, improvements and now works on Rails 6.
6
+
7
+ ## Important
8
+
9
+ First, make sure that the gem [rails_admin_content_builder](https://github.com/thefalked/rails_admin_content_builder_rails_6) is installed and working properly.
10
+
11
+ ## Installation
12
+
13
+ This is a complement to the gem rails_admin_content_builder, only works with dependencies listed in the requirements and not alone.
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'rails_admin_featured_content_rails_6'
19
+ ```
20
+ After the above step, execute:
21
+
22
+ $ bundle
23
+
24
+ Run the generator and migrations:
25
+
26
+ rails g rails_admin_featured_content
27
+ rake db:migrate
28
+
29
+ After running the generator, set the module like this in `config -> initializers -> carrierwave.rb`. This is used to low the quality of the image, leaving it light and you can use for all uploaders.
30
+
31
+ ```ruby
32
+ module CarrierWave
33
+ module MiniMagick
34
+ def quality(percentage)
35
+ manipulate! do |img|
36
+ img.quality(percentage.to_s)
37
+ img = yield(img) if block_given?
38
+ img
39
+ end
40
+ end
41
+ end
42
+ end
43
+ ```
44
+ after this steps you need to use your carousel and set the container to the class `.fc-slide`
45
+
46
+ ## Usage
47
+
48
+ Include this in your controller:
49
+
50
+ ```ruby
51
+ @featured = RailsAdminFeaturedContent::FeaturedContent.where(status: true).first
52
+ ```
53
+
54
+ In your show featured content view:
55
+
56
+ ```
57
+ <%= @featured.featured_sanitized %>
58
+ ```
59
+ ## Requirements
60
+
61
+ Dependencies:
62
+
63
+ MiniMagick
64
+ Rails_admin
65
+ Rails_admin_content_builder
66
+
67
+ Supported ORM:
68
+
69
+ ActiveRecord
70
+
71
+ Supported Asset Plugin:
72
+
73
+ CarrierWave
74
+
75
+ ## Development
76
+
77
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
78
+
79
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
80
+
81
+ ## Contributing
82
+
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thefalked/rails_admin_featured_content_rails_6. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/thefalked/rails_admin_featured_content_rails_6/blob/master/CODE_OF_CONDUCT.md).
84
+
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
89
+
90
+ ## Code of Conduct
91
+
92
+ Everyone interacting in the RailsAdminFeaturedContentRails6 project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/thefalked/rails_admin_featured_content_rails_6/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="utf-8"?><svg width='50px' height='50px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-ripple"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><g> <animate attributeName="opacity" dur="2s" repeatCount="indefinite" begin="0s" keyTimes="0;0.33;1" values="1;1;0"></animate><circle cx="50" cy="50" r="40" stroke="#aaaaab" fill="none" stroke-width="6" stroke-linecap="round"><animate attributeName="r" dur="2s" repeatCount="indefinite" begin="0s" keyTimes="0;0.33;1" values="0;22;44"></animate></circle></g><g><animate attributeName="opacity" dur="2s" repeatCount="indefinite" begin="1s" keyTimes="0;0.33;1" values="1;1;0"></animate><circle cx="50" cy="50" r="40" stroke="#7d7d7d" fill="none" stroke-width="6" stroke-linecap="round"><animate attributeName="r" dur="2s" repeatCount="indefinite" begin="1s" keyTimes="0;0.33;1" values="0;22;44"></animate></circle></g></svg>
@@ -0,0 +1,574 @@
1
+ //= require owl.carousel
2
+ //= require_tree ./helpers
3
+
4
+ // scroll to
5
+ function scrollTo(id) {
6
+ if(id) {
7
+ $('html, body').animate({
8
+ scrollTop: $('#' + id).offset().top
9
+ }, 400);
10
+ }
11
+ };
12
+
13
+ // reload the page so it doesn't duplicate the js called in the view
14
+ $(".pjax").click(function () {
15
+ setTimeout(function (){
16
+ location.reload();
17
+ }, 100);
18
+ });
19
+
20
+ // when rails admin ready
21
+ $(document).on('rails_admin.dom_ready', function() {
22
+ $('.fc-container').sortable({
23
+ revert: true,
24
+ placeholder: 'ui-sortable-placeholder',
25
+ handle: '.fc-tools__btn--move',
26
+ cursor: 'move',
27
+ });
28
+
29
+ $('.fc-item').each(function() {
30
+ autocomplete($(this).attr('id'));
31
+ addEventToInputFile($(this).attr('id'));
32
+ });
33
+
34
+ $('.fc-tools__input--upload').each(function() {
35
+ addEventToInputFile($(this).attr('id'));
36
+ });
37
+
38
+ $('.fc-form').on('submit', function(e) {
39
+ slideDestroy($('.fc-slide'));
40
+
41
+ var content = $('.fc-container').html();
42
+ $('#content').attr('value', content);
43
+ });
44
+
45
+ editable();
46
+
47
+ // Fix slide bug
48
+ setTimeout(() => {
49
+ slideActive($('.fc-slide'));
50
+ }, 100);
51
+ });
52
+
53
+ // when click on tools buttons
54
+ $(document).on('click', '.fc-tools__btn', function(e) {
55
+ e.preventDefault();
56
+ });
57
+
58
+ // when click on upload button
59
+ $(document).on('click', '.fc-tools__btn--upload', function() {
60
+ $($(this).attr('href')).find('input').trigger('click');
61
+ });
62
+
63
+ // when click on slide add button
64
+ $(document).on('click', '.fc-tools__btn--slide-add', function(e) {
65
+ slideAdd($(this).data('row'), $(this));
66
+ });
67
+
68
+ // when click on slide remove button
69
+ $(document).on('click', '.fc-tools__btn--slide-remove', function(e) {
70
+ var resp = confirm('<%= I18n.t('admin.actions.featured_content.delete_block')%>');
71
+
72
+ if(resp) {
73
+ slideRemove($(this).data('row'), $(this));
74
+ }
75
+ });
76
+
77
+ // when click on delete button
78
+ $(document).on('click', '.fc-tools__btn--delete', function() {
79
+ var resp = confirm('<%= I18n.t('admin.actions.featured_content.delete_block')%>');
80
+
81
+ if(resp) {
82
+ $($(this).attr('href')).remove();
83
+ }
84
+ });
85
+
86
+ // content editable
87
+ function editable() {
88
+ $('.fc-title').attr('contenteditable', 'true');
89
+ $('.fc-text').attr('contenteditable', 'true');
90
+ $('.fc-caption').attr('contenteditable', 'true');
91
+ }
92
+
93
+ // when click on snippet buttons
94
+ $(document).on('click', '.fc-snippet__btn', function(e) {
95
+ e.preventDefault();
96
+
97
+ var snippet = $(this).attr('data-snippet');
98
+ var container = $('.fc-container');
99
+ var row_id = generateID();
100
+ var section_id = generateID();
101
+
102
+ switch (snippet) {
103
+ case '1':
104
+ var element = '<div id="'+ row_id +'" class="fc-row">';
105
+ element += '<div class="fc-tools">';
106
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
107
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id + '"></a>';
108
+ element += '</div>';
109
+
110
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--border">';
111
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
112
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
113
+ element += '<h1 class="fc-title fc-title--highlight"></h1>';
114
+ element += '</section>';
115
+ element += '</div>';
116
+
117
+ container.append(element);
118
+ autocomplete(section_id);
119
+ scrollTo(row_id);
120
+ break;
121
+
122
+ case '2':
123
+ var element = '<div id="'+ row_id +'" class="fc-row">';
124
+ element += '<div class="fc-tools">';
125
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
126
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
127
+ element += '</div>';
128
+
129
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--border">';
130
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
131
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
132
+ element += '<h1 class="fc-title fc-title--large"></h1>';
133
+ element += '<p class="fc-text"></p>';
134
+ element += '</section>';
135
+ element += '</div>';
136
+
137
+ container.append(element);
138
+ autocomplete(section_id);
139
+ scrollTo(row_id);
140
+ break;
141
+
142
+ case '3':
143
+ var element = '<div id="'+ row_id +'" class="fc-row">';
144
+ element += '<div class="fc-tools">';
145
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
146
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
147
+ element += '</div>';
148
+
149
+ element += '<div class="fc-item fc-item--border">';
150
+ element += '<div class="fc-slide">';
151
+ element += '<div class="fc-item fc-slide__owl" id="'+ section_id +'">';
152
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
153
+ element += '<div class="fc-slide__item">';
154
+ element += '<div class="fc-tools fc-tools--center">';
155
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
156
+ element += '<a class="fc-tools__btn fc-tools__btn--slide-add fa fa-plus" data-row="'+ row_id +'" href="#'+ section_id +'"></a>';
157
+ element += '<a class="fc-tools__btn fc-tools__btn--slide-remove fa fa-trash" data-row="'+ row_id +'" href="#'+ section_id +'"></a>';
158
+ element += '</div>';
159
+ element += '<a href="#" class="fc-link fc-slide__link"></a>';
160
+ element += '<h2 class="fc-caption fc-slide__caption"></h2>';
161
+ element += '<figure class="fc-slide__figure">';
162
+ element += '<img class="fc-slide__image" src="<%= image_url 'cb-image-default.jpg' %>">';
163
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
164
+ element += '</figure>';
165
+ element += '<div class="fc-slide__content">';
166
+ element += '<h1 class="fc-title fc-slide__title"></h1>';
167
+ element += '<p class="fc-text fc-slide__text"></p>';
168
+ element += '</div>';
169
+ element += '</section>';
170
+ element += '</div>';
171
+ element += '</div>';
172
+ element += '</div>';
173
+ element += '</div>';
174
+
175
+ container.append(element);
176
+
177
+ autocomplete(section_id);
178
+ addEventToInputFile(section_id);
179
+ scrollTo(row_id);
180
+ slideActive($('.fc-slide'));
181
+ break;
182
+
183
+ case '4':
184
+ var element = '<div id="'+ row_id +'" class="fc-row">';
185
+ element += '<div class="fc-tools">';
186
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
187
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
188
+ element += '</div>';
189
+
190
+ element += '<div class="fc-row">';
191
+
192
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--border">';
193
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
194
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
195
+ element += '<h2 class="fc-caption"></h2>';
196
+ element += '<figure class="fc-figure fc-figure--block fc-figure--large">';
197
+ element += '<img class="fc-image" src="<%= image_url 'cb-image-default.jpg' %>">';
198
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
199
+ element += '<div class="fc-tools fc-tools--center">';
200
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
201
+ element += '</div>';
202
+ element += '</figure>';
203
+ element += '<h1 class="fc-title fc-title--small"></h1>';
204
+ element += '<p class="fc-text"></p>';
205
+ element += '</section>';
206
+
207
+ element += '</div>';
208
+ element += '</div>';
209
+
210
+ container.append(element);
211
+
212
+ autocomplete(section_id);
213
+ addEventToInputFile(section_id);
214
+ scrollTo(row_id);
215
+ break;
216
+
217
+ case '5':
218
+ var sections = [];
219
+
220
+ var element = '<div id="'+ row_id +'" class="fc-row">';
221
+ element += '<div class="fc-tools">';
222
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
223
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
224
+ element += '</div>';
225
+
226
+ element += '<div class="fc-row fc-row--flex">';
227
+
228
+ for(var i = 0; i < 2; i++) {
229
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--two fc-item--border">';
230
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
231
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
232
+ element += '<h2 class="fc-caption"></h2>';
233
+ element += '<figure class="fc-figure fc-figure--block fc-figure--large">';
234
+ element += '<img class="fc-image" src="<%= image_url 'cb-image-default.jpg' %>">';
235
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
236
+ element += '<div class="fc-tools fc-tools--center">';
237
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
238
+ element += '</div>';
239
+ element += '</figure>';
240
+ element += '<h1 class="fc-title fc-title--small"></h1>';
241
+ element += '<p class="fc-text"></p>';
242
+ element += '</section>';
243
+
244
+ sections.push(section_id);
245
+ section_id = generateID();
246
+ }
247
+
248
+ element += '</div>';
249
+ element += '</div>';
250
+
251
+ container.append(element);
252
+
253
+ for(var i = 0; i < sections.length; i++) {
254
+ autocomplete(sections[i]);
255
+ addEventToInputFile(sections[i]);
256
+ }
257
+
258
+ scrollTo(row_id);
259
+ break;
260
+
261
+ case '6':
262
+ var sections = [];
263
+
264
+ var element = '<div id="'+ row_id +'" class="fc-row">';
265
+ element += '<div class="fc-tools">';
266
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
267
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
268
+ element += '</div>';
269
+
270
+ element += '<div class="fc-row fc-row--flex">';
271
+
272
+ for(var i = 0; i < 3; i++) {
273
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--three fc-item--border">';
274
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
275
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
276
+ element += '<h2 class="fc-caption"></h2>';
277
+ element += '<figure class="fc-figure fc-figure--block fc-figure--large">';
278
+ element += '<img class="fc-image" src="<%= image_url 'cb-image-default.jpg' %>">';
279
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
280
+ element += '<div class="fc-tools fc-tools--center">';
281
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
282
+ element += '</div>';
283
+ element += '</figure>';
284
+ element += '<h1 class="fc-title fc-title--small"></h1>';
285
+ element += '<p class="fc-text"></p>';
286
+ element += '</section>';
287
+
288
+ sections.push(section_id);
289
+ section_id = generateID();
290
+ }
291
+
292
+ element += '</div>';
293
+ element += '</div>';
294
+
295
+ container.append(element);
296
+
297
+ for(var i = 0; i < sections.length; i++) {
298
+ autocomplete(sections[i]);
299
+ addEventToInputFile(sections[i]);
300
+ }
301
+
302
+ scrollTo(row_id);
303
+ break;
304
+
305
+ case '7':
306
+ var sections = [];
307
+
308
+ var element = '<div id="'+ row_id +'" class="fc-row">';
309
+ element += '<div class="fc-tools">';
310
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
311
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
312
+ element += '</div>';
313
+
314
+ element += '<div class="fc-row fc-row--flex">';
315
+
316
+ for(var i = 0; i < 4; i++) {
317
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--four fc-item--border">';
318
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
319
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
320
+ element += '<h2 class="fc-caption"></h2>';
321
+ element += '<figure class="fc-figure fc-figure--block fc-figure--large">';
322
+ element += '<img class="fc-image" src="<%= image_url 'cb-image-default.jpg' %>">';
323
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
324
+ element += '<div class="fc-tools fc-tools--center">';
325
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
326
+ element += '</div>';
327
+ element += '</figure>';
328
+ element += '<h1 class="fc-title fc-title--small"></h1>';
329
+ element += '<p class="fc-text"></p>';
330
+ element += '</section>';
331
+
332
+ sections.push(section_id);
333
+ section_id = generateID();
334
+ }
335
+
336
+ element += '</div>';
337
+ element += '</div>';
338
+
339
+ container.append(element);
340
+
341
+ for(var i = 0; i < sections.length; i++) {
342
+ autocomplete(sections[i]);
343
+ addEventToInputFile(sections[i]);
344
+ }
345
+
346
+ scrollTo(row_id);
347
+ break;
348
+
349
+ case '8':
350
+ var element = '<div id="'+ row_id +'" class="fc-row">';
351
+ element += '<div class="fc-tools">';
352
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
353
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
354
+ element += '</div>';
355
+
356
+ element += '<div class="fc-row">';
357
+
358
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--border">';
359
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
360
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
361
+ element += '<h2 class="fc-caption"></h2>';
362
+ element += '<h1 class="fc-title fc-title--small"></h1>';
363
+ element += '<figure class="fc-figure fc-figure--small">';
364
+ element += '<img class="fc-image" src="<%= image_url 'cb-image-default.jpg' %>">';
365
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
366
+ element += '<div class="fc-tools fc-tools--center">';
367
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
368
+ element += '</div>';
369
+ element += '</figure>';
370
+ element += '<p class="fc-text"></p>';
371
+ element += '</section>';
372
+
373
+ element += '</div>';
374
+ element += '</div>';
375
+
376
+ container.append(element);
377
+
378
+ autocomplete(section_id);
379
+ addEventToInputFile(section_id);
380
+ scrollTo(row_id);
381
+ break;
382
+
383
+ case '9':
384
+ var sections = [];
385
+
386
+ var element = '<div id="'+ row_id +'" class="fc-row">';
387
+ element += '<div class="fc-tools">';
388
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
389
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
390
+ element += '</div>';
391
+
392
+ element += '<div class="fc-row fc-row--flex">';
393
+
394
+ for(var i = 0; i < 2; i++) {
395
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--two fc-item--border">';
396
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
397
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
398
+ element += '<h2 class="fc-caption"></h2>';
399
+ element += '<h1 class="fc-title fc-title--small"></h1>';
400
+ element += '<figure class="fc-figure fc-figure--small">';
401
+ element += '<img class="fc-image" src="<%= image_url 'cb-image-default.jpg' %>">';
402
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
403
+ element += '<div class="fc-tools fc-tools--center">';
404
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
405
+ element += '</div>';
406
+ element += '</figure>';
407
+ element += '<p class="fc-text"></p>';
408
+ element += '</section>';
409
+
410
+ sections.push(section_id);
411
+ section_id = generateID();
412
+ }
413
+
414
+ element += '</div>';
415
+ element += '</div>';
416
+
417
+ container.append(element);
418
+
419
+ for(var i = 0; i < sections.length; i++) {
420
+ autocomplete(sections[i]);
421
+ addEventToInputFile(sections[i]);
422
+ }
423
+
424
+ scrollTo(row_id);
425
+ break;
426
+
427
+ case '10':
428
+ var sections = [];
429
+
430
+ var element = '<div id="'+ row_id +'" class="fc-row">';
431
+ element += '<div class="fc-tools">';
432
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
433
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
434
+ element += '</div>';
435
+
436
+ element += '<div class="fc-row fc-row--flex">';
437
+
438
+ for(var i = 0; i < 3; i++) {
439
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--three fc-item--border">';
440
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
441
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
442
+ element += '<h2 class="fc-caption"></h2>';
443
+ element += '<h1 class="fc-title fc-title--small"></h1>';
444
+ element += '<figure class="fc-figure fc-figure--small">';
445
+ element += '<img class="fc-image" src="<%= image_url 'cb-image-default.jpg' %>">';
446
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
447
+ element += '<div class="fc-tools fc-tools--center">';
448
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
449
+ element += '</div>';
450
+ element += '</figure>';
451
+ element += '<p class="fc-text"></p>';
452
+ element += '</section>';
453
+
454
+ sections.push(section_id);
455
+ section_id = generateID();
456
+ }
457
+
458
+ element += '</div>';
459
+ element += '</div>';
460
+
461
+ container.append(element);
462
+
463
+ for(var i = 0; i < sections.length; i++) {
464
+ autocomplete(sections[i]);
465
+ addEventToInputFile(sections[i]);
466
+ }
467
+
468
+ scrollTo(row_id);
469
+ break;
470
+
471
+ case '11':
472
+ var element = '<div id="'+ row_id +'" class="fc-row">';
473
+ element += '<div class="fc-tools">';
474
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
475
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
476
+ element += '</div>';
477
+
478
+ element += '<div class="fc-row">';
479
+
480
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--border">';
481
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
482
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
483
+ element += '<h2 class="fc-caption"></h2>';
484
+ element += '<h1 class="fc-title fc-title--small"></h1>';
485
+ element += '<p class="fc-text"></p>';
486
+ element += '</section>';
487
+
488
+ element += '</div>';
489
+ element += '</div>';
490
+
491
+ container.append(element);
492
+
493
+ autocomplete(section_id);
494
+ addEventToInputFile(section_id);
495
+ scrollTo(row_id);
496
+ break;
497
+
498
+ case '12':
499
+ var sections = [];
500
+
501
+ var element = '<div id="'+ row_id +'" class="fc-row">';
502
+ element += '<div class="fc-tools">';
503
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
504
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
505
+ element += '</div>';
506
+
507
+ element += '<div class="fc-row fc-row--flex">';
508
+
509
+ for(var i = 0; i < 2; i++) {
510
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--two fc-item--border">';
511
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
512
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
513
+ element += '<h2 class="fc-caption"></h2>';
514
+ element += '<h1 class="fc-title fc-title--small"></h1>';
515
+ element += '<p class="fc-text"></p>';
516
+ element += '</section>';
517
+
518
+ sections.push(section_id);
519
+ section_id = generateID();
520
+ }
521
+
522
+ element += '</div>';
523
+ element += '</div>';
524
+
525
+ container.append(element);
526
+
527
+ for(var i = 0; i < sections.length; i++) {
528
+ autocomplete(sections[i]);
529
+ addEventToInputFile(sections[i]);
530
+ }
531
+
532
+ scrollTo(row_id);
533
+ break;
534
+
535
+ case '13':
536
+ var sections = [];
537
+
538
+ var element = '<div id="'+ row_id +'" class="fc-row">';
539
+ element += '<div class="fc-tools">';
540
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
541
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
542
+ element += '</div>';
543
+
544
+ element += '<div class="fc-row fc-row--flex">';
545
+
546
+ for(var i = 0; i < 3; i++) {
547
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--three fc-item--border">';
548
+ element += '<input class="fc-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.featured_content.snippet.search_news') %>">';
549
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
550
+ element += '<h2 class="fc-caption"></h2>';
551
+ element += '<h1 class="fc-title fc-title--small"></h1>';
552
+ element += '<p class="fc-text"></p>';
553
+ element += '</section>';
554
+
555
+ sections.push(section_id);
556
+ section_id = generateID();
557
+ }
558
+
559
+ element += '</div>';
560
+ element += '</div>';
561
+
562
+ container.append(element);
563
+
564
+ for(var i = 0; i < sections.length; i++) {
565
+ autocomplete(sections[i]);
566
+ addEventToInputFile(sections[i]);
567
+ }
568
+
569
+ scrollTo(row_id);
570
+ break;
571
+ }
572
+
573
+ editable();
574
+ });