diff --git a/.eslintrc b/.eslintrc index 7003deb..ac65579 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,8 +1,20 @@ { - "parser": "babel-eslint", - "rules": { + "parserOptions": { + "parser": "babel-eslint", + "ecmaVersion": 6, + "sourceType": "module", + "impliedStrict": true + }, + "env": { + "browser": true, + "es6": true + }, + extends: [ + "eslint:recommended", + "plugin:vue/recommended" + ], + "rules": { + "indent": ["error", 4], + "no-console": 0 }, - "plugins": [ - "html" - ] } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 136ea08..d21f91c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2037,55 +2037,12 @@ "isarray": "1.0.0" } }, - "dom-serializer": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", - "dev": true, - "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" - }, - "dependencies": { - "domelementtype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", - "dev": true - } - } - }, "domain-browser": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=", "dev": true }, - "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", - "dev": true - }, - "domhandler": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", - "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", - "dev": true, - "requires": { - "domelementtype": "1.3.0" - } - }, - "domutils": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.6.2.tgz", - "integrity": "sha1-GVjMC0yUJuntNn+xyOhUiRsPo/8=", - "dev": true, - "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" - } - }, "dot-case": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-2.1.1.tgz", @@ -2180,12 +2137,6 @@ "tapable": "0.2.8" } }, - "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", - "dev": true - }, "errno": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", @@ -2412,13 +2363,14 @@ "rimraf": "2.6.1" } }, - "eslint-plugin-html": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-3.2.0.tgz", - "integrity": "sha512-jQLPqZNty889RrieCScFY3hJAJNeo0pX2ixCIPaXw/1wq5ZadKQkkh94ObqRfYzwrzD75HqEVGykmtDXEkReKg==", + "eslint-plugin-vue": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-3.12.0.tgz", + "integrity": "sha1-6a0J1sYo+ytleAaP7aVEA896lNs=", "dev": true, "requires": { - "htmlparser2": "3.9.2" + "requireindex": "1.1.0", + "vue-eslint-parser": "2.0.0-beta.7" } }, "eslint-scope": { @@ -3164,20 +3116,6 @@ } } }, - "htmlparser2": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", - "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", - "dev": true, - "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.4.1", - "domutils": "1.6.2", - "entities": "1.1.1", - "inherits": "2.0.3", - "readable-stream": "2.3.3" - } - }, "http-deceiver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", @@ -6496,6 +6434,12 @@ "resolve-from": "1.0.1" } }, + "requireindex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.1.0.tgz", + "integrity": "sha1-5UBLgVV+91225JxacgBIk/4D4WI=", + "dev": true + }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -7453,6 +7397,18 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-2.4.2.tgz", "integrity": "sha512-GB5r+CsrCHIB1PoXt4wgBienjF3WGYOIaTK27tDk96sZxpL5RwRrsi9I3ECwFt8x8qAmxT2xk1vsY2Vpcn9nIw==" }, + "vue-eslint-parser": { + "version": "2.0.0-beta.7", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-2.0.0-beta.7.tgz", + "integrity": "sha512-S62CeCnpOZ4WfFFW/DCvu5L8Pxy6bsWEDAt8sLHI03BH0x4rbcRZgfi45GiVe/FKUl79xDI1RuCPrZmqguHCtg==", + "dev": true, + "requires": { + "debug": "2.6.8", + "eslint-scope": "3.7.1", + "espree": "3.5.0", + "lodash": "4.17.4" + } + }, "vue-hot-reload-api": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.1.0.tgz", diff --git a/package.json b/package.json index d8924bc..52c885e 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "css-loader": "^0.28.5", "eslint": "^4.5.0", "eslint-loader": "^1.9.0", - "eslint-plugin-html": "^3.2.0", + "eslint-plugin-vue": "^3.12.0", "less": "^2.7.2", "less-loader": "^4.0.5", "vue-hot-reload-api": "^2.1.0", diff --git a/src/app.less b/src/app.less index 6d7dab5..115bd05 100644 --- a/src/app.less +++ b/src/app.less @@ -58,11 +58,12 @@ img {line-height:0;} # General Settings --------------------------------------------------------------*/ html,body { - font-family: 'Open Sans', sans-serif; - font-size:15px; - line-height:1.4; - color:#000; - background:#f5f3f4; + position: relative; + font-family: @font_family; + font-size: @font_size; + line-height: @line_height_base; + color: @text_color; + background: @gray_light; } .clear {clear:both;} .section_padding {padding:100px 0px;} @@ -70,15 +71,16 @@ html,body { /*-------------------------------------------------------------- # Typo --------------------------------------------------------------*/ -p {margin-bottom:20px; color:#000;} -h1 {display: block; font-size: 25px; font-weight: 600; line-height: 1.2; margin-bottom:10px; text-align:left; color:#333;} -h2 {display: block; font-size: 45px; font-weight: 600; line-height: 1.2; margin-bottom:10px; text-align:center;} -h3 {display: block; font-size: 20px; font-weight: 300; line-height: 1.2; letter-spacing:2px;} -h4 {display: block; font-size: 15px; font-weight: 600; line-height: 1.2;} -h5 {display: block; font-size: 18px; font-weight: 600; line-height: 1.2; border-bottom:dotted 1px #999; padding-bottom:5px; margin-top:20px; margin-bottom:20px;} +p {margin-bottom:20px; color: @text_color;} +h1, h2, h3, h4, h5{display: block; line-height: @line_height_heading;} +h1 {font-size: 25px; font-weight: 600; margin-bottom:10px; text-align:left; color: #333;} +h2 {font-size: 45px; font-weight: 600; margin-bottom:10px; text-align:center;} +h3 {font-size: 20px; font-weight: 300; letter-spacing:2px;} +h4 {font-size: 15px; font-weight: 600;} +h5 {font-size: 18px; font-weight: 600; border-bottom:dotted 1px #999; padding-bottom:5px; margin-top:20px; margin-bottom:20px;} strong {font-weight:700;} -mark {color:#ac1526;} -a {text-decoration:none; color:#ac1526;} +mark {color: @cms_brand_secondary;} +a {text-decoration:none; color: @cms_brand_secondary;} a:hover {color:#901624;} @@ -87,25 +89,23 @@ a:hover {color:#901624;} --------------------------------------------------------------*/ .input_holder {margin-bottom:20px; display:block;} .input_header {margin-bottom:10px;} -.input_description {font-size:13px; color:#666;} +.input_description {font-size:13px; color: @text_color;} input, textarea, select { - font-family: 'Open Sans', sans-serif; - width:100%; - display:block; - height:35px; - padding:0px 10px; - color:#333; - backrgound:#FFF; - border:solid 1px #CCC; - outline:none; - font-size:13px; - transition:all 0.3s; - -webkit-transition:all 0.3s; - -moz-transition:all 0.3s; + font-family: @font_family; + width: 100%; + display: block; + height: 35px; + padding: 0px 10px; + color: @text_color; + background: white; + border: solid 1px #CCC; + outline: none; + font-size: 14px; + transition: all 0.3s; } textarea {padding:10px; height:auto;} -input:focus, textarea:focus, select:focus {background:#FFF; border-color:#28b78d;} -label {font-weight:600; color:#333;} +input:focus, textarea:focus, select:focus {background:#FFF; border-color: @cms_brand_primary;} +label {font-weight:600; color: @text_color;} input[type="checkbox"] { position: absolute; @@ -149,15 +149,15 @@ input[type="checkbox"] { -webkit-transition: background 0.25s linear; } input[type=checkbox]:checked ~ .check_checkbox { - border: 1px solid #28b78d; + border: 1px solid @cms_brand_primary; } input[type=checkbox]:checked ~ .check_checkbox:before{ - background: #28b78d!important; + background: @cms_brand_primary!important; } button{ height: 40px; - background: @cms_brand_secondary; + background: @gray_dark; border: none; color: #FFF; cursor: pointer; @@ -168,7 +168,7 @@ button{ border-radius: 20px; } .cell_checkbox label {width:18px; height:18px; display:block; cursor:pointer; z-index:10; position: absolute; top:50%; margin-top:-9px;} -.checkbox_holder:hover .check_checkbox {border: 1px solid #28b78d;} +.checkbox_holder:hover .check_checkbox {border: 1px solid @cms_brand_primary;} /*-------------------------------------------------------------- # CMS CONTENT FORM @@ -186,8 +186,8 @@ button{ /*-------------------------------------------------------------- # Content Area --------------------------------------------------------------*/ -.content_area {position:absolute; left:70px; top:40px; right:0px; transition:all 0.3s;} -.content_main {position:relative; top:0px; padding:25px; transition:all 0.3s;} +.content_area {position:absolute; left:70px; top:40px; right:0px; height: 100%;} +.content_main {position:relative; top:0px; padding:25px;} .cms_content_main_headline {margin-bottom:20px; position:relative;} .content_open_sidebar {left:250px;} @@ -207,16 +207,16 @@ button{ /*-------------------------------------------------------------- # CMS ADD BUTTON --------------------------------------------------------------*/ -.button { - display:inline-block; - height:30px; - line-height:30px; - padding:0px 20px 0px 40px; - border-radius:20px; - color:#FFF; - font-weight:600; - font-size:14px; - transition:background 0.3s; +/*.button { + display: inline-block; + height: 30px; + line-height: 30px; + padding: 0px 20px 0px 40px; + border-radius: 20px; + color: #FFF; + font-weight: 600; + font-size: 14px; + transition: background 0.3s; } .button i {font-size:16px; line-height:28px; position:absolute; left:20px;} .button:hover {color:#FFF;} @@ -225,7 +225,7 @@ button{ position:absolute; top:0px; right:0px; - background:#28b78d; + background:@cms_brand_primary; } .cms_add_button:hover {background:#189671;} .button_action { @@ -234,38 +234,32 @@ button{ font-size:13px; position:relative; margin-left:20px; - background:#152129; + background: @gray_dark; padding:0px 10px 0px 30px; } .button_action i {line-height:25px; left:10px;} -.button_action:hover {background:#1f3441;} +.button_action:hover {background:#1f3441;}*/ /*-------------------------------------------------------------- # BACK BUTTON --------------------------------------------------------------*/ .back_button {display:block; float:left; height:30px; width:25px; background:#1f3441; text-align:center; line-height:30px; color:#FFF; font-size:20px; margin-right:10px;} -.back_button:hover {background:#28b78d; color:#FFF;} - -/*-------------------------------------------------------------- -# Content Tables ---------------------------------------------------------------*/ -.content_table_headline {margin-bottom:10px;} +.back_button:hover {background:@cms_brand_primary; color:#FFF;} /*-------------------------------------------------------------- # Table Footer --------------------------------------------------------------*/ -.table_footer {float:right; text-align:right; line-height:25px; margin-top:20px; display:block; color:#666; margin-bottom:20px;} +.table_footer {float:right; text-align:right; line-height:25px; margin-top:20px; display:block; color: @text_color; margin-bottom:20px;} .cms_paging {float:right; margin-left:10px; display:block; /*border:solid 1px #CCC;*/ background:#FFF;} .cms_paging ul {list-style-type:none;} .cms_paging ul li {float:left; margin-right:2px;} .cms_paging ul li:last-child {margin-right:0px;} .cms_paging ul li a {transition:all 0.3s; color:#FFF; text-align:center; display:block; height:25px; width:25px; line-height:25px; background:#CCC;} .cms_paging ul li i {} -.cms_paging ul li.active a {background:#28b78d; color:#FFF;} -.cms_paging ul li a:hover {background:#28b78d; color:#FFF;} - +.cms_paging ul li.active a {background:@cms_brand_primary; color:#FFF;} +.cms_paging ul li a:hover {background:@cms_brand_primary; color:#FFF;} /*-------------------------------------------------------------- # Breakpoints diff --git a/src/components/my-form.vue b/src/components/my-form.vue index 7f7ba2a..44c5aa5 100644 --- a/src/components/my-form.vue +++ b/src/components/my-form.vue @@ -14,7 +14,7 @@
- +
@@ -70,9 +70,9 @@ export default { }, buttonClick(type) { switch(type) { - case 'submit': - this.submit(); - break; + case 'submit': + this.submit(); + break; } }, submit() { diff --git a/src/components/my-table.vue b/src/components/my-table.vue index a384095..38d358d 100644 --- a/src/components/my-table.vue +++ b/src/components/my-table.vue @@ -1,215 +1,274 @@ diff --git a/src/components/scroll-table.vue b/src/components/scroll-table.vue index 73b2e00..a6d82e5 100644 --- a/src/components/scroll-table.vue +++ b/src/components/scroll-table.vue @@ -20,131 +20,131 @@ import MyInput from './my-input.vue'; import { ObserveVisibility } from 'vue-observe-visibility/dist/vue-observe-visibility'; export default { - name: "ScrollTable", - directives: { - ObserveVisibility - }, - components: { - MyTable, - MyInput - }, - props: { + name: "ScrollTable", + directives: { + ObserveVisibility + }, + components: { + MyTable, + MyInput + }, + props: { actions: { type: Array, default() { return [ ]; } }, - columns: { - type: Array, - default() { - return [ ]; - } - }, - newRows: { - type: Array, - default() { - return [ ]; - } - }, - offset: { - type: Number, - default: 0 - }, - limit: { - type: Number, - default: 10 - }, - orderBy: { - type: String - }, - orderDesc: { - type: Boolean, - default: false - }, - search: { - type: String - }, - loading: { - type: Boolean, - default: false - }, - hasMore: { - type: Boolean, - default: true - }, - handler: { - type: Function, - default: () => {} - } - }, - watch: { - newRows(rows) { - rows.forEach(row => { - this.rowsToPush.push(row); - }); - this.currentOffset += rows.length; + columns: { + type: Array, + default() { + return [ ]; + } + }, + newRows: { + type: Array, + default() { + return [ ]; + } + }, + offset: { + type: Number, + default: 0 + }, + limit: { + type: Number, + default: 10 + }, + orderBy: { + type: String + }, + orderDesc: { + type: Boolean, + default: false + }, + search: { + type: String + }, + loading: { + type: Boolean, + default: false + }, + hasMore: { + type: Boolean, + default: true + }, + handler: { + type: Function, + default: () => {} + } + }, + watch: { + newRows(rows) { + rows.forEach(row => { + this.rowsToPush.push(row); + }); + this.currentOffset += rows.length; this.pushRows(); // for transition }, loading(l) { - if (!l) { + if (!l) { // delay after loading for visibility observer setTimeout(() => { - this.loadingDelayed = false; + this.loadingDelayed = false; }, 200); } else { - this.loadingDelayed = true; + this.loadingDelayed = true; } } }, data() { - return { - rows: [ ], - rowsToPush: [ ], - currentOffset: this.offset, - currentOrderBy: this.orderBy, - currentOrderDesc: this.orderDesc, - currentSearch: this.search, - loadingDelayed: false, - reloadTriggered: false - } + return { + rows: [ ], + rowsToPush: [ ], + currentOffset: this.offset, + currentOrderBy: this.orderBy, + currentOrderDesc: this.orderDesc, + currentSearch: this.search, + loadingDelayed: false, + reloadTriggered: false + } }, methods: { - visibilityChanged(isVisible, entry) { - if (isVisible) { + visibilityChanged(isVisible) { + if (isVisible) { // infinite scrolling this.reloadTriggered = false; this.handler(this.currentOffset, this.limit, this.currentOrderBy, this.currentOrderDesc, this.currentSearch); } }, pushRows() { - let row = this.rowsToPush.shift(); - if (row) { - this.rows.push(row); - setTimeout(() => { - this.pushRows(); - }, 20); - } + let row = this.rowsToPush.shift(); + if (row) { + this.rows.push(row); + setTimeout(() => { + this.pushRows(); + }, 20); + } }, clear() { - this.currentOffset = 0; - this.rows = []; - this.rowsToPush = []; + this.currentOffset = 0; + this.rows = []; + this.rowsToPush = []; }, sort(e) { - if (e.orderBy == this.currentOrderBy) { - this.currentOrderDesc = !this.currentOrderDesc; - } else { - this.currentOrderDesc = false; - } - this.currentOrderBy = e.orderBy; - this.reloadTriggered = true; - this.clear(); + if (e.orderBy == this.currentOrderBy) { + this.currentOrderDesc = !this.currentOrderDesc; + } else { + this.currentOrderDesc = false; + } + this.currentOrderBy = e.orderBy; + this.reloadTriggered = true; + this.clear(); }, searchChanged(e) { - this.currentSearch = e; - this.reloadTriggered = true; - this.clear(); + this.currentSearch = e; + this.reloadTriggered = true; + this.clear(); } } } diff --git a/src/components/sidebar.vue b/src/components/sidebar.vue index b8af8ce..655ef5b 100644 --- a/src/components/sidebar.vue +++ b/src/components/sidebar.vue @@ -14,27 +14,6 @@ - - -
- -
-
Hans Zimmer
Administrator
-
-
-
- -
-
@@ -49,7 +28,7 @@ left: 0px; top: 40px; bottom: 0px; - background: @cms_bg_light; + background: @ui_bg; color: white; width: 70px; transition: all 0.3s; @@ -59,7 +38,8 @@ height:100%; /*overflow-y:scroll;*/ &>.inner { - position:relative; width:auto; + position:relative; + width:auto; } } @@ -84,7 +64,7 @@ } } - &.active {background:#28b78d;} + &.active {background: @cms_brand_primary;} // &.active .fa {background:#19435e;} /*&.active .submenu {border-top:solid 1px rgba(255,255,255,0.2);}*/ @@ -123,7 +103,7 @@ position: absolute; left: 100%; top: 0px; - background: #152129; + background: @gray_dark; width: 180px; height: auto; transition: all 0.3s; @@ -146,7 +126,7 @@ position: absolute; pointer-events: none; border-color: rgba(255, 255, 255, 0); - border-right-color: #f5f3f4; + border-right-color: @gray_light; border-width: 10px; margin-top: -10px; } @@ -155,54 +135,6 @@ } } - /*-------------------------------------------------------------- - # Left Sidebar (User Profile) - --------------------------------------------------------------*/ - .user_profile { - position:fixed; bottom:0px; left:0px; right:0px; cursor:pointer; width:230px; - &>.trigger { - .clearfix(); - display:block; - - // a {display:block; width:100%; height:100%;} - - .image {float:left; width:45px; height:45px; padding-top:7px; text-align:center;} - .image .icon {font-size:22px; color:#FFF;} - .image img {width:70%; margin:0 auto; display:block;} - - .text {float:left; line-height:1; color:#FFF; font-size:14px; padding-left:15px; padding-top: 9px;} - .text .role {font-size:12px; color:rgba(255,255,255,0.5); display:block; margin-top:0px;} - - &:hover {background:rgba(40,183,141,0.3);} - - .btn {position:absolute; right:0px; top:0px; width:auto; height:auto; padding-top:12px; padding-right:20px;} - .btn .icon {color:#FFF; font-size:18px; transition:all 0.3s;} - } - - &>.content { - display:none; color:#FFF; padding-bottom:30px; - - ul{ - list-style-type: none; - - li{ - padding:0px; line-height:1.2; color:#FFF; position:relative; - .icon {color:#FFF; font-size:20px; text-align:center; position:relative; left:0; float:left; height:45px; width:45px; line-height:45px;} - .navigation_text {position:relative; font-size:14px; display:block; color:#FFF; text-align:left; float:left; padding:0px 10px 0px 15px; width:180px; line-height:45px;} - a {color:#FFF; display:block; height:45px;} - &:after {clear:both; content:""; display:block;} - &:hover {background:rgba(40,183,141,0.3);} - } - } - } - - &.open { - background:rgba(40,183,141,0.3); - &>.trigger{background:rgba(40,183,141,0.5);} - .icon-arrow-up{transform: rotate(180deg);} - } - } - @media(max-width: @screen-xs-max) { .sidebar { left:inherit; position:relative; width:100%; top:0px; margin-bottom:30px; diff --git a/src/components/topbar.vue b/src/components/topbar.vue index 8af8a22..c5b9376 100644 --- a/src/components/topbar.vue +++ b/src/components/topbar.vue @@ -1,80 +1,205 @@ + + - \ No newline at end of file + .icon{ + font-size: 22px; + } + + .image, .text, .trigger_btn{ + float: left; + } + + div+div{ + margin-left: 10px; + } + + .image { + max-height: @bar_height - 8px; + img{ + width:70%; margin:0 auto; display:block; + } + } + + .text { + font-size: 12px; + + .role{ + display: block; + font-size: 11px; + color: fade(white, 50%); + } + } + } + + .user_menu { + display: none; + background: @cms_brand_primary; + + ul{ + list-style-type: none; + + li{ + .clearfix(); + .icon { + float: left; + width: 45px; + line-height: 45px; + text-align: center; + font-size: 20px; + } + .title { + float: left; + font-size: 14px; + line-height: 45px; + padding: 0 10px; + } + a { + display: block; + color: white; + height: 45px; + } + &:hover { + background: darken(@cms_brand_primary, 5%); + } + } + } + } + + &.open { + .user_menu{display: block;} + &>.trigger{background: fade(@cms_brand_primary, 50%);} + .trigger_btn .icon:before{transform: rotate(180deg);} + } + } + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 2eb0345..3f76e4c 100644 --- a/src/main.js +++ b/src/main.js @@ -13,212 +13,212 @@ Vue.use(Vuex); const router = new VueRouter(); const store = new Vuex.Store({ - state: { - api: {}, - navigation: [], - persist: { - login: {}, - authToken: '', - jwt: {}, - credentials: {} - } - }, - mutations: { - setAPI(state, payload) { - state.api = payload; + state: { + api: {}, + navigation: [], + persist: { + login: {}, + authToken: '', + jwt: {}, + credentials: {} + } }, - setNavigation(state, payload) { - for (var i = 0; i < payload.length; i++) { - state.navigation.push(payload[i]); // = payload; - } - }, - setCredentials(state, payload) { - state.persist.credentials = { - username: payload.username, - password: payload.password - }; - objectToPersist(state.persist, 'persistantStore'); - }, - setLogin(state, payload) { - state.persist.login = payload.User; - state.persist.authToken = payload.AuthToken; - state.persist.jwt = JwtDecode(payload.AuthToken); - objectToPersist(state.persist, 'persistantStore'); - }, - clearLogin(state) { - state.persist.login = {}; - state.persist.authToken = ''; - state.persist.jwt = {}; - state.persist.credentials = {}; - objectToPersist(state.persist, 'persistantStore'); - } - }, - actions: { - apiRequest(context, payload) { - let doRequest = () => { - return new Promise((resolve, reject) => { - Axios({ - method: payload.method ? payload.method : 'get', - baseURL: context.state.api.baseURL, - url: payload.endpoint, - params: payload.params, - data: payload.data, - headers: { - 'X-Auth-Token': context.state.persist.authToken + mutations: { + setAPI(state, payload) { + state.api = payload; + }, + setNavigation(state, payload) { + for (var i = 0; i < payload.length; i++) { + state.navigation.push(payload[i]); // = payload; } - }) - .then(response => { - console.log(response); - resolve(response.data); - }) - .catch(error => { - console.dir(error); - reject(error); - }) - }); - }; - - if (payload.endpoint != 'login') { - // no jwt check for login call - - // empty username = not logged in - if (!context.state.persist.credentials.username) { - return new Promise((resolve, reject) => { - // show login page - router.push('/login'); - reject(['not logged in']); - }); + }, + setCredentials(state, payload) { + state.persist.credentials = { + username: payload.username, + password: payload.password + }; + objectToPersist(state.persist, 'persistantStore'); + }, + setLogin(state, payload) { + state.persist.login = payload.User; + state.persist.authToken = payload.AuthToken; + state.persist.jwt = JwtDecode(payload.AuthToken); + objectToPersist(state.persist, 'persistantStore'); + }, + clearLogin(state) { + state.persist.login = {}; + state.persist.authToken = ''; + state.persist.jwt = {}; + state.persist.credentials = {}; + objectToPersist(state.persist, 'persistantStore'); } - - let now = Math.round(Date.now() / 1000); - if (context.state.persist.jwt.exp < (now + 300)) { - // too old jwt, logout - return new Promise((resolve, reject) => { - context.commit('clearLogin'); - router.push('/login'); - reject(['jwt too old, logout']); - }); - } - - if ((context.state.persist.jwt.exp - 60) < now) { - // jwt near expire, get new one - console.log("getting new jwt"); - - return context.dispatch('login', context.state.persist.credentials) - .then(() => { - console.log("LOOOGIIIINNN"); - return doRequest(); - }) - .catch(error => { - throw error; - }) - } - } - - return doRequest(); }, - login(context, payload) { - return new Promise((resolve, reject) => { - context.dispatch('apiRequest', { - method: 'post', - endpoint: 'login', - data: payload - }) - .then(data => { - context.commit('setCredentials', payload); - context.commit('setLogin', data); - resolve(data.User); - }) - .catch(error => { - if (error.response && error.response.data && error.response.data.error) { - reject(error.response.data.error); - } else { - reject([]); + actions: { + apiRequest(context, payload) { + let doRequest = () => { + return new Promise((resolve, reject) => { + Axios({ + method: payload.method ? payload.method : 'get', + baseURL: context.state.api.baseURL, + url: payload.endpoint, + params: payload.params, + data: payload.data, + headers: { + 'X-Auth-Token': context.state.persist.authToken + } + }) + .then(response => { + console.log(response); + resolve(response.data); + }) + .catch(error => { + console.dir(error); + reject(error); + }) + }); + }; + + if (payload.endpoint != 'login') { + // no jwt check for login call + + // empty username = not logged in + if (!context.state.persist.credentials.username) { + return new Promise((resolve, reject) => { + // show login page + router.push('/login'); + reject(['not logged in']); + }); + } + + let now = Math.round(Date.now() / 1000); + if (context.state.persist.jwt.exp < (now + 300)) { + // too old jwt, logout + return new Promise((resolve, reject) => { + context.commit('clearLogin'); + router.push('/login'); + reject(['jwt too old, logout']); + }); + } + + if ((context.state.persist.jwt.exp - 60) < now) { + // jwt near expire, get new one + console.log("getting new jwt"); + + return context.dispatch('login', context.state.persist.credentials) + .then(() => { + console.log("LOOOGIIIINNN"); + return doRequest(); + }) + .catch(error => { + throw error; + }) + } } - }); - }); + + return doRequest(); + }, + login(context, payload) { + return new Promise((resolve, reject) => { + context.dispatch('apiRequest', { + method: 'post', + endpoint: 'login', + data: payload + }) + .then(data => { + context.commit('setCredentials', payload); + context.commit('setLogin', data); + resolve(data.User); + }) + .catch(error => { + if (error.response && error.response.data && error.response.data.error) { + reject(error.response.data.error); + } else { + reject([]); + } + }); + }); + } } - } }); function objectToPersist(obj, key) { - try { - const serialized = JSON.stringify(obj); - localStorage.setItem(key ? key : 'persistant', serialized); - } catch (error) { - console.error(error); - } -}; + try { + const serialized = JSON.stringify(obj); + localStorage.setItem(key ? key : 'persistant', serialized); + } catch (error) { + console.error(error); + } +} function persistToObject(key) { - try { - const serialized = localStorage.getItem(key ? key : 'persistant'); - if (serialized === null) { - return undefined; + try { + const serialized = localStorage.getItem(key ? key : 'persistant'); + if (serialized === null) { + return undefined; + } + return JSON.parse(serialized); + } catch (error) { + console.log(error); + return undefined; } - return JSON.parse(serialized); - } catch (error) { - console.log(error); - return undefined; - } } // get store persist part from localStorage let persist = persistToObject('persistantStore'); if (persist) { - store.state.persist = persist; + store.state.persist = persist; } // load init Axios.get('conf/init.json') - .then(results => { - // set navigation - if (!Array.isArray(results.data.navigation)) { - alert('invalid data in init.json'); - return; - } - const navigation = results.data.navigation.map(({name, to, icon, show}) => {return {name, to, icon, show}}); + .then(results => { + // set navigation + if (!Array.isArray(results.data.navigation)) { + alert('invalid data in init.json'); + return; + } + const navigation = results.data.navigation.map(({name, to, icon, show}) => {return {name, to, icon, show}}); - store.commit("setNavigation", navigation); + store.commit("setNavigation", navigation); - // set api config in store - store.commit("setAPI", results.data.api); + // set api config in store + store.commit("setAPI", results.data.api); - // add routes - let routes = []; - let rIdx = 0; - results.data.navigation.forEach(({name, to, content, data}) => routes.push({ - name: name, - path: to, - meta: { - title: name - }, - component: Vue.component(name + rIdx++, { - template: '
' + content + '
', - components: Views, - data: function(data) { - if (typeof data != 'object') { - return () => { return {}; }; - } - return () => { return data; }; - }(data) - }) - })); - router.addRoutes(routes); - router.beforeEach((to, from, next) => { - console.log(to); - document.title = (to.meta && to.meta.title) ? results.data.title + ': ' + to.meta.title : results.data.title; - next(); - }); + // add routes + let routes = []; + let rIdx = 0; + results.data.navigation.forEach(({name, to, content, data}) => routes.push({ + name: name, + path: to, + meta: { + title: name + }, + component: Vue.component(name + rIdx++, { + template: '
' + content + '
', + components: Views, + data: function(data) { + if (typeof data != 'object') { + return () => { return {}; }; + } + return () => { return data; }; + }(data) + }) + })); + router.addRoutes(routes); + router.beforeEach((to, from, next) => { + console.log(to); + document.title = (to.meta && to.meta.title) ? results.data.title + ': ' + to.meta.title : results.data.title; + next(); + }); - // load app, when init finishs - new Vue({ - el: '#vue-app', - render: h => h(App), - router, - store - }); - }) - .catch(error => { - alert('error loading: ' + error.message); - }); \ No newline at end of file + // load app, when init finishs + new Vue({ + el: '#vue-app', + render: h => h(App), + router, + store + }); + }) + .catch(error => { + alert('error loading: ' + error.message); + }); \ No newline at end of file diff --git a/src/variables.less b/src/variables.less index 1c36911..6b726d8 100644 --- a/src/variables.less +++ b/src/variables.less @@ -3,15 +3,22 @@ @screen-md: 1024px; @screen-lg: 1200px; -@text_color: black; +@font_family: "Open Sans", sans-serif; +@text_color: #333; +@font_size: 14px; + +@line_height_base: 1.4; +@line_height_heading: 1.2; + + +@gray_dark: #152129; +@gray_light: #f5f3f4; -@cms_bg_lighter: #e0e0e0; -@cms_bg_light: #1a2e3b; -@cms_dark_border: #152129; @cms_brand_primary: #28b78d; -@cms_brand_secondary: #152129; +@cms_brand_secondary: #ac1526; +@ui_bg: #1a2e3b; /*****************************************/ diff --git a/src/views/contentdemo.vue b/src/views/contentdemo.vue deleted file mode 100644 index 243e5dc..0000000 --- a/src/views/contentdemo.vue +++ /dev/null @@ -1,294 +0,0 @@ - \ No newline at end of file diff --git a/src/views/forms/formdemo.vue b/src/views/forms/formdemo.vue index 932121b..43331e8 100644 --- a/src/views/forms/formdemo.vue +++ b/src/views/forms/formdemo.vue @@ -8,13 +8,12 @@ - +
Hier steht ein Beschreibungstext für etwas begriffsstutzige Menschen, die eine Beschreibung zum Befüllen des Feldes brauchen.
-
@@ -23,10 +22,10 @@
Hier steht ein Beschreibungstext für etwas begriffsstutzige Menschen, die eine Beschreibung zum Befüllen des Feldes brauchen.
- + - +
Feldergruppe
@@ -36,7 +35,7 @@ - +
diff --git a/src/views/forms/login.vue b/src/views/forms/login.vue index 5871d14..d7f64b6 100644 --- a/src/views/forms/login.vue +++ b/src/views/forms/login.vue @@ -1,9 +1,4 @@ - - \ No newline at end of file diff --git a/src/views/lists/userlist.vue b/src/views/lists/userlist.vue index aa9a88c..77b3f71 100644 --- a/src/views/lists/userlist.vue +++ b/src/views/lists/userlist.vue @@ -38,12 +38,12 @@ export default { heading: 'ID', prop: 'ID', orderBy: 'id', - align: 'left' + align: 'right' }, { heading: 'Benutzername', prop: 'Username', orderBy: 'username', - align: 'center' + align: 'left' }, { heading: 'Firma', prop: 'Company', @@ -66,7 +66,7 @@ export default { }, { heading: 'Render', render(row) { - return 'ID:' + row.ID; + return 'ID:' + row.ID; } }], newRows: [ ], diff --git a/webpack.config.js b/webpack.config.js index c868519..d3bd182 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,63 +13,62 @@ var env = process.env.WEBPACK_ENV; // Differ settings based on production flag if (env === 'production') { - var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin; + var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin; - plugins.push(new UglifyJsPlugin({ - minimize: true, - sourceMap: true - } - )); - plugins.push(new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: '"production"' - } - } - )); + plugins.push(new UglifyJsPlugin({ + minimize: true, + sourceMap: true + } + )); + plugins.push(new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: '"production"' + } + } + )); - appName = appName + '.js'; + appName = appName + '.js'; } else { - appName = appName + '.js'; + appName = appName + '.js'; } // Main Settings config module.exports = { - entry: [ - 'intersection-observer', - 'babel-polyfill', - entryPoint - ], - devtool: 'source-map', - output: { - path: exportPath, - publicPath: '/build', - filename: appName - }, - module: { - loaders: [ - { - test: /\.(vue|js)$/, - loader: 'eslint-loader', - exclude: /node_modules/ - }, - { - test: /\.vue$/, - loader: 'vue-loader' - }, - { - test: /\.js$/, - exclude: /(node_modules|bower_components)/, - loader: 'babel-loader', - query: { - presets: ['es2015'] - } - } - ] - }, - resolve: { - alias: { - 'vue$': 'vue/dist/vue.esm.js' - } - }, - plugins + entry: [ + 'intersection-observer', + 'babel-polyfill', + entryPoint + ], + devtool: 'source-map', + output: { + path: exportPath, + publicPath: '/build', + filename: appName + }, + module: { + loaders: [{ + enforce: "pre", + test: /\.(vue|js)$/, + loader: 'eslint-loader', + exclude: /node_modules/ + }, { + test: /\.vue$/, + loader: 'vue-loader' + }, { + test: /\.js$/, + exclude: /(node_modules|bower_components)/, + loader: 'babel-loader', + query: { + presets: ['es2015'] + } + }] + }, + resolve: { + alias: { + 'vue$': 'vue/dist/vue.esm.js' + }, + modules: [path.resolve(__dirname, "src"), "node_modules"], + extensions: [".vue", ".js", ".less"] + }, + plugins }; \ No newline at end of file