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.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +4 -0
- data/.rspec +3 -1
- data/Gemfile +1 -1
- data/README.md +25 -19
- data/app/assets/images/fc-snippet-four.jpg +0 -0
- data/app/assets/images/fc-snippet-four.psd +0 -0
- data/app/assets/images/fc-snippet-highlight.jpg +0 -0
- data/app/assets/images/fc-snippet-highlight.psd +0 -0
- data/app/assets/images/fc-snippet-slide.jpg +0 -0
- data/app/assets/images/fc-snippet-slide.psd +0 -0
- data/app/assets/images/fc-snippet-text.jpg +0 -0
- data/app/assets/images/fc-snippet-text.psd +0 -0
- data/app/assets/images/fc-snippet-three.jpg +0 -0
- data/app/assets/images/fc-snippet-three.psd +0 -0
- data/app/assets/images/fc-snippet-two.jpg +0 -0
- data/app/assets/images/fc-snippet-two.psd +0 -0
- data/app/assets/javascripts/rails_admin/featured_content.js.erb +68 -19
- data/app/assets/stylesheets/rails_admin/featured_content.scss +184 -74
- data/app/views/rails_admin/main/featured_content.html.erb +27 -5
- data/config/initializers/assets.rb +2 -1
- data/config/locales/featured_content.en.yml +7 -0
- data/config/locales/featured_content.pt-BR.yml +7 -0
- data/lib/rails_admin_featured_content/version.rb +1 -1
- data/screenshots/image-1.png +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +11 -1692
- data/spec/dummy/log/test.log +264 -0
- data/spec/spec_helper.rb +22 -5
- data/spec/version_spec.rb +1 -1
- data/vendor/assets/stylesheets/rails_admin_featured_content.scss +144 -96
- metadata +11 -34
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/example.jpg +0 -0
- 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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f794e8f92593ff587d49b62174df33192e8eb8c
|
|
4
|
+
data.tar.gz: b25a82ca04b40b67bd376202d9071fc9d9c48317
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ded74b6d5ccbd5c9945bd6b4d057732060c482650136e707c44713e374faac3e493e9d153594a17302a329bf4b74b7bebb93cdee2e22a6d538257d7227b08f3
|
|
7
|
+
data.tar.gz: f41d0940590a3e03b88362cab66d680538416389e4fa87dbbdc8862fc9f2f33730bdb9a397f86f22e329598683c685e98321409ee57707dde5f46f1f58536a43
|
data/.coveralls.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
repo_token: avzlu3CK5xcD93R0nsjwJZ18bU0NwsxSb
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
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 '
|
|
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
|
[](https://badge.fury.io/rb/rails_admin_content_builder)
|
|
4
|
+
[](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content)
|
|
5
|
+
[](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content/coverage)
|
|
6
|
+
[](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content)
|
|
7
|
+
[](https://travis-ci.org/luizpicolo/rails_admin_featured_content)
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
An easy way for creating Featured Content using rails_admin
|
|
6
10
|
|
|
7
|
-
##
|
|
11
|
+
## Preview
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+

|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
```
|
|
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,
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
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 '
|
|
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 <
|
|
213
|
-
element += '<section id="'+ section_id +'" class="fc-item fc-item--
|
|
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.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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: ['‹','›']
|
|
308
|
+
});
|
|
309
|
+
}
|
|
264
310
|
}
|
|
265
311
|
};
|
|
266
312
|
|
|
267
313
|
// slide destroy
|
|
268
314
|
function slideDestroy(container) {
|
|
269
315
|
if(container.length) {
|
|
270
|
-
container.
|
|
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
|
-
|
|
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
|
-
|
|
403
|
+
container.find('img').attr('src', e.image.thumb.url);
|
|
355
404
|
}).fail(function(e) {
|
|
356
405
|
alert('error: ' + e);
|
|
357
406
|
});
|