Skip to content

Commit

Permalink
Include URL helpers for easier customization for controllers and memb…
Browse files Browse the repository at this point in the history
…er actions
  • Loading branch information
excid3 committed Oct 29, 2024
1 parent 12529ce commit 8255806
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### Unreleased

### 2.0.0

- Remove Tailwind CDN
- Add styles through asset pipeline
- Refactor JavaScript into an Import map (separate from the Rails app)

### 1.2.10

- Fix compatibility with Pagy 8.x
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/madmin/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Madmin
class ApplicationController < Madmin::BaseController
include Rails.application.routes.url_helpers

before_action :authenticate_admin_user

def authenticate_admin_user
Expand Down
1 change: 1 addition & 0 deletions app/helpers/madmin/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Madmin
module ApplicationHelper
include Pagy::Frontend
include Rails.application.routes.url_helpers

def clear_search_params
resource.index_path(sort: params[:sort], direction: params[:direction])
Expand Down
2 changes: 1 addition & 1 deletion app/views/madmin/application/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="actions">
<% resource.member_actions.each do |action| %>
<%= instance_eval(&action) %>
<%= instance_exec(@record, &action) %>
<% end %>
<%= link_to "Edit", resource.edit_path(@record), class: "btn btn-secondary" %>
<%= button_to "Delete", resource.show_path(@record), method: :delete, data: { turbo_confirm: "Are you sure?" }, class: "btn btn-danger" %>
Expand Down

0 comments on commit 8255806

Please sign in to comment.