Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
coffee
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
coffee
Commits
43c29872
Commit
43c29872
authored
5 years ago
by
Aaron McGowan
Committed by
Michael Mol
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2981359
by amcgowanca, Coufu: Get coffee.get_data route path and send it via drupalSettings
parent
c076cf85
No related branches found
No related tags found
2 merge requests
!14
Draft: Automated Project Update Bot fixes
,
!1
Change the label class to be sr-only
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coffee.module
+4
-0
4 additions, 0 deletions
coffee.module
js/coffee.js
+2
-1
2 additions, 1 deletion
js/coffee.js
with
6 additions
and
1 deletion
coffee.module
+
4
−
0
View file @
43c29872
...
...
@@ -41,8 +41,12 @@ function coffee_page_attachments(array &$attachments) {
$cache_tags
=
isset
(
$attachments
[
'#cache'
][
'tags'
])
?
$attachments
[
'#cache'
][
'tags'
]
:
[];
$attachments
[
'#cache'
][
'tags'
]
=
Cache
::
mergeTags
(
$cache_tags
,
$config
->
getCacheTags
());
$data_path
=
Url
::
fromRoute
(
'coffee.get_data'
)
->
toString
();
$data_path
=
ltrim
(
$data_path
,
'/'
);
$attachments
[
'#attached'
][
'library'
][]
=
'coffee/drupal.coffee'
;
$attachments
[
'#attached'
][
'drupalSettings'
][
'coffee'
]
=
[
'dataPath'
=>
$data_path
,
'maxResults'
=>
$config
->
get
(
'max_results'
),
];
}
...
...
This diff is collapsed.
Click to expand it.
js/coffee.js
+
2
−
1
View file @
43c29872
...
...
@@ -73,8 +73,9 @@
var
autocomplete_data_element
=
'
ui-autocomplete
'
;
var
urlPath
=
drupalSettings
.
coffee
.
dataPath
||
'
admin/coffee/get-data
'
;
$
.
ajax
({
url
:
Drupal
.
url
(
'
admin/coffee/get-data
'
),
url
:
Drupal
.
url
(
urlPath
),
dataType
:
'
json
'
,
success
:
function
(
data
)
{
DrupalCoffee
.
dataset
=
data
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment