adminpanel 2.4.3 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +16 -16
- data/adminpanel.gemspec +9 -8
- data/app/assets/javascripts/adminpanel/application.js +4 -0
- data/app/assets/javascripts/adminpanel/bootstrap-wysihtml5.js +2 -4
- data/app/assets/javascripts/adminpanel/sortable.js.coffee +27 -0
- data/app/assets/stylesheets/adminpanel/application.css +1 -0
- data/app/assets/stylesheets/adminpanel/sortable.css.scss.erb +13 -0
- data/app/controllers/adminpanel/application_controller.rb +0 -1
- data/app/controllers/adminpanel/sessions_controller.rb +5 -2
- data/app/controllers/concerns/adminpanel/rest_actions.rb +24 -22
- data/app/controllers/concerns/adminpanel/sortable_actions.rb +3 -20
- data/app/helpers/adminpanel/breadcrumbs_helper.rb +6 -5
- data/app/helpers/adminpanel/router_helper.rb +9 -3
- data/app/helpers/adminpanel/shared_pages_helper.rb +1 -1
- data/app/models/concerns/adminpanel/base.rb +34 -11
- data/app/models/concerns/adminpanel/sitemap.rb +0 -1
- data/app/models/concerns/adminpanel/sortable.rb +33 -30
- data/app/models/concerns/adminpanel/sortable_gallery.rb +90 -0
- data/app/views/adminpanel/form/_adminpanel_file_field.html.erb +1 -1
- data/app/views/adminpanel/templates/index.html.erb +41 -13
- data/app/views/adminpanel/templates/show.html.erb +33 -13
- data/config/initializers/adminpanel/carrierwave_mini_magick_quality.rb +11 -0
- data/config/locales/en.yml +3 -7
- data/config/locales/es.yml +1 -8
- data/config/routes.rb +6 -8
- data/lib/adminpanel.rb +9 -8
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/custom_errors/custom_errors_generator.rb +37 -0
- data/lib/generators/adminpanel/custom_errors/templates/errors_controller.rb +14 -0
- data/lib/generators/adminpanel/custom_errors/templates/show.html.erb +1 -0
- data/lib/generators/adminpanel/gallery/templates/gallery_template.rb +8 -3
- data/lib/generators/adminpanel/gallery/templates/uploader.rb +4 -1
- data/lib/generators/adminpanel/initialize/initialize_generator.rb +0 -12
- data/lib/generators/adminpanel/initialize/templates/adminpanel_setup.rb +1 -2
- data/lib/generators/adminpanel/resource/resource_generator.rb +29 -8
- data/lib/generators/adminpanel/resource/resource_generator_helper.rb +34 -7
- data/lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb +7 -2
- data/lib/tasks/adminpanel/adminpanel.rake +19 -61
- data/test/dummy/app/models/adminpanel/file_resourcefile.rb +1 -1
- data/test/dummy/app/models/adminpanel/gallery.rb +9 -4
- data/test/dummy/app/models/adminpanel/galleryfile.rb +2 -2
- data/test/dummy/app/models/adminpanel/photo.rb +1 -1
- data/test/dummy/app/models/adminpanel/product.rb +0 -4
- data/test/dummy/config/initializers/adminpanel_setup.rb +1 -1
- data/test/dummy/test/fixtures/adminpanel/galleryfiles.yml +24 -0
- data/test/features/shared/concerns/sortable_gallery_ui_test.rb +25 -0
- data/test/features/shared/concerns/sortable_test.rb +4 -4
- data/test/features/shared/form/{belongs_to_non_category_modal_test.rb → belongs_to_remote_test.rb} +1 -1
- data/test/features/shared/form/{has_many_through_non_category_modal_test.rb → has_many_through_remote_test.rb} +1 -1
- data/test/generators/dump_generator_test.rb +1 -13
- data/test/generators/gallery_generator_test.rb +1 -1
- data/test/generators/initialize_generator_test.rb +1 -9
- data/test/generators/resource_generator_test.rb +21 -1
- data/test/helpers/router_helper_test.rb +0 -4
- data/test/models/adminpanel/sortable_gallery_unit_test.rb +118 -0
- data/test/models/adminpanel/sortable_unit_test.rb +75 -0
- data/test/tasks/adminpanel_rake_test.rb +1 -1
- metadata +86 -85
- data/app/assets/images/adminpanel/loguito.png +0 -0
- data/app/controllers/adminpanel/categories_controller.rb +0 -52
- data/app/controllers/concerns/adminpanel/galleryzable_actions.rb +0 -34
- data/app/models/concerns/adminpanel/galleryzation.rb +0 -78
- data/app/views/adminpanel/categories/_categories_table.html.erb +0 -48
- data/app/views/adminpanel/categories/_category_form.html.erb +0 -33
- data/app/views/adminpanel/categories/create.js.erb +0 -6
- data/app/views/adminpanel/categories/index.html.erb +0 -63
- data/app/views/adminpanel/categories/new.js.erb +0 -5
- data/app/views/adminpanel/icons/_move_to_better.html.erb +0 -17
- data/app/views/adminpanel/icons/_move_to_worst.html.erb +0 -18
- data/app/views/adminpanel/shared/_gallery_entries.html.erb +0 -11
- data/app/views/adminpanel/shared/_index_records.html.erb +0 -32
- data/app/views/adminpanel/templates/gallery_entries.js.erb +0 -1
- data/app/views/adminpanel/templates/index_records.js.erb +0 -1
- data/lib/generators/adminpanel/initialize/templates/category_template.rb +0 -45
- data/lib/generators/adminpanel/initialize/templates/create_adminpanel_categories_table.rb +0 -11
- data/test/features/categories/categories_index_test.rb +0 -31
- data/test/features/shared/concerns/galleryzable_test.rb +0 -22
- data/test/features/shared/form/belongs_to_category_modal_test.rb +0 -35
- data/test/features/shared/form/has_many_through_category_modal_test.rb +0 -35
- data/test/models/adminpanel/galleryzable_test.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29e7779fdfad1dfcd0ba7a9530ec701475088269
|
4
|
+
data.tar.gz: 7585703c7329d3abff21c22a5ce9695e56fa47d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0292a2d3d33a67604098adec66048e06ac3ace8a9b795290b3edfcbab1dca0a5600547103d68126b0b2b15592cc49d5109bddb2c2381116ffa8289172ea64336
|
7
|
+
data.tar.gz: 866ef3c3547ae743a1cccbf5a6123aeac6454210abfe498c876134a12d20db5276ce91ed9e008242f436c9e1ffa26f2e8335170bb006d92fbe8fa29f41952579
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
Thank you for considering this gem, we are going to use the lastest Rails version of Rails. make sure you can use it before trying this gem out.
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/adminpanel.svg)](http://badge.fury.io/rb/adminpanel)
|
6
|
-
[![Build Status](https://travis-ci.org/
|
7
|
-
[![Code Climate](https://codeclimate.com/github/
|
8
|
-
<!-- [![Dependency Status](https://gemnasium.com/
|
6
|
+
[![Build Status](https://travis-ci.org/codn/adminpanel.svg?branch=master)](https://travis-ci.org/codn/adminpanel)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/codn/adminpanel/badges/gpa.svg)](https://codeclimate.com/github/codn/adminpanel)
|
8
|
+
<!-- [![Dependency Status](https://gemnasium.com/codn/adminpanel.svg)](https://gemnasium.com/codn/adminpanel) -->
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
Add this line to your application's Gemfile:
|
@@ -16,8 +16,6 @@ And then execute:
|
|
16
16
|
|
17
17
|
$ bundle
|
18
18
|
|
19
|
-
## Usage
|
20
|
-
|
21
19
|
In you application.rb
|
22
20
|
|
23
21
|
config.i18n.default_locale = :es # or :en
|
@@ -28,17 +26,19 @@ Then run:
|
|
28
26
|
|
29
27
|
rails g adminpanel:initialize
|
30
28
|
rake db:migrate
|
31
|
-
to create the database that the adminpanel it's expecting, this will also seed the database with the default user (email: 'admin@admin.com', password: 'password').
|
29
|
+
to create the database that the adminpanel it's expecting, this will also seed the database with the default user if you're in development environment (email: 'admin@admin.com', password: 'password').
|
30
|
+
|
31
|
+
Then, mount the gem wherever you like!
|
32
32
|
|
33
|
-
|
33
|
+
mount Adminpanel::Engine => '/panel'
|
34
34
|
|
35
|
-
|
35
|
+
## Usage
|
36
36
|
|
37
|
-
|
37
|
+
Make sure you [read the wiki](https://github.com/codn/adminpanel/wiki), there is the descriptions of every relevant part of the gem.
|
38
38
|
|
39
|
-
|
39
|
+
To create a new resource check the [Resource Generator.](https://github.com/codn/adminpanel/wiki/Generator-adminpanel:resource)
|
40
40
|
|
41
|
-
|
41
|
+
You can seed the sections with help of the [Section task.](https://github.com/codn/adminpanel/wiki/Rake-task-adminpanel:section)
|
42
42
|
|
43
43
|
## Dependencies
|
44
44
|
|
@@ -48,10 +48,10 @@ Please make sure that you have ImageMagick -v 2.13.2 installed before trying to
|
|
48
48
|
|
49
49
|
Currently the integrations working are:
|
50
50
|
|
51
|
-
* [Google Analytics Service](https://github.com/
|
52
|
-
* [Facebook Share Link to Wall](https://github.com/
|
53
|
-
* [Twitter API](https://github.com/
|
54
|
-
* [Instagram API](https://github.com/
|
51
|
+
* [Google Analytics Service](https://github.com/codn/adminpanel/wiki/include-Google-Analytics)
|
52
|
+
* [Facebook Share Link to Wall](https://github.com/codn/adminpanel/wiki/include-Adminpanel::Facebook)
|
53
|
+
* [Twitter API](https://github.com/codn/adminpanel/wiki/include-Adminpanel::Twitter)
|
54
|
+
* [Instagram API](https://github.com/codn/adminpanel/wiki/include-Adminpanel::Instagram)
|
55
55
|
|
56
56
|
## Contributing
|
57
57
|
|
@@ -61,4 +61,4 @@ Currently the integrations working are:
|
|
61
61
|
4. Push to the branch (`git push origin my-new-feature`)
|
62
62
|
5. Create new Pull Request
|
63
63
|
|
64
|
-
Any questions, errors or feature suggestions [are welcome in the issues](https://github.com/
|
64
|
+
Any questions, errors or feature suggestions [are welcome in the issues](https://github.com/codn/adminpanel/issues/new)
|
data/adminpanel.gemspec
CHANGED
@@ -6,12 +6,12 @@ require 'adminpanel/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'adminpanel'
|
8
8
|
spec.version = Adminpanel::VERSION
|
9
|
-
spec.authors = ['Jose Ramon Camacho', 'Victor Camacho']
|
9
|
+
spec.authors = ['Jose Ramon Camacho', 'Victor Camacho', 'Eduardo Albertos']
|
10
10
|
spec.email = ['info@codn.mx']
|
11
11
|
spec.description = %q{Gem that focus on making a public site's resources very quickly while being very configurable!,
|
12
12
|
supports facebook sharing, twitter, instagram and google analytics integration}
|
13
13
|
spec.summary = %q{Made with <3 by CoDN}
|
14
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.homepage = 'https://github.com/codn/adminpanel'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files`.split($/)
|
@@ -24,32 +24,33 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.requirements << 'imagemagick installed'
|
25
25
|
|
26
26
|
spec.add_runtime_dependency 'rails', '>= 4.2.0', '< 5.0.0'
|
27
|
-
spec.add_runtime_dependency 'mini_magick', '4.0
|
27
|
+
spec.add_runtime_dependency 'mini_magick', '4.1.0'
|
28
28
|
spec.add_runtime_dependency 'bcrypt', '~> 3.1', '>= 3.1.7'
|
29
29
|
spec.add_runtime_dependency 'carrierwave', '~> 0.10', '>= 0.10.0'
|
30
30
|
spec.add_runtime_dependency 'cancancan', '~> 1.10.1', '>= 1.10.1'
|
31
31
|
|
32
32
|
# Implemented APIs
|
33
33
|
spec.add_runtime_dependency 'google-api-client', '0.8.2' # Google analytics
|
34
|
+
spec.add_runtime_dependency 'instagram', '1.1.3' # Instagram
|
34
35
|
spec.add_runtime_dependency 'koala', '1.10.1' # Facebook
|
35
|
-
spec.add_runtime_dependency 'twitter', '5.13.0' # Twitter
|
36
36
|
spec.add_runtime_dependency 'omniauth-twitter', '1.1.0' # login Twitter
|
37
|
-
spec.add_runtime_dependency '
|
37
|
+
spec.add_runtime_dependency 'twitter', '5.14.0' # Twitter
|
38
38
|
|
39
39
|
# Asset dependencies
|
40
|
+
spec.add_runtime_dependency 'coffee-rails', '~> 4.1.0', '>= 4.1.0'
|
40
41
|
spec.add_runtime_dependency 'font-awesome-rails', '~> 4.2', '>= 4.2.0'
|
42
|
+
spec.add_runtime_dependency 'jquery-rails', '4.0.3'
|
43
|
+
spec.add_runtime_dependency 'jquery-ui-rails', '5.0.3'
|
41
44
|
spec.add_runtime_dependency 'sass-rails', '~> 5.0.0', '>= 5.0.0'
|
42
|
-
spec.add_runtime_dependency 'coffee-rails', '~> 4.1.0', '>= 4.1.0'
|
43
|
-
spec.add_runtime_dependency 'jquery-rails', '3.1.2'
|
44
45
|
spec.add_runtime_dependency 'turbolinks', '~> 2.5.0', '>= 2.5.2'
|
45
46
|
|
46
47
|
# Development dependencies
|
47
48
|
spec.add_runtime_dependency 'faker', '~> 1.3', '>= 1.3.0'
|
48
49
|
|
49
50
|
# Test dependencies
|
50
|
-
spec.add_development_dependency 'sqlite3', '~> 1.3', '1.3.10'
|
51
51
|
spec.add_development_dependency 'minitest', '>= 5.4.0', '<= 6.0.0'
|
52
52
|
spec.add_development_dependency 'minitest-emoji', '2.0.0'
|
53
53
|
spec.add_development_dependency 'minitest-capybara','~> 0.7', '>= 0.7.1'
|
54
54
|
spec.add_development_dependency 'poltergeist', '~> 1.5', '>= 1.5.1'
|
55
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3', '1.3.10'
|
55
56
|
end
|
@@ -12,6 +12,10 @@
|
|
12
12
|
//
|
13
13
|
//= require jquery
|
14
14
|
//= require jquery_ujs
|
15
|
+
//= require jquery-ui/core
|
16
|
+
//= require jquery-ui/widget
|
17
|
+
//= require jquery-ui/mouse
|
18
|
+
//= require jquery-ui/sortable
|
15
19
|
//= require turbolinks
|
16
20
|
//= require adminpanel/bootstrap
|
17
21
|
//= require_tree .
|
@@ -37,8 +37,6 @@
|
|
37
37
|
"<div class='btn-group'>" +
|
38
38
|
"<a class='btn" + size + "' data-wysihtml5-command='insertUnorderedList' title='" + locale.lists.unordered + "' tabindex='-1'><i class='fa fa-list-ul'></i></a>" +
|
39
39
|
"<a class='btn" + size + "' data-wysihtml5-command='insertOrderedList' title='" + locale.lists.ordered + "' tabindex='-1'><i class='fa fa-list-ol'></i></a>" +
|
40
|
-
"<a class='btn" + size + "' data-wysihtml5-command='Outdent' title='" + locale.lists.outdent + "' tabindex='-1'><i class='fa fa-outdent'></i></a>" +
|
41
|
-
"<a class='btn" + size + "' data-wysihtml5-command='Indent' title='" + locale.lists.indent + "' tabindex='-1'><i class='fa fa-indent'></i></a>" +
|
42
40
|
"</div>" +
|
43
41
|
"</li>";
|
44
42
|
},
|
@@ -88,7 +86,7 @@
|
|
88
86
|
var size = (options && options.size) ? ' btn-'+options.size : '';
|
89
87
|
return "<li>" +
|
90
88
|
"<div class='btn-group'>" +
|
91
|
-
"<a class='btn" + size + "' data-wysihtml5-action='change_view' title='" + locale.html.edit + "' tabindex='-1'><i class='fa fa-
|
89
|
+
"<a class='btn" + size + "' data-wysihtml5-action='change_view' title='" + locale.html.edit + "' tabindex='-1'><i class='fa fa-code'></i></a>" +
|
92
90
|
"</div>" +
|
93
91
|
"</li>";
|
94
92
|
},
|
@@ -389,7 +387,7 @@
|
|
389
387
|
"color": false,
|
390
388
|
"emphasis": true,
|
391
389
|
"lists": true,
|
392
|
-
"html":
|
390
|
+
"html": true,
|
393
391
|
"link": true,
|
394
392
|
"image": true,
|
395
393
|
events: {},
|
@@ -0,0 +1,27 @@
|
|
1
|
+
ready = ->
|
2
|
+
$('tbody#sortable').sortable
|
3
|
+
update: (event, ui) ->
|
4
|
+
position = 1
|
5
|
+
$(@).children('tr').each ->
|
6
|
+
if $(@).data('id') == ui.item.data('id')
|
7
|
+
$row = $(@)
|
8
|
+
$.ajax(
|
9
|
+
url: $row.data('url')
|
10
|
+
data:
|
11
|
+
position: position
|
12
|
+
method: 'put',
|
13
|
+
success: ->
|
14
|
+
# flash the updated $row
|
15
|
+
$row.addClass('success')
|
16
|
+
setTimeout ( ->
|
17
|
+
$row.removeClass('success')
|
18
|
+
), 500
|
19
|
+
)
|
20
|
+
return true
|
21
|
+
else
|
22
|
+
position++
|
23
|
+
$('tbody#sortable').disableSelection
|
24
|
+
|
25
|
+
|
26
|
+
$(document).ready(ready)
|
27
|
+
$(document).on('page:load', ready)
|
@@ -10,7 +10,6 @@ module Adminpanel
|
|
10
10
|
include SessionsHelper
|
11
11
|
include Adminpanel::RestActions
|
12
12
|
include Adminpanel::SortableActions
|
13
|
-
include Adminpanel::GalleryzableActions
|
14
13
|
include Adminpanel::FacebookActions
|
15
14
|
include Adminpanel::TwitterActions
|
16
15
|
include Adminpanel::SitemapActions
|
@@ -4,7 +4,10 @@ module Adminpanel
|
|
4
4
|
include ApplicationHelper
|
5
5
|
|
6
6
|
layout 'adminpanel/application-login'
|
7
|
-
before_action :configure_instagram, only:[
|
7
|
+
before_action :configure_instagram, only: [
|
8
|
+
:instagram_login,
|
9
|
+
:instagram_callback
|
10
|
+
]
|
8
11
|
|
9
12
|
def new
|
10
13
|
end
|
@@ -43,7 +46,7 @@ module Adminpanel
|
|
43
46
|
end
|
44
47
|
|
45
48
|
def instagram_callback
|
46
|
-
response = Instagram.get_access_token(params[:code], :
|
49
|
+
response = Instagram.get_access_token(params[:code], redirect_uri: instagram_callback_sessions_url)
|
47
50
|
username = Instagram.client(access_token: response.access_token).user.username
|
48
51
|
Auth.create(key: 'instagram', value: response.access_token, name: "@#{username}")
|
49
52
|
redirect_to instagram_analytics_path
|
@@ -2,28 +2,26 @@ module Adminpanel
|
|
2
2
|
module RestActions
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
included do
|
5
|
-
before_action :set_resource_instance,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
before_action :set_resource_collection, only: [:index, :destroy]
|
18
|
-
before_action :set_relationship_collections, only: [:new, :create, :edit, :update]
|
5
|
+
before_action :set_resource_instance, only: [
|
6
|
+
:show,
|
7
|
+
:edit,
|
8
|
+
:update,
|
9
|
+
:destroy,
|
10
|
+
:fb_choose_page,
|
11
|
+
:fb_save_token,
|
12
|
+
:fb_publish,
|
13
|
+
:twitter_publish
|
14
|
+
]
|
15
|
+
before_action :set_resource_collection, only: [:index, :destroy]
|
16
|
+
before_action :set_relationship_collections, only: [:new, :create, :edit, :update]
|
19
17
|
end
|
20
18
|
|
21
19
|
def index
|
22
|
-
render 'adminpanel/templates/index'
|
20
|
+
render 'adminpanel/templates/index' if stale?(etag: @collection, public: true, template: false)
|
23
21
|
end
|
24
22
|
|
25
23
|
def show
|
26
|
-
render 'adminpanel/templates/show' if stale?(@resource_instance, public: true)
|
24
|
+
render 'adminpanel/templates/show' if stale?(etag: @resource_instance, public: true, template: false)
|
27
25
|
end
|
28
26
|
|
29
27
|
def new
|
@@ -42,8 +40,10 @@ module Adminpanel
|
|
42
40
|
format.js do
|
43
41
|
# if format js, request is from another controller's form
|
44
42
|
if params[:belongs_request]
|
43
|
+
# we are in other controller as a belongs_to, add option to select
|
45
44
|
render 'adminpanel/templates/create_belongs_to', locals: { resource: @resource_instance }
|
46
45
|
else
|
46
|
+
# we are in other controller as a has_many, add checkbox
|
47
47
|
render 'adminpanel/templates/create_has_many', locals: { resource: @resource_instance }
|
48
48
|
end
|
49
49
|
end
|
@@ -79,12 +79,15 @@ module Adminpanel
|
|
79
79
|
set_has_many_collections
|
80
80
|
end
|
81
81
|
|
82
|
+
# set the collection of objects for each attribute that it's a select (belongs_to)
|
83
|
+
# to populate the <select></select>s
|
82
84
|
def set_belongs_to_collections
|
83
85
|
@model.relationships_of('belongs_to').each do |class_variable|
|
84
86
|
set_relationship(class_variable)
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
90
|
+
# set the collection of objects for each attribute that it's a checkbox (has_many)
|
88
91
|
def set_has_many_collections
|
89
92
|
@model.relationships_of('has_many').each do |class_variable|
|
90
93
|
set_relationship(class_variable)
|
@@ -92,7 +95,7 @@ module Adminpanel
|
|
92
95
|
end
|
93
96
|
|
94
97
|
def set_relationship(class_variable)
|
95
|
-
if class_variable.respond_to?(
|
98
|
+
if class_variable.respond_to?('of_model')
|
96
99
|
@collections.merge!({"#{class_variable}" => class_variable.of_model(@model.display_name)})
|
97
100
|
else
|
98
101
|
@collections.merge!({"#{class_variable}" => class_variable.all})
|
@@ -100,10 +103,9 @@ module Adminpanel
|
|
100
103
|
end
|
101
104
|
|
102
105
|
def merge_params
|
103
|
-
params.merge({model:
|
104
|
-
params.merge({model_name:
|
105
|
-
params.merge({belongs_request:
|
106
|
-
params.merge({currentcontroller: params[:currentcontroller]}) if params[:currentcontroller].present?
|
106
|
+
params.merge({model: params[:model]}) if params[:model].present?
|
107
|
+
params.merge({model_name: params[:model_name]}) if params[:model_name].present?
|
108
|
+
params.merge({belongs_request: params[:belongs_request]}) if params[:belongs_request].present?
|
107
109
|
end
|
108
110
|
|
109
111
|
def whitelisted_params
|
@@ -119,7 +121,7 @@ module Adminpanel
|
|
119
121
|
@collection = @model.all
|
120
122
|
end
|
121
123
|
|
122
|
-
def render_new
|
124
|
+
def render_new(format)
|
123
125
|
format.html do
|
124
126
|
render 'adminpanel/templates/new'
|
125
127
|
end
|
@@ -2,28 +2,11 @@ module Adminpanel
|
|
2
2
|
module SortableActions
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
def
|
5
|
+
def move_to_position
|
6
6
|
resource = @model.find(params[:id])
|
7
|
-
resource.move_to_better_position
|
8
|
-
update_index_table
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
def move_to_worst
|
13
|
-
resource = @model.find(params[:id])
|
14
|
-
resource.move_to_worst_position
|
15
|
-
update_index_table
|
16
|
-
end
|
17
|
-
|
18
|
-
protected
|
19
|
-
def update_index_table
|
20
|
-
respond_to do |format|
|
21
|
-
format.js do
|
22
|
-
render 'adminpanel/templates/index_records', locals: {
|
23
|
-
collection: @model.all
|
24
|
-
}
|
25
|
-
end
|
26
|
-
end
|
8
|
+
resource.move_to_position(params[:position].to_i)
|
9
|
+
render json: {status: :ok}
|
27
10
|
end
|
28
11
|
end
|
29
12
|
end
|
@@ -2,17 +2,18 @@ module Adminpanel
|
|
2
2
|
module BreadcrumbsHelper
|
3
3
|
|
4
4
|
def breadcrumb_add(title, url)
|
5
|
-
|
5
|
+
breadcrumb << { title: title, url: url }
|
6
6
|
end
|
7
7
|
|
8
8
|
def render_breadcrumb(divider)
|
9
|
-
render
|
9
|
+
render 'adminpanel/shared/breadcrumb', nav: breadcrumb, divider: divider
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
def breadcrumb
|
15
|
+
@breadcrumb ||= [{ title: I18n.t('breadcrumb.index'), url: adminpanel.root_url }]
|
16
|
+
end
|
16
17
|
|
17
18
|
end
|
18
19
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module Adminpanel
|
2
2
|
module RouterHelper
|
3
|
-
def
|
4
|
-
resource_class(resource).
|
3
|
+
def gallery_is_sortable?(resource)
|
4
|
+
resource_class(resource).has_sortable_gallery?
|
5
|
+
end
|
6
|
+
|
7
|
+
def sortable_gallery(resource)
|
8
|
+
resource_class(resource).gallery_relationship
|
5
9
|
end
|
6
10
|
|
7
11
|
def resources_parameters(resource)
|
@@ -16,7 +20,7 @@ module Adminpanel
|
|
16
20
|
resource_class(resource).twitter_share?
|
17
21
|
end
|
18
22
|
|
19
|
-
def
|
23
|
+
def resource_is_sortable?(resource)
|
20
24
|
resource_class(resource).is_sortable?
|
21
25
|
end
|
22
26
|
|
@@ -37,7 +41,9 @@ module Adminpanel
|
|
37
41
|
}
|
38
42
|
}
|
39
43
|
end
|
44
|
+
|
40
45
|
private
|
46
|
+
|
41
47
|
def resource_class(resource)
|
42
48
|
"adminpanel/#{resource.to_s.singularize}".classify.constantize
|
43
49
|
end
|