{"action":"closed","issue":{"url":"https://api.github.com/repos/rstoenescu/quasar-framework/issues/30","repository_url":"https://api.github.com/repos/rstoenescu/quasar-framework","labels_url":"https://api.github.com/repos/rstoenescu/quasar-framework/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/rstoenescu/quasar-framework/issues/30/comments","events_url":"https://api.github.com/repos/rstoenescu/quasar-framework/issues/30/events","html_url":"https://github.com/rstoenescu/quasar-framework/issues/30","id":172889725,"number":30,"title":"Best practice about pages/views structuration","user":{"login":"mlenormand","id":2403897,"avatar_url":"https://avatars.githubusercontent.com/u/2403897?v=3","gravatar_id":"","url":"https://api.github.com/users/mlenormand","html_url":"https://github.com/mlenormand","followers_url":"https://api.github.com/users/mlenormand/followers","following_url":"https://api.github.com/users/mlenormand/following{/other_user}","gists_url":"https://api.github.com/users/mlenormand/gists{/gist_id}","starred_url":"https://api.github.com/users/mlenormand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlenormand/subscriptions","organizations_url":"https://api.github.com/users/mlenormand/orgs","repos_url":"https://api.github.com/users/mlenormand/repos","events_url":"https://api.github.com/users/mlenormand/events{/privacy}","received_events_url":"https://api.github.com/users/mlenormand/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rstoenescu/quasar-framework/labels/discussion","name":"discussion","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-24T08:06:19Z","updated_at":"2016-08-25T15:33:50Z","closed_at":"2016-08-25T15:33:50Z","body":"Not a bug, but rather a discussion about pages/views structuration (OK to use Github issues for that or you prefer a more appropriate place ?)\r\n\r\nPutting all the components in the /components folder is not convenient because the number of components (layouts, views, ui blocks, custom widgets, ...) quickly grows. What I did in my app is using different folders : /components, /layouts, /pages. Initial version of Quasar was also based on multiple folders (and one folder for each artefact, which was quite \"heavy\", the use of .vue files in 0.5.0 was a great improvement !).\r\n\r\nExtract from my router.js file : \r\n\r\n```\r\nlet routes = {\r\n  // Default\r\n  '/': {\r\n    component: require('layouts/LayoutMain.vue'),\r\n    subRoutes: {\r\n      '/search': {component: require('pages/PageSearch.vue')},\r\n      '/item': {component: require('pages/PageItem.vue')}\r\n    }\r\n  },\r\n  // Default\r\n  '/login': {\r\n    component: require('layouts/LayoutLogin.vue'),\r\n    subRoutes: {\r\n      '/': {component: require('pages/PageLogin.vue')},\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nExtract from my weback.base.conf.js file : \r\n\r\n```\r\n  resolve: {\r\n    extensions: ['', '.js', '.vue'],\r\n    fallback: [path.join(__dirname, '../node_modules')],\r\n    alias: {\r\n      'quasar': path.resolve(__dirname, '../node_modules/quasar-framework/'),\r\n      'src': path.resolve(__dirname, '../src'),\r\n      'assets': path.resolve(__dirname, '../src/assets'),\r\n      'components': path.resolve(__dirname, '../src/components'),\r\n      'layouts': path.resolve(__dirname, '../src/layouts'),\r\n      'pages': path.resolve(__dirname, '../src/pages')\r\n    }\r\n  },\r\n```\r\n\r\n**Remark** : customize the existing load() function (in router.js) to pass it for example 'layouts/LayoutMain.vue' or 'pages/PageSearch.vue' doesn't work, certainly because of the statically analysys of the dependencies by Webpack.\r\n\r\nAbout the responsability of layouts, views, what do you think about putting header/footer UI parts in the views rather than in the layouts ? The header includes the title, icon, sometimes subtitles, and those informations are specific to the current view. If we include its to the layout, caching pages would be difficult because each time the user returns to the previous page, we would have to \"update\" the header/footer part (I currently have this real case on my app !).\r\n\r\n**My proposal** : header/footer in the \"view\", and all the other parts (mainly drawers) in the \"layout\".\r\nA \"view\" just have to show the drawer buttons if the layout it belongs has drawer(s).\r\n\r\n"}}
{"actor":{"display_login":"rstoenescu"}}