-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add promotion batch default action -
csv_export.
- Loading branch information
1 parent
26b1756
commit 7c538d2
Showing
5 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/models/spree/admin/actions/promotion_batch_default_actions_builder.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Spree | ||
module Admin | ||
module Actions | ||
class PromotionBatchDefaultActionsBuilder | ||
include Spree::Core::Engine.routes.url_helpers | ||
|
||
def build | ||
root = Root.new | ||
export_codes_to_csv_action(root) | ||
root | ||
end | ||
|
||
private | ||
|
||
def export_codes_to_csv_action(root) | ||
action = | ||
ActionBuilder.new('csv_export', ->(resource) { csv_export_admin_promotion_batch_path(resource) }). | ||
with_icon_key('download.svg'). | ||
with_style(::Spree::Admin::Actions::ActionStyle::PRIMARY). | ||
build | ||
|
||
root.add(action) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
<% content_for :page_title do %> | ||
<%= Spree.t(:promotion_batch) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% content_for :page_actions do %> | ||
<% promotion_batch_actions.items.each do |action| %> | ||
<% next unless action.available?(current_ability) %> | ||
<%= button_link_to( | ||
Spree.t(action.label_translation_key), | ||
action.url(@promotion_batch), | ||
class: action.classes, | ||
icon: action.icon_key | ||
) %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters