From 0ef2b84b13d9ac79b2e8afa67e35004fc9f8a704 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Sat, 18 Feb 2017 11:07:07 +0100 Subject: [PATCH] project started, some html and js files added, showing events and users work communicating with server api --- .bowerrc | 3 + .editorconfig | 14 ++ .gitignore | 9 ++ bower.json | 11 ++ config.xml | 22 +++ gulpfile.js | 51 +++++++ hooks/README.md | 83 ++++++++++++ hooks/after_prepare/010_add_platform_class.js | 94 +++++++++++++ ionic.config.json | 4 + package.json | 26 ++++ scss/ionic.app.scss | 23 ++++ www/css/style.css | 1 + www/img/ionic.png | Bin 0 -> 4757 bytes www/index.html | 56 ++++++++ www/js/app.js | 125 ++++++++++++++++++ www/js/event.js | 57 ++++++++ www/js/events.js | 27 ++++ www/js/menu.js | 15 +++ www/js/translations.js | 7 + www/js/user.js | 54 ++++++++ www/js/users.js | 27 ++++ www/manifest.json | 12 ++ www/service-worker.js | 12 ++ www/templates/event.html | 24 ++++ www/templates/events.html | 17 +++ www/templates/menu.html | 39 ++++++ www/templates/tabs.html | 22 +++ www/templates/user.html | 20 +++ www/templates/users.html | 18 +++ 29 files changed, 873 insertions(+) create mode 100644 .bowerrc create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 bower.json create mode 100644 config.xml create mode 100644 gulpfile.js create mode 100644 hooks/README.md create mode 100755 hooks/after_prepare/010_add_platform_class.js create mode 100644 ionic.config.json create mode 100644 package.json create mode 100644 scss/ionic.app.scss create mode 100644 www/css/style.css create mode 100644 www/img/ionic.png create mode 100644 www/index.html create mode 100644 www/js/app.js create mode 100644 www/js/event.js create mode 100644 www/js/events.js create mode 100644 www/js/menu.js create mode 100644 www/js/translations.js create mode 100644 www/js/user.js create mode 100644 www/js/users.js create mode 100644 www/manifest.json create mode 100644 www/service-worker.js create mode 100644 www/templates/event.html create mode 100644 www/templates/events.html create mode 100644 www/templates/menu.html create mode 100644 www/templates/tabs.html create mode 100644 www/templates/user.html create mode 100644 www/templates/users.html diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..e28246d --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "www/lib" +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..aca2523 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e7a72b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Specifies intentionally untracked files to ignore when using Git +# http://git-scm.com/docs/gitignore + +node_modules/ +platforms/ +plugins/ +npm-debug.log +.idea/ +www/lib/ diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..8f7b554 --- /dev/null +++ b/bower.json @@ -0,0 +1,11 @@ +{ + "name": "HelloIonic", + "private": "true", + "devDependencies": { + "ionic": "driftyco/ionic-bower#1.3.2" + }, + "dependencies": { + "angular-translate": "^2.14.0", + "ui-leaflet": "^2.0.0" + } +} diff --git a/config.xml b/config.xml new file mode 100644 index 0000000..6fa9342 --- /dev/null +++ b/config.xml @@ -0,0 +1,22 @@ + + + openEventsPlatformApp + + An Ionic Framework and Cordova project. + + + Your Name Here + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..00c5ad0 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,51 @@ +var gulp = require('gulp'); +var gutil = require('gulp-util'); +var bower = require('bower'); +var concat = require('gulp-concat'); +var sass = require('gulp-sass'); +var minifyCss = require('gulp-minify-css'); +var rename = require('gulp-rename'); +var sh = require('shelljs'); + +var paths = { + sass: ['./scss/**/*.scss'] +}; + +gulp.task('default', ['sass']); + +gulp.task('sass', function(done) { + gulp.src('./scss/ionic.app.scss') + .pipe(sass()) + .on('error', sass.logError) + .pipe(gulp.dest('./www/css/')) + .pipe(minifyCss({ + keepSpecialComments: 0 + })) + .pipe(rename({ extname: '.min.css' })) + .pipe(gulp.dest('./www/css/')) + .on('end', done); +}); + +gulp.task('watch', ['sass'], function() { + gulp.watch(paths.sass, ['sass']); +}); + +gulp.task('install', ['git-check'], function() { + return bower.commands.install() + .on('log', function(data) { + gutil.log('bower', gutil.colors.cyan(data.id), data.message); + }); +}); + +gulp.task('git-check', function(done) { + if (!sh.which('git')) { + console.log( + ' ' + gutil.colors.red('Git is not installed.'), + '\n Git, the version control system, is required to download Ionic.', + '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', + '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' + ); + process.exit(1); + } + done(); +}); diff --git a/hooks/README.md b/hooks/README.md new file mode 100644 index 0000000..d2563ea --- /dev/null +++ b/hooks/README.md @@ -0,0 +1,83 @@ + +# Cordova Hooks + +This directory may contain scripts used to customize cordova commands. This +directory used to exist at `.cordova/hooks`, but has now been moved to the +project root. Any scripts you add to these directories will be executed before +and after the commands corresponding to the directory name. Useful for +integrating your own build systems or integrating with version control systems. + +__Remember__: Make your scripts executable. + +## Hook Directories +The following subdirectories will be used for hooks: + + after_build/ + after_compile/ + after_docs/ + after_emulate/ + after_platform_add/ + after_platform_rm/ + after_platform_ls/ + after_plugin_add/ + after_plugin_ls/ + after_plugin_rm/ + after_plugin_search/ + after_prepare/ + after_run/ + after_serve/ + before_build/ + before_compile/ + before_docs/ + before_emulate/ + before_platform_add/ + before_platform_rm/ + before_platform_ls/ + before_plugin_add/ + before_plugin_ls/ + before_plugin_rm/ + before_plugin_search/ + before_prepare/ + before_run/ + before_serve/ + pre_package/ <-- Windows 8 and Windows Phone only. + +## Script Interface + +All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: + +* CORDOVA_VERSION - The version of the Cordova-CLI. +* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). +* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) +* CORDOVA_HOOK - Path to the hook that is being executed. +* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) + +If a script returns a non-zero exit code, then the parent cordova command will be aborted. + + +## Writing hooks + +We highly recommend writting your hooks using Node.js so that they are +cross-platform. Some good examples are shown here: + +[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) + diff --git a/hooks/after_prepare/010_add_platform_class.js b/hooks/after_prepare/010_add_platform_class.js new file mode 100755 index 0000000..bda3e41 --- /dev/null +++ b/hooks/after_prepare/010_add_platform_class.js @@ -0,0 +1,94 @@ +#!/usr/bin/env node + +// Add Platform Class +// v1.0 +// Automatically adds the platform class to the body tag +// after the `prepare` command. By placing the platform CSS classes +// directly in the HTML built for the platform, it speeds up +// rendering the correct layout/style for the specific platform +// instead of waiting for the JS to figure out the correct classes. + +var fs = require('fs'); +var path = require('path'); + +var rootdir = process.argv[2]; + +function addPlatformBodyTag(indexPath, platform) { + // add the platform class to the body tag + try { + var platformClass = 'platform-' + platform; + var cordovaClass = 'platform-cordova platform-webview'; + + var html = fs.readFileSync(indexPath, 'utf8'); + + var bodyTag = findBodyTag(html); + if(!bodyTag) return; // no opening body tag, something's wrong + + if(bodyTag.indexOf(platformClass) > -1) return; // already added + + var newBodyTag = bodyTag; + + var classAttr = findClassAttr(bodyTag); + if(classAttr) { + // body tag has existing class attribute, add the classname + var endingQuote = classAttr.substring(classAttr.length-1); + var newClassAttr = classAttr.substring(0, classAttr.length-1); + newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote; + newBodyTag = bodyTag.replace(classAttr, newClassAttr); + + } else { + // add class attribute to the body tag + newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">'); + } + + html = html.replace(bodyTag, newBodyTag); + + fs.writeFileSync(indexPath, html, 'utf8'); + + process.stdout.write('add to body class: ' + platformClass + '\n'); + } catch(e) { + process.stdout.write(e); + } +} + +function findBodyTag(html) { + // get the body tag + try{ + return html.match(/])(.*?)>/gi)[0]; + }catch(e){} +} + +function findClassAttr(bodyTag) { + // get the body tag's class attribute + try{ + return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0]; + }catch(e){} +} + +if (rootdir) { + + // go through each of the platform directories that have been prepared + var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); + + for(var x=0; xmVT@%kmc!U*I1<^S(5R@!u0{5U zgR+#J5K0kQl7zfEztj1>f4t{?uIqWe%XQ!P=l*=YpXa)s>!Dd)FyY}8=L7(N$IKLE zb2w6d-t4T0&vso*@8KXuGIAi<61_-am>?XW?@9E)LCgpkZ=4Md;~5^){_FSu6b`lv55PffaKXfoAnf76dCC3^6@V}d!eL0nAUh(_?^hMA ze264sun#c+VrU3Cg~nj<{y*2J|01B#2s8g+62>2kGeaR|4keWFcuxe}@a$O_>MTlC zMavitH&Qi#slhc>RE^*&C=Gp81C?J~6cHOj!1ic$G5A-#zqy|O?#1w5xzIy1(4Qy!zfSts)?xenoc`0dhl_tYALoDA z?m>rry%kc=1ps{PW+;6-^28?>jx4+9!sTMj9pE8q&8ZqrYCO9#yC$WFeu~PkPDja_ zSp>nj3bFLgS%D6+v!Rth_PK!)b}ASB466}G0jEN-`(cHJ5{|OyKW{8JNQvJ3xO#o{ z$D92n%QwN(*T26(zS&xCa@$%W*sIL0y2yKJUM&;04yKQw(rEc$NqrK#HIj}%sndR2 zJNR^B!Z4xj8+4GDo=(#M6J(swUqFMAD7Q|06)&|7dCZW+IoOT5Nu3aoEG(UwIA53Y zfrowqmFl3`2nc~6(jxe8qK9sl{eGfo=DFpj2;GwQ!|;pNpg+Cxx#nzSiy;X%h|$4P zcm-zci|!SW2`q!Xs9LI*;K~=Kt5P>iNV?W;^dz(CgPacp`n$bt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{wLrZOYnmF16yTPPs~Sr+71R zU^%eRT2^oPL{VpfA~hOXap1>PY9!e|lSS!MEBpXjpHM>OE-bTc5}G8sCq*u2M#Czx zO~}gaBROVdXTquN>LAO@eh6+AC*AS(l zl3u#7+r@=zG3gA{vh)_YwE1YA{@aVFCqtNldgI2>1`Ztti&>Xq-4SnQ-^Utv0gU-I z3vg4!d36t+M?tV0>A8s!TvUNnX52+lr6e|@w1mnmy6%MQ_l>&bn}!WXRgZV8^HrC3 zJRPz&+moMOZF2g+EBrc9JB1CE1eYzqvG_i_>Cy3x_XXKvyJoFZ&`+_x-a%6F5nqhb zAdUg*7pQdWv+Sk*n^xk2A76FW98}gYy3jN#&;d`+jn$Rb*UV)L5Y{`P ze1@;=d6+CQtTdVVn^EC+>u_8}QlD3*sFf+?5in9^ZuH zR-~?cHM4wIAhSda${#^~@hCja8H**4+Vo}lc^SA_*|1vMe)g4gUtxm8 zs&5*&%G+eunV^f_S$xhf_R@=5)D(xlmI1Tnw~Fw!+Xoj;U~ZfiWG(PS@Z`Xl{a*xP ztXu>D+N#bw89|ZhE^)kWDxDfoMCVk{!IyEywX0Z5cNEfje2+0QHIc$yjk0qh8GXt2 z^ph(%oN&gV>O;ozus$GX)%@O5Bth^S2O+<7#;L!y_j2O`WGkYiH$IFKC?%zWJmKow z^O_XwFH5*DtvAko$2g?QY3^g^HSR^O8yAb#En?{@1=m0Nk{cfNeSlsn;{S276{u_* V)A2w7aX)_)nHgO`RT#L({STJyPAvcc literal 0 HcmV?d00001 diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..3f4bd1b --- /dev/null +++ b/www/index.html @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/js/app.js b/www/js/app.js new file mode 100644 index 0000000..fcd54f6 --- /dev/null +++ b/www/js/app.js @@ -0,0 +1,125 @@ +var urlapi = "http://localhost:3000/api/"; + + +angular.module('app', [ + 'ionic', + 'pascalprecht.translate', + 'app.menu', + 'app.events', + 'app.event', + 'app.users', + 'app.user' + ]) + +.run(function($ionicPlatform) { + $ionicPlatform.ready(function() { + // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard + // for form inputs) + if (window.cordova && window.cordova.plugins.Keyboard) { + cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); + cordova.plugins.Keyboard.disableScroll(true); + + } + if (window.StatusBar) { + // org.apache.cordova.statusbar required + StatusBar.styleDefault(); + } + }); +}) + +.config(function($stateProvider, $urlRouterProvider) { + $stateProvider + + // setup an abstract state for the tabs directive + .state('app', { + url: '/app', + abstract: true, + templateUrl: 'templates/menu.html', + controller: 'MenuCtrl' + }) + + // Each tab has its own nav history stack: + + .state('app.events', { + url: '/events', + views: { + 'menuContent': { + templateUrl: 'templates/events.html', + controller: 'EventsCtrl' + } + } + }).state('app.event', { + url: '/events/:eventid', + views: { + 'menuContent': { + templateUrl: 'templates/event.html', + controller: 'EventCtrl' + } + } + }) + .state('app.users', { + url: '/users', + views: { + 'menuContent': { + templateUrl: 'templates/users.html', + controller: 'UsersCtrl' + } + } + }) + .state('app.user', { + url: '/users/:userid', + views: { + 'menuContent': { + templateUrl: 'templates/user.html', + controller: 'UserCtrl' + } + } + }); + + // if none of the above states are matched, use this as the fallback + $urlRouterProvider.otherwise('/app/events'); +}) + /* translator */ + .config(['$translateProvider', function($translateProvider) { + + /* get lang from the file translations.js */ + for (lang in translations) { + $translateProvider.translations(lang, translations[lang]); + } + + if (window.localStorage.getItem('lang')) { + $translateProvider.preferredLanguage(window.localStorage.getItem('lang')); + } else { + $translateProvider.preferredLanguage('english'); + }; + + $translateProvider.useSanitizeValueStrategy('escape'); + + }]) + .factory('httpInterceptor', function httpInterceptor($q, $window, $location) { + return { + request: function(config) { + return config; + }, + requestError: function(config) { + return config; + }, + response: function(res) { + return res; + }, + responseError: function(res) { + return res; + } + } + }) + .factory('api', function($http) { + return { + init: function() { + $http.defaults.headers.common['X-Access-Token'] = localStorage.getItem("cim_app_token"); + $http.defaults.headers.post['X-Access-Token'] = localStorage.getItem("cim_app_token"); + } + }; + }) + .run(function(api) { + api.init(); + }); diff --git a/www/js/event.js b/www/js/event.js new file mode 100644 index 0000000..d545007 --- /dev/null +++ b/www/js/event.js @@ -0,0 +1,57 @@ +angular.module('app.event', ['pascalprecht.translate', 'ui-leaflet']) + +.controller('EventCtrl', function($scope, $http, $ionicModal, + $stateParams, $timeout, $ionicLoading, $filter, + leafletData, leafletBoundsHelpers) { + + + $scope.center= { + lat: 0, + lng: 0, + zoom: 1 + }; + $scope.markers=[]; + $scope.tiles= { + url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + options: { + attribution: 'OpenStreetMap contributors' + } + }; + + + $scope.event={}; + $scope.doRefresh = function() { + /* events refresh: */ + $http.get(urlapi + 'events/id/'+ $stateParams.eventid) + .then(function(data){ + console.log('data success events'); + console.log(data); // for browser console + //$scope.events = data.data; // for UI + $scope.event=data.data; + $scope.$broadcast('scroll.refreshComplete');//refresher stop + + if($scope.event.location) + { + $scope.markers=[]; + $scope.markers.push({ + lat: Number($scope.event.location.geo.lat), + lng: Number($scope.event.location.geo.long), + message: $scope.event.location.name + }); + $scope.center= { + lat: (Number($scope.travel.from.lat)+Number($scope.travel.to.lat))/2, + lng: (Number($scope.travel.from.long)+Number($scope.travel.to.long))/2, + zoom: 4 + }; + } + + }, function(data){ + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete');//refresher stop + $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); + + }); + }; + $scope.doRefresh(); + +}); diff --git a/www/js/events.js b/www/js/events.js new file mode 100644 index 0000000..ebb7724 --- /dev/null +++ b/www/js/events.js @@ -0,0 +1,27 @@ +angular.module('app.events', ['pascalprecht.translate']) + +.controller('EventsCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + + + $scope.events=[]; + $scope.page=0; + $scope.doRefresh = function() { + /* events refresh: */ + $http.get(urlapi + 'events?page=' + $scope.page) + .then(function(data){ + console.log('data success events'); + console.log(data); // for browser console + //$scope.events = data.data; // for UI + $scope.events=data.data; + $scope.$broadcast('scroll.refreshComplete');//refresher stop + + }, function(data){ + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete');//refresher stop + $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); + + }); + }; + $scope.doRefresh(); + +}); diff --git a/www/js/menu.js b/www/js/menu.js new file mode 100644 index 0000000..e0f3ebc --- /dev/null +++ b/www/js/menu.js @@ -0,0 +1,15 @@ +angular.module('app.menu', ['pascalprecht.translate']) + + + .controller('MenuCtrl', function($scope, $window) { + if (localStorage.getItem("events_app_userdata")) { + $scope.storageuser = JSON.parse(localStorage.getItem("events_app_userdata")); + console.log($scope.storageuser); + } + + $scope.logout = function() { + localStorage.removeItem("events_app_token"); + localStorage.removeItem("events_app_userdata"); + $window.location.reload(true); + }; + }); diff --git a/www/js/translations.js b/www/js/translations.js new file mode 100644 index 0000000..a4a946e --- /dev/null +++ b/www/js/translations.js @@ -0,0 +1,7 @@ +var translations = { + "english": { + "Actual_language": "Actual language: ", + "Menu": "Menu", + "Signup": "Signup" + } +}; diff --git a/www/js/user.js b/www/js/user.js new file mode 100644 index 0000000..3febda4 --- /dev/null +++ b/www/js/user.js @@ -0,0 +1,54 @@ +angular.module('app.user', ['pascalprecht.translate', 'ui-leaflet']) + +.controller('UserCtrl', function($scope, $http, $ionicModal, + $stateParams, $timeout, $ionicLoading, $filter, + leafletData, leafletBoundsHelpers) { + + $scope.center= { + lat: 0, + lng: 0, + zoom: 1 + }; + $scope.markers=[]; + $scope.tiles= { + url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + options: { + attribution: 'OpenStreetMap contributors' + } + }; + + $scope.user={}; + $scope.doRefresh = function() { + /* events refresh: */ + $http.get(urlapi + 'users/id/'+ $stateParams.userid) + .then(function(data){ + console.log('data success events'); + console.log(data); // for browser console + //$scope.events = data.data; // for UI + $scope.user=data.data; + $scope.$broadcast('scroll.refreshComplete');//refresher stop + if($scope.user.location) + { + $scope.markers=[]; + $scope.markers.push({ + lat: Number($scope.user.location.geo.lat), + lng: Number($scope.user.location.geo.long), + message: $scope.user.location.name + }); + $scope.center= { + lat: Number($scope.user.location.geo.lat), + lng: Number($scope.user.location.geo.long), + zoom: 16 + }; + } + + }, function(data){ + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete');//refresher stop + $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); + + }); + }; + $scope.doRefresh(); + +}); diff --git a/www/js/users.js b/www/js/users.js new file mode 100644 index 0000000..e0afc0b --- /dev/null +++ b/www/js/users.js @@ -0,0 +1,27 @@ +angular.module('app.users', ['pascalprecht.translate']) + +.controller('UsersCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + + + $scope.users=[]; + $scope.page=0; + $scope.doRefresh = function() { + /* users refresh: */ + $http.get(urlapi + 'users?page=' + $scope.page) + .then(function(data){ + console.log('data success users'); + console.log(data); // for browser console + //$scope.users = data.data; // for UI + $scope.users=data.data; + $scope.$broadcast('scroll.refreshComplete');//refresher stop + + }, function(data){ + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete');//refresher stop + $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); + + }); + }; + $scope.doRefresh(); + +}); diff --git a/www/manifest.json b/www/manifest.json new file mode 100644 index 0000000..5738a4d --- /dev/null +++ b/www/manifest.json @@ -0,0 +1,12 @@ + +{ + "name": "My Ionic App", + "short_name": "My Ionic App", + "start_url": "index.html", + "display": "standalone", + "icons": [{ + "src": "icon.png", + "sizes": "512x512", + "type": "image/png" + }] +} \ No newline at end of file diff --git a/www/service-worker.js b/www/service-worker.js new file mode 100644 index 0000000..a090018 --- /dev/null +++ b/www/service-worker.js @@ -0,0 +1,12 @@ + +self.addEventListener('activate', function (event) { + +}); + +self.addEventListener('fetch', function (event) { + +}); + +self.addEventListener('push', function (event) { + +}); \ No newline at end of file diff --git a/www/templates/event.html b/www/templates/event.html new file mode 100644 index 0000000..84bb53a --- /dev/null +++ b/www/templates/event.html @@ -0,0 +1,24 @@ + + + + +

