quick_admin 0.1.5 → 0.1.7

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: 63bdba520fa5bce41ca4dce1e5b4a8d20c3287d06b41b9d05e013ab36e7738e5
4
- data.tar.gz: d076140889f8f98d75bb19e5b7ba922e8c4ed07f542287982096b5b738d95fb2
3
+ metadata.gz: f5ccce0d8b771909d9fa6ebc569572c4c0fe9ac8e0224a1b42b07037315cd906
4
+ data.tar.gz: 4e278527a52d3f624c7ea56b9dc5ee405b6f908c2eb0b9aa6d54752445553be8
5
5
  SHA512:
6
- metadata.gz: 5c33376a983c0e6be53b301902d90237383976a29ccd209d731ad7e1598ed11ef441e0017c04d957eb0aba51c62873bba9f1c28d2564e790b85386c7f85c3041
7
- data.tar.gz: 672e6998f1aa925e6fc49ce67c83d747458fe002e62172685f76e669dc8cc1f3b479d93ce19f8ae746c7931d84db4942849b4d537cc926c87a3c77a0ce650fba
6
+ metadata.gz: 3798f45da60ce5ac20b420e1cc3981fe5a4a488378534de162d48054f3f51a937fea2bbb56010f016b0c3dc064422c9eff95a527c388e8b5ee8004167eab89e7
7
+ data.tar.gz: 709d9d50121ac45c3038315ec46a7dc247957b215f1a3d46308fee98659391c292919caebb49740acf1611d4566ee9ea33fff8d7676b067bd72b5e3fe99560c9
@@ -110,15 +110,25 @@ body {
110
110
  white-space: nowrap;
111
111
  }
112
112
 
