add 'to' action to controller, add test (currently failing, show error)
[catagits/catbook-code.git] / lib / LolCatalyst / Lite / Controller / Translate.pm
index 8df27b7..749b3ac 100644 (file)
@@ -30,9 +30,17 @@ sub view :Chained('object') :PathPart('') :Args(0) {
   my ($self, $c) = @_;
   my $object = $c->stash->{object};
   $c->stash(
-    result => $c->model('Translator')
-                ->translate($object->{text})
+    result => $object->translated
   );
 }
 
+sub translate_to :Chained('object') :PathPart('to') :Args(1) {
+  my ($self, $c, $to) = @_;
+  my $object = $c->stash->{object};
+  $c->stash(
+    result => $object->translated_to($to)
+  );
+  $c->stash(template => 'translate/view.tt');
+}
+
 1;