Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beta.ordbok.uib.no
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
Språksamlingane
beta.ordbok.uib.no
Commits
36ba8b4b
Commit
36ba8b4b
authored
3 years ago
by
Henrik Askjer
Browse files
Options
Downloads
Patches
Plain Diff
complete collapse settings
parent
35dedc2d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/components/Article.vue
+42
-20
42 additions, 20 deletions
src/components/Article.vue
src/components/Header.vue
+2
-2
2 additions, 2 deletions
src/components/Header.vue
src/components/Settings.vue
+8
-7
8 additions, 7 deletions
src/components/Settings.vue
src/main.js
+5
-1
5 additions, 1 deletion
src/main.js
with
57 additions
and
30 deletions
src/components/Article.vue
+
42
−
20
View file @
36ba8b4b
<
template
>
<
template
>
<article
v-bind:class=
"
{'v-sheet v-card rounded-xl': !articleLookup, dictionary, 'collapsable': collapsable, 'collapsed': collapsed}" v-if="article">
<article
v-bind:class=
"
{'v-sheet v-card rounded-xl': !articleLookup, dictionary, 'collapsable': collapsable, 'collapsed': collapsed}" v-if="article">
<Header
:title_id=
"title_id"
:lemmas=
"article.lemmas"
:dictionary=
"dictionary"
:article_id=
"article.article_id"
/>
<Header
:title_id=
"title_id"
:lemmas=
"article.lemmas"
:dictionary=
"dictionary"
:article_id=
"article.article_id"
@
toggle-collapse =
"toggle_collapse"
/>
<InflectionButton
:lemmas=
"article.lemmas"
:dictionary=
"dictionary"
:article_id=
"article.article_id"
/>
<InflectionButton
:lemmas=
"article.lemmas"
:dictionary=
"dictionary"
:article_id=
"article.article_id"
/>
<div
class=
"article_content"
:class=
"$vuetify.breakpoint.name"
v-if=
"!collapsed"
>
<div
class=
"article_content"
:class=
"$vuetify.breakpoint.name"
v-if=
"!collapsed"
>
...
@@ -81,23 +81,48 @@ export default {
...
@@ -81,23 +81,48 @@ export default {
},
},
data
:
function
()
{
data
:
function
()
{
return
{
return
{
collapsed
:
t
his
.
$parent
.
$options
.
name
==
'
SearchResults
'
&&
(
this
.
$parent
.
results_bm
.
length
+
this
.
$parent
.
results_nn
.
length
>
2
)
is_
collapsed
:
t
rue
}
}
},
},
computed
:
{
computed
:
{
collapsable
:
function
()
{
snippet
:
function
()
{
if
(
this
.
$parent
.
$options
.
name
!=
'
SearchResults
'
)
{
if
(
this
.
article
.
body
.
definitions
)
{
this
.
is_collapsed
=
false
return
this
.
parse_definitions
(
this
.
article
.
body
.
definitions
)
return
false
}
let
collapsable
=
this
.
$store
.
state
.
collapseArticles
if
(
collapsable
==
'
never
'
)
{
this
.
is_collapsed
=
false
}
if
(
collapsable
==
'
always
'
)
{
this
.
is_collapsed
=
true
}
if
(
collapsable
==
'
auto
'
)
{
this
.
is_collapsed
=
this
.
$parent
.
$options
.
name
==
'
SearchResults
'
&&
(
this
.
$parent
.
results_bm
.
length
+
this
.
$parent
.
results_nn
.
length
>
2
)
}
}
return
null
return
this
.
$store
.
state
.
collapseArticles
==
'
always
'
||
this
.
is_collapsed
//getters.collapsable(this.$parent.$options.name, this.$parent.results_bm.length + this.$parent.results_nn.length)
},
},
collapsable
:
function
()
{
collapsed
:
{
return
this
.
$parent
.
$options
.
name
==
'
SearchResults
'
&&
(
this
.
$parent
.
results_bm
.
length
+
this
.
$parent
.
results_nn
.
length
>
2
)
get
()
{
if
(
this
.
$parent
.
$options
.
name
!=
'
SearchResults
'
)
{
return
false
}
if
(
!
this
.
collapsable
)
{
this
.
is_collapsed
=
false
}
return
this
.
is_collapsed
},
set
(
value
)
{
this
.
is_collapsed
=
value
}
},
snippet
:
function
()
{
if
(
this
.
collapsable
&&
this
.
article
.
body
.
definitions
)
{
return
this
.
parse_definitions
(
this
.
article
.
body
.
definitions
)
}
return
null
},
},
link_to_self
:
function
()
{
link_to_self
:
function
()
{
return
{
return
{
...
@@ -190,14 +215,11 @@ export default {
...
@@ -190,14 +215,11 @@ export default {
return
definitions
return
definitions
},
},
expand
:
function
()
{
toggle_collapse
:
function
()
{
if
(
this
.
collapsed
)
{
console
.
log
(
"
toggle
"
,
this
.
collapsed
)
this
.
collapsed
=
false
this
.
collapsed
=
!
this
.
collapsed
}
},
collapse
:
function
()
{
this
.
collapsed
=
true
},
},
article_link_click
:
function
(
item
)
{
article_link_click
:
function
(
item
)
{
this
.
$emit
(
'
article-click
'
,
item
)
this
.
$emit
(
'
article-click
'
,
item
)
},
},
...
...
This diff is collapsed.
Click to expand it.
src/components/Header.vue
+
2
−
2
View file @
36ba8b4b
...
@@ -58,13 +58,13 @@
...
@@ -58,13 +58,13 @@
<v-btn
class=
"expand_icon"
v-if=
"$parent.collapsed"
<v-btn
class=
"expand_icon"
v-if=
"$parent.collapsed"
text
text
small
small
@
click=
"$
parent.
collapse
d=false
"
>
@
click=
"$
emit('toggle-
collapse
')
"
>
Vis artikkel
Vis artikkel
<v-icon
small
right
>
expand_more
</v-icon></v-btn>
<v-icon
small
right
>
expand_more
</v-icon></v-btn>
<v-btn
class=
"expand_icon"
v-else
<v-btn
class=
"expand_icon"
v-else
text
text
small
small
@
click=
"$
parent.
collapse
d=true
"
>
@
click=
"$
emit('toggle-
collapse
')
"
>
<v-icon
small
>
expand_less
</v-icon></v-btn>
<v-icon
small
>
expand_less
</v-icon></v-btn>
</span>
</span>
...
...
This diff is collapsed.
Click to expand it.
src/components/Settings.vue
+
8
−
7
View file @
36ba8b4b
...
@@ -17,9 +17,9 @@
...
@@ -17,9 +17,9 @@
</v-list-item>
</v-list-item>
<v-list-item>
<v-list-item>
<v-radio-group
mandatory
two-line
v-model=
"update
Local
e"
label=
"Velg
når artiklene i
søkeresultatene skal
forkortes
"
>
<v-radio-group
mandatory
two-line
v-model=
"update
Collaps
e"
label=
"Velg
om
søkeresultatene skal
inneholde utdrag eller fullstendige artikler.
"
>
<v-radio
value=
"auto"
label=
"
Forkort i søk med to eller flere
resultater"
></v-radio>
<v-radio
value=
"auto"
label=
"
Automatisk (hvis mer enn 2
resultater
)
"
></v-radio>
<v-radio
value=
"always"
label=
"Vis bare
forkortede artikler
"
></v-radio>
<v-radio
value=
"always"
label=
"Vis bare
utdrag
"
></v-radio>
<v-radio
value=
"never"
label=
"Vis bare fullstendige artikler"
></v-radio>
<v-radio
value=
"never"
label=
"Vis bare fullstendige artikler"
></v-radio>
</v-radio-group>
</v-radio-group>
</v-list-item>
</v-list-item>
...
@@ -42,11 +42,12 @@ export default {
...
@@ -42,11 +42,12 @@ export default {
set
()
{
this
.
$store
.
commit
(
"
toggle
"
,
"
showInflectionNo
"
)
set
()
{
this
.
$store
.
commit
(
"
toggle
"
,
"
showInflectionNo
"
)
}
}
},
},
toggl
eCollapse
:
{
updat
eCollapse
:
{
get
()
{
return
this
.
$store
.
state
.
collapseArticles
},
get
()
{
return
this
.
$store
.
state
.
collapseArticles
},
set
()
{
this
.
$store
.
commit
(
"
toggle
"
,
"
collapseArticles
"
)
set
(
value
)
{
}
this
.
$store
.
commit
(
"
setCollapse
"
,
value
)
}
}
},
},
},
}
}
</
script
>
</
script
>
This diff is collapsed.
Click to expand it.
src/main.js
+
5
−
1
View file @
36ba8b4b
...
@@ -102,7 +102,7 @@ const store = new Vuex.Store({
...
@@ -102,7 +102,7 @@ const store = new Vuex.Store({
state
.
showInflectionNo
=
localStorage
.
getItem
(
'
showInflectionNo
'
)
||
false
state
.
showInflectionNo
=
localStorage
.
getItem
(
'
showInflectionNo
'
)
||
false
state
.
currentLocale
=
localStorage
.
getItem
(
'
currentLocale
'
)
state
.
currentLocale
=
localStorage
.
getItem
(
'
currentLocale
'
)
state
.
defaultDict
=
localStorage
.
getItem
(
'
defaultDict
'
)
||
'
bm,nn
'
state
.
defaultDict
=
localStorage
.
getItem
(
'
defaultDict
'
)
||
'
bm,nn
'
state
.
collapseArticles
=
localStorage
.
getItem
(
'
collapseArticles
'
)
||
window
.
innerWidth
<
700
state
.
collapseArticles
=
localStorage
.
getItem
(
'
collapseArticles
'
)
||
'
auto
'
state
.
noMouse
=
window
.
matchMedia
(
'
(hover: none)
'
).
matches
state
.
noMouse
=
window
.
matchMedia
(
'
(hover: none)
'
).
matches
...
@@ -118,6 +118,10 @@ const store = new Vuex.Store({
...
@@ -118,6 +118,10 @@ const store = new Vuex.Store({
payload
.
i18n
.
locale
=
payload
.
value
payload
.
i18n
.
locale
=
payload
.
value
localStorage
.
setItem
(
"
currentLocale
"
,
payload
.
value
);
localStorage
.
setItem
(
"
currentLocale
"
,
payload
.
value
);
},
},
setCollapse
(
state
,
value
)
{
localStorage
.
setItem
(
"
collapseArticles
"
,
value
)
state
.
collapseArticles
=
value
},
toggle
(
state
,
setting
)
{
toggle
(
state
,
setting
)
{
let
value
=
!
state
[
setting
]
let
value
=
!
state
[
setting
]
state
[
setting
]
=
value
state
[
setting
]
=
value
...
...
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