itsf_backend 2.2.1 → 3.0.0
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/app/assets/javascripts/itsf/backend/application.js +1 -0
- data/app/assets/javascripts/itsf/backend/application/ui_autocomplete.js.coffee +15 -15
- data/app/concerns/routing/itsf_backend_resource_concern.rb +34 -0
- data/app/controllers/concerns/controller/collection_links_concern.rb +15 -0
- data/app/controllers/concerns/controller/resource_links_concern.rb +26 -0
- data/app/controllers/itsf/backend/resource/base_controller.rb +6 -0
- data/app/controllers/itsf/backend/service/base_controller.rb +1 -0
- data/app/policies/itsf/backend/engine_policy.rb +2 -2
- data/app/views/itsf/backend/resource/base/_additional_collection_tabs.html.haml +0 -0
- data/app/views/itsf/backend/resource/base/_additional_resource_tabs.html.haml +0 -0
- data/app/views/itsf/backend/resource/base/_collection_pages_navigation.html.haml +10 -0
- data/app/views/itsf/backend/resource/base/_form.html.haml +1 -1
- data/app/views/itsf/backend/resource/base/_resource_pages_navigation.haml +10 -0
- data/app/views/itsf/backend/resource/base/_show_extra_actions.html.haml +25 -0
- data/app/views/itsf/backend/resource/base/index.html.haml +10 -4
- data/app/views/itsf/backend/resource/base/show.html.haml +5 -0
- data/app/views/layouts/itsf/backend/_vertical_navigation.haml +1 -1
- data/config/initializers/extend_action_dispatch_routing_mapper.rb +1 -0
- data/config/locales/de.yml +2 -0
- data/lib/itsf/backend/configuration.rb +3 -0
- data/lib/itsf/backend/features.rb +2 -1
- data/lib/itsf/backend/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b47d47f7ec14b4bb2f5fe787602a69a0c9286949
|
4
|
+
data.tar.gz: e04584cf360c901603f0168fb839c12ba5ac3a73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c00692d6a894a14e54a64753b3b79278b75fff021f41ab3768097348f405b51194a629daae2add53dca337d6d21b960cfcf5852ce3fe201ad494822e8a594a1b
|
7
|
+
data.tar.gz: 2e57fdf91245162efda51d802d72153f8cf7502c33f0e97f6c3f8fa43f2d31716468b0485842eed938589e52e495a241048e5a426c9961e2cd7a88dae89925f2
|
@@ -1,16 +1,16 @@
|
|
1
|
-
$ ->
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
$(document).on 'turbolinks:load', ->
|
2
|
+
$('.ui-autocomplete-input').each ->
|
3
|
+
element = $(this)
|
4
|
+
target = $(this).attr('data-source-url')
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
element.autocomplete
|
7
|
+
source: target
|
8
|
+
minLength: 2
|
9
|
+
html: true
|
10
|
+
open: (event, ui) ->
|
11
|
+
$('.ui-autocomplete').css 'z-index', 1000
|
12
|
+
return
|
13
|
+
create: ->
|
14
|
+
$(this).data('ui-autocomplete')._renderItem = (ul, item) ->
|
15
|
+
$("<li>").append("<span>" + item.title + "<br><small>" + item.subtitle + "</small></span>").appendTo ul
|
16
|
+
return
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Routing
|
2
|
+
module ItsfBackendResourceConcern
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
# Using this method instead of resources, adds member routes for pages added in the
|
5
|
+
# itsf_backend configuration.
|
6
|
+
#
|
7
|
+
def backend_resources(*args, &block)
|
8
|
+
resources(*args, &block)
|
9
|
+
|
10
|
+
# additional_member_actions = (Itsf::Backend::Configuration.default_resource_pages - [:show])
|
11
|
+
|
12
|
+
# if additional_member_actions.any?
|
13
|
+
# resources_name = args.first
|
14
|
+
# resources resources_name, only: [] do
|
15
|
+
# member do
|
16
|
+
# additional_member_actions.each do |action|
|
17
|
+
# get action
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
|
23
|
+
additional_resource_route_blocks = Itsf::Backend::Configuration.additional_resource_route_blocks
|
24
|
+
if additional_resource_route_blocks.any?
|
25
|
+
resources_name = args.first
|
26
|
+
additional_resource_route_blocks.each do |route_block|
|
27
|
+
resources resources_name, only: [] do
|
28
|
+
route_block.call(self)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Controller
|
2
|
+
module ResourceLinksConcern
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
# included do
|
6
|
+
# helper_method :resource_pages
|
7
|
+
# end
|
8
|
+
|
9
|
+
# private
|
10
|
+
|
11
|
+
# def resource_pages
|
12
|
+
# # Itsf::Backend::Configuration.default_resource_pages +
|
13
|
+
# Itsf::Backend::Configuration.resource_pages.map { |arp| arp.respond_to?(:call) ? arp.call(self) : arp.to_sym }.compact
|
14
|
+
# end
|
15
|
+
|
16
|
+
included do
|
17
|
+
helper_method :resource_links
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def resource_links
|
23
|
+
Itsf::Backend.resource_links
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -18,6 +18,8 @@ module Itsf::Backend
|
|
18
18
|
include Controller::PaginationConcern if Itsf::Backend.features?(:kaminari)
|
19
19
|
include Controller::JsonApiConcern
|
20
20
|
include Controller::FeatureFlagsConcern
|
21
|
+
include Controller::ResourceLinksConcern
|
22
|
+
include Controller::CollectionLinksConcern
|
21
23
|
helper Itsf::Backend::ApplicationHelper
|
22
24
|
helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
|
23
25
|
|
@@ -31,6 +33,10 @@ module Itsf::Backend
|
|
31
33
|
name.gsub('Controller', '').singularize.constantize
|
32
34
|
end
|
33
35
|
|
36
|
+
def self.resource_count
|
37
|
+
resource_class.count
|
38
|
+
end
|
39
|
+
|
34
40
|
def resource_class
|
35
41
|
self.class.resource_class
|
36
42
|
end
|
@@ -13,6 +13,7 @@ module Itsf::Backend
|
|
13
13
|
include Controller::ServiceUrlsConcern
|
14
14
|
include Controller::ServiceActionsConcern
|
15
15
|
include Controller::JsonApiConcern
|
16
|
+
include Controller::FeatureFlagsConcern
|
16
17
|
helper Itsf::Backend::ApplicationHelper
|
17
18
|
|
18
19
|
layout 'itsf/backend/base'
|
@@ -5,9 +5,9 @@ module Itsf::Backend
|
|
5
5
|
allowed = user.respond_to?(:allowed_to?) ? user.allowed_to?(permission_identifier) : false
|
6
6
|
|
7
7
|
if allowed
|
8
|
-
Rails.logger.debug "User #{user} is allowed to access #{permission_identifier}"
|
8
|
+
Rails.logger.debug "User #{user.try_all(*Itsf::Backend.resource_title_methods)} is allowed to access #{permission_identifier}"
|
9
9
|
else
|
10
|
-
Rails.logger.debug "User #{user} is not allowed to access #{permission_identifier}"
|
10
|
+
Rails.logger.debug "User #{user.try_all(*Itsf::Backend.resource_title_methods)} is not allowed to access #{permission_identifier}"
|
11
11
|
end
|
12
12
|
allowed
|
13
13
|
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
%ul.nav.nav-tabs
|
2
|
+
- collection_links.each do |collection_link|
|
3
|
+
- if collection_link[:condition].call(self)
|
4
|
+
- if current_page? collection_link[:target].call(self)
|
5
|
+
%li.active{ role: :presentation }
|
6
|
+
= collection_link[:link_to].call(self)
|
7
|
+
- else
|
8
|
+
%li{ role: :presentation }
|
9
|
+
= collection_link[:link_to].call(self)
|
10
|
+
= render 'additional_collection_tabs', collection: collection
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- resource_class.attribute_names.delete_if { |name| Itsf::Backend.hidden_attributes_for[:edit].include?(name.to_sym) }.each do |name|
|
2
|
-
- if form.object.class.columns_hash[name].type == :hstore
|
2
|
+
- if form.object.class.columns_hash[name].try(:type) == :hstore
|
3
3
|
= simple_fields_for name do |hstore_form|
|
4
4
|
- if form.object.send(name).respond_to?(:each)
|
5
5
|
- form.object.send(name).each do |key, value|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
%ul.nav.nav-tabs
|
2
|
+
- resource_links.each do |resource_link|
|
3
|
+
- if resource_link[:condition].call(self)
|
4
|
+
- if current_page? resource_link[:target].call(self)
|
5
|
+
%li.active{ role: :presentation }
|
6
|
+
= resource_link[:link_to].call(self)
|
7
|
+
- else
|
8
|
+
%li{ role: :presentation }
|
9
|
+
= resource_link[:link_to].call(self)
|
10
|
+
= render 'additional_resource_tabs', resource: resource
|
@@ -0,0 +1,25 @@
|
|
1
|
+
- if features?(:audited)
|
2
|
+
.well.well-sm
|
3
|
+
- if @resource.version.nil?
|
4
|
+
- previous_version = @resource.audits.last.try(:version)
|
5
|
+
- next_version = nil
|
6
|
+
- else
|
7
|
+
- previous_version = @resource.version > 0 ? @resource.version - 1 : nil
|
8
|
+
- next_version = @resource.version < @resource.audits.count ? @resource.version + 1 : nil
|
9
|
+
|
10
|
+
|
11
|
+
- if previous_version
|
12
|
+
= link_to(url_for(action: 'version', version: previous_version), class: 'btn btn-primary btn-responsive') do
|
13
|
+
%span.glyphicon.glyphicon-chevron-left
|
14
|
+
%span.btn-text= t('.previous')
|
15
|
+
|
16
|
+
.pull-right
|
17
|
+
- if next_version
|
18
|
+
= link_to(url_for(action: 'version', version: next_version), class: 'btn btn-primary btn-responsive') do
|
19
|
+
%span.glyphicon.glyphicon-chevron-right
|
20
|
+
%span.btn-text= t('.next')
|
21
|
+
|
22
|
+
- if @resource.version == @resource.audits.count
|
23
|
+
= link_to(url_for(action: :show), class: 'btn btn-primary btn-responsive') do
|
24
|
+
%span.btn-text= t('.actual')
|
25
|
+
%span.glyphicon.glyphicon-chevron-right
|
@@ -14,11 +14,15 @@
|
|
14
14
|
%span.btn-text= t('.new', inflections)
|
15
15
|
- rescue ActionController::UrlGenerationError
|
16
16
|
|
17
|
+
#collection-pages-naviation.bottom-margin-1
|
18
|
+
= render 'collection_pages_navigation', collection: @collection
|
19
|
+
|
17
20
|
.panel.panel-default.panel-with-actions
|
18
|
-
-
|
19
|
-
.
|
20
|
-
|
21
|
+
.panel-heading
|
22
|
+
.pull-right.form-inline
|
23
|
+
- if features?(:kaminari)
|
21
24
|
= select_tag(:per_page, options_for_select({ '1': 1, '5': 5, '10': 10, '15': 15, '20': 20, '50': 50, '100': 100, t('.all') => 'all' }, (params[:per_page] || Itsf::Backend::Configuration.default_pagination_size)), 'data-select-pagination-size': true, id: 'pagination-size', class: 'form-control input-xs')
|
25
|
+
- if features?(:dragtable)
|
22
26
|
= button_tag(t('.reset_column_order'), class: 'btn btn-default btn-xs', data: { 'reset-column-order': true})
|
23
27
|
- if features?(:ransack)
|
24
28
|
.panel-body
|
@@ -36,7 +40,9 @@
|
|
36
40
|
= f.submit
|
37
41
|
|
38
42
|
.table-responsive
|
39
|
-
=
|
43
|
+
- table_classes = %w(table table-responsive table-condensed table-striped table-hover)
|
44
|
+
- table_classes << 'dragtable' if features?(:dragtable)
|
45
|
+
= render_collection(@collection, resource_class, as: :bootstrap_table, table_html_options: { class: table_classes.join(" ") }) do |table|
|
40
46
|
= render 'table', table: table
|
41
47
|
= render 'table_actions', table: table
|
42
48
|
|
@@ -1,5 +1,8 @@
|
|
1
1
|
%p#notice= notice
|
2
2
|
|
3
|
+
#resource-pages-naviation.bottom-margin-1
|
4
|
+
= render 'resource_pages_navigation', resource: @resource
|
5
|
+
|
3
6
|
#page-title.bottom-margin-1
|
4
7
|
.row
|
5
8
|
.col-xs-8
|
@@ -11,6 +14,8 @@
|
|
11
14
|
%span.glyphicon.glyphicon-fire
|
12
15
|
%span.btn-text= t('.destroy')
|
13
16
|
|
17
|
+
= render 'show_extra_actions', resource: @resource
|
18
|
+
|
14
19
|
.panel.panel-default.panel-with-actions
|
15
20
|
%table.table.table-striped.table-condensed.table-hover
|
16
21
|
= render_resource(@resource, as: :bootstrap_attribute_table) do |table|
|
@@ -17,5 +17,5 @@
|
|
17
17
|
- if !Itsf::Backend.features?(:pundit) || policy(resource_klass).index?
|
18
18
|
= link_to(send(engine.engine_name).url_for(controller: "/#{kontroller.controller_path}"), class: 'list-group-item') do
|
19
19
|
= resource_klass.model_name.human(count: :other)
|
20
|
-
%span.badge.badge-default=
|
20
|
+
%span.badge.badge-default= kontroller.resource_count.respond_to?(:call) ? instance_exec(&kontroller.resource_count) : kontroller.resource_count
|
21
21
|
|
@@ -0,0 +1 @@
|
|
1
|
+
ActionDispatch::Routing::Mapper.send(:include, Routing::ItsfBackendResourceConcern)
|
data/config/locales/de.yml
CHANGED
@@ -21,6 +21,9 @@ module Itsf
|
|
21
21
|
{ index: [], show: [], edit: [] }
|
22
22
|
end
|
23
23
|
mattr_accessor(:default_pagination_size) { 15 }
|
24
|
+
mattr_accessor(:resource_links) { [] }
|
25
|
+
mattr_accessor(:collection_links) { [] }
|
26
|
+
mattr_accessor(:additional_resource_route_blocks) { [] }
|
24
27
|
|
25
28
|
def registered_controllers
|
26
29
|
backend_engines.call.collect do |engine|
|
@@ -6,7 +6,8 @@ module Itsf
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def features?(name)
|
9
|
-
Gem::Specification.find_all_by_name(name.to_s).any? && Itsf::Backend::Configuration.enabled_features.include?(name)
|
9
|
+
# Gem::Specification.find_all_by_name(name.to_s).any? && Itsf::Backend::Configuration.enabled_features.include?(name)
|
10
|
+
Itsf::Backend::Configuration.enabled_features.include?(name)
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
data/lib/itsf/backend/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itsf_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -500,15 +500,18 @@ files:
|
|
500
500
|
- app/assets/stylesheets/itsf_backend.css
|
501
501
|
- app/concerns/enumerable/acts_as_paginatable_resource_concern.rb
|
502
502
|
- app/concerns/enumerable/acts_as_resource_concern.rb
|
503
|
+
- app/concerns/routing/itsf_backend_resource_concern.rb
|
503
504
|
- app/concerns/routing/service_concern.rb
|
504
505
|
- app/controllers/concerns/controller/acts_as_list_concern.rb
|
505
506
|
- app/controllers/concerns/controller/acts_as_published_concern.rb
|
506
507
|
- app/controllers/concerns/controller/awesome_nested_set_concern.rb
|
508
|
+
- app/controllers/concerns/controller/collection_links_concern.rb
|
507
509
|
- app/controllers/concerns/controller/feature_flags_concern.rb
|
508
510
|
- app/controllers/concerns/controller/pagination_concern.rb
|
509
511
|
- app/controllers/concerns/controller/pundit_authorization_failure_handling_concern.rb
|
510
512
|
- app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
|
511
513
|
- app/controllers/concerns/controller/ransack_concern.rb
|
514
|
+
- app/controllers/concerns/controller/resource_links_concern.rb
|
512
515
|
- app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb
|
513
516
|
- app/controllers/itsf/backend/application_controller.rb
|
514
517
|
- app/controllers/itsf/backend/dashboard_controller.rb
|
@@ -547,14 +550,19 @@ files:
|
|
547
550
|
- app/views/itsf/backend/home/_index_extras.html.haml
|
548
551
|
- app/views/itsf/backend/home/index.html.haml
|
549
552
|
- app/views/itsf/backend/i18n/_navigation.html.haml
|
553
|
+
- app/views/itsf/backend/resource/base/_additional_collection_tabs.html.haml
|
554
|
+
- app/views/itsf/backend/resource/base/_additional_resource_tabs.html.haml
|
555
|
+
- app/views/itsf/backend/resource/base/_collection_pages_navigation.html.haml
|
550
556
|
- app/views/itsf/backend/resource/base/_form.html.haml
|
551
557
|
- app/views/itsf/backend/resource/base/_form_buttons.haml
|
552
558
|
- app/views/itsf/backend/resource/base/_form_errors.html.haml
|
553
559
|
- app/views/itsf/backend/resource/base/_head_extras.html.haml
|
554
560
|
- app/views/itsf/backend/resource/base/_index_extras.html.haml
|
561
|
+
- app/views/itsf/backend/resource/base/_resource_pages_navigation.haml
|
555
562
|
- app/views/itsf/backend/resource/base/_scopes.html.haml
|
556
563
|
- app/views/itsf/backend/resource/base/_search.html.haml
|
557
564
|
- app/views/itsf/backend/resource/base/_show.html.haml
|
565
|
+
- app/views/itsf/backend/resource/base/_show_extra_actions.html.haml
|
558
566
|
- app/views/itsf/backend/resource/base/_show_extras.html.haml
|
559
567
|
- app/views/itsf/backend/resource/base/_table.html.haml
|
560
568
|
- app/views/itsf/backend/resource/base/_table_actions.html.haml
|
@@ -580,6 +588,7 @@ files:
|
|
580
588
|
- app/views/layouts/itsf/backend/_vertical_navigation.haml
|
581
589
|
- app/views/layouts/itsf/backend/base.html.haml
|
582
590
|
- config/initializers/assets.rb
|
591
|
+
- config/initializers/extend_action_dispatch_routing_mapper.rb
|
583
592
|
- config/initializers/extend_object.rb
|
584
593
|
- config/initializers/extend_ransack_form_builder.rb
|
585
594
|
- config/initializers/extend_simple_form_form_builder.rb
|