{{event.user.username}}

+

{{event.user.description}}

+
+ +

{{event.title}}

+

{{event.description}}

+

{{event.date | date: 'HH:mm, dd/MM/yyyy'}}

+
+ +
+ +
+ +
+

Map

+
+ + +
+
diff --git a/www/templates/events.html b/www/templates/events.html new file mode 100644 index 0000000..ffecdbc --- /dev/null +++ b/www/templates/events.html @@ -0,0 +1,17 @@ + + + + + + + +
{{event.user.username}}
+

{{event.title}}

+

{{event.description}}

+

{{event.date | date: 'HH:mm, dd/MM/yyyy'}}

+
+
+
diff --git a/www/templates/menu.html b/www/templates/menu.html new file mode 100644 index 0000000..9a8e325 --- /dev/null +++ b/www/templates/menu.html @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + +

Left

+
+ + + + Events + + + Users + + + Search + + + Settings + + + User login + + + +
+
diff --git a/www/templates/tabs.html b/www/templates/tabs.html new file mode 100644 index 0000000..8c7000a --- /dev/null +++ b/www/templates/tabs.html @@ -0,0 +1,22 @@ + + + diff --git a/www/templates/user.html b/www/templates/user.html new file mode 100644 index 0000000..e094c17 --- /dev/null +++ b/www/templates/user.html @@ -0,0 +1,20 @@ + + +
+ +
+ + Following + +
+

{{user.username}}

+

{{user.email}}

+
+
+ asdf asdflk jasdfljashd fljkas dflka shdfklasd {{user.description}} +
+ + +
+
diff --git a/www/templates/users.html b/www/templates/users.html new file mode 100644 index 0000000..b1d82ff --- /dev/null +++ b/www/templates/users.html @@ -0,0 +1,18 @@ + + + + + + + +

{{user.username}}

+

{{user.email}}

+ + Following +
+
+
+