diff --git a/.desktop/settings.json b/.desktop/settings.json index 8605c31..dca7e6f 100644 --- a/.desktop/settings.json +++ b/.desktop/settings.json @@ -1,6 +1,6 @@ { "name": "communecter", - "version": "0.0.11", + "version": "0.0.13", "projectName": "communecter", "devTools": true, "devtron": true, diff --git a/.meteor/cordova-plugins b/.meteor/cordova-plugins index 8ed444f..4db7939 100644 --- a/.meteor/cordova-plugins +++ b/.meteor/cordova-plugins @@ -1,9 +1,13 @@ com-sarriaroman-photoviewer@1.1.5 cordova-custom-config@2.0.3 +cordova-plugin-android-permissions@https://github.com/NeoLSN/cordova-plugin-android-permissions/tarball/789574937c97c6959db49341b2d901789affb364 +cordova-plugin-android-sensor-listeners@https://github.com/QuentinRoy/cordova-plugin-android-sensor-listeners/tarball/master +cordova-plugin-compat@1.0.0 cordova-plugin-contacts@2.2.1 cordova-plugin-device@1.1.4 cordova-plugin-dialogs@1.3.1 +cordova-plugin-media-capture@1.4.3 cordova-plugin-meteor-webapp@1.4.1 -phonegap-plugin-barcodescanner@https://github.com/JrontEnd/phonegap-plugin-barcodescanner/tarball/3a4b4ea69c8bff86f9749f7af332fc5b58c88601 -cordova-plugin-compat@1.0.0 cordova-plugin-crosswalk-webview@2.3.0 +me.dispatch.crosswalk-permissions@file://./packages +phonegap-plugin-barcodescanner@https://github.com/JrontEnd/phonegap-plugin-barcodescanner/tarball/3a4b4ea69c8bff86f9749f7af332fc5b58c88601 diff --git a/.meteor/packages b/.meteor/packages index 9c975da..099a480 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -82,3 +82,4 @@ jameslefrere:caretjs dynamic-import@0.1.1 #microservice aldeed:template-extension +elmarti:video-chat diff --git a/.meteor/versions b/.meteor/versions index c2438a2..1aa484e 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -24,7 +24,8 @@ caching-html-compiler@1.1.2 callback-hook@1.0.10 cfs:http-methods@0.0.32 check@1.2.5 -coffeescript@1.12.6_1 +coffeescript@1.12.7_1 +coffeescript-compiler@1.12.7_1 communecter:account@0.0.5 communecter:deep-link@4.0.4 communecter:mapbox@2.2.3_3 @@ -46,6 +47,7 @@ ecmascript-runtime@0.4.1 ecmascript-runtime-client@0.4.3 ecmascript-runtime-server@0.4.1 ejson@1.0.13 +elmarti:video-chat@1.1.1 es5-shim@4.6.15 fastclick@1.0.13 fourseven:scss@3.13.0 @@ -79,7 +81,7 @@ markdown@1.0.12 mdg:reload-on-resume@1.0.4 mdg:validated-method@1.1.0 mdg:validation-error@0.5.1 -meteor@1.7.0 +meteor@1.7.1 meteor-base@1.1.0 meteorhacks:async@1.0.0 meteorhacks:subs-manager@1.6.4 @@ -90,16 +92,18 @@ meteorspark:util@0.2.0 minifier-css@1.2.16 minifier-js@2.1.1 minimongo@1.2.1 +mizzao:timesync@0.5.0 +mizzao:user-status@0.6.7 mobile-experience@1.0.4 mobile-status-bar@1.0.14 -modules@0.9.2 +modules@0.9.4 modules-runtime@0.8.0 momentjs:moment@2.15.1 -mongo@1.1.19 +mongo@1.1.22 mongo-id@1.0.6 mrt:profile-online@0.1.9 multiply:iron-router-progress@1.0.2 -npm-mongo@2.2.24 +npm-mongo@2.2.30 observe-sequence@1.0.16 omega:meteor-desktop-bundler@0.7.2 omega:meteor-desktop-localstorage@0.0.11 @@ -118,6 +122,7 @@ reactive-var@1.0.11 reload@1.1.11 retry@1.0.9 reywood:publish-composite@1.5.2 +rocketchat:streamer@0.5.0 routepolicy@1.0.12 rzymek:moment-locale-fr@2.14.1 service-configuration@1.0.11 @@ -125,7 +130,7 @@ session@1.1.7 sha@1.0.9 shell-server@0.2.4 spacebars@1.0.15 -spacebars-compiler@1.1.2 +spacebars-compiler@1.1.3 standard-minifier-css@1.3.4 standard-minifier-js@2.1.1 tap:i18n@1.8.2 diff --git a/client/main.js b/client/main.js index 6657860..0a65b83 100644 --- a/client/main.js +++ b/client/main.js @@ -10,6 +10,10 @@ import '../imports/ui/login/login.js'; import '../imports/ui/images/images.js'; +import '../imports/ui/video/video.js'; + +import '../imports/ui/sensors/sensors.js'; + import '../imports/ui/dashboard/dashboard.js'; import '../imports/ui/mapscope/mapscope.js'; diff --git a/client/scss/_ionic.scss b/client/scss/_ionic.scss index 0f0d463..6e949d7 100755 --- a/client/scss/_ionic.scss +++ b/client/scss/_ionic.scss @@ -40,6 +40,7 @@ // Buttons "stylesheets/button", "stylesheets/button-bar", + "stylesheets/floating-menu", // Util "stylesheets/grid", diff --git a/client/scss/ionic.app.scss b/client/scss/ionic.app.scss index a0492fb..6f89c97 100644 --- a/client/scss/ionic.app.scss +++ b/client/scss/ionic.app.scss @@ -314,6 +314,42 @@ $button-follower-active-border: darken($assertive, 10%) !default; } } +.organization, a.organization { + color: $color-orga; +} +.organization-bg { + background-color: $color-orga; +} +.person, a.person { + color: $color-person; +} +.person-bg { + background-color: $color-person; +} +.event, a.event { + color: $color-event; +} +.event-bg { + background-color: $color-event; +} +.project, a.project { + color: $color-project; +} +.project-bg { + background-color: $color-project; +} +.poi, a.poi { + color: $color-poi; +} +.poi-bg { + background-color: $color-poi; +} +.classified, a.classified { + color: $color-classified; +} +.classified-bg { + background-color: $color-classified; +} // BUTTONS END .yellow{ diff --git a/client/scss/stylesheets/_floating-menu.scss b/client/scss/stylesheets/_floating-menu.scss new file mode 100644 index 0000000..7c9651b --- /dev/null +++ b/client/scss/stylesheets/_floating-menu.scss @@ -0,0 +1,225 @@ +#floating-button { + bottom: 20px; + position: fixed; + right: 20px; + z-index : 9999; + width: 60px; + height: 60px; + line-height: 60px; + list-style-type: none; + margin: 0; + padding: 0; + text-align: center; + color: #000; + cursor: pointer; + box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2), 0 2px 5px 0 rgba(0, 0, 0, 0.2); + transform: translate3d(0, 0, 0); + backface-visibility: hidden; + padding: 0; + border: none; + border-radius: 50%; +} + +#floating-button.center{ + margin-left: auto !important; + margin-right: auto !important; + left: 0 !important; + right: 0 !important; +} + +#floating-button>li { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + backface-visibility: hidden; + padding: 0; + border: none; + border-radius: 50%; + -webkit-border-radius: 50%; +} + +#floating-button a { + width: 40px; + height: 40px; + display: inline-block; + border-radius: 50%; + -webkit-border-radius: 50%; + text-decoration: none; + font-size: 0.8em; +} + +#floating-button .icon.menu-icon{ + font-size: 20px; +} + +#floating-button li span.label{ + margin-right: 2px; + color: gray; + background-color: white; + padding: 6px; + border-radius: 6px; + -webkit-border-radius: 6px; + box-shadow: 0.5px 2px 2px 0.5px rgba(0, 0, 0, 0.2); +} + + +#floating-button li span.label-container{ + margin-right: 2px; + position: absolute; + display: inline-block; + top: 0px; + overflow: hidden; + right: 75px; + width: 400px; + text-align: right; + font-size: 15px; +} + + + +/*floating-menu*/ + +#floating-menu { + position: fixed; + right: 20px; + z-index: 9999; + width: 60px; + height: 60px; + line-height: 60px; + list-style-type: none; + margin: 0; + padding: 0; + text-align: center; + cursor: pointer; + box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2), 0 2px 5px 0 rgba(0, 0, 0, 0.2); + transform: translate3d(0, 0, 0); + backface-visibility: hidden; + padding: 0; + border: none; + border-radius: 50%; +} + +#floating-menu .center{ + margin-left: auto; + margin-right: auto; + left: 0; + right: 0; +} + +#floating-menu .icon.menu-icon{ + font-size: 20px; +} + +#floating-menu img.menu-icon{ + font-size: 20px; +} + +#floating-menu li i{ + font-size: 20px; + left: 0; + top: 0; +} + +#floating-menu li.menu-button { + z-index: 9999; + left: 0; + top: 0; + width: 100%; + height: 100%; +} + +#floating-menu li{ + position: absolute; + left: 0.5px; + top: 0.5px; + width: 98%; + height: 98%; + transform: translate3d(0, 0, 0); + backface-visibility: hidden; + padding: 0; + border: none; + border-radius: 50%; + -webkit-border-radius: 50%; +} + +#floating-menu li span.label{ + margin-right: 2px; + color: gray; + background-color: white; + padding: 6px; + border-radius: 6px; + -webkit-border-radius: 6px; + box-shadow: 0.5px 2px 2px 0.5px rgba(0, 0, 0, 0.2); +} + + +#floating-menu li span.label-container{ + margin-right: 2px; + position: absolute; + display: inline-block; + visibility: hidden; + top: 0px; + overflow: hidden; + right: 75px; + width: 400px; + text-align: right; + font-size: 15px; +} + +#floating-menu.active span.label-container{ + visibility: visible; +} + + +#floating-menu.active li{ + box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2), 0 2px 5px 0 rgba(0, 0, 0, 0.2); + top: 0; +} + +/*#floating-menu li { + width: 40px; + height: 40px; + display: inline-block; + border-radius: 50%; + -webkit-border-radius: 50%; + text-decoration: none; + font-size: 0.8em; +}*/ + +#floating-menu ion-floating-item > li { + transition: all .3s; + -webkit-transition: all .3s; + -moz-transition: .3s; +} + + +#floating-menu.active ion-floating-item:nth-child(1) > li { + transform: translateY(-70px); -webkit-transform: translateY(-70px); + transition-delay: 0ms; -webkit-transition-delay: 0ms; +} +#floating-menu.active ion-floating-item:nth-child(2) > li { + transform: translateY(-140px); -webkit-transform: translateY(-140px); + transition-delay: 50ms; -webkit-transition-delay: 50ms; +} +#floating-menu.active ion-floating-item:nth-child(3) > li { + transform: translateY(-210px); -webkit-transform: translateY(-210px); + transition-delay: 100ms; -webkit-transition-delay: 100ms; +} +#floating-menu.active ion-floating-item:nth-child(4) > li { + transform: translateY(-280px); -webkit-transform: translateY(-280px); + transition-delay: 150ms; -webkit-transition-delay: 150ms; +} +#floating-menu.active ion-floating-item:nth-child(5) > li { + transform: translateY(-350px); -webkit-transform: translateY(-350px); + transition-delay: 160ms; -webkit-transition-delay: 160ms; +} +#floating-menu.active ion-floating-item:nth-child(6) > li { + transform: translateY(-420px); -webkit-transform: translateY(-420px); + transition-delay: 170ms; -webkit-transition-delay: 170ms; +} +#floating-menu.active ion-floating-item:nth-child(7) > li { + transform: translateY(-490px); -webkit-transform: translateY(-490px); + transition-delay: 180ms; -webkit-transition-delay: 180ms; +} diff --git a/client/scss/stylesheets/_popover.scss b/client/scss/stylesheets/_popover.scss index 77025f4..f2a41c7 100755 --- a/client/scss/stylesheets/_popover.scss +++ b/client/scss/stylesheets/_popover.scss @@ -117,7 +117,7 @@ // Android Popover -.platform-android { +/*.platform-android { .popover { margin-top: -32px; @@ -138,7 +138,7 @@ .popover-backdrop.active { background-color: transparent; } -} +}*/ // disable clicks on all but the popover diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index ce0a461..6d754cb 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -142,6 +142,31 @@ "comment":"comment", "comments":"comments", "Close and reopen the application to get the new version":"Close and reopen the application to get the new version!", + "Add":"Add", + "a organization":"a organization", + "a project":"a project", + "a event":"a event", + "a point of interest":"a point of interest", + "a classified":"a classified", + "organizer":"organizer", + "video call":"video call", + "endPhoneCall":"Finished calling", + "You are receiving a phone call":"You are receiving a video phone call", + "Answer":"Answer", + "Ignore":"Ignore", + "onTerminateCall":"call terminated", + "activitystream":{ + "verb":{ + "share":"shared", + "create":"created" + }, + "type":{ + "organizations":"an organization", + "events":"an event", + "projects":"an project", + "news":"a publication of" + } + }, "simpleschema": { "messages": { "usernameNotUnique": "[label] already exists", @@ -345,6 +370,18 @@ "url":{ "label": "url" }, + "fixe":{ + "label": "phone", + "placeholder": "phone" + }, + "mobile":{ + "label": "mobile phone", + "placeholder": "mobile phone" + }, + "fax":{ + "label": "fax", + "placeholder": "fax" + }, "tags":{ "label": "tags" }, diff --git a/i18n/fr.i18n.json b/i18n/fr.i18n.json index b34a4d0..504d342 100644 --- a/i18n/fr.i18n.json +++ b/i18n/fr.i18n.json @@ -142,6 +142,31 @@ "comment":"Commentaire", "comments":"Commentaires", "Close and reopen the application to get the new version":"Fermez et rouvrez l'application pour obtenir la nouvelle version!", + "Add":"Ajouter", + "a organization":"une organisation", + "a project":"un projet", + "a event":"un évenement", + "a point of interest":"un point d'intérêt", + "a classified":"une annonce", + "organizer":"organisateur", + "video call":"Appel vidéo", + "endPhoneCall":"Terminé appel", + "You are receiving a phone call":"Vous recevez un appel vidéo", + "Answer":"Répondre", + "Ignore":"Ignorer", + "onTerminateCall":"Appel terminé", + "activitystream":{ + "verb":{ + "share":"a partagé", + "create":"a créé" + }, + "type":{ + "organizations":"une organisation", + "events":"un événement", + "projects":"un projet", + "news": "une publication de" + } + }, "simpleschema": { "messages": { "usernameNotUnique": "[label] existe déja", @@ -343,6 +368,18 @@ "url":{ "label": "Url" }, + "fixe":{ + "label": "Téléphone fixe", + "placeholder": "téléphone fixe" + }, + "mobile":{ + "label": "Téléphone mobile", + "placeholder": "téléphone mobile" + }, + "fax":{ + "label": "Fax", + "placeholder": "fax" + }, "tags":{ "label": "Tags" }, diff --git a/imports/api/citoyens.js b/imports/api/citoyens.js index 61450d0..4831c41 100644 --- a/imports/api/citoyens.js +++ b/imports/api/citoyens.js @@ -317,10 +317,10 @@ Citoyens.helpers({ }, listPoiCreator () { const query = {}; - query.parentId = this._id._str; + query.parentId = this._id._str // query[`links.contributors.${this._id._str}.isAdmin`] = true; // query[`links.contributors.${this._id._str}.toBeValidated`] = {$exists: false}; - return Poi.find(query, queryOptions); + return Poi.find(query); }, countPoiCreator () { return this.listPoiCreator() && this.listPoiCreator().count(); diff --git a/imports/api/client/reactive.js b/imports/api/client/reactive.js index dea6a1d..f7c61b2 100644 --- a/imports/api/client/reactive.js +++ b/imports/api/client/reactive.js @@ -9,3 +9,7 @@ export const pageCollections = new ReactiveDict('pageCollections'); export const geoId = new ReactiveDict('geoId'); export const SessionGeo = new ReactiveDict('sessionGeo'); + +export const SessionSensors = new ReactiveDict('SessionSensors'); + +export const pageVideo = new ReactiveDict('pageVideo'); diff --git a/imports/api/client/sensors.js b/imports/api/client/sensors.js new file mode 100644 index 0000000..854177d --- /dev/null +++ b/imports/api/client/sensors.js @@ -0,0 +1,100 @@ +import { Meteor } from 'meteor/meteor'; +import { SessionSensors } from './reactive.js'; + +const sensorApi = { + config() { + this.Motion = ['ACCELEROMETER', 'GRAVITY', 'GYROSCOPE', 'GYROSCOPE_UNCALIBRATED', 'ROTATION_VECTOR', 'LINEAR_ACCELERATION', 'STEP_COUNTER']; + this.Environmental = ['AMBIENT_TEMPERATURE', 'RELATIVE_HUMIDITY', 'PRESSURE', 'LIGHT', 'TEMPERATURE']; + this.Position = ['ORIENTATION', 'MAGNETIC_FIELD', 'MAGNETIC_FIELD_UNCALIBRATED', 'GAME_ROTATION_VECTOR', 'PROXIMITY']; + this.allSensors = [...this.Motion, ...this.Environmental, ...this.Position]; + }, + enable(typeSensor) { + console.log(`enable ${typeSensor}`); + sensors.enableSensor(typeSensor); + }, + disable(typeSensor) { + SessionSensors.set('typeSensor', typeSensor); + sensors.removeSensorListener(typeSensor, 'NORMAL', this.listener, (error) => { + if (error) console.error('Could not stop listening to sensor'); + }); + }, + listener(event) { + //console.log(event); + if (event && event.values) { + console.log(event.values); + SessionSensors.set(SessionSensors.get('typeSensor'), `${event.values[0]}`); + } + }, + getState(typeSensor) { + SessionSensors.set('typeSensor', typeSensor); + sensors.addSensorListener(typeSensor, 'NORMAL', this.listener, (error) => { + if (error) { + console.log(error.message || error); + console.error('Could not listen to sensor'); + SessionSensors.set(typeSensor, 'na'); + } + }); + }, + get(typeSensor) { + return SessionSensors.get(typeSensor); + }, + setEnvironmental(environmental) { + SessionSensors.set('environmental', environmental); + }, + getEnvironmental() { + return SessionSensors.get('environmental'); + }, + disables() { + const self = this; + this.Environmental.map((typeSensor) => { + SessionSensors.set(typeSensor, null); + self.disable(typeSensor); + }); + }, +}; + + +/* const sensorApi = { + config() { + this.Motion = ['ACCELEROMETER', 'GRAVITY', 'GYROSCOPE', 'GYROSCOPE_UNCALIBRATED', 'ROTATION_VECTOR', 'LINEAR_ACCELERATION', 'STEP_COUNTER']; + this.Environmental = ['AMBIENT_TEMPERATURE', 'RELATIVE_HUMIDITY', 'PRESSURE', 'LIGHT', 'TEMPERATURE']; + this.Position = ['ORIENTATION', 'MAGNETIC_FIELD', 'MAGNETIC_FIELD_UNCALIBRATED', 'GAME_ROTATION_VECTOR', 'PROXIMITY']; + this.allSensors = [...this.Motion, ...this.Environmental, ...this.Position]; + }, + enable(typeSensor) { + console.log(`enable ${typeSensor}`); + sensors.enableSensor(typeSensor); + }, + disable() { + sensors.disableSensor(); + }, + getState(typeSensor) { + this.disable(); + this.enable(typeSensor); + const id = Meteor.setInterval(() =>{ + sensors.getState((value) => { + if (value) { + SessionSensors.set(typeSensor, `${value[0]}`); + Meteor.clearInterval(id); + } + }); + }, 100) + + + }, + get(typeSensor) { + return SessionSensors.get(typeSensor); + }, + setEnvironmental(environmental) { + SessionSensors.set('environmental', environmental); + }, + getEnvironmental() { + return SessionSensors.get('environmental'); + }, + disables() { + this.allSensors.map(typeSensor => SessionSensors.set(typeSensor, null)); + this.disable(); + }, +}; */ + +export { sensorApi as default }; diff --git a/imports/api/events.js b/imports/api/events.js index f6ac68c..55b168a 100644 --- a/imports/api/events.js +++ b/imports/api/events.js @@ -200,7 +200,9 @@ Events.helpers({ const bothUserId = (typeof userId !== 'undefined') ? userId : Meteor.userId(); if (bothUserId && this.organizerId && this.organizerType && _.contains(['events', 'projects', 'organizations'], this.organizerType)) { // console.log(this.organizerEvent()); - return this.organizerEvent() && this.organizerEvent().isAdmin(bothUserId); + if (this.organizerEvent() && this.organizerEvent().isAdmin(bothUserId)) { + return true; + } } return !!((this.links && this.links.attendees && this.links.attendees[bothUserId] && this.links.attendees[bothUserId].isAdmin)); }, @@ -252,7 +254,7 @@ Events.helpers({ listPoiCreator () { const query = {}; query.parentId = this._id._str; - return Poi.find(query, queryOptions); + return Poi.find(query); }, countPoiCreator () { return this.listPoiCreator() && this.listPoiCreator().count(); diff --git a/imports/api/helpers.js b/imports/api/helpers.js index 9cd9fe4..ce7ceef 100644 --- a/imports/api/helpers.js +++ b/imports/api/helpers.js @@ -99,6 +99,7 @@ export const queryOptions = { sort: { name: 1 }, name: 1, links: 1, tags: 1, + type: 1, profilThumbImageUrl: 1, } }; diff --git a/imports/api/organizations.js b/imports/api/organizations.js index ef9a52a..c2198a7 100644 --- a/imports/api/organizations.js +++ b/imports/api/organizations.js @@ -272,7 +272,7 @@ Organizations.helpers({ listPoiCreator () { const query = {}; query.parentId = this._id._str; - return Poi.find(query, queryOptions); + return Poi.find(query); }, countPoiCreator () { return this.listPoiCreator() && this.listPoiCreator().count(); diff --git a/imports/api/projects.js b/imports/api/projects.js index e29c23f..fc55b35 100644 --- a/imports/api/projects.js +++ b/imports/api/projects.js @@ -174,7 +174,9 @@ Projects.helpers({ if (bothUserId && this.parentId && this.parentType && _.contains(['organizations'], this.parentType)) { // console.log(this.organizerProject()); // console.log(`${this.parentType}:${this.parentId}`); - return this.organizerProject() && this.organizerProject().isAdmin(bothUserId); + if (this.organizerProject() && this.organizerProject().isAdmin(bothUserId)) { + return true; + } } return !!((this.links && this.links.contributors && this.links.contributors[bothUserId] && this.links.contributors[bothUserId].isAdmin && this.isToBeValidated(bothUserId))); }, @@ -279,7 +281,7 @@ Projects.helpers({ listPoiCreator () { const query = {}; query.parentId = this._id._str; - return Poi.find(query, queryOptions); + return Poi.find(query); }, countPoiCreator () { return this.listPoiCreator() && this.listPoiCreator().count(); diff --git a/imports/api/server/api.js b/imports/api/server/api.js index 0ee5c55..a28a67c 100644 --- a/imports/api/server/api.js +++ b/imports/api/server/api.js @@ -17,7 +17,7 @@ const callPixelRest = (token, method, controller, action, post) => { jar: true, }, }); - // console.log(responsePost); + // console.log(responsePost); if (responsePost && responsePost.data && responsePost.data.result) { return responsePost; } diff --git a/imports/api/server/method.js b/imports/api/server/method.js index cf89ecc..88c82d6 100644 --- a/imports/api/server/method.js +++ b/imports/api/server/method.js @@ -174,6 +174,9 @@ const baseDocRetour = (docRetour, doc, scope) => { docRetour.role = doc.role; docRetour.email = doc.email ? doc.email : ''; docRetour.url = doc.url ? doc.url : ''; + docRetour.fixe = doc.fixe ? doc.fixe : ''; + docRetour.mobile = doc.mobile ? doc.mobile : ''; + docRetour.fax = doc.fax ? doc.fax : ''; if (doc.preferences) { docRetour.preferences = doc.preferences; } @@ -321,7 +324,7 @@ const baseDocRetour = (docRetour, doc, scope) => { return docRetour; }; -/* URL._encodeParams = function(params, prefix) { +URL._encodeParams = function(params, prefix) { const str = []; for (const p in params) { if (params.hasOwnProperty(p)) { @@ -336,7 +339,7 @@ const baseDocRetour = (docRetour, doc, scope) => { } } return str.join('&').replace(/%20/g, '+'); -}; */ +}; Meteor.methods({ userup (geo) { @@ -666,6 +669,26 @@ Meteor.methods({ } return true; }, + getUser (callerId) { + check(callerId, String); + if (!this.userId) { + throw new Meteor.Error('not-authorized'); + } + + const user = Citoyens.findOne({ _id: new Mongo.ObjectID(callerId) }, { + fields: { + _id: 1, + name: 1, + profilThumbImageUrl: 1, + }, + }); + + if (user && user._id) { + return user; + } else{ + throw new Meteor.Error('not user'); + } + }, searchTagautocomplete (query, options) { check(query, String); if (!query) return []; @@ -1035,7 +1058,7 @@ indexMax:20 */ } } -/* if (newsOne && newsOne.media && newsOne.media.images) { + /* if (newsOne && newsOne.media && newsOne.media.images) { const arrayId = newsOne.media.images.map(_id => new Mongo.ObjectID(_id)); const newsDocs = Documents.find({ _id: { $in: arrayId }, @@ -1434,6 +1457,7 @@ indexMax:20 */ } }, insertOrganization (doc) { + // console.log(doc); SchemasOrganizationsRest.clean(doc); check(doc, SchemasOrganizationsRest); if (!this.userId) { @@ -1505,7 +1529,7 @@ indexMax:20 */ email: user.email, username: user.username, pwd: user.password, - cp: insee.cp, + cp: insee.postalCodes[0].postalCode, city: insee.insee, geoPosLatitude: insee.geo.latitude, geoPosLongitude: insee.geo.longitude, @@ -1649,3 +1673,36 @@ export const userLocale = new ValidatedMethod({ return false; }, }); + +export const userDevice = new ValidatedMethod({ + name: 'userDevice', + validate: new SimpleSchema({ + available: { type: Boolean }, + cordova: { type: String }, + model: { type: String }, + platform: { type: String }, + uuid: { type: String }, + version: { type: String }, + manufacturer: { type: String }, + isVirtual: { type: Boolean }, + serial: { type: String }, + }).validator(), + run(device) { + this.unblock(); + if (!this.userId) { + throw new Meteor.Error('not-authorized'); + } + // console.log(device); + if (Meteor.users.update({ + _id: this.userId, + }, { + $addToSet: { + 'profile.device': device, + }, + })) { + return true; + } + + return false; + }, +}); diff --git a/imports/api/server/publish.js b/imports/api/server/publish.js index bf5711a..4d9f238 100644 --- a/imports/api/server/publish.js +++ b/imports/api/server/publish.js @@ -250,8 +250,25 @@ Meteor.publishComposite('geo.scope', function(scope, latlng, radius) { const options = {}; options._disableOplog = true; if (scope === 'citoyens') { - options.fields = { pwd: 0 }; + // options.fields = { pwd: 0 }; } + + options.fields = { _id: 1, + profilThumbImageUrl: 1, + type: 1, + startDate: 1, + endDate: 1, + geo: 1, + name: 1, + organizerType: 1, + organizerId: 1, + parentType: 1, + parentId: 1, + creator: 1, + geoPosition: 1, + 'address.codeInsee': 1, + tags: 1 }; + const query = {}; if (radius) { query.geoPosition = { @@ -281,10 +298,18 @@ Meteor.publishComposite('geo.scope', function(scope, latlng, radius) { }, children: [ { + find(scopeD) { + if (scope === 'events') { + return scopeD.listEventTypes(); + } else if (scope === 'organizations') { + return scopeD.listOrganisationTypes(); + } + }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + } */ { find(scopeD) { if (scope === 'events') { @@ -416,12 +441,12 @@ Meteor.publishComposite('scopeDetail', function(scope, scopeId) { }); } }, - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -444,12 +469,12 @@ Meteor.publishComposite('citoyenActusList', function(limit) { }); } }, - }, + }, /* { find(scopeD) { return scopeD.documents(); }, - }, + }, */ { find(scopeD) { Counts.publish(this, `countActus.${this.userId}`, scopeD.newsActus(this.userId), { noReady: true }); @@ -467,14 +492,14 @@ Meteor.publishComposite('citoyenActusList', function(limit) { profilThumbImageUrl: 1, }, }); - }, + }, /* , children: [ { find(citoyen) { return citoyen.documents(); }, }, - ], + ], */ }, { find(news) { @@ -493,7 +518,7 @@ Meteor.publishComposite('citoyenActusList', function(limit) { return collection.find({ _id: new Mongo.ObjectID(news.target.id) }, queryOptions); } }, - }, + }, /* { find(news) { if (news.target && news.target.type && news.target.id) { @@ -503,7 +528,7 @@ Meteor.publishComposite('citoyenActusList', function(limit) { }, { sort: { created: -1 }, limit: 1 }); } }, - }, + }, */ { find(news) { const queryOptions = { fields: { @@ -516,7 +541,7 @@ Meteor.publishComposite('citoyenActusList', function(limit) { return collection.find({ _id: new Mongo.ObjectID(news.object.id) }, queryOptions); } }, - }, + }, /* { find(news) { if (news.object && news.object.type && news.object.id) { @@ -526,7 +551,7 @@ Meteor.publishComposite('citoyenActusList', function(limit) { }, { sort: { created: -1 }, limit: 1 }); } }, - }, + }, */ ], }, ] }; @@ -561,80 +586,80 @@ Meteor.publishComposite('collectionsList', function(scope, scopeId, type) { { find(scopeD) { return scopeD.listCollections(type, 'citoyens'); - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { return scopeD.listCollections(type, 'organizations'); - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { return scopeD.listCollections(type, 'projects'); - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { return scopeD.listCollections(type, 'events'); - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { return scopeD.listCollections(type, 'poi'); - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { return scopeD.listCollections(type, 'classified'); - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], - }, + ], */ + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -653,8 +678,21 @@ Meteor.publishComposite('directoryList', function(scope, scopeId) { const options = {}; // options['_disableOplog'] = true; if (scope === 'citoyens') { - options.fields = { pwd: 0 }; + // options.fields = { pwd: 0 }; } + + options.fields = { _id: 1, + profilThumbImageUrl: 1, + type: 1, + name: 1, + organizerType: 1, + organizerId: 1, + parentType: 1, + parentId: 1, + creator: 1, + tags: 1, + links: 1 }; + if (scope === 'events') { // Counts.publish(this, `countSous.${scopeId}`, Events.find({parentId:scopeId}), { noReady: true }); } @@ -675,14 +713,14 @@ Meteor.publishComposite('directoryList', function(scope, scopeId) { } else if (scope === 'projects') { return scopeD.listFollowers(); } - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { @@ -693,14 +731,14 @@ Meteor.publishComposite('directoryList', function(scope, scopeId) { } else if (scope === 'projects') { return scopeD.listContributors(); } - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { @@ -709,48 +747,48 @@ Meteor.publishComposite('directoryList', function(scope, scopeId) { } else if (scope === 'organizations') { return scopeD.listMembersOrganizations(); } - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { if (scope === 'citoyens' || scope === 'organizations') { return scopeD.listProjects(); } - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], + ], */ }, { find(scopeD) { if (scope === 'citoyens' || scope === 'organizations' || scope === 'projects') { return scopeD.listEvents(); } - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], - }, + ], */ + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -804,19 +842,19 @@ Meteor.publishComposite('directoryListEvents', function(scope, scopeId) { }); } }, - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ], - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -867,19 +905,19 @@ Meteor.publishComposite('directoryListProjects', function(scope, scopeId) { }); } }, - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ], - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -925,19 +963,19 @@ Meteor.publishComposite('directoryListPoi', function(scope, scopeId) { }); } }, - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ], - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -983,19 +1021,19 @@ Meteor.publishComposite('directoryListClassified', function(scope, scopeId) { }); } }, - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ], - }, + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -1029,20 +1067,20 @@ Meteor.publishComposite('directoryListOrganizations', function(scope, scopeId) { if (scope === 'citoyens') { return scopeD.listOrganizationsCreator(); } - }, + }, /* , children: [ { find(scopeD) { return scopeD.documents(); }, }, - ], - }, + ], */ + }, /* , { find(scopeD) { return scopeD.documents(); }, - }, + }, */ ] }; }); @@ -1055,14 +1093,14 @@ Meteor.publishComposite('listeventSous', function(scopeId) { find() { Counts.publish(this, `countSous.${scopeId}`, Events.find({ parentId: scopeId }), { noReady: true }); return Events.find({ parentId: scopeId }); - }, + }, /* , children: [ { find(event) { return event.documents(); }, }, - ] }; + ] */ }; }); Meteor.publishComposite('listAttendees', function(scopeId) { @@ -1091,12 +1129,12 @@ Meteor.publishComposite('listAttendees', function(scopeId) { }, }); }, - }, + }, /* , { find(citoyen) { return citoyen.documents(); }, - }, + }, */ ], }, ] }; @@ -1128,12 +1166,12 @@ Meteor.publishComposite('listMembers', function(scopeId) { }, }); }, - }, + }, /* , { find(citoyen) { return citoyen.documents(); }, - }, + }, */ ], }, ] }; @@ -1169,12 +1207,12 @@ Meteor.publishComposite('listMembersToBeValidated', function(scope, scopeId) { }, }); }, - }, + }, /* , { find(citoyen) { return citoyen.documents(); }, - }, + }, */ ], }, ] }; @@ -1206,12 +1244,12 @@ Meteor.publishComposite('listContributors', function(scopeId) { }, }); }, - }, + }, /* , { find(citoyen) { return citoyen.documents(); }, - }, + }, */ ], }, ] }; @@ -1250,12 +1288,12 @@ Meteor.publishComposite('listFollows', function(scopeId) { }, }); }, - }, + }, /* , { find(citoyen) { return citoyen.documents(); }, - }, + }, */ ], }, ] }; @@ -1289,14 +1327,14 @@ Meteor.publishComposite('newsList', function(scope, scopeId, limit) { profilThumbImageUrl: 1, }, }); - }, + }, /* , children: [ { find(citoyen) { return citoyen.documents(); }, }, - ], + ], */ }, { find(news) { @@ -1315,8 +1353,7 @@ Meteor.publishComposite('newsList', function(scope, scopeId, limit) { return collection.find({ _id: new Mongo.ObjectID(news.target.id) }, queryOptions); } }, - }, - { + }, /* , { find(news) { if (news.target && news.target.type && news.target.id) { return Documents.find({ @@ -1325,7 +1362,7 @@ Meteor.publishComposite('newsList', function(scope, scopeId, limit) { }, { sort: { created: -1 }, limit: 1 }); } }, - }, + } */ { find(news) { const queryOptions = { fields: { @@ -1338,7 +1375,7 @@ Meteor.publishComposite('newsList', function(scope, scopeId, limit) { return collection.find({ _id: new Mongo.ObjectID(news.object.id) }, queryOptions); } }, - }, + }, /* , { find(news) { if (news.object && news.object.type && news.object.id) { @@ -1348,7 +1385,7 @@ Meteor.publishComposite('newsList', function(scope, scopeId, limit) { }, { sort: { created: -1 }, limit: 1 }); } }, - }, + }, */ ], }; }); @@ -1406,14 +1443,14 @@ Meteor.publishComposite('newsDetail', function(scope, scopeId, newsId) { profilThumbImageUrl: 1, }, }); - }, + }, /* , children: [ { find(citoyen) { return citoyen.documents(); }, }, - ], + ], */ }, { find(news) { @@ -1432,7 +1469,7 @@ Meteor.publishComposite('newsDetail', function(scope, scopeId, newsId) { return collection.find({ _id: new Mongo.ObjectID(news.target.id) }, queryOptions); } }, - }, + }, /* { find(news) { if (news.target && news.target.type && news.target.id) { @@ -1442,7 +1479,7 @@ Meteor.publishComposite('newsDetail', function(scope, scopeId, newsId) { }, { sort: { created: -1 }, limit: 1 }); } }, - }, + }, */ { find(news) { const queryOptions = { fields: { @@ -1455,7 +1492,7 @@ Meteor.publishComposite('newsDetail', function(scope, scopeId, newsId) { return collection.find({ _id: new Mongo.ObjectID(news.object.id) }, queryOptions); } }, - }, + }, /* , { find(news) { if (news.object && news.object.type && news.object.id) { @@ -1465,7 +1502,7 @@ Meteor.publishComposite('newsDetail', function(scope, scopeId, newsId) { }, { sort: { created: -1 }, limit: 1 }); } }, - }, + }, */ ], }; }); @@ -1521,14 +1558,14 @@ Meteor.publishComposite('newsDetailComments', function(scope, scopeId, newsId) { profilThumbImageUrl: 1, }, }); - }, + }, /* , children: [ { find(citoyen) { return citoyen.documents(); }, }, - ], + ], */ }, { find(news) { @@ -1547,14 +1584,14 @@ Meteor.publishComposite('newsDetailComments', function(scope, scopeId, newsId) { profilThumbImageUrl: 1, }, }); - }, + }, /* , children: [ { find(citoyen) { return citoyen.documents(); }, }, - ], + ], */ }, ], }, @@ -1605,6 +1642,49 @@ Meteor.publish('users', function() { ]; }); +Meteor.publishComposite('callUsers', function() { + if (!this.userId) { + return null; + } + return { + find() { + return Citoyens.find({ _id: new Mongo.ObjectID(this.userId) }, { + fields: { + _id: 1, + name: 1, + 'links.follows': 1, + profilThumbImageUrl: 1, + }, + }); + }, + children: [ + { + find(citoyen) { + return citoyen.listFollows(); + }, + children: [ + { + find(citoyen) { + return Meteor.users.find({ + _id: citoyen._id._str, + }, { + fields: { + 'profile.online': 1, + status: 1, + }, + }); + }, + }, /* , + { + find(citoyen) { + return citoyen.documents(); + }, + }, */ + ], + }, + ] }; +}); + Meteor.publish('thing', function(limit, boardId) { check(limit, Number); check(boardId, Match.Maybe(String)); diff --git a/imports/startup/client/client.js b/imports/startup/client/client.js index 230ed1e..2750093 100644 --- a/imports/startup/client/client.js +++ b/imports/startup/client/client.js @@ -4,6 +4,7 @@ import { AutoForm } from 'meteor/aldeed:autoform'; import { moment } from 'meteor/momentjs:moment'; import { Router } from 'meteor/iron:router'; import { DeepLink } from 'meteor/communecter:deep-link'; +import { TAPi18n } from 'meteor/tap:i18n'; import { _ } from 'meteor/underscore'; import { $ } from 'meteor/jquery'; @@ -172,6 +173,9 @@ Meteor.startup(function () { }, ); + Template.registerHelper('i18npref', (prefix, text) => TAPi18n.__(`${prefix}.${text}`)); + + Template.registerHelper('isCordova', () => Meteor.isCordova); Template.registerHelper('textTags', (text, tags) => { diff --git a/imports/startup/client/device.js b/imports/startup/client/device.js new file mode 100644 index 0000000..250875f --- /dev/null +++ b/imports/startup/client/device.js @@ -0,0 +1,11 @@ +import { Meteor } from 'meteor/meteor'; +import { Tracker } from 'meteor/tracker'; + +Meteor.startup(() => { + Tracker.autorun((c) => { + if (Meteor.isCordova && !Meteor.isDesktop && Meteor.userId() && Meteor.user() && Meteor.user().profile) { + Meteor.call('userDevice', device); + c.stop(); + } + }); +}); diff --git a/imports/startup/client/index.js b/imports/startup/client/index.js index 2a6e8db..5d662f0 100644 --- a/imports/startup/client/index.js +++ b/imports/startup/client/index.js @@ -1,8 +1,12 @@ import './client.js'; +import './permisions.js'; import './locale.js'; +import './device.js'; import './reload.js'; +import './videortc.js'; import './position.js'; import './routes.js'; import './push.js'; import './mapbox.js'; import './autolinker.js'; +import './sensors.js'; diff --git a/imports/startup/client/permisions.js b/imports/startup/client/permisions.js new file mode 100644 index 0000000..abd5b0f --- /dev/null +++ b/imports/startup/client/permisions.js @@ -0,0 +1,34 @@ +import { Meteor } from 'meteor/meteor'; + +Meteor.startup(() => { + if (Meteor.isCordova && !Meteor.isDesktop) { + const permissions = cordova.plugins.permissions; + + const list = [ + permissions.ACCESS_COARSE_LOCATION, + permissions.ACCESS_FINE_LOCATION, + permissions.CAMERA, + permissions.RECORD_AUDIO, + permissions.MODIFY_AUDIO_SETTINGS, + ]; + + const error = () => { + console.warn('Camera, record audio and audio setting is not turned on'); + }; + + const success = (status) => { + // console.log(JSON.stringify(status)); + if (!status.hasPermission) { + permissions.requestPermissions( + list, + (status) => { + // console.log(JSON.stringify(status)); + if (!status.hasPermission) error(); + }, + error); + } + }; + + permissions.checkPermission(list, success, null); + } +}); diff --git a/imports/startup/client/routes.js b/imports/startup/client/routes.js index e4207bf..5588181 100644 --- a/imports/startup/client/routes.js +++ b/imports/startup/client/routes.js @@ -41,6 +41,18 @@ Router.map(function() { loadingTemplate: 'loading', }); + this.route('videoRTC', { + path: '/call', + template: 'videoRTC', + loadingTemplate: 'loading', + }); + + this.route('sensors', { + path: '/sensors', + template: 'sensors', + loadingTemplate: 'loading', + }); + this.route('listEvents', { path: '/events', template: 'listEvents', diff --git a/imports/startup/client/sensors.js b/imports/startup/client/sensors.js new file mode 100644 index 0000000..b11bb74 --- /dev/null +++ b/imports/startup/client/sensors.js @@ -0,0 +1,50 @@ +import { Meteor } from 'meteor/meteor'; +import { Tracker } from 'meteor/tracker'; + +import sensorApi from '../../api/client/sensors.js'; + +Meteor.startup(() => { + if (Meteor.isCordova && !Meteor.isDesktop) { + if (device.platform === 'Android') { + sensorApi.config(); + sensorApi.disables(); + + Tracker.autorun((c) => { + if (Meteor.userId() && Meteor.user()) { + const AMBIENT_TEMPERATURE = sensorApi.get('AMBIENT_TEMPERATURE'); + if (AMBIENT_TEMPERATURE) { + sensorApi.disable('AMBIENT_TEMPERATURE'); + const RELATIVE_HUMIDITY = sensorApi.get('RELATIVE_HUMIDITY'); + if (RELATIVE_HUMIDITY) { + sensorApi.disable('RELATIVE_HUMIDITY'); + const PRESSURE = sensorApi.get('PRESSURE'); + if (PRESSURE) { + sensorApi.disable('PRESSURE'); + const LIGHT = sensorApi.get('LIGHT'); + if (LIGHT) { + sensorApi.disable('LIGHT'); + sensorApi.setEnvironmental({ + temperature: AMBIENT_TEMPERATURE, + humidity: RELATIVE_HUMIDITY, + pressure: PRESSURE, + light: LIGHT, + timestamp: (new Date()).getTime() }); + console.log(JSON.stringify(sensorApi.getEnvironmental())); + // c.stop(); + } else { + sensorApi.getState('LIGHT'); + } + } else { + sensorApi.getState('PRESSURE'); + } + } else { + sensorApi.getState('RELATIVE_HUMIDITY'); + } + } else { + sensorApi.getState('AMBIENT_TEMPERATURE'); + } + } + }); + } + } +}); diff --git a/imports/startup/client/videortc.js b/imports/startup/client/videortc.js new file mode 100644 index 0000000..9f9b113 --- /dev/null +++ b/imports/startup/client/videortc.js @@ -0,0 +1,48 @@ +import { Meteor } from 'meteor/meteor'; +import { Tracker } from 'meteor/tracker'; +import { Router } from 'meteor/iron:router'; +import { TAPi18n } from 'meteor/tap:i18n'; +import { IonPopup } from 'meteor/meteoric:ionic'; +import { pageVideo } from '../../api/client/reactive.js'; + +Meteor.startup(() => { + pageVideo.set('showChat', false); + pageVideo.set('showCaller', false); + pageVideo.set('showTarget', false); + + Meteor.VideoCallServices.RTCConfiguration = { iceServers: [{ + urls: 'turn:numb.viagenie.ca', + credential: 'codjab974', + username: 'thomas.craipeau@gmail.com', + }] }; + + Tracker.autorun((c) => { + if (Meteor.userId() && Meteor.user()) { + Meteor.VideoCallServices.onReceivePhoneCall = (callerId) => { + Meteor.call('getUser', callerId, (error, user) => { + if (!error) { + pageVideo.set('showChat', user._id._str); + IonPopup.confirm({ + title: ` ${TAPi18n.__('You are receiving a phone call')}`, + template: (user.profilThumbImageUrl ? `

${user.name}

` : `

${user.name}

`), + onOk() { + pageVideo.set('showTarget', true); + Router.go('videoRTC'); + }, + okText: ``, + okType: 'button-balanced', + cancelText: ``, + cancelType: 'button-assertive', + onCancel() { + pageVideo.set('showChat', false); + pageVideo.set('showTarget', false); + Meteor.VideoCallServices.endPhoneCall(); + }, + }); + } + }); + }; + c.stop(); + } + }); +}); diff --git a/imports/ui/classified/list.html b/imports/ui/classified/list.html index 7dc66f8..6a37c68 100644 --- a/imports/ui/classified/list.html +++ b/imports/ui/classified/list.html @@ -51,6 +51,12 @@

{{_ "classified"}} {{> cityTitle}}

{{/if}} + + {{/ionContent}} {{/ionView}} diff --git a/imports/ui/components/scope/item.html b/imports/ui/components/scope/item.html index 5a9478c..18e5b61 100644 --- a/imports/ui/components/scope/item.html +++ b/imports/ui/components/scope/item.html @@ -8,11 +8,25 @@

{{name}}

{{#if ../count}} {{../count}} {{/if}} + {{#if equals scopeVar 'poi'}} {{#if type}}

{{_ (typeI18n type)}}

{{/if}} {{/if}} + + {{#if equals scopeVar 'organizations'}} + {{#if typeValue}} +

{{typeValue}}

+ {{/if}} + {{/if}} + + {{#if equals scopeVar 'events'}} + {{#if typeValue}} +

{{typeValue}}

+ {{/if}} + {{/if}} + {{#if startDate}}

{{#if isStart}} diff --git a/imports/ui/dashboard/dashboard.html b/imports/ui/dashboard/dashboard.html index 51b3560..f7d7445 100644 --- a/imports/ui/dashboard/dashboard.html +++ b/imports/ui/dashboard/dashboard.html @@ -101,7 +101,32 @@

{{_ "dashboard"}} {{> cityTitle}}

+ + + + {{/ionContent}} {{/ionView}} + + diff --git a/imports/ui/events/list.html b/imports/ui/events/list.html index b1d03fc..72b2d75 100644 --- a/imports/ui/events/list.html +++ b/imports/ui/events/list.html @@ -56,6 +56,12 @@

{{_ "events"}} {{> cityTitle}}

{{/if}} + + {{/ionContent}} {{/ionView}} diff --git a/imports/ui/map/map.js b/imports/ui/map/map.js index 5e7c6b5..44440d4 100644 --- a/imports/ui/map/map.js +++ b/imports/ui/map/map.js @@ -12,21 +12,37 @@ Template.map.onCreated(function () { }); Template.map.onRendered(function () { - const self = this; - L.mapbox.accessToken = Meteor.settings.public.mapbox; - const map = L.mapbox.map('map', 'mapbox.streets'); - let marker; - self.autorun(function() { - const latitude = pageSession.get('geoPosLatitude') || AutoForm.getFieldValue('geoPosLatitude'); - const longitude = pageSession.get('geoPosLongitude') || AutoForm.getFieldValue('geoPosLongitude'); - // console.log(`${city} ${latitude} ${longitude}`); - if (latitude && longitude) { + + if (Mapbox.loaded()) { + const self = this; + L.mapbox.accessToken = Meteor.settings.public.mapbox; + const map = L.mapbox.map('map', 'mapbox.streets'); + let marker; + self.autorun(function() { + const latitude = pageSession.get('geoPosLatitude') || AutoForm.getFieldValue('geoPosLatitude'); + const longitude = pageSession.get('geoPosLongitude') || AutoForm.getFieldValue('geoPosLongitude'); + // console.log(`${city} ${latitude} ${longitude}`); + if (latitude && longitude) { // console.log('recompute'); - map.setView(new L.LatLng(parseFloat(latitude), parseFloat(longitude)), 13); - if (marker) { - map.removeLayer(marker); + map.setView(new L.LatLng(parseFloat(latitude), parseFloat(longitude)), 13); + if (marker) { + map.removeLayer(marker); + } + marker = L.marker(new L.LatLng(parseFloat(latitude), parseFloat(longitude)), { id: 'point', + latitude: parseFloat(latitude), + longitude: parseFloat(longitude), + draggable: true, + icon: L.mapbox.marker.icon({ + 'marker-size': 'large', + 'marker-color': '#fa0', + }) }).addTo(map); + + marker.on('dragend', function(e) { + console.log('dragend'); + pageSession.set('geoPosLatitude', e.target._latlng.lat); + pageSession.set('geoPosLongitude', e.target._latlng.lng); + }); } - marker = L.marker(new L.LatLng(parseFloat(latitude), parseFloat(longitude))).bindPopup('Vous êtes ici :)').addTo(map); - } - }); + }); + } }); diff --git a/imports/ui/mapscope/mapscope.js b/imports/ui/mapscope/mapscope.js index d730c3d..c2145e3 100644 --- a/imports/ui/mapscope/mapscope.js +++ b/imports/ui/mapscope/mapscope.js @@ -168,8 +168,8 @@ const addMarker = (marker) => { markers[marker.options._id] = marker; if (pageSession.get('currentScopeId') === marker.options._id) { // console.log('marker open'); - marker.addTo(map).openPopup(); map.panTo([marker.options.latitude, marker.options.longitude]); + marker.addTo(map).openPopup(); map.on('popupclose', function() { // console.log('popupclose'); // map.removeLayer(marker); diff --git a/imports/ui/news/detail/detail.html b/imports/ui/news/detail/detail.html index 6a8c27b..d886347 100644 --- a/imports/ui/news/detail/detail.html +++ b/imports/ui/news/detail/detail.html @@ -29,8 +29,8 @@

{{_ "news"}}

+ + + + + + +