Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/regazzojDevelopment'
Browse files Browse the repository at this point in the history
  • Loading branch information
seballot committed Aug 2, 2018
2 parents dcf33ea + cc17a41 commit 13da964
Show file tree
Hide file tree
Showing 7 changed files with 3,402 additions and 6 deletions.
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ gulp.task('scriptsLibs', function() {
return gulp.src(['src/js/libs/**/!(leaflet-routing-machine)*.js',
'src/js/libs/leaflet-routing-machine.js' ,
'!src/js/libs/materialize/unused/**/*.js',
'!src/js/libs/nunjucks.js',
'!src/js/libs/nunjucks-slim.js',
'!src/js/libs/commonmark.js'
])
.pipe(concat('libs.js'))
.pipe(gulp.dest('build'));
Expand Down
3 changes: 3 additions & 0 deletions src/js/classes/config/gogo-config.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { GoGoFeature } from './gogo-feature.class';
import { ElementStatus } from '../classes';
import { DEFAULT_FEATURES } from './gogo-default-feature' ;
declare var L : any;
declare var commonmark;

export class GoGoConfig
{
Expand Down Expand Up @@ -145,6 +146,7 @@ export class GoGoConfig
titleFont: undefined ,
taxonomyMainTitleFont: undefined ,
}
readonly bodyTemplate = undefined;

constructor(config : any)
{
Expand Down Expand Up @@ -199,6 +201,7 @@ export class GoGoConfig
switch(prop) {
case 'defaultBounds' : new_prop = L.latLngBounds(object[prop]);break;
case 'defaultCenter' : new_prop = L.latLng(object[prop]);break;
case 'bodyTemplate': let parser=new commonmark.Parser(),htmlRenderer=new commonmark.HtmlRenderer();new_prop=htmlRenderer.render(parser.parse(object[prop]));break;
default: new_prop = object[prop];break;
}
that[prop] = new_prop;
Expand Down
16 changes: 12 additions & 4 deletions src/js/components/element/element.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ElementMenuComponent } from "./element-menu.component";
import { ModerationComponent } from '../element/moderation.component';
import { InteractiveSectionComponent } from './interactive-section.component';
declare var $;
declare var nunjucks;

export class ElementComponent
{
Expand Down Expand Up @@ -37,8 +38,7 @@ export class ElementComponent
else
rootCategoriesValues = this.element.getRootCategoriesValues();

let html = App.templateModule.render('element',
{
let options = {
element : this.element,
showDistance: App.geocoder.getLocation() ? true : false,
listingMode: App.mode == AppModes.List,
Expand All @@ -54,8 +54,16 @@ export class ElementComponent
isMapMode : App.mode == AppModes.Map,
config : App.config,
smallWidth : App.mode == AppModes.Map && App.infoBarComponent.isDisplayedAside(),
allowedStamps : App.stampModule.allowedStamps
});
allowedStamps : App.stampModule.allowedStamps,
body : undefined
};

// If there is a body template configured, then we use it. We use the default body otherwise.
if(App.config.bodyTemplate) options.body = nunjucks.renderString(App.config.bodyTemplate, this.element).replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"');
else options.body = nunjucks.render('components/element/body.html.njk', options);

let html = App.templateModule.render('element', options);

return html;
};

Expand Down
Loading

0 comments on commit 13da964

Please sign in to comment.