mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
Merge pull request #9109 from apricot12/8917-Link-to-enterprise-site
Adding a link to enterprise's own site from Order confirmation page.
This commit is contained in:
@@ -29,6 +29,7 @@ class ApplicationController < ActionController::Base
|
||||
helper 'footer_links'
|
||||
helper 'discourse'
|
||||
helper 'checkout'
|
||||
helper 'link'
|
||||
helper 'terms_and_conditions'
|
||||
|
||||
protect_from_forgery
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module GroupsHelper
|
||||
module LinkHelper
|
||||
def link_to_service(baseurl, name, html_options = {}, &block)
|
||||
return if name.blank?
|
||||
|
||||
@@ -15,8 +15,4 @@ module GroupsHelper
|
||||
prefix + url
|
||||
end
|
||||
end
|
||||
|
||||
def strip_url(url)
|
||||
url&.sub(%r{^https?://}i, '')
|
||||
end
|
||||
end
|
||||
@@ -1,16 +1,21 @@
|
||||
.row
|
||||
.columns.small-12.medium-3
|
||||
.columns.small-12.medium-5
|
||||
- if current_order.nil? || current_order.distributor.nil? || current_order.distributor == @order.distributor
|
||||
- if current_order&.line_items.present?
|
||||
= link_to main_app.cart_path, :class => "button expand" do
|
||||
= t(:order_back_to_cart)
|
||||
- else
|
||||
= link_to "#{main_app.enterprise_shop_path(@order.distributor)}#/shop", class: "button expand" do
|
||||
= t(:order_back_to_store)
|
||||
.columns.small-12.medium-6
|
||||
= link_to "#{main_app.enterprise_shop_path(@order.distributor)}#/shop", class: "button expand" do
|
||||
= t(:order_back_to_store)
|
||||
.columns.small-12.medium-6
|
||||
- if @order.distributor.website.present?
|
||||
= link_to_service "https://", current_order.distributor.website, class: "button expand" do
|
||||
= t(:order_back_to_website)
|
||||
- else
|
||||
|
||||
- if order.changes_allowed?
|
||||
.columns.show-for-medium-up.medium-3
|
||||
.columns.show-for-medium-up.medium-1
|
||||
.columns.small-12.medium-3
|
||||
= link_to main_app.cancel_order_path(@order), method: :put, class: "button secondary expand", "data-confirm": t('orders_confirm_cancel') do
|
||||
%i.ofn-i_009-close
|
||||
|
||||
@@ -1901,6 +1901,7 @@ en:
|
||||
order_hub_info: Hub Info
|
||||
order_back_to_store: Back To Store
|
||||
order_back_to_cart: Back To Cart
|
||||
order_back_to_website: Back To Website
|
||||
|
||||
bom_tip: "Use this page to alter product quantities across multiple orders. Products may also be removed from orders entirely, if required."
|
||||
|
||||
|
||||
@@ -2,18 +2,11 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe GroupsHelper, type: :helper do
|
||||
describe LinkHelper, type: :helper do
|
||||
describe "ext_url" do
|
||||
it "adds prefix if missing" do
|
||||
expect(helper.ext_url("http://example.com/", "http://example.com/bla")).to eq("http://example.com/bla")
|
||||
expect(helper.ext_url("http://example.com/", "bla")).to eq("http://example.com/bla")
|
||||
end
|
||||
end
|
||||
describe "strip_url" do
|
||||
it "removes http(s)://" do
|
||||
expect(helper.strip_url("http://example.com/")).to eq("example.com/")
|
||||
expect(helper.strip_url("https://example.com/")).to eq("example.com/")
|
||||
expect(helper.strip_url("example.com")).to eq("example.com")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user