rails_admin_content_builder_rails_6 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) 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 +134 -0
  7. data/Rakefile +2 -0
  8. data/app/assets/images/cb-image-default.jpg +0 -0
  9. data/app/assets/images/cb-loading.svg +1 -0
  10. data/app/assets/images/cb-snippet-gallery.jpg +0 -0
  11. data/app/assets/images/cb-snippet-gallery.psd +0 -0
  12. data/app/assets/images/cb-snippet-image-text.jpg +0 -0
  13. data/app/assets/images/cb-snippet-image-text.psd +0 -0
  14. data/app/assets/images/cb-snippet-image.jpg +0 -0
  15. data/app/assets/images/cb-snippet-image.psd +0 -0
  16. data/app/assets/images/cb-snippet-quote-text.jpg +0 -0
  17. data/app/assets/images/cb-snippet-quote-text.psd +0 -0
  18. data/app/assets/images/cb-snippet-quote.jpg +0 -0
  19. data/app/assets/images/cb-snippet-quote.psd +0 -0
  20. data/app/assets/images/cb-snippet-relational-text.jpg +0 -0
  21. data/app/assets/images/cb-snippet-relational-text.psd +0 -0
  22. data/app/assets/images/cb-snippet-text-image.jpg +0 -0
  23. data/app/assets/images/cb-snippet-text-image.psd +0 -0
  24. data/app/assets/images/cb-snippet-text-quote.jpg +0 -0
  25. data/app/assets/images/cb-snippet-text-quote.psd +0 -0
  26. data/app/assets/images/cb-snippet-text-relational.jpg +0 -0
  27. data/app/assets/images/cb-snippet-text-relational.psd +0 -0
  28. data/app/assets/images/cb-snippet-text.jpg +0 -0
  29. data/app/assets/images/cb-snippet-text.psd +0 -0
  30. data/app/assets/images/cb-snippet-video.jpg +0 -0
  31. data/app/assets/images/cb-snippet-video.psd +0 -0
  32. data/app/assets/images/cb-video-default.jpg +0 -0
  33. data/app/assets/javascripts/rails_admin/content_builder.js.erb +374 -0
  34. data/app/assets/javascripts/rails_admin/helpers/action_sortable.js +16 -0
  35. data/app/assets/javascripts/rails_admin/helpers/add_event_to_input.js +9 -0
  36. data/app/assets/javascripts/rails_admin/helpers/autocomplete.js.erb +32 -0
  37. data/app/assets/javascripts/rails_admin/helpers/file_select_and_upload.js +31 -0
  38. data/app/assets/javascripts/rails_admin/helpers/file_select_and_upload_gallery.js +43 -0
  39. data/app/assets/javascripts/rails_admin/helpers/generate_id.js +4 -0
  40. data/app/assets/javascripts/rails_admin/helpers/get_image_of_position.js +11 -0
  41. data/app/assets/javascripts/rails_admin/helpers/medium_editor.js +44 -0
  42. data/app/assets/javascripts/rails_admin/helpers/scrool_to.js +8 -0
  43. data/app/assets/javascripts/rails_admin/helpers/youtube_parse.js.erb +11 -0
  44. data/app/assets/stylesheets/rails_admin/content_builder.scss +534 -0
  45. data/app/controllers/rails_admin_content_builder/content_builder_controller.rb +39 -0
  46. data/app/helpers/rails_admin_content_builder/content_builder_helpers.rb +38 -0
  47. data/app/models/application_record.rb +3 -0
  48. data/app/models/rails_admin_content_builder/content_builder.rb +45 -0
  49. data/app/models/rails_admin_content_builder/content_builder_category.rb +12 -0
  50. data/app/models/rails_admin_content_builder/content_builder_image.rb +11 -0
  51. data/app/views/.gitkeep +0 -0
  52. data/app/views/rails_admin/main/content_builder.html.erb +102 -0
  53. data/bin/console +14 -0
  54. data/bin/setup +8 -0
  55. data/config/initializers/assets.rb +14 -0
  56. data/config/locales/content_builder.en.yml +32 -0
  57. data/config/locales/content_builder.pt-BR.yml +32 -0
  58. data/config/routes.rb +9 -0
  59. data/lib/rails_admin_content_builder_rails_6.rb +55 -0
  60. data/lib/rails_admin_content_builder_rails_6/engine.rb +24 -0
  61. data/lib/rails_admin_content_builder_rails_6/generators/rails_admin_content_builder_generator.rb +40 -0
  62. data/lib/rails_admin_content_builder_rails_6/generators/templates/content_builder_image_uploader.rb +90 -0
  63. data/lib/rails_admin_content_builder_rails_6/generators/templates/create_content_builder_category_migration.rb +10 -0
  64. data/lib/rails_admin_content_builder_rails_6/generators/templates/create_content_builder_image_migration.rb +10 -0
  65. data/lib/rails_admin_content_builder_rails_6/generators/templates/create_content_builder_migration.rb +16 -0
  66. data/lib/rails_admin_content_builder_rails_6/generators/templates/rails_admin_content_builder.rb +37 -0
  67. data/lib/rails_admin_content_builder_rails_6/version.rb +3 -0
  68. data/rails_admin_content_builder_rails_6.gemspec +45 -0
  69. data/vendor/assets/stylesheets/rails_admin_content_builder.scss +411 -0
  70. metadata +417 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 50df2ecef0583acf039157f1b3bf165baa58c8ee0f5a3e5ccb62e494676dec96
