Use double quotes for JS files to avoid confused Go developers
This commit is contained in:
parent
c5e2783b8d
commit
8d4291de38
18 changed files with 266 additions and 266 deletions
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
'comma-dangle': ['error', 'always-multiline'],
|
||||
indent: ['error', 4],
|
||||
'linebreak-style': ['error', 'unix'],
|
||||
quotes: ['error', 'single'],
|
||||
quotes: ['error', 'double'], // Easier for Go developers!
|
||||
semi: ['error', 'always'],
|
||||
'no-unused-vars': ['warn'],
|
||||
'no-console': 0,
|
||||
|
|
|
@ -1,64 +1,64 @@
|
|||
const path = require('path');
|
||||
const findChrome = require('chrome-finder');
|
||||
const path = require("path");
|
||||
const findChrome = require("chrome-finder");
|
||||
|
||||
process.env.CHROME_BIN = findChrome();
|
||||
|
||||
module.exports = (config) => {
|
||||
config.set({
|
||||
frameworks: ['mocha'],
|
||||
frameworks: ["mocha"],
|
||||
|
||||
browsers: ['LocalChrome'],
|
||||
browsers: ["LocalChrome"],
|
||||
|
||||
customLaunchers: {
|
||||
LocalChrome: {
|
||||
base: 'ChromeHeadless',
|
||||
flags: ['--disable-translate', '--disable-extensions', '--no-sandbox', '--disable-web-security'],
|
||||
}
|
||||
base: "ChromeHeadless",
|
||||
flags: ["--disable-translate", "--disable-extensions", "--no-sandbox", "--disable-web-security"],
|
||||
},
|
||||
},
|
||||
|
||||
files: [
|
||||
{pattern: 'tests/**/*_test.js', watched: false}
|
||||
{pattern: "tests/**/*_test.js", watched: false},
|
||||
],
|
||||
|
||||
// Preprocess through webpack
|
||||
preprocessors: {
|
||||
'tests/**/*_test.js': ['webpack']
|
||||
"tests/**/*_test.js": ["webpack"],
|
||||
},
|
||||
|
||||
reporters: ['progress', 'html'],
|
||||
reporters: ["progress", "html"],
|
||||
|
||||
htmlReporter: {
|
||||
outputFile: 'tests/result.html'
|
||||
outputFile: "tests/result.html",
|
||||
},
|
||||
|
||||
webpack: {
|
||||
mode: 'development',
|
||||
mode: "development",
|
||||
|
||||
resolve: {
|
||||
modules: [
|
||||
path.join(__dirname, 'src'),
|
||||
path.join(__dirname, 'node_modules'),
|
||||
path.join(__dirname, 'tests'),
|
||||
path.join(__dirname, "src"),
|
||||
path.join(__dirname, "node_modules"),
|
||||
path.join(__dirname, "tests"),
|
||||
],
|
||||
alias: {
|
||||
vue: 'vue/dist/vue.js'
|
||||
}
|
||||
vue: "vue/dist/vue.js",
|
||||
},
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
loader: "babel-loader",
|
||||
exclude: file => (
|
||||
/node_modules/.test(file)
|
||||
),
|
||||
query: {
|
||||
presets: ['@babel/preset-env'],
|
||||
compact: false
|
||||
presets: ["@babel/preset-env"],
|
||||
compact: false,
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
singleRun: true,
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
"scripts": {
|
||||
"dev": "webpack --watch",
|
||||
"build": "webpack --optimize-minimize",
|
||||
"lint": "eslint --cache src/ webpack.*.js",
|
||||
"fmt": "eslint --cache --fix src/ webpack.*.js",
|
||||
"lint": "eslint --cache src/ *.js",
|
||||
"fmt": "eslint --cache --fix src/ *.js",
|
||||
"test": "karma start"
|
||||
},
|
||||
"babel": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = ({ file, options, env }) => ({
|
||||
module.exports = {
|
||||
plugins: {
|
||||
"postcss-import": {},
|
||||
"postcss-preset-env": true,
|
||||
"cssnano": env === "production",
|
||||
}
|
||||
});
|
||||
"postcss-preset-env": {},
|
||||
"cssnano": {},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import Vue from 'vue';
|
||||
import Vuetify from 'vuetify';
|
||||
import Router from 'vue-router';
|
||||
import '../css/app.css';
|
||||
import App from 'app/main.vue';
|
||||
import routes from 'app/routes';
|
||||
import Api from 'common/api';
|
||||
import Config from 'common/config';
|
||||
import Components from 'component/init';
|
||||
import Maps from 'maps/init';
|
||||
import Alert from 'common/alert';
|
||||
import Gallery from 'common/gallery';
|
||||
import Session from 'common/session';
|
||||
import Event from 'pubsub-js';
|
||||
import Moment from 'vue-moment';
|
||||
import InfiniteScroll from 'vue-infinite-scroll';
|
||||
import VueTruncate from 'vue-truncate-filter';
|
||||
import VueFullscreen from 'vue-fullscreen';
|
||||
import Vue from "vue";
|
||||
import Vuetify from "vuetify";
|
||||
import Router from "vue-router";
|
||||
import "../css/app.css";
|
||||
import App from "app/main.vue";
|
||||
import routes from "app/routes";
|
||||
import Api from "common/api";
|
||||
import Config from "common/config";
|
||||
import Components from "component/init";
|
||||
import Maps from "maps/init";
|
||||
import Alert from "common/alert";
|
||||
import Gallery from "common/gallery";
|
||||
import Session from "common/session";
|
||||
import Event from "pubsub-js";
|
||||
import Moment from "vue-moment";
|
||||
import InfiniteScroll from "vue-infinite-scroll";
|
||||
import VueTruncate from "vue-truncate-filter";
|
||||
import VueFullscreen from "vue-fullscreen";
|
||||
|
||||
// Initialize client-side session
|
||||
const session = new Session(window.localStorage);
|
||||
|
@ -32,15 +32,15 @@ Vue.prototype.$config = config;
|
|||
// Register Vuetify
|
||||
Vue.use(Vuetify, {
|
||||
theme: {
|
||||
primary: '#FFD600',
|
||||
secondary: '#b0bec5',
|
||||
accent: '#00B8D4',
|
||||
error: '#E57373',
|
||||
info: '#00B8D4',
|
||||
success: '#00BFA5',
|
||||
warning: '#FFD600',
|
||||
delete: '#E57373',
|
||||
love: '#EF5350',
|
||||
primary: "#FFD600",
|
||||
secondary: "#b0bec5",
|
||||
accent: "#00B8D4",
|
||||
error: "#E57373",
|
||||
info: "#00B8D4",
|
||||
success: "#00BFA5",
|
||||
warning: "#FFD600",
|
||||
delete: "#E57373",
|
||||
love: "#EF5350",
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -56,14 +56,14 @@ Vue.use(Router);
|
|||
// Configure client-side routing
|
||||
const router = new Router({
|
||||
routes,
|
||||
mode: 'history',
|
||||
mode: "history",
|
||||
saveScrollPosition: true,
|
||||
});
|
||||
|
||||
// Run app
|
||||
/* eslint-disable no-unused-vars */
|
||||
const app = new Vue({
|
||||
el: '#app',
|
||||
el: "#app",
|
||||
router,
|
||||
render: h => h(App),
|
||||
});
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
import Photos from 'app/pages/photos.vue';
|
||||
import PhotosEdit from 'app/pages/photosEdit.vue';
|
||||
import Albums from 'app/pages/albums.vue';
|
||||
import Albums2 from 'app/pages/albums2.vue';
|
||||
import Import2 from 'app/pages/import2.vue';
|
||||
import Import3 from 'app/pages/import3.vue';
|
||||
import Import from 'app/pages/import.vue';
|
||||
import Export from 'app/pages/export.vue';
|
||||
import Settings from 'app/pages/settings.vue';
|
||||
import Tags from 'app/pages/tags.vue';
|
||||
import Todo from 'app/pages/todo.vue';
|
||||
import Places from 'app/pages/places.vue';
|
||||
import Calendar from 'app/pages/calendar.vue';
|
||||
import Photos from "app/pages/photos.vue";
|
||||
import PhotosEdit from "app/pages/photosEdit.vue";
|
||||
import Albums from "app/pages/albums.vue";
|
||||
import Albums2 from "app/pages/albums2.vue";
|
||||
import Import2 from "app/pages/import2.vue";
|
||||
import Import3 from "app/pages/import3.vue";
|
||||
import Import from "app/pages/import.vue";
|
||||
import Export from "app/pages/export.vue";
|
||||
import Settings from "app/pages/settings.vue";
|
||||
import Tags from "app/pages/tags.vue";
|
||||
import Todo from "app/pages/todo.vue";
|
||||
import Places from "app/pages/places.vue";
|
||||
import Calendar from "app/pages/calendar.vue";
|
||||
|
||||
export default [
|
||||
{ name: 'Home', path: '/', redirect: '/photos' },
|
||||
{ name: 'Photos', path: '/photos', component: Photos },
|
||||
{ name: 'PhotosEdit', path: '/photosEdit', component: PhotosEdit },
|
||||
{ name: 'Filters', path: '/filters', component: Todo },
|
||||
{ name: 'Calendar', path: '/calendar', component: Calendar },
|
||||
{ name: 'Tags', path: '/tags', component: Tags },
|
||||
{ name: 'Bookmarks', path: '/bookmarks', component: Todo },
|
||||
{ name: 'Favorites', path: '/favorites', component: Todo },
|
||||
{ name: 'Places', path: '/places', component: Places },
|
||||
{ name: 'Albums', path: '/albums', component: Albums },
|
||||
{ name: 'Albums2', path: '/albums2', component: Albums2 },
|
||||
{ name: 'Import', path: '/import', component: Import },
|
||||
{ name: 'Import2', path: '/import2', component: Import2 },
|
||||
{ name: 'Import3', path: '/import3', component: Import3 },
|
||||
{ name: 'Export', path: '/export', component: Export },
|
||||
{ name: 'Settings', path: '/settings', component: Settings },
|
||||
{ path: '*', redirect: '/photos' },
|
||||
{ name: "Home", path: "/", redirect: "/photos" },
|
||||
{ name: "Photos", path: "/photos", component: Photos },
|
||||
{ name: "PhotosEdit", path: "/photosEdit", component: PhotosEdit },
|
||||
{ name: "Filters", path: "/filters", component: Todo },
|
||||
{ name: "Calendar", path: "/calendar", component: Calendar },
|
||||
{ name: "Tags", path: "/tags", component: Tags },
|
||||
{ name: "Bookmarks", path: "/bookmarks", component: Todo },
|
||||
{ name: "Favorites", path: "/favorites", component: Todo },
|
||||
{ name: "Places", path: "/places", component: Places },
|
||||
{ name: "Albums", path: "/albums", component: Albums },
|
||||
{ name: "Albums2", path: "/albums2", component: Albums2 },
|
||||
{ name: "Import", path: "/import", component: Import },
|
||||
{ name: "Import2", path: "/import2", component: Import2 },
|
||||
{ name: "Import3", path: "/import3", component: Import3 },
|
||||
{ name: "Export", path: "/export", component: Export },
|
||||
{ name: "Settings", path: "/settings", component: Settings },
|
||||
{ path: "*", redirect: "/photos" },
|
||||
];
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import Event from 'pubsub-js';
|
||||
import Event from "pubsub-js";
|
||||
|
||||
const Alert = {
|
||||
info: function (message) {
|
||||
Event.publish('alert.info', message);
|
||||
Event.publish("alert.info", message);
|
||||
},
|
||||
warning: function (message) {
|
||||
Event.publish('alert.warning', message);
|
||||
Event.publish("alert.warning", message);
|
||||
},
|
||||
error: function (message) {
|
||||
Event.publish('alert.error', message);
|
||||
Event.publish("alert.error", message);
|
||||
},
|
||||
success: function (message) {
|
||||
Event.publish('alert.success', message);
|
||||
Event.publish("alert.success", message);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import axios from 'axios';
|
||||
import Event from 'pubsub-js';
|
||||
import '@babel/polyfill';
|
||||
import axios from "axios";
|
||||
import Event from "pubsub-js";
|
||||
import "@babel/polyfill";
|
||||
|
||||
const Api = axios.create({
|
||||
baseURL: '/api/v1',
|
||||
baseURL: "/api/v1",
|
||||
headers: {common: {
|
||||
'X-Session-Token': window.localStorage.getItem('session_token'),
|
||||
"X-Session-Token": window.localStorage.getItem("session_token"),
|
||||
}},
|
||||
});
|
||||
|
||||
Api.interceptors.request.use(function (config) {
|
||||
// Do something before request is sent
|
||||
Event.publish('ajax.start', config);
|
||||
Event.publish("ajax.start", config);
|
||||
return config;
|
||||
}, function (error) {
|
||||
// Do something with request error
|
||||
|
@ -19,7 +19,7 @@ Api.interceptors.request.use(function (config) {
|
|||
});
|
||||
|
||||
Api.interceptors.response.use(function (response) {
|
||||
Event.publish('ajax.end', response);
|
||||
Event.publish("ajax.end", response);
|
||||
|
||||
return response;
|
||||
}, function (error) {
|
||||
|
@ -27,7 +27,7 @@ Api.interceptors.response.use(function (response) {
|
|||
console.log(error);
|
||||
}
|
||||
|
||||
let errorMessage = 'An error occurred - are you offline?';
|
||||
let errorMessage = "An error occurred - are you offline?";
|
||||
let code = error.code;
|
||||
|
||||
if(error.response && error.response.data) {
|
||||
|
@ -36,11 +36,11 @@ Api.interceptors.response.use(function (response) {
|
|||
errorMessage = data.message ? data.message : data.error;
|
||||
}
|
||||
|
||||
Event.publish('ajax.end');
|
||||
Event.publish('alert.error', errorMessage);
|
||||
Event.publish("ajax.end");
|
||||
Event.publish("alert.error", errorMessage);
|
||||
|
||||
if(code === 401) {
|
||||
window.location = '/';
|
||||
window.location = "/";
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Api from 'common/api';
|
||||
import Api from "common/api";
|
||||
|
||||
class Config {
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@ class Config {
|
|||
*/
|
||||
constructor(storage, values) {
|
||||
this.storage = storage;
|
||||
this.storage_key = 'config';
|
||||
this.storage_key = "config";
|
||||
|
||||
this.values = values;
|
||||
|
||||
|
@ -54,7 +54,7 @@ class Config {
|
|||
}
|
||||
|
||||
pullFromServer() {
|
||||
return Api.get('config').then(
|
||||
return Api.get("config").then(
|
||||
(result) => {
|
||||
this.setValues(result.data);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export const FormPropertyType = Object.freeze({
|
||||
String: 'string',
|
||||
Number: 'number',
|
||||
Object: 'object',
|
||||
String: "string",
|
||||
Number: "number",
|
||||
Object: "object",
|
||||
});
|
||||
|
||||
export default class Form {
|
||||
|
@ -68,11 +68,11 @@ export default class Form {
|
|||
if (
|
||||
this.definition &&
|
||||
this.definition.hasOwnProperty(fieldName) &&
|
||||
this.definition[fieldName].hasOwnProperty('options')
|
||||
this.definition[fieldName].hasOwnProperty("options")
|
||||
) {
|
||||
return this.definition[fieldName].options;
|
||||
}
|
||||
|
||||
return [{ option: '', label: '' }];
|
||||
return [{ option: "", label: "" }];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import PhotoSwipe from 'photoswipe';
|
||||
import PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default.js';
|
||||
import PhotoSwipe from "photoswipe";
|
||||
import PhotoSwipeUI_Default from "photoswipe/dist/photoswipe-ui-default.js";
|
||||
|
||||
class Gallery {
|
||||
constructor() {
|
||||
|
@ -13,7 +13,7 @@ class Gallery {
|
|||
|
||||
createPhotoSizes(photo) {
|
||||
const createPhotoSize = height => ({
|
||||
src: photo.getThumbnailUrl('fit', height),
|
||||
src: photo.getThumbnailUrl("fit", height),
|
||||
w: photo.calculateWidth(height),
|
||||
h: height,
|
||||
title: photo.PhotoTitle,
|
||||
|
@ -32,10 +32,10 @@ class Gallery {
|
|||
|
||||
getEl() {
|
||||
if(!this.el) {
|
||||
const elements = document.querySelectorAll('.pswp');
|
||||
const elements = document.querySelectorAll(".pswp");
|
||||
|
||||
if(elements.length !== 1) {
|
||||
let err = 'There should be only one PhotoSwipe element';
|
||||
let err = "There should be only one PhotoSwipe element";
|
||||
console.log(err, elements);
|
||||
throw err;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Gallery {
|
|||
|
||||
show(photos, index = 0) {
|
||||
if (!Array.isArray(photos) || photos.length === 0 || index >= photos.length) {
|
||||
console.log('Array passed to gallery was empty:', photos);
|
||||
console.log("Array passed to gallery was empty:", photos);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,12 @@ class Gallery {
|
|||
let firstResize = true;
|
||||
let photoSrcWillChange;
|
||||
|
||||
gallery.listen('beforeResize', () => {
|
||||
gallery.listen("beforeResize", () => {
|
||||
realViewportWidth = gallery.viewportSize.x * window.devicePixelRatio;
|
||||
realViewportHeight = gallery.viewportSize.y * window.devicePixelRatio;
|
||||
|
||||
if (!previousSize) {
|
||||
previousSize = 'm';
|
||||
previousSize = "m";
|
||||
}
|
||||
|
||||
nextSize = this.constructor.mapViewportToImageSize(realViewportWidth, realViewportHeight, photosWithSizes[index]);
|
||||
|
@ -104,7 +104,7 @@ class Gallery {
|
|||
});
|
||||
|
||||
|
||||
gallery.listen('gettingData', function (index, item) {
|
||||
gallery.listen("gettingData", function (index, item) {
|
||||
item.src = item[nextSize].src;
|
||||
item.w = item[nextSize].w;
|
||||
item.h = item[nextSize].h;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Api from 'common/api';
|
||||
import User from 'model/user';
|
||||
import Api from "common/api";
|
||||
import User from "model/user";
|
||||
|
||||
class Session {
|
||||
/**
|
||||
|
@ -7,17 +7,17 @@ class Session {
|
|||
*/
|
||||
constructor(storage) {
|
||||
this.storage = storage;
|
||||
this.session_token = this.storage.getItem('session_token');
|
||||
this.session_token = this.storage.getItem("session_token");
|
||||
|
||||
const userJson = this.storage.getItem('user');
|
||||
const userJson = this.storage.getItem("user");
|
||||
|
||||
this.user = userJson !== 'undefined' ? new User(JSON.parse(userJson)) : null;
|
||||
this.user = userJson !== "undefined" ? new User(JSON.parse(userJson)) : null;
|
||||
}
|
||||
|
||||
setToken(token) {
|
||||
this.session_token = token;
|
||||
this.storage.setItem('session_token', token);
|
||||
Api.defaults.headers.common['X-Session-Token'] = token;
|
||||
this.storage.setItem("session_token", token);
|
||||
Api.defaults.headers.common["X-Session-Token"] = token;
|
||||
}
|
||||
|
||||
getToken() {
|
||||
|
@ -26,14 +26,14 @@ class Session {
|
|||
|
||||
deleteToken() {
|
||||
this.session_token = null;
|
||||
this.storage.removeItem('session_token');
|
||||
Api.defaults.headers.common['X-Session-Token'] = '';
|
||||
this.storage.removeItem("session_token");
|
||||
Api.defaults.headers.common["X-Session-Token"] = "";
|
||||
this.deleteUser();
|
||||
}
|
||||
|
||||
setUser(user) {
|
||||
this.user = user;
|
||||
this.storage.setItem('user', JSON.stringify(user.getValues()));
|
||||
this.storage.setItem("user", JSON.stringify(user.getValues()));
|
||||
}
|
||||
|
||||
getUser() {
|
||||
|
@ -45,15 +45,15 @@ class Session {
|
|||
return this.user.userEmail;
|
||||
}
|
||||
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
|
||||
getFullName() {
|
||||
if (this.isUser()) {
|
||||
return this.user.userFirstName + ' ' + this.user.userLastName;
|
||||
return this.user.userFirstName + " " + this.user.userLastName;
|
||||
}
|
||||
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
|
||||
getFirstName() {
|
||||
|
@ -61,7 +61,7 @@ class Session {
|
|||
return this.user.userFirstName;
|
||||
}
|
||||
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
|
||||
isUser() {
|
||||
|
@ -69,7 +69,7 @@ class Session {
|
|||
}
|
||||
|
||||
isAdmin() {
|
||||
return this.user.hasId() && this.user.userRole === 'admin';
|
||||
return this.user.hasId() && this.user.userRole === "admin";
|
||||
}
|
||||
|
||||
isAnonymous() {
|
||||
|
@ -78,13 +78,13 @@ class Session {
|
|||
|
||||
deleteUser() {
|
||||
this.user = null;
|
||||
this.storage.removeItem('user');
|
||||
this.storage.removeItem("user");
|
||||
}
|
||||
|
||||
login(email, password) {
|
||||
this.deleteToken();
|
||||
|
||||
return Api.post('session', { email: email, password: password }).then(
|
||||
return Api.post("session", { email: email, password: password }).then(
|
||||
(result) => {
|
||||
this.setToken(result.data.token);
|
||||
this.setUser(new User(result.data.user));
|
||||
|
@ -97,9 +97,9 @@ class Session {
|
|||
|
||||
this.deleteToken();
|
||||
|
||||
Api.delete('session/' + token).then(
|
||||
Api.delete("session/" + token).then(
|
||||
() => {
|
||||
window.location = '/';
|
||||
window.location = "/";
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import AppAlert from './app-alert.vue';
|
||||
import AppNavigation from './app-navigation.vue';
|
||||
import AppLoadingBar from './app-loading-bar.vue';
|
||||
import AppGallery from './app-gallery.vue';
|
||||
import AppAlert from "./app-alert.vue";
|
||||
import AppNavigation from "./app-navigation.vue";
|
||||
import AppLoadingBar from "./app-loading-bar.vue";
|
||||
import AppGallery from "./app-gallery.vue";
|
||||
|
||||
const components = {};
|
||||
|
||||
components.install = (Vue) => {
|
||||
Vue.component('app-alert', AppAlert);
|
||||
Vue.component('app-gallery', AppGallery);
|
||||
Vue.component('app-navigation', AppNavigation);
|
||||
Vue.component('app-loading-bar', AppLoadingBar);
|
||||
Vue.component("app-alert", AppAlert);
|
||||
Vue.component("app-gallery", AppGallery);
|
||||
Vue.component("app-navigation", AppNavigation);
|
||||
Vue.component("app-loading-bar", AppLoadingBar);
|
||||
};
|
||||
|
||||
export default components;
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import {LMap, LTileLayer, LMarker, LControl} from 'vue2-leaflet';
|
||||
import {Icon} from 'leaflet';
|
||||
import {LMap, LTileLayer, LMarker, LControl} from "vue2-leaflet";
|
||||
import {Icon} from "leaflet";
|
||||
|
||||
const components = {};
|
||||
|
||||
components.install = (Vue) => {
|
||||
Vue.component('l-map', LMap);
|
||||
Vue.component('l-tile-layer', LTileLayer);
|
||||
Vue.component('l-marker', LMarker);
|
||||
Vue.component('l-control', LControl);
|
||||
Vue.component("l-map", LMap);
|
||||
Vue.component("l-tile-layer", LTileLayer);
|
||||
Vue.component("l-marker", LMarker);
|
||||
Vue.component("l-control", LControl);
|
||||
|
||||
delete Icon.Default.prototype._getIconUrl;
|
||||
|
||||
Icon.Default.mergeOptions({
|
||||
iconRetinaUrl: require('./marker/marker-icon-2x-red.png'),
|
||||
iconUrl: require('./marker/marker-icon-red.png'),
|
||||
shadowUrl: require('./marker/marker-shadow.png'),
|
||||
iconRetinaUrl: require("./marker/marker-icon-2x-red.png"),
|
||||
iconUrl: require("./marker/marker-icon-red.png"),
|
||||
shadowUrl: require("./marker/marker-shadow.png"),
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Api from 'common/api';
|
||||
import Form from 'common/form';
|
||||
import Api from "common/api";
|
||||
import Form from "common/form";
|
||||
|
||||
class Abstract {
|
||||
constructor(values) {
|
||||
|
@ -14,7 +14,7 @@ class Abstract {
|
|||
if(!values) return;
|
||||
|
||||
for(let key in values) {
|
||||
if(values.hasOwnProperty(key) && key !== '__originalValues') {
|
||||
if(values.hasOwnProperty(key) && key !== "__originalValues") {
|
||||
this[key] = values[key];
|
||||
this.__originalValues[key] = values[key];
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class Abstract {
|
|||
const result = {};
|
||||
|
||||
for(let key in this.__originalValues) {
|
||||
if(this.__originalValues.hasOwnProperty(key) && key !== '__originalValues') {
|
||||
if(this.__originalValues.hasOwnProperty(key) && key !== "__originalValues") {
|
||||
result[key] = this[key];
|
||||
}
|
||||
}
|
||||
|
@ -72,19 +72,19 @@ class Abstract {
|
|||
id = this.getId();
|
||||
}
|
||||
|
||||
return this.constructor.getCollectionResource() + '/' + id;
|
||||
return this.constructor.getCollectionResource() + "/" + id;
|
||||
}
|
||||
|
||||
getEntityName() {
|
||||
return this.constructor.getModelName() + ' ' + this.getId();
|
||||
return this.constructor.getModelName() + " " + this.getId();
|
||||
}
|
||||
|
||||
static getCollectionResource() {
|
||||
throw new Error('getCollectionResource() needs to be implemented');
|
||||
throw new Error("getCollectionResource() needs to be implemented");
|
||||
}
|
||||
|
||||
static getCreateResource() {
|
||||
return this.getCollectionResource() + '/new';
|
||||
return this.getCollectionResource() + "/new";
|
||||
}
|
||||
|
||||
static getCreateForm() {
|
||||
|
@ -92,7 +92,7 @@ class Abstract {
|
|||
}
|
||||
|
||||
static getModelName() {
|
||||
return 'Item';
|
||||
return "Item";
|
||||
}
|
||||
|
||||
static getSearchForm() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Abstract from 'model/abstract';
|
||||
import Api from 'common/api';
|
||||
import Abstract from "model/abstract";
|
||||
import Api from "common/api";
|
||||
|
||||
class Photo extends Abstract {
|
||||
getEntityName() {
|
||||
|
@ -16,13 +16,13 @@ class Photo extends Abstract {
|
|||
|
||||
getColor() {
|
||||
switch (this.PhotoColor) {
|
||||
case 'brown':
|
||||
case 'black':
|
||||
case 'white':
|
||||
case 'grey':
|
||||
return 'grey lighten-2';
|
||||
case "brown":
|
||||
case "black":
|
||||
case "white":
|
||||
case "grey":
|
||||
return "grey lighten-2";
|
||||
default:
|
||||
return this.PhotoColor + ' lighten-4';
|
||||
return this.PhotoColor + " lighten-4";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,25 +31,25 @@ class Photo extends Abstract {
|
|||
}
|
||||
|
||||
getGoogleMapsLink() {
|
||||
return 'https://www.google.com/maps/place/' + this.PhotoLat + ',' + this.PhotoLong;
|
||||
return "https://www.google.com/maps/place/" + this.PhotoLat + "," + this.PhotoLong;
|
||||
}
|
||||
|
||||
getThumbnailUrl(type, size) {
|
||||
return '/api/v1/thumbnails/' + type + '/' + size + '/' + this.FileHash;
|
||||
return "/api/v1/thumbnails/" + type + "/" + size + "/" + this.FileHash;
|
||||
}
|
||||
|
||||
getThumbnailSrcset() {
|
||||
const result = [];
|
||||
|
||||
result.push(this.getThumbnailUrl('fit', 320) + ' 320w');
|
||||
result.push(this.getThumbnailUrl('fit', 500) + ' 500w');
|
||||
result.push(this.getThumbnailUrl('fit', 720) + ' 720w');
|
||||
result.push(this.getThumbnailUrl('fit', 1280) + ' 1280w');
|
||||
result.push(this.getThumbnailUrl('fit', 1920) + ' 1920w');
|
||||
result.push(this.getThumbnailUrl('fit', 2560) + ' 2560w');
|
||||
result.push(this.getThumbnailUrl('fit', 3840) + ' 3840w');
|
||||
result.push(this.getThumbnailUrl("fit", 320) + " 320w");
|
||||
result.push(this.getThumbnailUrl("fit", 500) + " 500w");
|
||||
result.push(this.getThumbnailUrl("fit", 720) + " 720w");
|
||||
result.push(this.getThumbnailUrl("fit", 1280) + " 1280w");
|
||||
result.push(this.getThumbnailUrl("fit", 1920) + " 1920w");
|
||||
result.push(this.getThumbnailUrl("fit", 2560) + " 2560w");
|
||||
result.push(this.getThumbnailUrl("fit", 3840) + " 3840w");
|
||||
|
||||
return result.join(', ');
|
||||
return result.join(", ");
|
||||
}
|
||||
|
||||
calculateWidth(height) {
|
||||
|
@ -59,15 +59,15 @@ class Photo extends Abstract {
|
|||
getThumbnailSizes() {
|
||||
const result = [];
|
||||
|
||||
result.push('(min-width: 2560px) 3840px');
|
||||
result.push('(min-width: 1920px) 2560px');
|
||||
result.push('(min-width: 1280px) 1920px');
|
||||
result.push('(min-width: 720px) 1280px');
|
||||
result.push('(min-width: 500px) 720px');
|
||||
result.push('(min-width: 320px) 500px');
|
||||
result.push('320px');
|
||||
result.push("(min-width: 2560px) 3840px");
|
||||
result.push("(min-width: 1920px) 2560px");
|
||||
result.push("(min-width: 1280px) 1920px");
|
||||
result.push("(min-width: 720px) 1280px");
|
||||
result.push("(min-width: 500px) 720px");
|
||||
result.push("(min-width: 320px) 500px");
|
||||
result.push("320px");
|
||||
|
||||
return result.join(', ');
|
||||
return result.join(", ");
|
||||
}
|
||||
|
||||
hasLocation() {
|
||||
|
@ -96,10 +96,10 @@ class Photo extends Abstract {
|
|||
} else if (this.CountryName) {
|
||||
location.push(this.CountryName);
|
||||
} else {
|
||||
location.push('Unknown');
|
||||
location.push("Unknown");
|
||||
}
|
||||
|
||||
return location.join(', ');
|
||||
return location.join(", ");
|
||||
}
|
||||
|
||||
getFullLocation() {
|
||||
|
@ -132,10 +132,10 @@ class Photo extends Abstract {
|
|||
} else if (this.CountryName) {
|
||||
location.push(this.CountryName);
|
||||
} else {
|
||||
location.push('Unknown');
|
||||
location.push("Unknown");
|
||||
}
|
||||
|
||||
return location.join(', ');
|
||||
return location.join(", ");
|
||||
}
|
||||
|
||||
getCamera() {
|
||||
|
@ -143,23 +143,23 @@ class Photo extends Abstract {
|
|||
return this.CameraModel;
|
||||
}
|
||||
|
||||
return 'Unknown';
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
like(liked) {
|
||||
if (liked === true) {
|
||||
return Api.post(this.getEntityResource() + '/like');
|
||||
return Api.post(this.getEntityResource() + "/like");
|
||||
} else {
|
||||
return Api.delete(this.getEntityResource() + '/like');
|
||||
return Api.delete(this.getEntityResource() + "/like");
|
||||
}
|
||||
}
|
||||
|
||||
static getCollectionResource() {
|
||||
return 'photos';
|
||||
return "photos";
|
||||
}
|
||||
|
||||
static getModelName() {
|
||||
return 'Photo';
|
||||
return "Photo";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import Abstract from 'model/abstract';
|
||||
import Form from 'common/form';
|
||||
import Api from 'common/api';
|
||||
import Abstract from "model/abstract";
|
||||
import Form from "common/form";
|
||||
import Api from "common/api";
|
||||
|
||||
class User extends Abstract {
|
||||
getEntityName() {
|
||||
return this.userFirstName + ' ' + this.userLastName;
|
||||
return this.userFirstName + " " + this.userLastName;
|
||||
}
|
||||
|
||||
getId() {
|
||||
|
@ -12,30 +12,30 @@ class User extends Abstract {
|
|||
}
|
||||
|
||||
getRegisterForm() {
|
||||
return Api.options(this.getEntityResource() + '/register').then(response => Promise.resolve(new Form(response.data)));
|
||||
return Api.options(this.getEntityResource() + "/register").then(response => Promise.resolve(new Form(response.data)));
|
||||
}
|
||||
|
||||
getProfileForm() {
|
||||
return Api.options(this.getEntityResource() + '/profile').then(response => Promise.resolve(new Form(response.data)));
|
||||
return Api.options(this.getEntityResource() + "/profile").then(response => Promise.resolve(new Form(response.data)));
|
||||
}
|
||||
|
||||
changePassword(oldPassword, newPassword) {
|
||||
return Api.put(this.getEntityResource() + '/password', {
|
||||
return Api.put(this.getEntityResource() + "/password", {
|
||||
password: oldPassword,
|
||||
new_password: newPassword,
|
||||
}).then((response) => Promise.resolve(response.data));
|
||||
}
|
||||
|
||||
saveProfile() {
|
||||
return Api.post(this.getEntityResource() + '/profile', this.getValues()).then((response) => Promise.resolve(this.setValues(response.data)));
|
||||
return Api.post(this.getEntityResource() + "/profile", this.getValues()).then((response) => Promise.resolve(this.setValues(response.data)));
|
||||
}
|
||||
|
||||
static getCollectionResource() {
|
||||
return 'users';
|
||||
return "users";
|
||||
}
|
||||
|
||||
static getModelName() {
|
||||
return 'User';
|
||||
return "User";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
const path = require('path');
|
||||
const path = require("path");
|
||||
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
|
||||
const webpack = require('webpack');
|
||||
const webpack = require("webpack");
|
||||
|
||||
const PATHS = {
|
||||
app: path.join(__dirname, 'src/app.js'),
|
||||
css: path.join(__dirname, 'css'),
|
||||
build: path.join(__dirname, '../assets/server/public/build'),
|
||||
app: path.join(__dirname, "src/app.js"),
|
||||
css: path.join(__dirname, "css"),
|
||||
build: path.join(__dirname, "../assets/server/public/build"),
|
||||
};
|
||||
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
const isDev = process.env.NODE_ENV !== "production";
|
||||
|
||||
const config = {
|
||||
mode: 'production',
|
||||
devtool: isDev ? 'inline-source-map' : false,
|
||||
mode: "production",
|
||||
devtool: isDev ? "inline-source-map" : false,
|
||||
entry: {
|
||||
app: PATHS.app,
|
||||
},
|
||||
output: {
|
||||
path: PATHS.build,
|
||||
filename: '[name].js',
|
||||
filename: "[name].js",
|
||||
},
|
||||
resolve: {
|
||||
modules: [
|
||||
path.join(__dirname, 'src'),
|
||||
path.join(__dirname, 'node_modules'),
|
||||
path.join(__dirname, "src"),
|
||||
path.join(__dirname, "node_modules"),
|
||||
],
|
||||
alias: {
|
||||
vue: 'vue/dist/vue.js',
|
||||
vue: "vue/dist/vue.js",
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css',
|
||||
filename: "[name].css",
|
||||
}),
|
||||
],
|
||||
node: {
|
||||
fs: 'empty',
|
||||
fs: "empty",
|
||||
},
|
||||
performance: {
|
||||
hints: 'warning',
|
||||
hints: "warning",
|
||||
maxEntrypointSize: 1512000,
|
||||
maxAssetSize: 1512000,
|
||||
},
|
||||
|
@ -50,30 +50,30 @@ const config = {
|
|||
test: /\.js$/,
|
||||
include: PATHS.app,
|
||||
exclude: /node_modules/,
|
||||
enforce: 'pre',
|
||||
loader: 'eslint-loader',
|
||||
enforce: "pre",
|
||||
loader: "eslint-loader",
|
||||
options: {
|
||||
formatter: require('eslint-formatter-pretty'),
|
||||
formatter: require("eslint-formatter-pretty"),
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
loader: "vue-loader",
|
||||
options: {
|
||||
loaders: {
|
||||
js: 'babel-loader',
|
||||
css: 'css-loader',
|
||||
js: "babel-loader",
|
||||
css: "css-loader",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
loader: "babel-loader",
|
||||
exclude: file => (
|
||||
/node_modules/.test(file)
|
||||
),
|
||||
query: {
|
||||
presets: ['@babel/preset-env'],
|
||||
presets: ["@babel/preset-env"],
|
||||
compact: false,
|
||||
},
|
||||
},
|
||||
|
@ -86,101 +86,101 @@ const config = {
|
|||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
hmr: false,
|
||||
fallback: 'vue-style-loader',
|
||||
fallback: "vue-style-loader",
|
||||
use: [
|
||||
// "vue-style-loader",
|
||||
'style-loader',
|
||||
"style-loader",
|
||||
{
|
||||
loader: 'css-loader',
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
importLoaders: 1,
|
||||
sourceMap: isDev,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
loader: "postcss-loader",
|
||||
options: {
|
||||
sourceMap: isDev,
|
||||
config: {
|
||||
path: path.resolve(__dirname, './postcss.config.js'),
|
||||
path: path.resolve(__dirname, "./postcss.config.js"),
|
||||
},
|
||||
},
|
||||
},
|
||||
'resolve-url-loader',
|
||||
"resolve-url-loader",
|
||||
],
|
||||
publicPath: PATHS.build,
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
"css-loader",
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
include: /node_modules/,
|
||||
loaders: [
|
||||
'vue-style-loader',
|
||||
'style-loader',
|
||||
"vue-style-loader",
|
||||
"style-loader",
|
||||
{
|
||||
loader: 'css-loader',
|
||||
loader: "css-loader",
|
||||
options: { importLoaders: 1, sourceMap: isDev },
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
loader: "postcss-loader",
|
||||
options: {
|
||||
sourceMap: isDev,
|
||||
config: {
|
||||
path: path.resolve(__dirname, './postcss.config.js'),
|
||||
path: path.resolve(__dirname, "./postcss.config.js"),
|
||||
},
|
||||
},
|
||||
},
|
||||
'resolve-url-loader',
|
||||
"resolve-url-loader",
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.s[c|a]ss$/,
|
||||
use: [
|
||||
'vue-style-loader',
|
||||
'style-loader',
|
||||
"vue-style-loader",
|
||||
"style-loader",
|
||||
{
|
||||
loader: 'css-loader',
|
||||
loader: "css-loader",
|
||||
options: { importLoaders: 2, sourceMap: isDev },
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
loader: "postcss-loader",
|
||||
options: {
|
||||
sourceMap: isDev,
|
||||
config: {
|
||||
path: path.resolve(__dirname, './postcss.config.js'),
|
||||
path: path.resolve(__dirname, "./postcss.config.js"),
|
||||
},
|
||||
},
|
||||
},
|
||||
'resolve-url-loader',
|
||||
'sass-loader',
|
||||
"resolve-url-loader",
|
||||
"sass-loader",
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|jpeg|gif)$/,
|
||||
loader: 'file-loader',
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: '[hash].[ext]',
|
||||
publicPath: '/assets/build/img',
|
||||
outputPath: 'img',
|
||||
name: "[hash].[ext]",
|
||||
publicPath: "/assets/build/img",
|
||||
outputPath: "img",
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'file-loader',
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: '[hash].[ext]',
|
||||
publicPath: '/assets/build/fonts',
|
||||
outputPath: 'fonts',
|
||||
name: "[hash].[ext]",
|
||||
publicPath: "/assets/build/fonts",
|
||||
outputPath: "fonts",
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.svg/,
|
||||
use: {
|
||||
loader: 'svg-url-loader',
|
||||
loader: "svg-url-loader",
|
||||
options: {},
|
||||
},
|
||||
},
|
||||
|
@ -191,7 +191,7 @@ const config = {
|
|||
// No sourcemap for production
|
||||
if (isDev) {
|
||||
const devToolPlugin = new webpack.SourceMapDevToolPlugin({
|
||||
filename: '[name].map',
|
||||
filename: "[name].map",
|
||||
});
|
||||
|
||||
config.plugins.push(devToolPlugin);
|
||||
|
|
Loading…
Reference in a new issue