This is an automated email from the git hooks/post-receive script. New commit to branch feature/createPreviewRessource in repository pollen. See http://git.chorem.org/pollen.git commit 590bf52169a854466da50924c122deb119ea566c Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Tue Aug 12 17:49:15 2014 +0200 improve printResource --- pollen-ui-angular/src/main/webapp/js/directives.js | 29 ++++++++++++++++++-- pollen-ui-angular/src/main/webapp/less/style.less | 32 +++++----------------- .../src/main/webapp/partials/inline-poll.html | 2 +- .../src/main/webapp/partials/printResource.html | 7 +++-- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js index 8d32590..b123ee1 100644 --- a/pollen-ui-angular/src/main/webapp/js/directives.js +++ b/pollen-ui-angular/src/main/webapp/js/directives.js @@ -460,12 +460,12 @@ angular.module('pollenDirective', []) ///// PRINT RESOURCE ///// ////////////////////////////////////// -.directive("printResource", ['$timeout', function ($timeout) { +.directive("printResource", ['$timeout', '$http', function ($timeout, $http) { return { restrict : "E", scope : { image : "=", - name : "=" + meta : "=" }, transclude : true, templateUrl : "partials/printResource.html", @@ -477,6 +477,15 @@ angular.module('pollenDirective', []) if (angular.isDefined(newVal)) { scope.resourceURL = conf.restURL+"/resources/"+scope.image; scope.previewURL = scope.resourceURL+"/preview"; + + if (scope.meta.hasOwnProperty("name")) { + scope.resourceURL += "/" + scope.meta.name; + scope.previewURL += "/" + scope.meta.name; + } + + console.log(scope.meta.type); + scope.isImage = isImage(scope.meta.type); + $(element).find('div').spin(false); } else { @@ -497,8 +506,22 @@ angular.module('pollenDirective', []) }); }; + var isImage = function (type) { + var allTypeAccepted = ["image/jpeg", "image/png", "image/gif"]; + + for (var i in allTypeAccepted) { + console.log(allTypeAccepted[i]); + if (allTypeAccepted[i] == type) { + return true; + } + } + return false; + }; + element.bind("click", function () { - toggleZoom(); + if (scope.isImage) { + toggleZoom(); + } }); } } diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less index d2ced80..bef8bdf 100644 --- a/pollen-ui-angular/src/main/webapp/less/style.less +++ b/pollen-ui-angular/src/main/webapp/less/style.less @@ -55,9 +55,7 @@ body { } .navbar .dropdown-menu { - padding: 0; - padding-top: 15px; - padding-bottom: 5px; + padding: 15px 0 5px; left:auto; right:0px; @@ -302,8 +300,7 @@ body { text-align:center; table { - margin:auto; - margin-bottom:8px; + margin: auto auto 8px; } #poll-inline { @@ -362,10 +359,7 @@ body { .pollChoice { min-width:150px; - padding-left:5px; - padding-right:5px; - padding-top:10px; - padding-bottom:5px; + padding: 10px 5px 5px; text-align:center; border:1px solid @border-color; @@ -457,10 +451,7 @@ a { td { border-bottom:1px solid @border-color; - padding-top:5px; - padding-bottom:15px; - padding-left:5px; - padding-right:5px; + padding: 5px 5px 15px; vertical-align:top; } @@ -486,10 +477,7 @@ a { border:3px solid @border-color; tr th, tr td { - padding-top:8px; - padding-bottom:8px; - padding-left:5px; - padding-right:5px; + padding: 8px 5px; border:1px solid @border-color; &.weight { @@ -511,10 +499,7 @@ label.label-block { } .table-result { - margin-left: auto; - margin-right: auto; - margin-top:5px; - margin-bottom:15px; + margin: 5px auto 15px; tr { td, th { @@ -586,10 +571,7 @@ footer { display:inline-block; max-width:100%; max-height:100%; - margin-top:1.25%; - margin-bottom:0px; - margin-left:1.25%; - margin-right:1.25%; + margin: 1.25% 1.25% 0px; padding:8px; background-color:@border-color; border-radius:8px; diff --git a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html index 1da8c67..e8b6da4 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -53,7 +53,7 @@ <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue"></info-error> <input type="button" class="btn btn-default" ng-if="data.poll.choiceAddAllowed && (choice.permission || !choice.id) || globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice, $event);" value="..."/> <br/> - <print-resource image="choice.choiceValue.id" name="choice.choiceValue.meta.name"></print-resource> + <print-resource image="choice.choiceValue.id" meta="choice.choiceValue.meta"></print-resource> </div> diff --git a/pollen-ui-angular/src/main/webapp/partials/printResource.html b/pollen-ui-angular/src/main/webapp/partials/printResource.html index 810e708..875f8d1 100644 --- a/pollen-ui-angular/src/main/webapp/partials/printResource.html +++ b/pollen-ui-angular/src/main/webapp/partials/printResource.html @@ -1,7 +1,8 @@ -<div class="preview"><img ng-attr-src="{{previewURL}}" /></div> -<div ng-show="showImage" class="full"> +<div class="preview" ng-if="isImage"><img ng-attr-src="{{previewURL}}" /></div> +<div class="preview" ng-if="!isImage"><a ng-attr-href="{{resourceURL}}"><img ng-attr-src="{{previewURL}}" /></a></div> +<div ng-if="showImage && isImage" class="full"> <div class="full-content"> - <span>{{name}}</span> + <span>{{meta.name}}</span> <img ng-attr-src="{{resourceURL}}" /> </div> </div> \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.