Commit af7485cb8a9c42a7c18f4d8331fd2463cfbc33b0

Authored by Victor Costa
1 parent 2709e359

Add filter to replace noosfero template attributes

src/app/components/noosfero-blocks/link-list/link-list.html
1 1 <div ng-repeat="link in vm.links">
2   - <a class="icon-{{link.icon}}" ng-href="{{link.address}}">{{link.name}}</a>
  2 + <a class="icon-{{link.icon}}" ng-href="{{link.address | noosferoTemplateFilter:{profile: vm.owner.identifier} }}">{{link.name}}</a>
3 3 </div>
... ...
src/app/components/noosfero/noosfero-template.filter.js 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +(function() {
  2 + 'use strict';
  3 + angular
  4 + .module("angular")
  5 + .filter("noosferoTemplateFilter", function() {
  6 + return function(text, options) {
  7 + for(var option in options) {
  8 + text = text.replace('{'+option+'}', options[option]);
  9 + }
  10 + return text;
  11 + }
  12 + })
  13 +})();
... ...
src/app/views/profile/block.html
... ... @@ -3,7 +3,6 @@
3 3 <h3 class="panel-title">{{block.title}}</h3>
4 4 </div>
5 5 <div class="panel-body">
6   - <pre>{{block}}</pre>
7 6 <noosfero-block block="block" owner="main.owner"></noosfero-block>
8 7 </div>
9 8 </div>
... ...