Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
8ff240ee
Commit
8ff240ee
authored
4 years ago
by
Neuber, Eugen Ramon
Browse files
Options
Downloads
Patches
Plain Diff
Fix enabling select2 without auth/token
See issue
#49
parent
ec29eeb9
No related branches found
No related tags found
No related merge requests found
Pipeline
#17199
passed with warnings
4 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/person-select/src/dbp-person-select-demo.js
+7
-0
7 additions, 0 deletions
packages/person-select/src/dbp-person-select-demo.js
packages/person-select/src/person-select.js
+11
-3
11 additions, 3 deletions
packages/person-select/src/person-select.js
with
18 additions
and
3 deletions
packages/person-select/src/dbp-person-select-demo.js
+
7
−
0
View file @
8ff240ee
...
...
@@ -84,6 +84,13 @@ export class PersonSelectDemo extends ScopedElementsMixin(DBPLitElement) {
<dbp-person-select subscribe="auth" lang="
${
this
.
lang
}
" entry-point-url="
${
this
.
entryPointUrl
}
" show-reload-button reload-button-title="Click me"></dbp-person-select>
</div>
</div>
<div class="field">
<label class="label">Person 3 unsubscribed</label>
<div class="control">
<dbp-person-select lang="
${
this
.
lang
}
" entry-point-url="
${
this
.
entryPointUrl
}
" show-reload-button reload-button-title="Click me"></dbp-person-select>
</div>
<p>This comonent doesn't get any notification about user's login and will become active.</p>
</div>
</form>
</div>
</section>
...
...
This diff is collapsed.
Click to expand it.
packages/person-select/src/person-select.js
+
11
−
3
View file @
8ff240ee
...
...
@@ -110,7 +110,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
JSONLD
.
initialize
(
this
.
entryPointUrl
,
function
(
jsonld
)
{
that
.
jsonld
=
jsonld
;
that
.
active
=
t
rue
;
that
.
active
=
t
hat
.
authenticated
()
;
// we need to poll because maybe the user interface isn't loaded yet
// Note: we need to call initSelect2() in a different function so we can access "this" inside initSelect2()
...
...
@@ -150,7 +150,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
width
:
'
100%
'
,
language
:
this
.
lang
===
"
de
"
?
select2LangDe
()
:
select2LangEn
(),
minimumInputLength
:
2
,
placeholder
:
i18n
.
t
(
'
person-select.placeholder
'
),
placeholder
:
i18n
.
t
(
this
.
authenticated
()
?
'
person-select.placeholder
'
:
'
person-select.login-required
'
),
dropdownParent
:
this
.
$
(
'
#person-select-dropdown
'
),
ajax
:
{
delay
:
500
,
...
...
@@ -293,6 +293,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
break
;
case
"
auth
"
:
JSONLD
.
doInitializationOnce
(
this
.
entryPointUrl
,
this
.
auth
.
token
);
this
.
active
=
this
.
authenticated
();
break
;
}
});
...
...
@@ -318,6 +319,10 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
}));
}
authenticated
()
{
return
(
this
.
auth
.
token
||
''
)
!==
''
;
}
static
get
styles
()
{
return
[
commonStyles
.
getThemeCSS
(),
...
...
@@ -366,7 +371,10 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
<div class="field has-addons">
<div class="select2-control control">
<!-- https://select2.org-->
<select id="
${
this
.
selectId
}
" name="person" class="select" ?disabled=
${
!
this
.
active
}
>
${
!
this
.
active
?
html
`<option value="" disabled selected>
${
i18n
.
t
(
'
person-select.login-required
'
)}
</option>`
:
''
}
</select>
<select id="
${
this
.
selectId
}
" name="person" class="select"
?disabled=
${
!
this
.
active
}
>
${
!
this
.
authenticated
()
?
html
`<option value="" disabled selected>
${
i18n
.
t
(
'
person-select.login-required
'
)}
</option>`
:
''
}
</select>
</div>
<a class="control button"
id="reload-button"
...
...
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