rails_admin_featured_content 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +4 -0
  4. data/.rspec +3 -1
  5. data/Gemfile +1 -1
  6. data/README.md +25 -19
  7. data/app/assets/images/fc-snippet-four.jpg +0 -0
  8. data/app/assets/images/fc-snippet-four.psd +0 -0
  9. data/app/assets/images/fc-snippet-highlight.jpg +0 -0
  10. data/app/assets/images/fc-snippet-highlight.psd +0 -0
  11. data/app/assets/images/fc-snippet-slide.jpg +0 -0
  12. data/app/assets/images/fc-snippet-slide.psd +0 -0
  13. data/app/assets/images/fc-snippet-text.jpg +0 -0
  14. data/app/assets/images/fc-snippet-text.psd +0 -0
  15. data/app/assets/images/fc-snippet-three.jpg +0 -0
  16. data/app/assets/images/fc-snippet-three.psd +0 -0
  17. data/app/assets/images/fc-snippet-two.jpg +0 -0
  18. data/app/assets/images/fc-snippet-two.psd +0 -0
  19. data/app/assets/javascripts/rails_admin/featured_content.js.erb +68 -19
  20. data/app/assets/stylesheets/rails_admin/featured_content.scss +184 -74
  21. data/app/views/rails_admin/main/featured_content.html.erb +27 -5
  22. data/config/initializers/assets.rb +2 -1
  23. data/config/locales/featured_content.en.yml +7 -0
  24. data/config/locales/featured_content.pt-BR.yml +7 -0
  25. data/lib/rails_admin_featured_content/version.rb +1 -1
  26. data/screenshots/image-1.png +0 -0
  27. data/spec/dummy/db/test.sqlite3 +0 -0
  28. data/spec/dummy/log/development.log +11 -1692
  29. data/spec/dummy/log/test.log +264 -0
  30. data/spec/spec_helper.rb +22 -5
  31. data/spec/version_spec.rb +1 -1
  32. data/vendor/assets/stylesheets/rails_admin_featured_content.scss +144 -96
  33. metadata +11 -34
  34. data/spec/dummy/db/development.sqlite3 +0 -0
  35. data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/center_example.jpg +0 -0
  36. data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/example.jpg +0 -0
  37. data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/left_or_right_example.jpg +0 -0
  38. data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/center_example.jpg +0 -0
  39. data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/example.jpg +0 -0
  40. data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/left_or_right_example.jpg +0 -0
  41. data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/center_example.jpg +0 -0
  42. data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/example.jpg +0 -0
  43. data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/left_or_right_example.jpg +0 -0
  44. data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/center_example.jpg +0 -0
  45. data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/example.jpg +0 -0
  46. data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/left_or_right_example.jpg +0 -0
  47. data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/center_example.jpg +0 -0
  48. data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/example.jpg +0 -0
  49. data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/left_or_right_example.jpg +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca1e12df658f1365dfa246bcbd4308131a2b3f34
4
- data.tar.gz: e449cff9b8f992281b6a1ca9b0185c59c9210124
3
+ metadata.gz: 8f794e8f92593ff587d49b62174df33192e8eb8c
4
+ data.tar.gz: b25a82ca04b40b67bd376202d9071fc9d9c48317
5
5
  SHA512:
