From 1f4c5ccaceed19a94d25ca1ee774b658da5a7cd4 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 13 Mar 2013 20:11:12 +0100 Subject: [PATCH] added link to registration --- angular-server.pl | 6 ++++-- app/js/filters.js | 6 ++++++ app/partials/authors.html.ep | 1 + test/unit/filtersSpec.js | 7 +++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/angular-server.pl b/angular-server.pl index e6298fc..aff04f0 100755 --- a/angular-server.pl +++ b/angular-server.pl @@ -19,9 +19,13 @@ my $couchdb_database = 'drzb2013v2'; my $couchdb_view = "http://10.60.0.92:5984/_utils/document.html?$couchdb_database"; my $client = Mojo::UserAgent->new; +our $view_cache; + sub _couchdb_put { my ( $url, $data ) = @_; + $view_cache = undef; + $data->{'$entity'} = $1 if $url =~ m{/(\w+)\.\d+/$/}; my $json = Mojo::JSON->new->encode( $data ); @@ -216,8 +220,6 @@ any [ 'post' ] => '/data/:database/:entity' => sub { # CouchDB proxy for _design _view -our $view_cache; - get '/:database/_design/:design/_view/:view' => sub { my $self = shift; my $format = $self->param('format'); diff --git a/app/js/filters.js b/app/js/filters.js index 84624ac..b34d679 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -19,4 +19,10 @@ angular.module('myApp.filters', []). return date.toString(); } } + }). + filter('registration_url', function() { + return function(text) { + if ( ! text ) return ''; + return '#/' + text.replace('.','/'); + } }); diff --git a/app/partials/authors.html.ep b/app/partials/authors.html.ep index d151365..9532da6 100644 --- a/app/partials/authors.html.ep +++ b/app/partials/authors.html.ep @@ -28,6 +28,7 @@ Authors {{author.value.firstname}} {{author.value.organization}} {{author.value.email}} +R diff --git a/test/unit/filtersSpec.js b/test/unit/filtersSpec.js index 92e9ae8..c494e67 100644 --- a/test/unit/filtersSpec.js +++ b/test/unit/filtersSpec.js @@ -27,4 +27,11 @@ describe('filter', function() { expect(registration_date_timeFilter('registration.135721386441722')).toMatch(/2013/); })); }); + + describe('registration_url', function() { + it('registration_url from id', inject(function(registration_urlFilter) { + expect(registration_urlFilter('registration.135721386441722')).toMatch(/registration\/135721386441722/); + })); + }); + }); -- 2.20.1