Commits

Rufus Pollock committed bd6b70f

[app,annotator][s]: annotator functionality working in new sammy app.

* Lots still to do e.g. security and user info

  • Participants
  • Parent commits fe6910a
  • Branches couchdb

Comments (0)

Files changed (2)

File _attachments/index.html

   <title>Comment On It</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <link rel="shortcut icon" href="http://assets.okfn.org/gfx/logo/favicon.ico" type="image/x-icon" />
-  <!--
-  <link rel="stylesheet" href="https://github.com/nickstenning/annotator/raw/0.8/pkg/annotator.min.css" type="text/css" />
-  -->
+  <link rel="stylesheet" href="https://github.com/nickstenning/annotator/raw/0.9/pkg/annotator.min.css" type="text/css" />
   <link rel="stylesheet" href="themes/commentonit/style.css" type="text/css">
 </head>
 
 <script src="script/vendor/showdown.js" type="text/javascript" charset="utf-8"></script>
 <script src="script/vendor/sha1.js" type="text/javascript" charset="utf-8"></script>
 <script src="script/app.js" type="text/javascript" charset="utf-8"></script>
+<script src="https://github.com/nickstenning/annotator/raw/0.9/pkg/annotator.min.js"></script>
+<!--script src="https://github.com/rgrp/annotator/blob/master/src/plugins/storecouchdb.js?raw=true"></script-->
+<script src="script/vendor/annotator/storecouchdb.js"></script>
 <script type="text/javascript" charset="utf-8">
 	jQuery(function() {
 		CommentOnIt.app.run('#/');

File _attachments/script/app.js

           templateVars.editLink = '#/text/edit/' + docid;
           templateVars.rendered_body = showdown.makeHtml(doc.body);
           self.title(doc.title + ' - View');
-          context.partial(tmplPath('templates/text/view.ms'),
-            templateVars);
+          var docUri = 'our-doc-uri';
+          context.render(tmplPath('templates/text/view.ms')
+            , templateVars
+            , function(fragment) {
+              var ourBoundElement = context.$element();
+              ourBoundElement.html(fragment);
+              var annotator_store = '';
+              ourBoundElement.annotator()
+                .annotator('addPlugin', Annotator.Plugins.User, {one: 1, two: 2})
+                .annotator('addPlugin', Annotator.Plugins.StoreCouchdb, {
+                  prefix: annotator_store,
+                  annotationData: {
+                    uri: docUri
+                    // 'user': {'id': userid} 
+                  },
+                  loadFromSearch: {
+                    uri: docUri
+                  }
+               });
+            }
+          );
         }
       });
     });