Merge pull request #8678 from Matt-Yorkley/dead-code-js-uri

Remove outdated jsUri
This commit is contained in:
Filipe
2022-01-24 13:15:02 +00:00
committed by GitHub
6 changed files with 20 additions and 26 deletions

View File

@@ -1,13 +1,10 @@
#= require jsuri
class window.Spree
# Helper function to take a URL and add query parameters to it
@url: (uri, query) ->
if uri.path == undefined
uri = new Uri(uri)
if query
$.each query, (key, value) ->
uri.addQueryParam(key, value)
@url: (uri) ->
if uri.pathname == undefined
uri = new URL(uri.toString())
if Spree.api_key
uri.addQueryParam('token', Spree.api_key)
params = new URLSearchParams(uri.search)
params.append('token', Spree.api_key)
return uri

View File

@@ -2,10 +2,9 @@ root = exports ? this
root.taxon_tree_menu = (obj, context) ->
base_url = Spree.url(Spree.routes.taxonomy_taxons_path)
admin_base_url = Spree.url(Spree.routes.admin_taxonomy_taxons_path)
edit_url = admin_base_url.clone()
edit_url.setPath(edit_url.path() + '/' + obj.attr("id") + "/edit");
base_url = Spree.url(Spree.routes.taxonomy_taxons)
admin_base_url = Spree.url(Spree.routes.admin_taxonomy_taxons)
edit_url = Spree.url(Spree.routes.admin_taxonomy_taxons + '/' + obj.attr("id") + "/edit");
create:
label: "<i class='icon-plus'></i> " + Spree.translations.add,

View File

@@ -9,7 +9,7 @@ handle_move = (e, data) ->
new_parent = data.rslt.np
url = Spree.url(base_url).clone()
url.setPath url.path() + '/' + node.attr("id")
url.pathname = url.pathname + '/' + node.attr("id")
$.ajax
type: "POST",
dataType: "json",
@@ -41,7 +41,7 @@ handle_rename = (e, data) ->
name = data.rslt.new_name
url = Spree.url(base_url).clone()
url.setPath(url.path() + '/' + node.attr("id"))
url.pathname = url.pathname + '/' + node.attr("id")
$.ajax
type: "POST",
@@ -70,10 +70,10 @@ root = exports ? this
root.setup_taxonomy_tree = (taxonomy_id) ->
if taxonomy_id != undefined
# this is defined within admin/taxonomies/edit
root.base_url = Spree.url(Spree.routes.taxonomy_taxons_path)
root.base_url = Spree.url(Spree.routes.taxonomy_taxons)
$.ajax
url: base_url.path().replace("/taxons", "/jstree"),
url: base_url.pathname.replace("/taxons", "/jstree"),
success: (taxonomy) ->
last_rollback = null
@@ -82,7 +82,7 @@ root.setup_taxonomy_tree = (taxonomy_id) ->
data: taxonomy,
ajax:
url: (e) ->
base_url.path() + '/' + e.attr('id') + '/jstree'
base_url.pathname + '/' + e.attr('id') + '/jstree'
themes:
theme: "apple",
url: "/assets/jquery.jstree/themes/apple/style.css"