4
+ data.tar.gz: 947b7b9c3bdb2ac20fb6df787637c9436c2c366a9b718dba5a3f6154a18745b3
5
+ SHA512:
6
+ metadata.gz: 6bf109d8917109ad97173bd22b34237486bcd67f4a5e35512bcca2e9db0761d7a51c2a5b55d42aabdebf98e6ac92b9ab2f58d6a1550e0d6e4aa1dd66250b43be
7
+ data.tar.gz: 4e594f4161a1f6c185d8324c1bd3d89c2b5419e7191f3518109fbdfc53d6d64ad7afe7da29df66aa10b794f68cd0ca44c514c3174914f24bbd922104b89b6090
@@ -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 [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://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_content_builder_rails_6.gemspec
4
+ gemspec
@@ -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.
@@ -0,0 +1,134 @@
1
+ # RailsAdminContentBuilderRails6
2
+
3
+ Easy way for create contents using [rails_admin](https://github.com/sferik/rails_admin).
4
+ This gem is an update of [rails_admin_content_builder](https://github.com/luizpicolo/rails_admin_content_builder), it has bugfixes, improvements and now works on Rails 6.
5
+
6
+
7
+ ## Preview
8
+
9
+ ![content-min](https://cloud.githubusercontent.com/assets/2979365/20011834/b0c61e4a-a28b-11e6-955c-cc487f43a880.jpg)
10
+
11
+ ## Requirements
12
+
13
+ Dependencies
14
+
15
+ MiniMagick
16
+
17
+ Supported ORM
18
+
19
+ ActiveRecord
20
+
21
+ Supported Asset Plugin
22
+
23
+ CarrierWave
24
+
25
+ ## Installation
26
+ Add this line to your application's Gemfile:
27
+
28
+ ```ruby
29
+ gem 'rails_admin'
30
+ gem 'rails_admin_content_builder_rails_6'
31
+ ```
32
+
33
+ Run the generator and migrations
34
+
35
+ rails g rails_admin_content_builder
36
+ rake db:migrate
37
+
38
+ Add styles in app/assets/application.scss
39
+
40
+ ```ruby
41
+ *= require rails_admin_content_builder
42
+ ```
43
+
44
+ Now you can remove the `Related Content Snippets`. Inside `config/application.rb`, just after `Bundler.require`
45
+
46
+ ```ruby
47
+ ENV['RAILS_ADMIN_CONTENT_BUILDER_RELATED'] = 'false'
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ For custom model, see: [Customizing Model](https://github.com/luizpicolo/rails_admin_content_builder/wiki/Customizing-model)
53
+
54
+ Include in your controller
55
+
56
+ ```ruby
57
+ include RailsAdminContentBuilder::ContentBuilderHelpers
58
+ ```
59
+
60
+ Example
61
+
62
+ ```ruby
63
+ class PostsController < ApplicationController
64
+ include RailsAdminContentBuilder::ContentBuilderHelpers
65
+
66
+ def index
67
+ end
68
+
69
+ def show
70
+ end
71
+ end
72
+ ```
73
+
74
+ ```ruby
75
+ # Return all objects contents
76
+ @contents = all_contents_created
77
+
78
+ # Return especific object content
79
+ @content = find_content_created_by_slug('your-slug')
80
+
81
+ # Return content
82
+ @content = find_content_created_by_slug('your-slug')
83
+ @content.content_sanitized
84
+ ```
85
+
86
+ In your show content view
87
+
88
+ ```html
89
+ <article>
90
+ <h1><%= @content.title %></h1>
91
+ <p>
92
+ <%= @content.written_by %>
93
+ </p>
94
+ <p><%= @content.summary %></p>
95
+
96
+ <%= @content.content_sanitized %>
97
+ </article>
98
+ ```
99
+
100
+ You can see more stuff on the [Wiki](https://github.com/thefalked/rails_admin_content_builder_rails_6/wiki) page!
101
+
102
+ ## Attributes and Methods
103
+
104
+ ```ruby
105
+ # Attributes
106
+ "title" : String
107
+ "written_by" : String
108
+ "date_publish" : DateTime
109
+ "content" : Text
110
+ "status" : Boolean
111
+ "slug" : String
112
+
113
+ # Methods
114
+ content_sanitized : Text
115
+ content_builder_images : Object
116
+ ```
117
+
118
+ ## Development
119
+
120
+ 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.
121
+
122
+ 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).
123
+
124
+ ## Contributing
125
+
126
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thefalked/rails_admin_content_builder_rails_6. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
127
+
128
+ ## License
129
+
130
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
131
+
132
+ ## Code of Conduct
133
+
134
+ Everyone interacting in the RailsAdminContentBuilderRails6 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/thefalked/rails_admin_content_builder_rails_6/blob/master/CODE_OF_CONDUCT.md).
@@ -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,374 @@
1
+ //= require medium-editor
2
+ //= require_tree ./helpers
3
+
4
+ // reload the page so it doesn't duplicate the js called in the view
5
+ $(".pjax").click(function () {
6
+ setTimeout(function (){
7
+ location.reload();
8
+ }, 100);
9
+ });
10
+
11
+ // when rails admin ready
12
+ $(document).on('rails_admin.dom_ready', function () {
13
+ activeSortable();
14
+ console.log("ready")
15
+
16
+ $('.cb-form').on('submit', function (e) {
17
+ // remove all attributes of cb-text
18
+ $('.cb-text').replaceWith(function () {
19
+ return $('<' + this.nodeName + '>')
20
+ .addClass($(this).attr('class'))
21
+ .append($(this).contents());
22
+ });
23
+
24
+ // remove all attributes of cb-editable
25
+ $('.cb-editable').replaceWith(function () {
26
+ return $('<' + this.nodeName + '>')
27
+ .addClass($(this).attr('class'))
28
+ .append($(this).contents());
29
+ });
30
+
31
+ // get all content of container
32
+ var content = $('#cb-container').html();
33
+
34
+ // set content in input file
35
+ $('#content').attr('value', content);
36
+ });
37
+
38
+ $('.cb-content .cb-search').each(function () {
39
+ autocomplete($(this).parents(".cb-content").attr('id'));
40
+ });
41
+
42
+ $('.cb-content-gallery').each(function () {
43
+ addEventToInputFileGallery($(this).attr('id'));
44
+ });
45
+
46
+ $('#cb-container').sortable({
47
+ revert: true,
48
+ placeholder: 'ui-sortable-placeholder',
49
+ handle: '.cb-tools__btn--move',
50
+ cursor: 'move',
51
+ });
52
+
53
+ activeMediumEditor();
54
+ });
55
+
56
+ // when click on delete button
57
+ $(document).on('click', '.cb-tools__btn--delete', function (e) {
58
+ e.preventDefault()
59
+
60
+ var resp = confirm('<%= I18n.t('admin.actions.content_builder.delete_block') %>');
61
+
62
+ if (resp) {
63
+ $($(this).attr('href')).remove();
64
+ }
65
+ });
66
+
67
+ // when click on tools buttons
68
+ $(document).on('click', '.cb-tools__btn', function (e) {
69
+ e.preventDefault();
70
+ });
71
+
72
+ // when click on upload button
73
+ $(document).on('click', '.cb-tools__btn--upload', function () {
74
+ $($(this).attr('href')).find('input').trigger('click');
75
+ });
76
+
77
+ // when click on youtube buttons
78
+ $(document).on('click', '.cb-tools__btn--youtube', function () {
79
+ var resp = prompt('<%= I18n.t('admin.actions.content_builder.url')%>', '');
80
+ resp = youtubeParser(resp);
81
+
82
+ if (resp) {
83
+ var href = $(this).attr('href');
84
+ $(href).find('iframe').attr('src', 'https://www.youtube.com/embed/' + resp + '?rel=0&amp;showinfo=0');
85
+ }
86
+ });
87
+
88
+ // when click on snippet buttons
89
+ $(document).on('click', '.cb-snippet__btn', function (e) {
90
+ e.preventDefault();
91
+
92
+ var snippet = $(this).attr('data-snippet');
93
+ var container = $('#cb-container');
94
+ var id = generateID();
95
+
96
+ switch (snippet) {
97
+ case '1':
98
+ var element = '<div id="' + id + '" class="cb-content">';
99
+
100
+ element += '<div class="cb-tools">';
101
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
102
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
103
+ element += '</div>';
104
+
105
+ element += '<div class="cb-text">';
106
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem.</p>';
107
+ element += '</div>';
108
+
109
+ element += '</div>';
110
+
111
+ container.append(element);
112
+ scrollTo(id);
113
+ break;
114
+
115
+ case '2':
116
+ var element = '<div id="' + id + '" class="cb-content">';
117
+
118
+ element += '<div class="cb-tools">';
119
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
120
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
121
+ element += '</div>';
122
+
123
+ element += '<figure class="cb-figure cb-figure--left">';
124
+ element += '<div class="cb-figure__clip">';
125
+ element += '<%= image_tag('cb-image-default.jpg') %>';
126
+ element += '<input id="' + id + '" data-position="left" class="filePicker cb-tools__input cb-tools__input--upload" type="file" name="cb-image">';
127
+ element += '<div class="cb-tools cb-tools--center">';
128
+ element += '<a class="cb-tools__btn cb-tools__btn--upload fa fa-camera" href="#' + id + '"></a>';
129
+ element += '</div>';
130
+ element += '</div>';
131
+ element += '<figcaption class="cb-figcaption cb-text">';
132
+ element += '<%= I18n.t('admin.actions.content_builder.image_description')%>';
133
+ element += '</figcaption>';
134
+ element += '</figure>';
135
+
136
+ element += '<div class="cb-text">';
137
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem.</p>';
138
+ element += '</div>';
139
+
140
+ element += '</div>';
141
+
142
+ container.append(element);
143
+ addEventToInputFile(id);
144
+ scrollTo(id);
145
+ break;
146
+
147
+ // Image center
148
+ case '3':
149
+ var element = '<div id="' + id + '" class="cb-content">';
150
+
151
+ element += '<div class="cb-tools">';
152
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
153
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
154
+ element += '</div>';
155
+
156
+ element += '<figure class="cb-figure cb-figure--right">';
157
+ element += '<div class="cb-figure__clip">';
158
+ element += '<%= image_tag('cb-image-default.jpg') %>';
159
+ element += '<input id="' + id + '" data-position="right" class="filePicker cb-tools__input cb-tools__input--upload" type="file" name="cb-image">';
160
+ element += '<div class="cb-tools cb-tools--center">';
161
+ element += '<a class="cb-tools__btn cb-tools__btn--upload fa fa-camera" href="#' + id + '"></a>';
162
+ element += '</div>';
163
+ element += '</div>';
164
+ element += '<figcaption class="cb-figcaption cb-text">';
165
+ element += '<%= I18n.t('admin.actions.content_builder.image_description')%>';
166
+ element += '</figcaption>';
167
+ element += '</figure>';
168
+
169
+ element += '<div class="cb-text">';
170
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem.</p>';
171
+ element += '</div>';
172
+
173
+ element += '</div>';
174
+
175
+ container.append(element);
176
+ addEventToInputFile(id);
177
+ scrollTo(id);
178
+ break;
179
+
180
+ case '4':
181
+ var element = '<div id="' + id + '" class="cb-content">';
182
+
183
+ element += '<div class="cb-tools">';
184
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
185
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
186
+ element += '</div>';
187
+
188
+ element += '<figure class="cb-figure cb-figure--center">';
189
+ element += '<div class="cb-figure__clip">';
190
+ element += '<%= image_tag('cb-image-default.jpg') %>';
191
+ element += '<input id="' + id + '" data-position="center" class="filePicker cb-tools__input cb-tools__input--upload" type="file" name="cb-image">';
192
+ element += '<div class="cb-tools cb-tools--center">';
193
+ element += '<a class="cb-tools__btn cb-tools__btn--upload fa fa-camera" href="#' + id + '"></a>';
194
+ element += '</div>';
195
+ element += '</div>';
196
+ element += '<figcaption class="cb-figcaption cb-text">';
197
+ element += '<%= I18n.t('admin.actions.content_builder.image_description')%>';
198
+ element += '</figcaption>';
199
+ element += '</figure>';
200
+
201
+ element += '</div>';
202
+
203
+ container.append(element);
204
+ addEventToInputFile(id);
205
+ scrollTo(id);
206
+ break;
207
+
208
+ case '5':
209
+ var element = '<div id="' + id + '" class="cb-content">';
210
+
211
+ element += '<div class="cb-tools">';
212
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
213
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
214
+ element += '</div>';
215
+
216
+ element += '<div class="cb-video cb-video--center">';
217
+ element += '<iframe id="' + id + '" src="" frameborder="0" allowfullscreen></iframe>';
218
+ element += '<div class="cb-tools cb-tools--center">';
219
+ element += '<a class="cb-tools__btn cb-tools__btn--upload cb-tools__btn--youtube fa fa-youtube-play" href="#' + id + '"></a>';
220
+ element += '</div>';
221
+ element += '</div>';
222
+
223
+ element += '</div>';
224
+
225
+ container.append(element);
226
+ addEventToInputFile(id);
227
+ scrollTo(id);
228
+ break;
229
+
230
+ case '6':
231
+ var element = '<div id="' + id + '" class="cb-content">';
232
+
233
+ element += '<div class="cb-tools">';
234
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
235
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
236
+ element += '</div>';
237
+
238
+ element += '<blockquote class="cb-blockquote cb-blockquote--left">';
239
+ element += '<div class="cb-blockquote__text cb-text"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis</p></div>';
240
+ element += '<footer class="cb-blockquote__footer cb-text">Lorem Ipsum</footer>';
241
+ element += '</blockquote>';
242
+
243
+ element += '<div class="cb-text">';
244
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem.</p>';
245
+ element += '</div>';
246
+
247
+ element += '</div>';
248
+
249
+ container.append(element);
250
+ addEventToInputFile(id);
251
+ scrollTo(id);
252
+ break;
253
+
254
+ case '7':
255
+ var element = '<div id="' + id + '" class="cb-content">';
256
+
257
+ element += '<div class="cb-tools">';
258
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
259
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
260
+ element += '</div>';
261
+
262
+ element += '<blockquote class="cb-blockquote cb-blockquote--right">';
263
+ element += '<div class="cb-blockquote__text cb-text"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis</p></div>';
264
+ element += '<footer class="cb-blockquote__footer cb-text">Lorem Ipsum</footer>';
265
+ element += '</blockquote>';
266
+
267
+ element += '<div class="cb-text">';
268
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem..</p>';
269
+ element += '</div>';
270
+
271
+ element += '</div>';
272
+
273
+ container.append(element);
274
+ addEventToInputFile(id);
275
+ scrollTo(id);
276
+ break;
277
+
278
+ case '8':
279
+ var element = '<div id="' + id + '" class="cb-content">';
280
+
281
+ element += '<div class="cb-tools">';
282
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
283
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
284
+ element += '</div>';
285
+
286
+ element += '<blockquote class="cb-blockquote">';
287
+ element += '<div class="cb-blockquote__text cb-text"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis</p></div>';
288
+ element += '<footer class="cb-blockquote__footer cb-text">Lorem Ipsum</footer>';
289
+ element += '</blockquote>';
290
+
291
+ element += '<div class="cb-text">';
292
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem..</p>';
293
+ element += '</div>';
294
+
295
+ element += '</div>';
296
+
297
+ container.append(element);
298
+ addEventToInputFile(id);
299
+ scrollTo(id);
300
+ break;
301
+
302
+ case '9':
303
+ var element = '<div id="' + id + '" class="cb-content">';
304
+
305
+ element += '<div class="cb-tools">';
306
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
307
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
308
+ element += '</div>';
309
+
310
+ element += '<aside class="cb-relational cb-relational--left">'
311
+ element += '<h2 class="cb-relational__title">Saiba mais</h2>';
312
+ element += '<input class="cb-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.content_builder.search_content')%>">';
313
+ element += '<ol class="cb-relational__list"></ol>';
314
+ element += '</aside>';
315
+
316
+ element += '<div class="cb-text">';
317
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem..</p>';
318
+ element += '</div>';
319
+
320
+ element += '</div>';
321
+
322
+ container.append(element);
323
+ autocomplete(id);
324
+ scrollTo(id);
325
+ activeSortable();
326
+ break;
327
+
328
+ case '10':
329
+ var element = '<div id="' + id + '" class="cb-content">';
330
+
331
+ element += '<div class="cb-tools">';
332
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
333
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
334
+ element += '</div>';
335
+
336
+ element += '<aside class="cb-relational cb-relational--right">'
337
+ element += '<h2 class="cb-relational__title">Saiba mais</h2>';
338
+ element += '<input class="cb-search" type="text" name="search" placeholder="<%= I18n.t('admin.actions.content_builder.search_content')%>">';
339
+ element += '<ol class="cb-relational__list"></ol>';
340
+ element += '</aside>';
341
+
342
+ element += '<div class="cb-text">';
343
+ element += '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur venenatis congue pharetra. Proin quis commodo odio. Fusce a sapien massa. Praesent ultrices dolor at risus porttitor, nec semper orci ornare. Nullam nisi eros, pellentesque et suscipit ac, ultrices eget lorem. Donec ipsum tellus, aliquet vitae metus ut, tempus viverra lorem.</p>';
344
+ element += '</div>';
345
+
346
+ element += '</div>';
347
+
348
+ container.append(element);
349
+ autocomplete(id);
350
+ scrollTo(id);
351
+ activeSortable();
352
+ break;
353
+
354
+ case '11':
355
+ var element = '<div id="' + id + '" class="cb-content-gallery">';
356
+
357
+ element += '<div class="cb-tools">';
358
+ element += '<a class="cb-tools__btn cb-tools__btn--move fa fa-arrows" href="#"></a>';
359
+ element += '<input id="' + id + '" data-position="center" class="filePicker cb-tools__input cb-tools__input--upload" type="file" name="cb-image" multiple>';
360
+ element += '<a class="cb-tools__btn cb-tools__btn--upload fa fa-camera" href="#' + id + '"></a>';
361
+ element += '<a class="cb-tools__btn cb-tools__btn--delete fa fa-trash" href="#' + id + '"></a>';
362
+ element += '</div>';
363
+ element += '<div class="cb-gallery"></div>';
364
+ element += '</div>';
365
+
366
+ container.append(element);
367
+ addEventToInputFileGallery(id);
368
+ scrollTo(id);
369
+ activeSortable();
370
+ break;
371
+ };
372
+
373
+ activeMediumEditor();
374
+ });