added link to registration
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 13 Mar 2013 19:11:12 +0000 (20:11 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 13 Mar 2013 19:11:12 +0000 (20:11 +0100)
angular-server.pl
app/js/filters.js
app/partials/authors.html.ep
test/unit/filtersSpec.js

index e6298fc..aff04f0 100755 (executable)
@@ -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');
index 84624ac..b34d679 100644 (file)
@@ -19,4 +19,10 @@ angular.module('myApp.filters', []).
                        return date.toString();
                }
     }
+  }).
+  filter('registration_url', function() {
+    return function(text) {
+               if ( ! text ) return '';
+               return '#/' + text.replace('.','/');
+    }
   });
index d151365..9532da6 100644 (file)
@@ -28,6 +28,7 @@ Authors
 <td>{{author.value.firstname}}</td>
 <td>{{author.value.organization}}</td>
 <td>{{author.value.email}}</td>
+<td><a href="{{author.id | registration_url }}" target="{{author.id}}" title="see {{author.id}} in new window">R</a></td>
 </tr>
 </table>
 
index 92e9ae8..c494e67 100644 (file)
@@ -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/);
+    }));
+  });
+
 });