From d084845afdf398065370278b51a6f25fa85fefce Mon Sep 17 00:00:00 2001 From: aboire Date: Thu, 17 Aug 2017 15:38:19 +0400 Subject: [PATCH 1/5] update --- client/scss/_ionic.scss | 1 + client/scss/ionic.app.scss | 36 ++++ client/scss/stylesheets/_floating-menu.scss | 225 ++++++++++++++++++++ i18n/en.i18n.json | 19 ++ i18n/fr.i18n.json | 19 ++ imports/api/server/method.js | 39 +++- imports/startup/client/device.js | 11 + imports/startup/client/index.js | 1 + imports/ui/classified/list.html | 6 + imports/ui/dashboard/dashboard.html | 25 +++ imports/ui/events/list.html | 6 + imports/ui/map/map.js | 46 ++-- imports/ui/news/news.html | 94 +++++--- imports/ui/news/news.js | 10 + imports/ui/organizations/list.html | 9 + imports/ui/poi/list.html | 8 +- imports/ui/projects/list.html | 6 + 17 files changed, 517 insertions(+), 44 deletions(-) create mode 100644 client/scss/stylesheets/_floating-menu.scss create mode 100644 imports/startup/client/device.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/i18n/en.i18n.json b/i18n/en.i18n.json index ce0a461..4b69ff5 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -142,6 +142,13 @@ "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", "simpleschema": { "messages": { "usernameNotUnique": "[label] already exists", @@ -345,6 +352,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..24f70bc 100644 --- a/i18n/fr.i18n.json +++ b/i18n/fr.i18n.json @@ -142,6 +142,13 @@ "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", "simpleschema": { "messages": { "usernameNotUnique": "[label] existe déja", @@ -343,6 +350,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/server/method.js b/imports/api/server/method.js index cf89ecc..e77f79b 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; } @@ -1434,6 +1437,7 @@ indexMax:20 */ } }, insertOrganization (doc) { + console.log(doc); SchemasOrganizationsRest.clean(doc); check(doc, SchemasOrganizationsRest); if (!this.userId) { @@ -1444,7 +1448,7 @@ indexMax:20 */ docRetour.key = 'organization'; docRetour.collection = 'organizations'; - // console.log(docRetour); + console.log(docRetour); const retour = apiCommunecter.postPixel('element', 'save', docRetour); return retour; @@ -1649,3 +1653,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/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..d3e0a65 100644 --- a/imports/startup/client/index.js +++ b/imports/startup/client/index.js @@ -1,5 +1,6 @@ import './client.js'; import './locale.js'; +import './device.js'; import './reload.js'; import './position.js'; import './routes.js'; 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/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..f8be8d4 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': 'small', + '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/news/news.html b/imports/ui/news/news.html index 1ff98f7..a5dab2f 100644 --- a/imports/ui/news/news.html +++ b/imports/ui/news/news.html @@ -447,8 +447,7 @@

{{_ "news"}}

{{> ionIcon icon="ios-people"}} {{#if isAdmin}} - - + {{else}} {{> Bouton_card id=_id._str scope=scopeVar isConnect=isAttendees classOff="button-small saveattendees-link" classOn="button-small disconnectscope-link" iconOff="fa fa-link" iconOn="fa fa-unlink" titleOff=(_ "Participate")}} {{/if}} @@ -487,10 +486,7 @@

{{_ "news"}}

{{#if isMembers}} {{#if isAdmin}} - - - - + {{#if isCordova}} {{/if}} @@ -515,7 +511,6 @@

{{_ "news"}}

{{> Bouton_card id=_id._str scope=scopeVar isConnect=isFollowersMe classOff="button-small followperson-link" classOn="button-small unfollowscope-link" iconOff="fa fa-rss" iconOn="fa fa-rss-square"}} {{> Bouton_card id=_id._str scope=scopeVar isConnect=isFavorites classOff="button-small favorites-link" classOn="button-small favorites-link" iconOff="fa fa-star" iconOn="fa fa-star-o"}} - {{#if toBeValidated}} {{/if}} @@ -567,14 +561,12 @@

{{_ "news"}}

+ +