113
- .sign-out-link {
113
+ .sign-out-form {
114
+ margin: 0;
115
+ padding: 0;
116
+ }
117
+
118
+ .sign-out-btn {
119
+ background: none;
120
+ border: none;
114
121
  color: rgba(255,255,255,0.8);
115
122
  text-decoration: none;
116
123
  padding: 0.5rem 0;
117
124
  display: block;
118
125
  font-size: 0.9rem;
126
+ cursor: pointer;
127
+ width: 100%;
128
+ text-align: left;
119
129
  }
120
130
 
121
- .sign-out-link:hover {
131
+ .sign-out-btn:hover {
122
132
  color: var(--danger-color);
123
133
  }
124
134
 
@@ -227,11 +227,23 @@ module QuickAdmin
227
227
  # Returns the sign out path if available.
228
228
  # @return [String, nil] the sign out path or nil
229
229
  def quick_admin_sign_out_path
230
- path = QuickAdmin.config.resolved_sign_out_path
231
- return path if path.is_a?(String)
230
+ # First check explicit configuration
231
+ configured_path = QuickAdmin.config.sign_out_path
232
+ return configured_path if configured_path.present?
232
233
 
233
- # If it's a proc, call it
234
- path.respond_to?(:call) ? path.call : nil
234
+ # Try to use Rails route helpers (more reliable than string paths)
235
+ if defined?(Devise)
236
+ begin
237
+ # Try destroy_admin_session_path first
238
+ return main_app.destroy_admin_session_path if main_app.respond_to?(:destroy_admin_session_path)
239
+ # Fall back to destroy_user_session_path
240
+ return main_app.destroy_user_session_path if main_app.respond_to?(:destroy_user_session_path)
241
+ rescue => e
242
+ Rails.logger.debug "QuickAdmin: Could not resolve sign out path: #{e.message}"
243
+ end
244
+ end
245
+
246
+ nil
235
247
  end
236
248
  end
237
249
  end
@@ -32,10 +32,10 @@
32
32
  </div>
33
33
  <% end %>
34
34
  <% if quick_admin_sign_out_path %>
35
- <%= link_to "Sign Out", quick_admin_sign_out_path,
36
- method: QuickAdmin.config.sign_out_method,
37
- data: { turbo_method: QuickAdmin.config.sign_out_method },
38
- class: "nav-link sign-out-link" %>
35
+ <%= button_to "Sign Out", quick_admin_sign_out_path,
36
+ method: QuickAdmin.config.sign_out_method,
37
+ class: "sign-out-btn",
38
+ form_class: "sign-out-form" %>
39
39
  <% end %>
40
40
  </div>
41
41
  </nav>
@@ -3,10 +3,12 @@
3
3
  resource_name_param = defined?(resource_name) ? resource_name : @resource_config.model_name
4
4
  # Get the correct param value for URLs (uses configured find_by_field)
5
5
  param_value = resource_param_value(resource)
6
+ # Preserve current page for after save
7
+ current_page = params[:page] || 1
6
8
  %>
7
9
 
8
10
  <%= form_with model: [QuickAdmin::Engine, resource_name_param.singularize.to_sym, resource],
9
- url: resource.persisted? ? quick_admin.resource_path(resource_name_param, param_value) : quick_admin.resources_path(resource_name_param),
11
+ url: resource.persisted? ? quick_admin.resource_path(resource_name_param, param_value, page: current_page) : quick_admin.resources_path(resource_name_param, page: current_page),
10
12
  method: resource.persisted? ? :patch : :post,
11
13
  local: false,
12
14
  class: "resource-form" do |form| %>
@@ -3,6 +3,8 @@
3
3
  resource_name_param = defined?(resource_name) ? resource_name : params[:resource_name]
4
4
  # Get the correct param value for URLs (uses configured find_by_field)
5
5
  param_value = resource_param_value(resource)
6
+ # Preserve current page
7
+ current_page = params[:page] || 1
6
8
  %>
7
9
 
8
10
  <tr class="resource-row" id="resource_<%= resource.id %>">
@@ -16,13 +18,13 @@
16
18
  </td>
17
19
  <% end %>
18
20
  <td class="actions">
19
- <%= link_to "View", quick_admin.resource_path(resource_name_param, param_value),
21
+ <%= link_to "View", quick_admin.resource_path(resource_name_param, param_value, page: current_page),
20
22
  class: "btn btn-sm btn-info",
21
23
  data: { turbo_frame: "modal" } %>
22
- <%= link_to "Edit", quick_admin.edit_resource_path(resource_name_param, param_value),
24
+ <%= link_to "Edit", quick_admin.edit_resource_path(resource_name_param, param_value, page: current_page),
23
25
  class: "btn btn-sm btn-warning",
24
26
  data: { turbo_frame: "modal" } %>
25
- <%= link_to "Delete", quick_admin.resource_path(resource_name_param, param_value),
27
+ <%= link_to "Delete", quick_admin.resource_path(resource_name_param, param_value, page: current_page),
26
28
  class: "btn btn-sm btn-danger",
27
29
  data: {
28
30
  turbo_method: :delete,
@@ -20,10 +20,11 @@
20
20
 
21
21
  <div class="detail-actions">
22
22
  <% param_value = resource_param_value(@resource) %>
23
- <%= link_to "Edit", quick_admin.edit_resource_path(resource_name, param_value),
23
+ <% current_page = params[:page] || 1 %>
24
+ <%= link_to "Edit", quick_admin.edit_resource_path(resource_name, param_value, page: current_page),
24
25
  class: "btn btn-warning",
25
26
  data: { turbo_frame: "modal" } %>
26
- <%= button_to "Delete", quick_admin.resource_path(resource_name, param_value),
27
+ <%= button_to "Delete", quick_admin.resource_path(resource_name, param_value, page: current_page),
27
28
  method: :delete,
28
29
  class: "btn btn-danger",
29
30
  form_class: "inline-form",
@@ -1,3 +1,3 @@
1
1
  module QuickAdmin
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quick_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nezir Zahirovic