Commit ffe6ac7f authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Corrige carga de imágenes públicas, añade template

Aplica correctamente las condiciones de entrada para cargar imágenes,
comprobando si se deben usar credenciales o no de manera estricta
(handlebars agregaba último parámetro a los helpers, rompiendo la
detección de booleano a falso).

Agrega nuevo template para la imagen del usuario, con logo genérico
alternativo si no hay datos.
parent 4da558db
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ module.exports = function(grunt) {

				, 'dist/UserTitle.js': 'src/User/Title.hbs'
				, 'dist/UserImage.js': 'src/User/Image.hbs'
				, 'dist/UserTopbarImage.js': 'src/User/TopbarImage.hbs'
				, 'dist/UserTopbarMenu.js': 'src/User/TopbarMenu.hbs'
				, 'dist/UserEmail.js': 'src/User/Email.hbs'
				, 'dist/UserName.js': 'src/User/Name.hbs'
+2 −1
Original line number Diff line number Diff line
@@ -236,7 +236,8 @@ define([
				var imgSrcPrefix = envApiUrl.replace('/api', '');
				imgSrc = imgSrcPrefix + imagePath;

				if (useCredentials && Credentials.get('userRole') !== 'ROLE_GUEST') {
				var mustUseCredentials = useCredentials && typeof useCredentials === 'boolean';
				if (mustUseCredentials && Credentials.get('userRole') !== 'ROLE_GUEST') {
					imgSrc += '?access_token=' + Credentials.get('accessToken');
				}
			}
+0 −15
Original line number Diff line number Diff line
@@ -331,21 +331,6 @@ define([
			return new handlebars.SafeString(content + "'></i>");
		},

		'Imagea': function(image, urlDefault) {

			var content;
			if (image && (Credentials.get("userRole") && (Credentials.get("userRole") != "ROLE_GUEST"))) {
				content = "<img src='" + image + "?access_token=" + Credentials.get("accessToken") +
				"' width='100%' class='detailsPhoto' /><br>";
			} else if (!(urlDefault instanceof Object)) {
				content = "<img src='" + urlDefault + "' width='100%' class='detailsPhoto' /><br>";
			} else {
				content = "<img src='/resources/images/noIMG.png' width='100%' class='detailsPhoto' /><br>";
			}

			return new handlebars.SafeString(content);
		},

		'URL': function(url) {

			if (url) {
+5 −0
Original line number Diff line number Diff line
{{#if data.image}}
	{{Image data.image true}}
{{else}}
	<i class="fa fa-user"></i>
{{/if}}