6
- metadata.gz: d11d30bcedcca16bab0aead68fbde0f81c024b58224b88d9304a0727b341cf6c7cc04bbcd5410f34e20e4b199a437e5abfb5424ea80e3a961172262b3fce14bb
7
- data.tar.gz: 52d253d464feebb75208a5218fc84b06c1628d7466e9376911b54c386348bd519e048b8df9323828c5554816a66a36a8959de6bc84505e08aca83e7810136d21
6
+ metadata.gz: 1ded74b6d5ccbd5c9945bd6b4d057732060c482650136e707c44713e374faac3e493e9d153594a17302a329bf4b74b7bebb93cdee2e22a6d538257d7227b08f3
7
+ data.tar.gz: f41d0940590a3e03b88362cab66d680538416389e4fa87dbbdc8862fc9f2f33730bdb9a397f86f22e329598683c685e98321409ee57707dde5f46f1f58536a43
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ repo_token: avzlu3CK5xcD93R0nsjwJZ18bU0NwsxSb
data/.gitignore CHANGED
@@ -12,4 +12,8 @@
12
12
  /spec/dummy/tmp/*
13
13
  spec/dummy/log/test.log
14
14
  spec/dummy/db/test.sqlite3
15
+ spec/dummy/db/development.sqlite3
16
+ spec/dummy/log/development.log
17
+ spec/dummy/public/uploads/rails_admin_featured_content/*
18
+ spec/dummy/public/uploads/tmp/*
15
19
  *.gem
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
- --format documentation
2
1
  --color
2
+ --order=random
3
+ --drb
4
+ --format Fuubar
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ group :development, :test do
7
7
  gem 'friendly_id'
8
8
  gem 'rails_admin'
9
9
  gem 'fuubar'
10
- gem 'codeclimate-test-reporter'
10
+ gem 'coveralls', require: false
11
11
  gem 'rails_admin_content_builder', git: 'git://github.com/luizpicolo/rails_admin_content_builder.git'
12
12
  gem 'simplecov', require: false
13
13
  end
data/README.md CHANGED
@@ -1,35 +1,43 @@
1
1
  # RailsAdminFeaturedContent
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rails_admin_content_builder.svg)](https://badge.fury.io/rb/rails_admin_content_builder)
4
+ [![Code Climate](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content/badges/gpa.svg)](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content)
5
+ [![Test Coverage](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content/badges/coverage.svg)](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content/coverage)
6
+ [![Issue Count](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content/badges/issue_count.svg)](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content)
7
+ [![Build Status](https://travis-ci.org/luizpicolo/rails_admin_featured_content.svg?branch=master)](https://travis-ci.org/luizpicolo/rails_admin_featured_content)
4
8
 
5
- Easy way for create featured contents using rails_admin
9
+ An easy way for creating Featured Content using rails_admin
6
10
 
7
- ## Importante
11
+ ## Preview
8
12
 
9
- First make sure that the gem [rails_admin_content_builder](https://github.com/luizpicolo/rails_admin_content_builder) is installed and working properly
13
+ ![preview](https://raw.githubusercontent.com/luizpicolo/rails_admin_featured_content/master/screenshots/image-1.png)
14
+
15
+ ## Important
16
+
17
+ First, make sure that the gem [rails_admin_content_builder](https://github.com/luizpicolo/rails_admin_content_builder) is installed and working properly
10
18
 
11
19
  ## Installation
12
20
 
13
21
  **Test with rails < 5 and TurboLink < 5**
14
22
 
15
23
  Add this line to your application's Gemfile:
16
- This is a complement to the gem rails_admin_content_builder, only works with dependencies lists in requirements and not alone
24
+ This is a complement to the gem rails_admin_content_builder, only works with dependencies listed in the requirements and not alone.
17
25
 
18
26
  ```ruby
19
27
  gem 'owlcarousel-rails' # For slides
20
28
  gem 'rails_admin_featured_content'
21
29
  ```
22
30
 
23
- And then execute:
31
+ After the above step, execute:
24
32
 
25
33
  $ bundle
26
34
 
27
- Run the generator and migrations
35
+ Run the generator and migrations:
28
36
 
29
37
  rails g rails_admin_featured_content
30
38
  rake db:migrate
31
39
 
32
- Add styles in app/assets/stylesheets/application.scss
40
+ Add styles in app/assets/stylesheets/application.scss:
33
41
 
34
42
  ```ruby
35
43
  *= require rails_admin_featured_content
@@ -37,7 +45,7 @@ Add styles in app/assets/stylesheets/application.scss
37
45
  *= require owl.theme
38
46
  ```
39
47
 
40
- Add Javascript in app/assets/javascripts/application.js
48
+ Add Javascript in app/assets/javascripts/application.js:
41
49
 
42
50
  ```ruby
43
51
  //= require owl.carousel
@@ -59,7 +67,7 @@ $(document).ready(function() {
59
67
 
60
68
  ```
61
69
 
62
- And, add in view/layouts/application.html.erb (optional)
70
+ Also, add in view/layouts/application.html.erb (optional):
63
71
 
64
72
  ```html
65
73
  <link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" media="all">
@@ -67,15 +75,15 @@ And, add in view/layouts/application.html.erb (optional)
67
75
 
68
76
  ## Usage
69
77
 
70
- Include in your controller
78
+ Include this in your controller:
71
79
 
72
80
  ```ruby
73
81
  @featured = RailsAdminFeaturedContent::FeaturedContent.where(status: true).first
74
82
  ```
75
83
 
76
- In your show featured content view
84
+ In your show featured content view:
77
85
 
78
- ```ruby
86
+ ```
79
87
  <%= @featured.featured_sanitized %>
80
88
  ```
81
89
 
@@ -83,33 +91,32 @@ In your show featured content view
83
91
 
84
92
  Featured Content:
85
93
  [link](https://example-cb-fc.herokuapp.com/)
86
- Rails Admin:
94
+ Rails Admin:
87
95
  [link](https://example-cb-fc.herokuapp.com/admin/rails_admin_featured_content~featured_content/1/featured_content)
88
96
 
89
97
  ## Requirements
90
98
 
91
- Dependencies
99
+ Dependencies:
92
100
 
93
101
  MiniMagick
94
102
  Rails_admin
95
103
  Rails_admin_content_builder
96
104
 
97
- Supported ORM
105
+ Supported ORM:
98
106
 
99
107
  ActiveRecord
100
108
 
101
- Supported Asset Plugin
109
+ Supported Asset Plugin:
102
110
 
103
111
  CarrierWave
104
112
 
105
-
106
113
  ## TODO
107
114
 
108
115
  - Tests :)
109
116
 
110
117
  ## Development
111
118
 
112
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
119
+ After checking out the repo, run `bin/setup` to install dependencies. Then, execute `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
113
120
 
114
121
  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).
115
122
 
@@ -117,7 +124,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
117
124
 
118
125
  Bug reports and pull requests are welcome on GitHub at https://github.com/luizpicolo/rails_admin_featured_content. 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.
119
126
 
120
-
121
127
  ## License
122
128
 
123
129
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Binary file
Binary file
Binary file
Binary file
@@ -165,6 +165,50 @@ $(document).on('click', '.fc-snippet__btn', function(e) {
165
165
 
166
166
  element += '<div class="fc-row fc-row--flex">';
167
167
 
168
+ for(var i = 0; i < 2; i++) {
169
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--two fc-item--border">';
170
+ element += '<input class="fc-search" type="text" name="search" placeholder="Buscar notícia">';
171
+ element += '<a href="#" class="fc-link fc-link--absolute"></a>';
172
+ element += '<h2 class="fc-caption"></h2>';
173
+ element += '<figure class="fc-figure fc-figure--block fc-figure--large">';
174
+ element += '<img class="fc-image" src="<%= image_url('cb-image-default.jpg') %>">';
175
+ element += '<input class="fc-tools__input fc-tools__input--upload" type="file" name="image" id="'+ section_id +'">';
176
+ element += '<div class="fc-tools fc-tools--center">';
177
+ element += '<a class="fc-tools__btn fc-tools__btn--upload fa fa-camera" href="#'+ section_id + '"></a>';
178
+ element += '</div>';
179
+ element += '</figure>';
180
+ element += '<h1 class="fc-title fc-title--small"></h1>';
181
+ element += '<p class="fc-text"></p>';
182
+ element += '</section>';
183
+
184
+ sections.push(section_id);
185
+ section_id = generateID();
186
+ }
187
+
188
+ element += '</div>';
189
+ element += '</div>';
190
+
191
+ container.append(element);
192
+
193
+ for(var i = 0; i < sections.length; i++) {
194
+ autocomplete(sections[i]);
195
+ addEventToInputFile(sections[i]);
196
+ }
197
+
198
+ scrollTo(row_id);
199
+ break;
200
+
201
+ case '5':
202
+ var sections = [];
203
+
204
+ var element = '<div id="'+ row_id +'" class="fc-row">';
205
+ element += '<div class="fc-tools">';
206
+ element += '<a class="fc-tools__btn fc-tools__btn--move fa fa-arrows" href="#"></a>';
207
+ element += '<a class="fc-tools__btn fc-tools__btn--delete fa fa-trash" href="#'+ row_id +'"></a>';
208
+ element += '</div>';
209
+
210
+ element += '<div class="fc-row fc-row--flex">';
211
+
168
212
  for(var i = 0; i < 3; i++) {
169
213
  element += '<section id="'+ section_id +'" class="fc-item fc-item--three fc-item--border">';
170
214
  element += '<input class="fc-search" type="text" name="search" placeholder="Buscar notícia">';
@@ -198,7 +242,7 @@ $(document).on('click', '.fc-snippet__btn', function(e) {
198
242
  scrollTo(row_id);
199
243
  break;
200
244
 
201
- case '5':
245
+ case '6':
202
246
  var sections = [];
203
247
 
204
248
  var element = '<div id="'+ row_id +'" class="fc-row">';
@@ -209,8 +253,8 @@ $(document).on('click', '.fc-snippet__btn', function(e) {
209
253
 
210
254
  element += '<div class="fc-row fc-row--flex">';
211
255
 
212
- for(var i = 0; i < 2; i++) {
213
- element += '<section id="'+ section_id +'" class="fc-item fc-item--two fc-item--border">';
256
+ for(var i = 0; i < 4; i++) {
257
+ element += '<section id="'+ section_id +'" class="fc-item fc-item--four fc-item--border">';
214
258
  element += '<input class="fc-search" type="text" name="search" placeholder="Buscar notícia">';
215
259
  element += '<a href="#" class="fc-link fc-link--absolute"></a>';
216
260
  element += '<h2 class="fc-caption"></h2>';
@@ -249,25 +293,29 @@ $(document).on('click', '.fc-snippet__btn', function(e) {
249
293
  // slide active
250
294
  function slideActive(container) {
251
295
  if(container) {
252
- container.owlCarousel({
253
- singleItem: true,
254
- slideSpeed: 500,
255
- autoPlay: false,
256
- stopOnHover: true,
257
- paginationSpeed: 500,
258
- rewindSpeed: 1000,
259
- navigation: true,
260
- touchDrag: false,
261
- mouseDrag: false,
262
- navigationText: ['&lsaquo;','&rsaquo;']
263
- });
296
+ for(var i = 0; i < container.length; i++) {
297
+ $(container[i]).owlCarousel({
298
+ singleItem: true,
299
+ slideSpeed: 500,
300
+ autoPlay: false,
301
+ stopOnHover: true,
302
+ paginationSpeed: 500,
303
+ rewindSpeed: 1000,
304
+ navigation: true,
305
+ touchDrag: false,
306
+ mouseDrag: false,
307
+ navigationText: ['&lsaquo;','&rsaquo;']
308
+ });
309
+ }
264
310
  }
265
311
  };
266
312
 
267
313
  // slide destroy
268
314
  function slideDestroy(container) {
269
315
  if(container.length) {
270
- container.data('owlCarousel').destroy();
316
+ for(var i = 0; i < container.length; i++) {
317
+ $(container[i]).data('owlCarousel').destroy();
318
+ }
271
319
  }
272
320
  }
273
321
 
@@ -330,6 +378,7 @@ function addEventToInputFile(id) {
330
378
  // upload file via ajax
331
379
  function fileSelectAndUpload(evt) {
332
380
  var file = evt.target.files[0];
381
+ var container = $('#' + evt.target.id);
333
382
 
334
383
  if(file) {
335
384
  var formData = new FormData();
@@ -343,15 +392,15 @@ function fileSelectAndUpload(evt) {
343
392
  processData: false,
344
393
  type: 'PUT',
345
394
  beforeSend: function() {
346
- $('#' + evt.target.id).find('figure').append('<div class="fc-loading"></div>');
347
- $('.fc-tools--center').addClass('fc-tools--disabled');
395
+ container.find('figure').append('<div class="fc-loading"></div>');
396
+ container.find($('.fc-tools--center')).addClass('fc-tools--disabled');
348
397
  },
349
398
  complete: function(){
350
399
  $('.fc-loading').remove();
351
400
  $('.fc-tools--center').removeClass('fc-tools--disabled');
352
401
  }
353
402
  }).done(function(e) {
354
- $('#' + evt.target.id).find('img').attr('src', e.image.thumb.url);
403
+ container.find('img').attr('src', e.image.thumb.url);
355
404
  }).fail(function(e) {
356
405
  alert('error: ' + e);
357
406
  });