godmin 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +2 -2
- data/.travis.yml +12 -5
- data/Appraisals +7 -0
- data/CHANGELOG.md +18 -2
- data/README.md +3 -3
- data/Rakefile +2 -1
- data/app/assets/javascripts/godmin/batch-actions.js +10 -1
- data/app/views/godmin/resource/_batch_actions.html.erb +1 -1
- data/app/views/godmin/resource/_export_actions.html.erb +2 -2
- data/app/views/godmin/resource/_pagination.html.erb +5 -5
- data/app/views/godmin/resource/_scopes.html.erb +1 -1
- data/app/views/godmin/resource/_table.html.erb +3 -3
- data/app/views/godmin/resource/columns/_actions.html.erb +20 -4
- data/app/views/layouts/godmin/login.html.erb +1 -1
- data/config/locales/en.yml +3 -0
- data/config/locales/pt-BR.yml +3 -0
- data/config/locales/sv.yml +3 -0
- data/gemfiles/rails_4.gemfile +9 -0
- data/gemfiles/rails_5.gemfile +9 -0
- data/godmin.gemspec +19 -18
- data/lib/godmin/application_controller.rb +11 -0
- data/lib/godmin/authorization.rb +1 -1
- data/lib/godmin/helpers/application.rb +9 -2
- data/lib/godmin/helpers/batch_actions.rb +1 -9
- data/lib/godmin/helpers/filters.rb +17 -10
- data/lib/godmin/helpers/forms.rb +3 -1
- data/lib/godmin/helpers/tables.rb +1 -1
- data/lib/godmin/resources/resource_controller/batch_actions.rb +1 -1
- data/lib/godmin/resources/resource_service/batch_actions.rb +14 -0
- data/lib/godmin/version.rb +1 -1
- data/template.rb +4 -24
- data/test/dummy/admin/admin.gemspec +1 -1
- data/test/dummy/app/services/article_service.rb +18 -3
- data/test/dummy/config/environments/test.rb +8 -2
- data/test/dummy/db/schema.rb +0 -1
- data/test/fakes/article_service.rb +1 -1
- data/test/integration/batch_actions_test.rb +30 -1
- data/test/integration/filters_test.rb +15 -0
- data/test/integration/scopes_test.rb +1 -1
- data/test/lib/godmin/helpers/filters_test.rb +32 -6
- data/test/lib/godmin/resources/resource_service/batch_actions_test.rb +1 -1
- metadata +88 -63
- data/test/dummy/admin/Rakefile +0 -24
- data/test/dummy/admin/app/helpers/admin/application_helper.rb +0 -4
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/concerns/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43049a2e50fce4f665099b88786fd13cda3d1e58
|
4
|
+
data.tar.gz: 4ddd3cf185bcca97a1d50d37893cf760a5d3ebf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8ed426f1242d6054da877458cd5dd81e25ca8a30133edd0a0e3a44e34db3a616138c01d2c332444dd3f0df716992efc15265f9285ac746581e63f0b1fd0aba4
|
7
|
+
data.tar.gz: 74131a43082434db552085b31fc767610545c36cb7f64f6fc39838f814349b0070bf38fde927d07fc0514f9e998acbcc04e863643f2ff3caf6d24cddd98f658d
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
bundler_args: --without debug
|
2
|
-
|
2
|
+
cache: bundler
|
3
3
|
script: "bundle exec rake test"
|
4
4
|
sudo: false
|
5
|
-
cache: bundler
|
6
5
|
|
7
6
|
rvm:
|
8
|
-
- 2.
|
9
|
-
- 2.1
|
10
|
-
|
7
|
+
- 2.1.0
|
8
|
+
- 2.3.1
|
9
|
+
|
10
|
+
gemfile:
|
11
|
+
- gemfiles/rails_4.gemfile
|
12
|
+
- gemfiles/rails_5.gemfile
|
13
|
+
|
14
|
+
matrix:
|
15
|
+
exclude:
|
16
|
+
- rvm: 2.1.0
|
17
|
+
gemfile: gemfiles/rails_5.gemfile
|
11
18
|
|
12
19
|
addons:
|
13
20
|
code_climate:
|
data/Appraisals
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 1.3.0 - 2016-07-11
|
4
|
+
Features
|
5
|
+
- Increased batch action checkbox click area (https://github.com/varvet/godmin/pull/183)
|
6
|
+
- Adds titles to action links (https://github.com/varvet/godmin/pull/185)
|
7
|
+
- Rails 5 support (https://github.com/varvet/godmin/pull/199)
|
8
|
+
|
9
|
+
Bug fixes
|
10
|
+
- Use translated title on login page (https://github.com/varvet/godmin/pull/195)
|
11
|
+
- Hide batch action toggle when no batch action available (https://github.com/varvet/godmin/pull/197)
|
12
|
+
- Remove hidden field for multiselect filters (https://github.com/varvet/godmin/pull/169)
|
13
|
+
|
14
|
+
Other
|
15
|
+
- Fixes a deprecation warning on Rails 4.2.5.1 (https://github.com/varvet/godmin/pull/188)
|
16
|
+
- Adds caching partial overrides to increase table rendering speed (https://github.com/varvet/godmin/pull/184)
|
17
|
+
|
3
18
|
### 1.2.0 - 2016-02-02
|
4
19
|
Features
|
5
20
|
- Adds support for custom ordering of columns (https://github.com/varvet/godmin/pull/168)
|
6
|
-
- Adds passing of
|
21
|
+
- Adds passing of options to association form helper (https://github.com/varvet/godmin/pull/172)
|
22
|
+
- Adds passing of html options to association form helper (https://github.com/varvet/godmin/pull/176)
|
7
23
|
|
8
|
-
Bug fixes
|
24
|
+
Bug fixes
|
9
25
|
- Fixes an issue with the template resolver and Rails 4.2.5.1 (https://github.com/varvet/godmin/pull/175)
|
10
26
|
|
11
27
|
### 1.1.0 - 2015-12-08
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[![Code Climate](https://img.shields.io/codeclimate/github/varvet/godmin.svg)](https://codeclimate.com/github/varvet/godmin)
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/varvet/godmin/badges/coverage.svg)](https://codeclimate.com/github/varvet/godmin/coverage)
|
7
7
|
|
8
|
-
Godmin is an admin framework for Rails 4+. Use it to build dedicated admin sections for your apps, or stand alone admin apps such as internal tools. It has support for common features such as scoping, filtering and performing batch actions on your models.
|
8
|
+
Godmin is an admin framework for Rails 4+. Use it to build dedicated admin sections for your apps, or stand alone admin apps such as internal tools. It has support for common features such as scoping, filtering and performing batch actions on your models. Check out the [demo app](http://godmin-sandbox.herokuapp.com) and its [source code](https://github.com/varvet/godmin-sandbox) to get a feel for how it works.
|
9
9
|
|
10
10
|
Godmin differs from tools like [ActiveAdmin](http://activeadmin.info/) and [RailsAdmin](https://github.com/sferik/rails_admin) in how admin sections are created. Rather than being DSL-based, Godmin is a set of opt-in modules and helpers that can be applied to regular Rails apps and engines. An admin section built with Godmin is just that, a regular Rails app or Rails engine, with regular routes, controllers and views. That means there is less to learn, because you already know most of it, and fewer constraints on what you can do. After all, administrators are users too, and what better way to provide them with a tailor made experience than building them a Rails app?
|
11
11
|
|
@@ -536,8 +536,8 @@ end
|
|
536
536
|
It's easy to override view templates and partials in Godmin, both globally and per resource. All you have to do is place a file with an identical name in your `app/views` directory. For instance, to override the `godmin/resource/index.html.erb` template for all resources, place a file under `app/views/resource/index.html.erb`. If you only wish to override it for articles, place it instead under `app/views/articles/index.html.erb`.
|
537
537
|
|
538
538
|
You can also inherit from the default template as such:
|
539
|
-
```
|
540
|
-
<%= render template:
|
539
|
+
```erb
|
540
|
+
<%= render template: "godmin/resource/show" %>
|
541
541
|
|
542
542
|
<p>Append stuff here</p>
|
543
543
|
```
|
data/Rakefile
CHANGED
@@ -25,13 +25,14 @@ Rake::TestTask.new(:test) do |t|
|
|
25
25
|
t.libs << "lib"
|
26
26
|
t.libs << "test"
|
27
27
|
t.pattern = "test/**/*_test.rb"
|
28
|
+
t.warning = false
|
28
29
|
t.verbose = false
|
29
30
|
end
|
30
31
|
|
31
32
|
task default: :test
|
32
33
|
|
33
34
|
namespace :sandbox do
|
34
|
-
desc "
|
35
|
+
desc "Generate the Sandbox app then push it to GitHub which deploys it to Heroku"
|
35
36
|
task :deploy do
|
36
37
|
message = "Generated from: https://github.com/varvet/godmin/commit/#{`git rev-parse HEAD`.strip}"
|
37
38
|
template_path = File.expand_path("../template.rb", __FILE__)
|
@@ -16,6 +16,7 @@ Godmin.BatchActions = (function() {
|
|
16
16
|
|
17
17
|
function initializeEvents() {
|
18
18
|
$container.find('[data-behavior~=batch-actions-select]').on('click', toggleCheckboxes);
|
19
|
+
$container.find('[data-behavior~=batch-actions-checkbox-container]').on('click', toggleCheckbox);
|
19
20
|
$container.find('[data-behavior~=batch-actions-checkbox]').on('change', toggleActions);
|
20
21
|
$(document).delegate('[data-behavior~=batch-actions-action-link]', 'mousedown', triggerAction);
|
21
22
|
}
|
@@ -38,7 +39,15 @@ Godmin.BatchActions = (function() {
|
|
38
39
|
}).toArray().join(',');
|
39
40
|
}
|
40
41
|
|
41
|
-
function
|
42
|
+
function toggleCheckbox(e) {
|
43
|
+
if (this == e.target) {
|
44
|
+
$(this).find('[data-behavior~=batch-actions-checkbox]').click();
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
function toggleCheckboxes(e) {
|
49
|
+
e.preventDefault();
|
50
|
+
|
42
51
|
if (checkedCheckboxes().length > 0) {
|
43
52
|
$container.find('[data-behavior~=batch-actions-checkbox]').prop('checked', false).trigger('change');
|
44
53
|
setSelectToAll();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if @resource_service.
|
1
|
+
<% if @resource_service.include_batch_actions? %>
|
2
2
|
<%= link_to translate_scoped("batch_actions.buttons.select_all"), "#", class: "btn btn-default",
|
3
3
|
data: { behavior: "batch-actions-select batch-actions-select-all" } %>
|
4
4
|
<%= link_to translate_scoped("batch_actions.buttons.deselect_all"), "#", class: "btn btn-default hidden",
|
@@ -5,10 +5,10 @@
|
|
5
5
|
</button>
|
6
6
|
<ul class="dropdown-menu" role="menu">
|
7
7
|
<li>
|
8
|
-
<%= link_to "#{translate_scoped("actions.export_as")} JSON", url_for(params.merge(only_path: true, format: "json")) %>
|
8
|
+
<%= link_to "#{translate_scoped("actions.export_as")} JSON", url_for(params.to_unsafe_h.merge(only_path: true, format: "json")) %>
|
9
9
|
</li>
|
10
10
|
<li>
|
11
|
-
<%= link_to "#{translate_scoped("actions.export_as")} CSV", url_for(params.merge(only_path: true, format: "csv")) %>
|
11
|
+
<%= link_to "#{translate_scoped("actions.export_as")} CSV", url_for(params.to_unsafe_h.merge(only_path: true, format: "csv")) %>
|
12
12
|
</li>
|
13
13
|
</ul>
|
14
14
|
</div>
|
@@ -3,23 +3,23 @@
|
|
3
3
|
<nav>
|
4
4
|
<ul class="pagination">
|
5
5
|
<% unless @resource_service.paginator.pages.first == 1 && @resource_service.paginator.current_page == @resource_service.paginator.pages.first %>
|
6
|
-
<li><%= link_to translate_scoped("pagination.first"), params.merge(page: 1) %></li>
|
7
|
-
<li><%= link_to "«", params.merge(page: @resource_service.paginator.current_page - 1) %></li>
|
6
|
+
<li><%= link_to translate_scoped("pagination.first"), params.to_unsafe_h.merge(page: 1) %></li>
|
7
|
+
<li><%= link_to "«", params.to_unsafe_h.merge(page: @resource_service.paginator.current_page - 1) %></li>
|
8
8
|
<% end %>
|
9
9
|
<% unless @resource_service.paginator.pages.first == 1 %>
|
10
10
|
<li class="disabled"><%= link_to "…" %></li>
|
11
11
|
<% end %>
|
12
12
|
<% @resource_service.paginator.pages.each do |page| %>
|
13
13
|
<li class="<%= "active" if page == @resource_service.paginator.current_page %>">
|
14
|
-
<%= link_to page, params.merge(page: page) %>
|
14
|
+
<%= link_to page, params.to_unsafe_h.merge(page: page) %>
|
15
15
|
</li>
|
16
16
|
<% end %>
|
17
17
|
<% unless @resource_service.paginator.pages.last == @resource_service.paginator.total_pages %>
|
18
18
|
<li class="disabled"><%= link_to "…" %></li>
|
19
19
|
<% end %>
|
20
20
|
<% unless @resource_service.paginator.pages.last == @resource_service.paginator.total_pages && @resource_service.paginator.current_page == @resource_service.paginator.pages.last %>
|
21
|
-
<li><%= link_to "»", params.merge(page: @resource_service.paginator.current_page + 1) %></li>
|
22
|
-
<li><%= link_to translate_scoped("pagination.last"), params.merge(page: @resource_service.paginator.total_pages) %></li>
|
21
|
+
<li><%= link_to "»", params.to_unsafe_h.merge(page: @resource_service.paginator.current_page + 1) %></li>
|
22
|
+
<li><%= link_to translate_scoped("pagination.last"), params.to_unsafe_h.merge(page: @resource_service.paginator.total_pages) %></li>
|
23
23
|
<% end %>
|
24
24
|
</ul>
|
25
25
|
</nav>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<ul class="nav nav-tabs">
|
4
4
|
<% @resource_service.scope_map.each do |name, options| %>
|
5
5
|
<li class="<%= "active" if @resource_service.scoped_by?(name) %>">
|
6
|
-
<%= link_to url_for(params.merge(scope: name, only_path: true).except(:page)) do %>
|
6
|
+
<%= link_to url_for(params.to_unsafe_h.merge(scope: name, only_path: true).except(:page)) do %>
|
7
7
|
<%= translate_scoped("scopes.labels.#{name.to_s.underscore}", default: name.to_s.titleize) %>
|
8
8
|
<span class="text-muted"> (<%= @resource_service.scope_count(name) %>)</span>
|
9
9
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<table class="table table-bordered table-hover">
|
3
3
|
<thead>
|
4
4
|
<tr>
|
5
|
-
<% if @resource_service.
|
5
|
+
<% if @resource_service.include_batch_actions? %>
|
6
6
|
<th></th>
|
7
7
|
<% end %>
|
8
8
|
<% @resource_service.attrs_for_index.each do |attr| %>
|
@@ -16,8 +16,8 @@
|
|
16
16
|
<tbody>
|
17
17
|
<% @resources.each do |resource| %>
|
18
18
|
<tr data-resource-id="<%= resource.id %>" class="<%= "highlight" if flash[:updated_ids] && flash[:updated_ids].include?(resource.id) %>">
|
19
|
-
<% if @resource_service.
|
20
|
-
<td align="center">
|
19
|
+
<% if @resource_service.include_batch_actions? %>
|
20
|
+
<td align="center" data-behavior="batch-actions-checkbox-container">
|
21
21
|
<%= check_box_tag "batch_action[items][#{resource.id}]", nil, nil,
|
22
22
|
data: { behavior: "batch-actions-checkbox" } %>
|
23
23
|
</td>
|
@@ -1,12 +1,28 @@
|
|
1
1
|
<div class="btn-group btn-group-sm pull-right">
|
2
2
|
<% if policy(resource).show? %>
|
3
|
-
<%= link_to
|
3
|
+
<%= link_to(
|
4
|
+
translate_scoped("actions.show"),
|
5
|
+
resource,
|
6
|
+
class: "btn btn-default",
|
7
|
+
title: translate_scoped("actions.show_title", resource: resource)
|
8
|
+
) %>
|
4
9
|
<% end %>
|
5
10
|
<% if policy(resource).edit? %>
|
6
|
-
<%= link_to
|
11
|
+
<%= link_to(
|
12
|
+
translate_scoped("actions.edit"),
|
13
|
+
[:edit, resource],
|
14
|
+
class: "btn btn-default",
|
15
|
+
title: translate_scoped("actions.edit_title", resource: resource)
|
16
|
+
) %>
|
7
17
|
<% end %>
|
8
18
|
<% if policy(resource).destroy? %>
|
9
|
-
<%= link_to
|
10
|
-
|
19
|
+
<%= link_to(
|
20
|
+
translate_scoped("actions.destroy"),
|
21
|
+
resource,
|
22
|
+
method: :delete,
|
23
|
+
class: "btn btn-danger",
|
24
|
+
title: translate_scoped("actions.destroy_title", resource: resource),
|
25
|
+
data: { confirm: translate_scoped("actions.confirm_message") }
|
26
|
+
) %>
|
11
27
|
<% end %>
|
12
28
|
</div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<div class="col-md-4 col-md-offset-4">
|
5
5
|
<div class="panel panel-default">
|
6
6
|
<div class="panel-heading">
|
7
|
-
<h3 class="panel-title"
|
7
|
+
<h3 class="panel-title"><%= t("godmin.title") %></h3>
|
8
8
|
</div>
|
9
9
|
<div class="panel-body">
|
10
10
|
<%= render "layouts/godmin/content" %>
|
data/config/locales/en.yml
CHANGED
@@ -17,8 +17,11 @@ en:
|
|
17
17
|
actions:
|
18
18
|
label: Actions
|
19
19
|
show: Show
|
20
|
+
show_title: Show %{resource}
|
20
21
|
edit: Edit
|
22
|
+
edit_title: Edit %{resource}
|
21
23
|
destroy: Destroy
|
24
|
+
destroy_title: Destroy %{resource}
|
22
25
|
confirm_message: Are you sure?
|
23
26
|
export: Export
|
24
27
|
export_as: As
|
data/config/locales/pt-BR.yml
CHANGED
@@ -17,8 +17,11 @@ pt-BR:
|
|
17
17
|
actions:
|
18
18
|
label: Ações
|
19
19
|
show: Exibir
|
20
|
+
show_ttitle: Exibir %{resource}
|
20
21
|
edit: Editar
|
22
|
+
edit_title: Editar %{resource}
|
21
23
|
destroy: Remover
|
24
|
+
destroy_title: Remover %{resource}
|
22
25
|
confirm_message: Você tem certeza?
|
23
26
|
export: Exportar
|
24
27
|
export_as: Como
|
data/config/locales/sv.yml
CHANGED
@@ -17,8 +17,11 @@ sv:
|
|
17
17
|
actions:
|
18
18
|
label: Alternativ
|
19
19
|
show: Visa
|
20
|
+
show_title: Visa %{resource}
|
20
21
|
edit: Ändra
|
22
|
+
edit_title: Ändra %{resource}
|
21
23
|
destroy: Ta bort
|
24
|
+
destroy_title: Ta bort %{resource}
|
22
25
|
confirm_message: Är du säker?
|
23
26
|
export: Exportera
|
24
27
|
export_as: Som
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "admin", :path => "../test/dummy/admin", :group => [:test, :development]
|
6
|
+
gem "codeclimate-test-reporter", :group => :test, :require => nil
|
7
|
+
gem "rails", "~> 4.0"
|
8
|
+
|
9
|
+
gemspec :path => "../"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "admin", :path => "../test/dummy/admin", :group => [:test, :development]
|
6
|
+
gem "codeclimate-test-reporter", :group => :test, :require => nil
|
7
|
+
gem "rails", "~> 5.0"
|
8
|
+
|
9
|
+
gemspec :path => "../"
|
data/godmin.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.email = ["info@varvet.se"]
|
12
12
|
gem.homepage = "https://github.com/varvet/godmin"
|
13
13
|
gem.summary = "Godmin is an admin framework for Rails 4+"
|
14
|
-
gem.description = "Godmin is an admin framework for Rails 4
|
14
|
+
gem.description = "Godmin is an admin framework for Rails 4+. Use it to build dedicated admin sections for your apps, or stand alone admin apps such as internal tools."
|
15
15
|
gem.license = "MIT"
|
16
16
|
|
17
17
|
gem.files = `git ls-files`.split($/)
|
@@ -19,22 +19,23 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
20
|
gem.require_paths = ["lib"]
|
21
21
|
|
22
|
-
gem.add_dependency "bcrypt", "~> 3.1
|
23
|
-
gem.add_dependency "
|
24
|
-
gem.add_dependency "
|
25
|
-
gem.add_dependency "coffee-rails", [">= 4.0", "<
|
26
|
-
gem.add_dependency "csv_builder", "~> 2.1
|
27
|
-
gem.add_dependency "jquery-rails", ">= 3.0"
|
28
|
-
gem.add_dependency "momentjs-rails", "
|
29
|
-
gem.add_dependency "rails", "
|
30
|
-
gem.add_dependency "sass-rails", ">= 4.0"
|
31
|
-
gem.add_dependency "selectize-rails", "~> 0.12
|
22
|
+
gem.add_dependency "bcrypt", "~> 3.1"
|
23
|
+
gem.add_dependency "bootstrap_form", "~> 2.4"
|
24
|
+
gem.add_dependency "bootstrap-sass", "~> 3.3"
|
25
|
+
gem.add_dependency "coffee-rails", [">= 4.0", "< 6.0"]
|
26
|
+
gem.add_dependency "csv_builder", "~> 2.1"
|
27
|
+
gem.add_dependency "jquery-rails", [">= 3.0", "< 5.0"]
|
28
|
+
gem.add_dependency "momentjs-rails", "~> 2.8"
|
29
|
+
gem.add_dependency "rails", [">= 4.0", "< 6.0"]
|
30
|
+
gem.add_dependency "sass-rails", [">= 4.0", "< 6.0"]
|
31
|
+
gem.add_dependency "selectize-rails", "~> 0.12"
|
32
32
|
|
33
|
-
gem.add_development_dependency "
|
34
|
-
gem.add_development_dependency "
|
35
|
-
gem.add_development_dependency "
|
36
|
-
gem.add_development_dependency "minitest"
|
37
|
-
gem.add_development_dependency "
|
38
|
-
gem.add_development_dependency "
|
39
|
-
gem.add_development_dependency "
|
33
|
+
gem.add_development_dependency "appraisal", "~> 2.1"
|
34
|
+
gem.add_development_dependency "capybara", "~> 2.4"
|
35
|
+
gem.add_development_dependency "m", "~> 1.3"
|
36
|
+
gem.add_development_dependency "minitest-reporters", "~> 1.0"
|
37
|
+
gem.add_development_dependency "minitest", "~> 5.5"
|
38
|
+
gem.add_development_dependency "poltergeist", "~> 1.7"
|
39
|
+
gem.add_development_dependency "pry", "~> 0.10"
|
40
|
+
gem.add_development_dependency "sqlite3", "~> 1.3"
|
40
41
|
end
|
data/lib/godmin/authorization.rb
CHANGED
@@ -9,7 +9,7 @@ module Godmin
|
|
9
9
|
helper_method :policy
|
10
10
|
|
11
11
|
rescue_from NotAuthorizedError do
|
12
|
-
render
|
12
|
+
render plain: "You are not authorized to do this", status: 403, layout: "godmin/login"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -2,9 +2,16 @@ module Godmin
|
|
2
2
|
module Helpers
|
3
3
|
module Application
|
4
4
|
# Renders the provided partial with locals if it exists, otherwise
|
5
|
-
# yields the given block.
|
5
|
+
# yields the given block. The lookup context call is cached for
|
6
|
+
# each partial.
|
6
7
|
def partial_override(partial, locals = {})
|
7
|
-
|
8
|
+
@_partial_override ||= {}
|
9
|
+
|
10
|
+
if @_partial_override[partial].nil?
|
11
|
+
@_partial_override[partial] = lookup_context.exists?(partial, nil, true)
|
12
|
+
end
|
13
|
+
|
14
|
+
if @_partial_override[partial]
|
8
15
|
render partial: partial, locals: locals
|
9
16
|
else
|
10
17
|
yield
|
@@ -2,7 +2,7 @@ module Godmin
|
|
2
2
|
module Helpers
|
3
3
|
module BatchActions
|
4
4
|
def batch_action_link(name, options)
|
5
|
-
return unless
|
5
|
+
return unless @resource_service.include_batch_action?(name)
|
6
6
|
|
7
7
|
link_to(
|
8
8
|
translate_scoped("batch_actions.labels.#{name}", default: name.to_s.titleize),
|
@@ -16,14 +16,6 @@ module Godmin
|
|
16
16
|
}
|
17
17
|
)
|
18
18
|
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def include_batch_action_link?(options)
|
23
|
-
(options[:only].nil? && options[:except].nil?) ||
|
24
|
-
(options[:only] && options[:only].include?(@resource_service.scope.to_sym)) ||
|
25
|
-
(options[:except] && !options[:except].include?(@resource_service.scope.to_sym))
|
26
|
-
end
|
27
19
|
end
|
28
20
|
end
|
29
21
|
end
|