itsf_backend 3.0.7 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71eed6cfcc268ef5f460a907df0b286818fec094
4
- data.tar.gz: df4a8a6d20297456495afb0073ee8da1897d6971
3
+ metadata.gz: 7dba7df55da3a16d726325289495274aaaa991f6
4
+ data.tar.gz: cd5b43538b9080d8b761df1a3959ccb8437501b2
5
5
  SHA512:
6
- metadata.gz: ee2b2f614bea5f33d04f5e760f063b4b6d08500c339a420cfb2d8ea3af53ec64c74cc3120860be2ead7cf7bde58b154e109318f5c6d00d5a0206ecc23f60e2fb
7
- data.tar.gz: b467607742f446bd68692d33cddfb7f9c3f0e60ffb180ba5894d4c4b98f0ec309717d09945e3d0efcbfe3583ad4d03ab675b68758f758c362cab9d8ea81072fa
6
+ metadata.gz: b24be68819b940e891f24b8b13fc629c4bf87aeea222121216274a03d5744bc5d74c78ce8f752756c40315abaefcecaf25e0aae28ebfad2b46b6670a95cd814a
7
+ data.tar.gz: 85f12a5f32d79b7528629f6185a50e95d72f2cb2b9be2dca096f2105dea607604f0f85b5a2f825da8fbe50a426fae735cbc275aa64b3d722478d8721576b299c
@@ -0,0 +1,11 @@
1
+ module Controller
2
+ module FriendlyIdConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ private
6
+
7
+ def load_scope
8
+ resource_class.friendly
9
+ end
10
+ end
11
+ end
@@ -62,7 +62,7 @@ module Controller
62
62
  private
63
63
 
64
64
  def after_create_location
65
- collection_path
65
+ @resource
66
66
  end
67
67
 
68
68
  def after_destroy_location
@@ -70,7 +70,7 @@ module Controller
70
70
  end
71
71
 
72
72
  def after_update_location
73
- collection_path
73
+ @resource
74
74
  end
75
75
 
76
76
  def authorize_action
@@ -91,21 +91,49 @@ module Controller
91
91
  final_scope
92
92
  end
93
93
 
94
- def collection_scope
94
+ def search_scopes
95
+ return [] unless params.key?(:q) && params[:q].key?(:scopes)
96
+ params[:q][:scopes].keys - ['unscoped']
97
+ end
98
+
99
+ def base_scope
95
100
  resource_class
96
101
  end
97
102
 
103
+ def after_create_location
104
+ collection_path
105
+ end
106
+
107
+ def after_destroy_location
108
+ collection_path
109
+ end
110
+
111
+ def after_update_location
112
+ collection_path
113
+ end
114
+
115
+ def collection_scope
116
+ base_scope
117
+ end
118
+
119
+ def initialize_scope
120
+ base_scope
121
+ end
122
+
98
123
  def initialize_resource
99
- resource_class.new
124
+ initialize_scope.new
100
125
  end
101
126
 
102
- def load_resource
103
- resource_class.find(params[:id])
127
+ def load_collection
128
+ collection_scope.all
104
129
  end
105
130
 
106
- def search_scopes
107
- return [] unless params.key?(:q) && params[:q].key?(:scopes)
108
- params[:q][:scopes].keys - ['unscoped']
131
+ def load_scope
132
+ base_scope
133
+ end
134
+
135
+ def load_resource
136
+ load_scope.find(params[:id])
109
137
  end
110
138
  end
111
139
  end
@@ -47,13 +47,13 @@ module Itsf::Backend
47
47
  def after_create_location
48
48
  return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit)
49
49
  return new_resource_path if params.has_key?(:commit_and_continue_with_new)
50
- collection_path
50
+ @resource
51
51
  end
52
52
 
53
53
  def after_update_location
54
54
  return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit)
55
55
  return new_resource_path if params.has_key?(:commit_and_continue_with_new)
56
- collection_path
56
+ @resource
57
57
  end
58
58
  end
59
59
  end
@@ -1,5 +1,5 @@
1
1
  module Itsf
2
2
  module Backend
3
- VERSION = '3.0.7'
3
+ VERSION = '3.1.0'
4
4
  end
5
5
  end
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: 3.0.7
4
+ version: 3.1.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: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -506,6 +506,7 @@ files:
506
506
  - app/controllers/concerns/controller/awesome_nested_set_concern.rb
507
507
  - app/controllers/concerns/controller/collection_links_concern.rb
508
508
  - app/controllers/concerns/controller/feature_flags_concern.rb
509
+ - app/controllers/concerns/controller/friendly_id_concern.rb
509
510
  - app/controllers/concerns/controller/pagination_concern.rb
510
511
  - app/controllers/concerns/controller/pundit_authorization_failure_handling_concern.rb
511
512
  - app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb