Skip to content

Commit

Permalink
Use our own objects and translations, add link to legacy promotions
Browse files Browse the repository at this point in the history
This commit isn't super clear cut but really small: It adds a link to
the top of the promotions index to the legacy Solidus promotions
overview, and it also switches out some of the uses of the legacy system
for our system.
  • Loading branch information
mamhoff committed Oct 5, 2023
1 parent c522cd6 commit e3fb85a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<% admin_breadcrumb(plural_resource_name(Spree::Promotion)) %>
<% admin_breadcrumb(plural_resource_name(SolidusFriendlyPromotions::Promotion)) %>

<% content_for :page_actions do %>
<% if can? :create, Spree::Promotion %>
<% if can? :create, SolidusFriendlyPromotions::Promotion %>
<li>
<%= link_to t('spree.new_promotion'), spree.new_admin_promotion_path, class: 'btn btn-primary' %>
<%= link_to t('solidus_friendly_promotions.new_promotion'), solidus_friendly_promotions.new_admin_promotion_path, class: 'btn btn-primary' %>
</li>
<li>
<%= link_to t('solidus_friendly_promotions.legacy_promotions'), spree.admin_promotions_path, class: 'btn btn-primary' %>
</li>
<% end %>
<% end %>
Expand Down Expand Up @@ -118,7 +121,7 @@
<% else %>
<div class="no-objects-found">
<%= render 'spree/admin/shared/no_objects_found',
resource: Spree::Promotion,
resource: SolidusFriendlyPromotions::Promotion,
new_resource_url: new_object_url %>
</div>
<% end %>
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ en:
new_promotion: New Promotion
new_promotion_category: New Promotion Category
new_promotion_code_batch: New Promotion Code Batch
legacy_promotions: Legacy Promotions
no_rules_addes: No Rules Added
promotion_successfully_created: Promotion has been successfully created!
promotion_total_changed_before_complete: One or more of the promotions on your order have become ineligible and were removed. Please check the new order amounts and try again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
}
expect(response).to be_redirect
expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
expect(response).to redirect_to solidus_friendly_promotions.edit_admin_promotion_path(promotion)
expect(promotion.actions.count).to eq(1)
end

Expand All @@ -24,7 +24,7 @@
promotion_action: {type: "Spree::InvalidType"}
}
expect(response).to be_redirect
expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
expect(response).to redirect_to solidus_friendly_promotions.edit_admin_promotion_path(promotion)
expect(promotion.actions.count).to eq(0)
end
end

0 comments on commit e3fb85a

Please sign in to comment.