effective_resources 1.4.5 → 1.4.6

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
  SHA256:
3
- metadata.gz: 571da9239743b31a993c4c7f3f4f12b298aaae57df08e032e045df1db52dea73
4
- data.tar.gz: 7999a8faebcdc0a9192bfb9a375386c803690a23af20376233665de05b09865c
3
+ metadata.gz: 7c4f700e19057fb28260220750481c0e31de2b9800b3620b4ec480deaf15814c
4
+ data.tar.gz: 2004bea3ba5a18301aef5fa315c35b6f3c3421559f9263734ca04c0e73587f0b
5
5
  SHA512:
6
- metadata.gz: 4d3851cc02705cf17afbad40ca397e420c62b2d5dcc29ee372cf8f7532e5e36ded201dae5b85a3f3bc4484bafb45dd2158d6dc0ce15cb44697af7fa03b105e5a
7
- data.tar.gz: eabc40a3e44b973ef323f409a4923710aa5e4ab23b28813ba3cc916c156f709f8f8d4f2f8743166b2f394b7c2561d1efe754145186daa549f48aad28878cdee8
6
+ metadata.gz: 1fa70e959c9286c9334765cce3f4070adcfbda17a749ae664c121819482fb22c14451dfa82a192979e74f166c2261e21e77e755e7ba1d4aa93b67f612a2022a7
7
+ data.tar.gz: 747e552fc23f61ff06467ab36cec1f67a8cb92e46859c3a7271036d7a6be0e8aa51dc1a4a30871c1ad62122841cd2ebdf84009eff1a1ab8f1246f228d2eda330
@@ -51,7 +51,7 @@ module Effective
51
51
  flash.now[:danger] ||= resource_flash(:danger, resource, action)
52
52
 
53
53
  respond_to do |format|
54
- case action.to_sym
54
+ case action_name.to_sym
55
55
  when :create
56
56
  format.html { render :new }
57
57
  when :update
@@ -61,24 +61,11 @@ module Effective
61
61
  redirect_flash
62
62
  redirect_to(resource_redirect_path(action))
63
63
  end
64
- else # member action
65
- from_path = referer_redirect_path.to_s
66
-
67
- format.html do
68
- if resource_edit_path && from_path.end_with?(resource_edit_path)
69
- @page_title ||= "Edit #{resource}"
70
- render :edit
71
- elsif resource_new_path && from_path.end_with?(resource_new_path)
72
- @page_title ||= "New #{resource_name.titleize}"
73
- render :new
74
- elsif resource_action_path(action) && from_path.end_with?(resource_action_path(action)) && template_present?(action)
75
- @page_title ||= "#{action.to_s.titleize} #{resource}"
76
- render(action, locals: { action: action })
77
- elsif resource_show_path && from_path.end_with?(resource_show_path)
78
- @page_title ||= resource_name.titleize
79
- render :show
80
- else
81
- @page_title ||= resource.to_s
64
+ else
65
+ if template_present?(action)
66
+ format.html { render(action, locals: { action: action }) }
67
+ else
68
+ format.html do
82
69
  redirect_flash
83
70
  redirect_to(from_path.presence || resource_redirect_path(action))
84
71
  end
@@ -92,6 +79,54 @@ module Effective
92
79
  end
93
80
  end
94
81
 
82
+ # def respond_with_error(resource, action)
83
+ # return if response.body.present?
84
+
85
+ # flash.delete(:success)
86
+ # flash.now[:danger] ||= resource_flash(:danger, resource, action)
87
+
88
+ # respond_to do |format|
89
+ # case action.to_sym
90
+ # when :create
91
+ # format.html { render :new }
92
+ # when :update
93
+ # format.html { render :edit }
94
+ # when :destroy
95
+ # format.html do
96
+ # redirect_flash
97
+ # redirect_to(resource_redirect_path(action))
98
+ # end
99
+ # else # member action
100
+ # from_path = referer_redirect_path.to_s
101
+
102
+ # format.html do
103
+ # if resource_edit_path && from_path.end_with?(resource_edit_path)
104
+ # @page_title ||= "Edit #{resource}"
105
+ # render :edit
106
+ # elsif resource_new_path && from_path.end_with?(resource_new_path)
107
+ # @page_title ||= "New #{resource_name.titleize}"
108
+ # render :new
109
+ # elsif resource_action_path(action) && from_path.end_with?(resource_action_path(action)) && template_present?(action)
110
+ # @page_title ||= "#{action.to_s.titleize} #{resource}"
111
+ # render(action, locals: { action: action })
112
+ # elsif resource_show_path && from_path.end_with?(resource_show_path)
113
+ # @page_title ||= resource_name.titleize
114
+ # render :show
115
+ # else
116
+ # @page_title ||= resource.to_s
117
+ # redirect_flash
118
+ # redirect_to(from_path.presence || resource_redirect_path(action))
119
+ # end
120
+ # end
121
+ # end
122
+
123
+ # format.js do
124
+ # view = template_present?(action) ? action : :member_action
125
+ # render(view, locals: { action: action }) # action.js.erb
126
+ # end
127
+ # end
128
+ # end
129
+
95
130
  private
96
131
 
97
132
  def redirect_flash
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.4.5'.freeze
2
+ VERSION = '1.4.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails