Procházet zdrojové kódy

reimplement router

pull/44/head
Guillaume Vincent před 8 roky
rodič
revize
347d53a4db
28 změnil soubory, kde provedl 235 přidání a 48 odebrání
  1. +0
    -0
      app/1-header/header.vue
  2. +0
    -0
      app/1-header/logo-white.png
  3. +24
    -31
      app/app.vue
  4. +0
    -0
      app/landing-page/features/features.vue
  5. +0
    -0
      app/landing-page/features/free.png
  6. +0
    -0
      app/landing-page/features/no-cloud.png
  7. +0
    -0
      app/landing-page/features/open-source.png
  8. +0
    -0
      app/landing-page/features/responsive.png
  9. +0
    -0
      app/landing-page/feedback/el.jpg
  10. +0
    -0
      app/landing-page/feedback/feedback.vue
  11. +0
    -0
      app/landing-page/feedback/gv.jpg
  12. +0
    -0
      app/landing-page/footer/footer.vue
  13. +0
    -0
      app/landing-page/footer/logo.png
  14. +0
    -0
      app/landing-page/header/header.vue
  15. +0
    -0
      app/landing-page/header/password-generator/password-generator.vue
  16. +0
    -0
      app/landing-page/howitworks/howitworks.vue
  17. +0
    -0
      app/landing-page/howitworks/lesspass.gif
  18. +0
    -0
      app/landing-page/image-separator/image-separator.vue
  19. +0
    -0
      app/landing-page/image-separator/story-en.png
  20. +0
    -0
      app/landing-page/image-separator/story-fr.png
  21. +32
    -0
      app/landing-page/index.vue
  22. +31
    -0
      app/lesspass/index.vue
  23. +6
    -15
      app/main.js
  24. +49
    -0
      app/routes.js
  25. +55
    -0
      app/services/auth.js
  26. +35
    -0
      app/services/logging.js
  27. +1
    -1
      index.html
  28. +2
    -1
      package.json

app/navbar/navbar.vue → app/1-header/header.vue Zobrazit soubor


app/navbar/logo-white.png → app/1-header/logo-white.png Zobrazit soubor


+ 24
- 31
app/app.vue Zobrazit soubor

@@ -1,36 +1,29 @@
<template>
<div id="app">
<lesspass-navbar></lesspass-navbar>
<lesspass-header></lesspass-header>
<lesspass-features></lesspass-features>
<!--<lesspass-headlines></lesspass-headlines>-->
<lesspass-howitworks></lesspass-howitworks>
<lesspass-feedback></lesspass-feedback>
<lesspass-image></lesspass-image>
<lesspass-footer></lesspass-footer>
<router-view></router-view>
</div>
</template>
<script>
import LesspassNavbar from './navbar/navbar.vue';
import LesspassHeader from './header/header.vue';
import LesspassFeatures from './features/features.vue';
import LesspassHowitworks from './howitworks/howitworks.vue';
import LesspassFeedback from './feedback/feedback.vue';
import LesspassImage from './image-separator/image-separator.vue';
import LesspassFooter from './footer/footer.vue';
<!--<script>-->
<!--import LesspassNavbar from './navbar/navbar.vue';-->
<!--import LesspassHeader from './header/header.vue';-->
<!--import LesspassFeatures from './features/features.vue';-->
<!--import LesspassHowitworks from './howitworks/howitworks.vue';-->
<!--import LesspassFeedback from './feedback/feedback.vue';-->
<!--import LesspassImage from './image-separator/image-separator.vue';-->
<!--import LesspassFooter from './footer/footer.vue';-->

export default {
data: function () {
return {}
},
components: {
LesspassNavbar,
LesspassHeader,
LesspassFeatures,
LesspassHowitworks,
LesspassFeedback,
LesspassImage,
LesspassFooter
}
}
</script>
<!--export default {-->
<!--data: function () {-->
<!--return {}-->
<!--},-->
<!--components: {-->
<!--LesspassNavbar,-->
<!--LesspassHeader,-->
<!--LesspassFeatures,-->
<!--LesspassHowitworks,-->
<!--LesspassFeedback,-->
<!--LesspassImage,-->
<!--LesspassFooter-->
<!--}-->
<!--}-->
<!--</script>-->

app/features/features.vue → app/landing-page/features/features.vue Zobrazit soubor


app/features/free.png → app/landing-page/features/free.png Zobrazit soubor


app/features/no-cloud.png → app/landing-page/features/no-cloud.png Zobrazit soubor


app/features/open-source.png → app/landing-page/features/open-source.png Zobrazit soubor


app/features/responsive.png → app/landing-page/features/responsive.png Zobrazit soubor


app/feedback/el.jpg → app/landing-page/feedback/el.jpg Zobrazit soubor


app/feedback/feedback.vue → app/landing-page/feedback/feedback.vue Zobrazit soubor


app/feedback/gv.jpg → app/landing-page/feedback/gv.jpg Zobrazit soubor


app/footer/footer.vue → app/landing-page/footer/footer.vue Zobrazit soubor


app/footer/logo.png → app/landing-page/footer/logo.png Zobrazit soubor


app/header/header.vue → app/landing-page/header/header.vue Zobrazit soubor


app/header/password-generator/password-generator.vue → app/landing-page/header/password-generator/password-generator.vue Zobrazit soubor


app/howitworks/howitworks.vue → app/landing-page/howitworks/howitworks.vue Zobrazit soubor


app/howitworks/lesspass.gif → app/landing-page/howitworks/lesspass.gif Zobrazit soubor


app/image-separator/image-separator.vue → app/landing-page/image-separator/image-separator.vue Zobrazit soubor


app/image-separator/story-en.png → app/landing-page/image-separator/story-en.png Zobrazit soubor


app/image-separator/story-fr.png → app/landing-page/image-separator/story-fr.png Zobrazit soubor


+ 32
- 0
app/landing-page/index.vue Zobrazit soubor

@@ -0,0 +1,32 @@
<template>
<div id="app">
<lesspass-header></lesspass-header>
<lesspass-features></lesspass-features>
<lesspass-howitworks></lesspass-howitworks>
<lesspass-feedback></lesspass-feedback>
<lesspass-image></lesspass-image>
<lesspass-footer></lesspass-footer>
</div>
</template>
<script>
import LesspassHeader from './header/header.vue';
import LesspassFeatures from './features/features.vue';
import LesspassHowitworks from './howitworks/howitworks.vue';
import LesspassFeedback from './feedback/feedback.vue';
import LesspassImage from './image-separator/image-separator.vue';
import LesspassFooter from './footer/footer.vue';

export default {
data: function () {
return {}
},
components: {
LesspassHeader,
LesspassFeatures,
LesspassHowitworks,
LesspassFeedback,
LesspassImage,
LesspassFooter
}
}
</script>

+ 31
- 0
app/lesspass/index.vue Zobrazit soubor

@@ -0,0 +1,31 @@
<template>
<div class="container">
<div class="row m-y-3">
<div class="col-lg-12">
<form>
<input class="form-control" id="search-input" placeholder="Search..." autocomplete="off"
type="text">
<div class="dropdown-menu bd-search-results" id="search-results"></div>
</form>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<ol>
<li v-for="entry in entries">
{{ entry.title }}
</li>
</ol>
</div>
</div>
</div>
</template>

<script>
export default {
data: function () {
return {
entries: []
}
}
}

+ 6
- 15
app/main.js Zobrazit soubor

@@ -1,15 +1,6 @@
require('../node_modules/bootstrap/dist/css/bootstrap.css');
require('../node_modules/font-awesome/css/font-awesome.min.css');
require('../node_modules/bootstrap/dist/js/umd/collapse.js');

var Vue = require('vue');
var App = require('./app.vue');

require('./locales.js');

new Vue({
el: 'body',
components: {
App
}
});
import 'bootstrap/dist/css/bootstrap.css';
import 'font-awesome/css/font-awesome.min.css';
import 'bootstrap/dist/js/umd/collapse.js';
import Vue from 'vue';
import './locales';
import './routes'

+ 49
- 0
app/routes.js Zobrazit soubor

@@ -0,0 +1,49 @@
import Vue from 'vue';
import Router from 'vue-router';

import App from './app.vue';
import LandingPage from './landing-page/index.vue';
import LessPass from './lesspass/index.vue';

Vue.use(Router);

var router = new Router();


var Foo = Vue.extend({
template: '<p>This is foo!</p>'
});

var Bar = Vue.extend({
template: '<p>This is bar!</p>'
});

router.map({
'/': {
auth: true,
component: LessPass
},
'/presentation/': {
component: LandingPage
}
});

router.redirect({
'*': '/'
});

router.start(App, '#app');

var Auth = require('./services/auth.js');

Auth.checkAuth();

router.beforeEach(function (transition) {
if (transition.to.auth && !Auth.user.authenticated) {
transition.redirect('/presentation/')
} else {
transition.next()
}
});

module.exports = router;

+ 55
- 0
app/services/auth.js Zobrazit soubor

@@ -0,0 +1,55 @@
import logging from './logging.js';

module.exports = {
user: {
authenticated: false
},

login(context, credentials, callback) {
var self = this;
context.$http.post('/api/sessions/', credentials).then(
function (response) {
localStorage.setItem('token', response.data.token);
self.user.authenticated = true;
if (callback) {
logging.success(this.$t('login.welcome'));
callback();
}
},
function () {
logging.error(this.$t('login.credentials_invalids'));
}
);
},

register(context, user) {
var self = this;
context.$http.post('/api/users/', user).then(
function (response) {
logging.warning(this.$t('register.beta'));
},
function (error) {
logging.warning(this.$t('register.beta'));
}
);
},

logout(callback) {
localStorage.removeItem('token');
this.user.authenticated = false;
if (callback) {
callback();
}
},

checkAuth() {
var jwt = localStorage.getItem('token');
this.user.authenticated = !!jwt;
},

getAuthHeader() {
return {
'Authorization': 'Bearer ' + localStorage.getItem('token')
}
}
};

+ 35
- 0
app/services/logging.js Zobrazit soubor

@@ -0,0 +1,35 @@
import toastr from 'toastr';
import 'toastr/build/toastr.min.css';

toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-top-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "10000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};

module.exports = {
error(message){
toastr.error(message);
},
success(message){
toastr.success(message);
},
warning(message){
toastr.warning(message);
},
clear(){
toastr.clear();
}
};

+ 1
- 1
index.html Zobrazit soubor

@@ -25,7 +25,7 @@
<meta name="theme-color" content="#252830">
</head>
<body>
<App></App>
<div id="app"></div>
<script src="dist/bundle.js"></script>
</body>
</html>

+ 2
- 1
package.json Zobrazit soubor

@@ -36,7 +36,8 @@
"toastr": "^2.1.2",
"vue": "^1.0.16",
"vue-i18n": "^2.4.0",
"vue-resource": "^0.7.0"
"vue-resource": "^0.7.0",
"vue-router": "^0.7.11"
},
"devDependencies": {
"babel-core": "^6.5.1",


Načítá se…
Zrušit
Uložit