2019-04-23 21:47:32 +01:00
< template >
2019-04-24 10:43:01 +01:00
< div >
2019-04-28 16:16:15 +01:00
< banner >
2019-06-18 20:51:58 +01:00
< template # sub -banner >
2019-05-02 22:59:21 +01:00
< project-search / >
< / template >
2019-04-28 16:16:15 +01:00
< / banner >
2019-04-24 10:43:01 +01:00
2020-01-04 20:50:46 +00:00
< main class = "container mx-auto p-6 xl:px-0" >
2019-04-28 13:44:20 +02:00
< div class = "flex justify-between items-baseline" >
2019-06-14 23:02:33 +01:00
< page-title > All Projects < / page-title >
2019-04-24 10:43:01 +01:00
2019-06-14 21:29:26 +01:00
< project-view-switcher @changed ="projectViewSwitched" :mode = "displayMode" > < / project-view-switcher >
2019-04-28 13:44:20 +02:00
< / div >
2019-06-14 23:02:33 +01:00
< div class = "mt-6" >
< div v-if = "displayMode == 'grid'" class="flex flex-wrap -mt-8 mb-4 -mx-4" >
2019-06-15 21:35:48 +01:00
< div class = "w-full px-4 mt-8 sm:w-1/2 lg:w-1/3" v-for = "project in projects" :key="project.id" >
< project-card :project = "project" / >
2019-06-14 23:02:33 +01:00
< / div >
< / div >
2019-04-24 10:43:01 +01:00
< / div >
2019-04-25 23:56:46 +02:00
2019-06-14 20:08:30 +01:00
< div v-if = "displayMode == 'list'" class="pt-6 pb-6 mt-4 bg-white shadow-md" >
2019-04-25 23:56:46 +02:00
< table class = "w-full" >
< thead >
< tr class = "border-b border-gray-300" >
2019-06-14 20:08:30 +01:00
< th class = "w-1/2 pb-3 px-6 font-semibold text-left text-sm" > Project name < / th >
< th class = "pb-3 px-6 font-semibold text-left text-sm" > Owner < / th >
< th class = "w-1/4 pb-3 px-6 font-semibold text-left text-sm" > Region < / th >
2019-04-25 23:56:46 +02:00
< / tr >
< / thead >
< tbody >
2019-06-15 21:35:48 +01:00
< tr v-for = "project in projects" :key="project.id" >
2019-04-25 23:56:46 +02:00
< td class = "px-6 py-4" >
2019-06-15 21:35:48 +01:00
< router-link : to = "{ name: 'project', params: { id: project.id }}" class = "font-semibold text-sm hover:underline" > { { project . name } } < / router-link >
2019-04-25 23:56:46 +02:00
< / td >
< td class = "px-6 py-4" >
2019-06-15 21:35:48 +01:00
< a href = "#0" class = "font-semibold text-sm hover:underline" > { { project . owner } } < / a >
2019-04-25 23:56:46 +02:00
< / td >
< td class = "px-6 py-4" >
2019-06-15 21:35:48 +01:00
< a href = "#0" class = "font-semibold text-sm hover:underline" > { { project . region } } < / a >
2019-04-25 23:56:46 +02:00
< / td >
< / tr >
< / tbody >
< / table >
< / div >
2019-06-14 23:02:33 +01:00
< / main >
2019-04-24 10:43:01 +01:00
< / div >
2019-04-23 21:47:32 +01:00
< / template >
< script >
2019-04-24 10:43:01 +01:00
import ProjectCard from '@/components/ProjectCard'
2019-04-26 00:07:02 +02:00
import ProjectSearch from '@/components/ProjectSearch'
2019-04-28 13:44:20 +02:00
import ProjectViewSwitcher from '@/components/ProjectViewSwitcher'
2019-04-23 21:47:32 +01:00
export default {
2019-04-24 10:44:26 +01:00
name : 'projects' ,
2019-04-25 23:56:46 +02:00
2019-06-15 22:53:50 +01:00
props : {
projects : {
type : Object ,
required : true
}
} ,
2019-04-23 21:47:32 +01:00
components : {
2019-04-26 00:07:02 +02:00
ProjectCard ,
2019-04-28 13:44:20 +02:00
ProjectSearch ,
ProjectViewSwitcher
2019-04-25 23:56:46 +02:00
} ,
data ( ) {
return {
2019-06-15 22:53:50 +01:00
displayMode : 'grid'
2019-04-28 13:44:20 +02:00
}
} ,
methods : {
projectViewSwitched ( mode ) {
this . displayMode = mode
2019-04-25 23:56:46 +02:00
}
2019-04-23 21:47:32 +01:00
}
}
< / script >