Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106_2022_02
boco-frontend
Commits
205c95f9
Commit
205c95f9
authored
3 years ago
by
Zara Mudassar
Browse files
Options
Downloads
Patches
Plain Diff
filter
parent
3554ecc4
No related branches found
No related tags found
No related merge requests found
Pipeline
#180620
passed
3 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/BaseComponents/FilterComponent.vue
+52
-0
52 additions, 0 deletions
src/components/BaseComponents/FilterComponent.vue
src/components/CommunityComponents/CommunityHome.vue
+21
-4
21 additions, 4 deletions
src/components/CommunityComponents/CommunityHome.vue
with
73 additions
and
4 deletions
src/components/BaseComponents/FilterComponent.vue
0 → 100644
+
52
−
0
View file @
205c95f9
<
template
>
<div>
<div
class=
"form-check"
v-for=
"filter in filters"
:key=
"filter"
>
<input
class=
"form-check-input appearance-none rounded-full h-4 w-4 border border-gray-300 bg-white checked:bg-primary-medium checked:border-primary-medium focus:outline-none transition duration-200 mt-1 align-top bg-no-repeat bg-center bg-contain float-left mr-2 cursor-pointer"
type=
"radio"
name=
"flexRadioDefault"
:value=
"filter"
@
change=
"checkRadioButton($event)"
/>
<label
class=
"form-check-label inline-block text-gray-800"
>
{{
filter
}}
</label>
</div>
<ColoredButton
:text=
"'Lagre'"
@
click=
"saveFilter()"
class=
"m-2 w-fit"
/>
</div>
</
template
>
<
script
>
import
ColoredButton
from
"
@/components/BaseComponents/ColoredButton
"
;
export
default
{
name
:
"
FilterComponent
"
,
components
:
{
ColoredButton
,
},
data
(){
return
{
radio
:
null
,
filters
:
[
'
Pris: lav til høy
'
,
'
Pris: høy til lav
'
,
'
Tittel: A - Å
'
,
'
Tittel: Å - A
'
],
}
},
methods
:
{
checkRadioButton
:
function
(
event
){
this
.
radio
=
event
.
target
.
value
;
},
saveFilter
:
function
(
radio
){
console
.
log
(
"
Save clicked
"
);
//console.log(this.radio);
radio
=
this
.
radio
;
this
.
$emit
(
"
filter
"
,
radio
);
}
}
}
</
script
>
This diff is collapsed.
Click to expand it.
src/components/CommunityComponents/CommunityHome.vue
+
21
−
4
View file @
205c95f9
...
...
@@ -20,7 +20,7 @@
<input
type=
"text"
id=
"searchInput"
class=
"w-
4/5
py-3 pl-10 pr-4 text-gray-700 bg-white border rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-primary-medium dark:focus:border-primary-medium focus:outline-none focus:ring"
class=
"w-
11/12
py-3 pl-10 pr-4 text-gray-700 bg-white border rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-primary-medium dark:focus:border-primary-medium focus:outline-none focus:ring"
placeholder=
"Search"
v-model=
"search"
@
change=
"searchWritten"
...
...
@@ -29,11 +29,15 @@
<ColoredButton
:text=
"'Filter'"
@
click=
"OpenFilter()"
class=
"m-2 w-
1/5
"
class=
"m-2 w-
fit
"
/>
</div>
<FilterComponent
class=
" bg-white"
v-if=
"filterDialog"
v-on:filter=
"saveFilter"
/>
</div>
</div>
<div
class=
"absolute inset-x-0 px-5 py-3"
>
...
...
@@ -85,6 +89,7 @@ import ItemCard from "@/components/ItemComponents/ItemCard";
import
CommunityHeader
from
"
@/components/CommunityComponents/CommunityHeader
"
;
import
PaginationTemplate
from
"
@/components/BaseComponents/PaginationTemplate
"
;
import
ColoredButton
from
"
@/components/BaseComponents/ColoredButton.vue
"
;
import
FilterComponent
from
"
@/components/BaseComponents/FilterComponent
"
;
import
{
GetCommunity
,
...
...
@@ -98,6 +103,7 @@ export default {
ItemCard
,
PaginationTemplate
,
ColoredButton
,
FilterComponent
,
},
computed
:
{
searchedItems
()
{
...
...
@@ -132,6 +138,7 @@ export default {
communityID
:
-
1
,
community
:
{},
filterDialog
:
false
,
selectedFilter
:
null
,
showItems
:
true
,
showSearchedItems
:
false
,
...
...
@@ -177,10 +184,20 @@ export default {
},
OpenFilter
:
function
(){
this
.
filterDialog
=
true
;
if
(
this
.
filterDialog
===
true
){
this
.
filterDialog
=
false
;
}
else
{
this
.
filterDialog
=
true
;
}
console
.
log
(
this
.
filterDialog
);
},
saveFilter
(
radio
){
this
.
selectedFilter
=
radio
;
console
.
log
(
this
.
selectedFilter
);
},
//Pagination
updatePage
(
pageNumber
)
{
this
.
currentPage
=
pageNumber
;
...
...
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