Skip to content

Commit

Permalink
Merge pull request #25 from aboire/master
Browse files Browse the repository at this point in the history
update et bug fix
  • Loading branch information
aboire authored Aug 11, 2017
2 parents 41fff82 + ef6cb57 commit ab56a4b
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 38 deletions.
6 changes: 5 additions & 1 deletion imports/api/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ if (Meteor.isClient) {
}

export const matchTags = (doc, tags) => {
const regex = /(?:^|\s)(?:#)([a-zA-Z\d]+)/gm;
// const regex = /(?:^|\s)(?:#)([a-zA-Z\d]+)/gm;
// const regex = /(?:^|\s)(?:#)([^\s!@#$%^&*()=+./,\[{\]};:'"?><]+)/gm;
const regex = /(?:#)([^\s!@#$%^&*()=+./,\[{\]};:'"?><]+)/gm;

const matches = [];
let match;
if (doc.shortDescription) {
Expand All @@ -154,6 +157,7 @@ export const matchTags = (doc, tags) => {
matches.push(match[1]);
}
}

if (tags) {
const arrayTags = _.reject(tags, value => matches[value] === null, matches);
if (doc.tags) {
Expand Down
4 changes: 2 additions & 2 deletions imports/api/server/method.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,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)) {
Expand All @@ -336,7 +336,7 @@ URL._encodeParams = function(params, prefix) {
}
}
return str.join('&').replace(/%20/g, '+');
};
}; */

Meteor.methods({
userup (geo) {
Expand Down
3 changes: 2 additions & 1 deletion imports/startup/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ Meteor.startup(function () {
Template.registerHelper('textTags', (text, tags) => {
if (text) {
if (tags) {
tags.sort((a, b) => b.length - a.length);
_.each(tags, (value) => {
text = text.replace(new RegExp(`#${value}`, 'g'), `<a href="" class="positive">#${value}</a>`);
text = text.replace(new RegExp(`#${value}`, 'g'), `<a href="" class="positive"><i class="icon fa fa-tag"></i>${value}</a>`);
}, text);
}
return text;
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/changeposition/changeposition.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1 class="title">{{_ "Change location"}}</h1>
{{#ionView}}
{{#ionContent}}
{{#ionList}}
<div class="list list-inset">
<div class="list list-inset" data-snap-ignore="true">
<label class="item item-input">
<i class="icon ion-search placeholder-icon"></i>
<input id="search" type="text" placeholder="{{_ "Search a city or postal code"}}" value="{{filter}}">
Expand Down
8 changes: 4 additions & 4 deletions imports/ui/citoyens/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h1 class="title">{{_ "citoyens"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a citoyen"}}
</div>
Expand Down Expand Up @@ -138,7 +138,7 @@ <h1 class="title">{{_ "citoyens"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a citoyen"}}
</div>
Expand Down Expand Up @@ -188,8 +188,8 @@ <h1 class="title">{{_ "citoyens"}}</h1>
{{/if}}

{{#if equals block 'descriptions'}}
{{> afQuickField name='shortDescription' type="textarea" label-type='stacked' rows=8}}
{{> afQuickField name='description' type="textarea" label-type='stacked' rows=8}}
{{> afQuickField name='shortDescription' type="textarea" label-type='stacked' rows=8 autocorrect="off" spellcheck="false" autocapitalize="off"}}
{{> afQuickField name='description' type="textarea" label-type='stacked' rows=8 autocorrect="off" spellcheck="false" autocapitalize="off"}}
{{/if}}

{{#if equals block 'preferences'}}
Expand Down
1 change: 1 addition & 0 deletions imports/ui/citoyens/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ AutoForm.addHooks(['editBlockCitoyen'], {
const scope = 'citoyens';
const block = pageSession.get('block');
if (modifier && modifier.$set) {
console.log(pageSession.get('tags'));
modifier.$set = matchTags(modifier.$set, pageSession.get('tags'));
} else {
modifier.$set = {};
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/classified/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h1 class="title">{{_ "classified"}}</h1>

{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Create a classified"}}
</div>
Expand Down Expand Up @@ -127,7 +127,7 @@ <h1 class="title">{{_ "classified"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a classified"}}
</div>
Expand Down
6 changes: 3 additions & 3 deletions imports/ui/events/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h1 class="title">{{_ "events"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Create a event"}}
</div>
Expand Down Expand Up @@ -137,7 +137,7 @@ <h1 class="title">{{_ "events"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a event"}}
</div>
Expand Down Expand Up @@ -181,7 +181,7 @@ <h1 class="title">{{_ "events"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a event"}}
</div>
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/login/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title">Communecter</h1>
</div>
</div>
{{/if}}
<div class="animated fadeInLeft list">
<div class="animated fadeInLeft list" data-snap-ignore="true">
<label class="item item-input">
<span class="input-label">
<i class="icon ion-email"></i>
Expand Down Expand Up @@ -70,7 +70,7 @@ <h1 class="title">Communecter</h1>
</div>
</div>
{{/if}}
<div class="animated fadeInRight list">
<div class="animated fadeInRight list" data-snap-ignore="true">
<label class="item item-input">
<div class="input-label">
<i class="icon ion-person"></i>
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/mapscope/mapscope.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1 class="title">{{_ "Carte"}}</h1>
</template>

<template name="mapCanvas">
<div id="map_canvas" class="map"></div>
<div id="map_canvas" class="map" data-snap-ignore="true"></div>
</template>

<template name="mapscopepopup">
Expand Down
68 changes: 62 additions & 6 deletions imports/ui/mapscope/mapscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Mapbox } from 'meteor/communecter:mapbox';
import { $ } from 'meteor/jquery';
import { Blaze } from 'meteor/blaze';
import { Router } from 'meteor/iron:router';
import { Mongo } from 'meteor/mongo';
import { ReactiveVar } from 'meteor/reactive-var';
import { IonLoading } from 'meteor/meteoric:ionic';

Expand Down Expand Up @@ -314,24 +315,76 @@ Template.mapCanvas.onRendered(function () {
if (self.liveQuery) {
self.liveQuery.stop();
}
if (self.liveQueryCurrent) {
self.liveQueryCurrent.stop();
}
self.autorun(function () {
if (self.ready.get()) {
if (Mapbox.loaded()) {
clearLayers();

const collection = nameToCollection(Router.current().params.scope);
let query = {};
query = queryGeoFilter(query);

if (pageSession.get('currentScopeId')) {
query.$or = [{ _id: pageSession.get('currentScopeId') }];
self.liveQueryCurrent = collection.find({ _id: new Mongo.ObjectID(pageSession.get('currentScopeId')), geo: { $exists: 1 } }).observe({
added(event) {
if (event && event.geo && event.geo.latitude) {
const containerNode = document.createElement('div');

Blaze.renderWithData(Template.mapscopepopup, event, containerNode);
const marker = new L.Marker([event.geo.latitude, event.geo.longitude], {
_id: event._id._str,
title: event.name,
latitude: event.geo.latitude,
longitude: event.geo.longitude,
icon: selectIcon(event),
}).bindPopup(containerNode).on('click', function(e) {
// console.log(e.target.options._id);
map.panTo([e.target.options.latitude, e.target.options.longitude]);
// pageSession.set('currentScopeId', e.target.options._id);
});
addMarker(marker);
}
},
changed(event) {
// console.log(event._id._str);
if (event && event.geo && event.geo.latitude) {
const marker = markers[event._id._str];
if (marker) {
if (map.hasLayer(marker)) map.removeLayer(marker);
const containerNode = document.createElement('div');
Blaze.renderWithData(Template.mapscopepopup, event, containerNode);
const markerAdd = new L.Marker([event.geo.latitude, event.geo.longitude], {
_id: event._id._str,
title: event.name,
latitude: event.geo.latitude,
longitude: event.geo.longitude,
icon: selectIcon(event),
}).bindPopup(containerNode).on('click', function(e) {
// console.log(e.target.options._id);
map.panTo([e.target.options.latitude, e.target.options.longitude]);
// pageSession.set('currentScopeId', e.target.options._id);
});
addMarker(markerAdd);
}
}
},
removed(event) {
// console.log(event._id._str);
removeMarker(event._id._str);
},
});
}

let query = {};
query = queryGeoFilter(query);
// query['created'] = {$gte : inputDate};

if (Router.current().params.scope === 'events') {
/* if (Router.current().params.scope === 'events') {
}
} */
query.geo = { $exists: 1 };
// console.log(query);

self.liveQuery = collection.find(query).observe({
added(event) {
if (event && event.geo && event.geo.latitude) {
Expand Down Expand Up @@ -393,4 +446,7 @@ Template.mapCanvas.onDestroyed(function () {
if (self.liveQuery) {
self.liveQuery.stop();
}
if (self.liveQueryCurrent) {
self.liveQueryCurrent.stop();
}
});
2 changes: 1 addition & 1 deletion imports/ui/news/detail/comments/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ <h1 class="title">{{_ "comment"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "edit a comment"}}
</div>
Expand Down
8 changes: 4 additions & 4 deletions imports/ui/news/news.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ <h1 class="title">{{_ "post a news"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "post a news"}}
</div>
Expand All @@ -324,7 +324,7 @@ <h1 class="title">{{_ "post a news"}}</h1>
</div>
{{/if}}
{{#autoForm id="addNew" schema=blockSchema type="method" meteormethod="insertNew" template="ionic" class="padding"}}
{{> afQuickField name='text' type="textarea" label-type='placeholder' rows=8 class="atwho-inputor"}}
{{> afQuickField name='text' type="textarea" label-type='placeholder' rows=8 class="atwho-inputor" autocomplete="off" autocorrect="off" spellcheck="false" autocapitalize="off"}}
{{> afQuickField name='scope'}}
{{#if equals scope.scopeVar 'organizations'}}
{{#if scope.isAdmin}}
Expand Down Expand Up @@ -368,7 +368,7 @@ <h1 class="title">{{_ "news"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "edit a news"}}
</div>
Expand All @@ -394,7 +394,7 @@ <h1 class="title">{{_ "news"}}</h1>
</template>

<template name="newsFields">
{{> afQuickField name='text' type="textarea" label-type='placeholder' rows=8 class="atwho-inputor"}}
{{> afQuickField name='text' type="textarea" label-type='placeholder' rows=8 class="atwho-inputor" autocomplete="off" autocorrect="off" spellcheck="false" autocapitalize="off"}}
</template>

<template name="actionSheet">
Expand Down
6 changes: 3 additions & 3 deletions imports/ui/organizations/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h1 class="title">{{_ "organizations"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Create a organization"}}
</div>
Expand Down Expand Up @@ -131,7 +131,7 @@ <h1 class="title">{{_ "organizations"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a organization"}}
</div>
Expand Down Expand Up @@ -174,7 +174,7 @@ <h1 class="title">{{_ "organizations"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a organization"}}
</div>
Expand Down
6 changes: 3 additions & 3 deletions imports/ui/poi/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h1 class="title">{{_ "poi"}}</h1>

{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Create a point of interest"}}
</div>
Expand Down Expand Up @@ -127,7 +127,7 @@ <h1 class="title">{{_ "poi"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a point of interest"}}
</div>
Expand Down Expand Up @@ -170,7 +170,7 @@ <h1 class="title">{{_ "poi"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a point of interest"}}
</div>
Expand Down
6 changes: 3 additions & 3 deletions imports/ui/projects/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h1 class="title">{{_ "projects"}}</h1>

{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Create a project"}}
</div>
Expand Down Expand Up @@ -127,7 +127,7 @@ <h1 class="title">{{_ "projects"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a project"}}
</div>
Expand Down Expand Up @@ -170,7 +170,7 @@ <h1 class="title">{{_ "projects"}}</h1>
{{#if dataReady}}
{{#ionView}}
{{#ionContent}}
<div class="list">
<div class="list" data-snap-ignore="true">
<div class="item item-divider">
{{_ "Edit a project"}}
</div>
Expand Down
Loading

0 comments on commit ab56a4b

Please sign in to comment.