Commit 41904b1b authored by Sean Hammond's avatar Sean Hammond Committed by GitHub

Merge pull request #8 from hypothesis/simplify-annot-cmp

Simplify annotation component by removing duplicated state
parents 9d6f56bc 8db47b83
This diff is collapsed.
...@@ -22,20 +22,20 @@ ...@@ -22,20 +22,20 @@
target="_blank" ng-if="vm.group() && vm.group().url" href="{{vm.group().url}}"> target="_blank" ng-if="vm.group() && vm.group().url" href="{{vm.group().url}}">
<i class="h-icon-group"></i><span class="annotation-header__group-name">{{vm.group().name}}</span> <i class="h-icon-group"></i><span class="annotation-header__group-name">{{vm.group().name}}</span>
</a> </a>
<span ng-show="vm.isPrivate" <span ng-show="vm.state().isPrivate"
title="This annotation is visible only to you."> title="This annotation is visible only to you.">
<i class="h-icon-lock"></i><span class="annotation-header__group-name" ng-show="!vm.group().url">Only me</span> <i class="h-icon-lock"></i><span class="annotation-header__group-name" ng-show="!vm.group().url">Only me</span>
</span> </span>
<i class="h-icon-border-color" ng-show="vm.isHighlight() && !vm.editing()" title="This is a highlight. Click 'edit' to add a note or tag."></i> <i class="h-icon-border-color" ng-show="vm.isHighlight() && !vm.editing()" title="This is a highlight. Click 'edit' to add a note or tag."></i>
<span ng-if="::vm.showDocumentInfo"> <span ng-if="::vm.showDocumentInfo">
<span class="annotation-citation" ng-if="vm.documentMeta.titleLink"> <span class="annotation-citation" ng-if="vm.documentMeta().titleLink">
on "<a ng-href="{{vm.documentMeta.titleLink}}">{{vm.documentMeta.titleText}}</a>" on "<a ng-href="{{vm.documentMeta().titleLink}}">{{vm.documentMeta().titleText}}</a>"
</span> </span>
<span class="annotation-citation" ng-if="!vm.documentMeta.titleLink"> <span class="annotation-citation" ng-if="!vm.documentMeta().titleLink">
on "{{vm.documentMeta.titleText}}" on "{{vm.documentMeta().titleText}}"
</span> </span>
<span class="annotation-citation-domain" <span class="annotation-citation-domain"
ng-if="vm.documentMeta.domain">({{vm.documentMeta.domain}})</span> ng-if="vm.documentMeta().domain">({{vm.documentMeta().domain}})</span>
</span> </span>
</span> </span>
</span> </span>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<timestamp <timestamp
class-name="'annotation-header__timestamp'" class-name="'annotation-header__timestamp'"
timestamp="vm.updated()" timestamp="vm.updated()"
href="vm.linkHTML" href="vm.links().html"
ng-if="!vm.editing() && vm.updated()"></timestamp> ng-if="!vm.editing() && vm.updated()"></timestamp>
</header> </header>
...@@ -75,8 +75,8 @@ ...@@ -75,8 +75,8 @@
collapse="vm.collapseBody" collapse="vm.collapseBody"
collapsed-height="400" collapsed-height="400"
overflow-hysteresis="20" overflow-hysteresis="20"
content-data="vm.form.text"> content-data="vm.state().text">
<markdown text="vm.form.text" <markdown text="vm.state().text"
on-edit-text="vm.setText(text)" on-edit-text="vm.setText(text)"
read-only="!vm.editing()"> read-only="!vm.editing()">
</markdown> </markdown>
...@@ -86,14 +86,14 @@ ...@@ -86,14 +86,14 @@
<!-- Tags --> <!-- Tags -->
<div class="annotation-body form-field" ng-if="vm.editing()"> <div class="annotation-body form-field" ng-if="vm.editing()">
<tag-editor tags="vm.form.tags" <tag-editor tags="vm.state().tags"
on-edit-tags="vm.setTags(tags)"></tag-editor> on-edit-tags="vm.setTags(tags)"></tag-editor>
</div> </div>
<div class="annotation-body u-layout-row tags tags-read-only" <div class="annotation-body u-layout-row tags tags-read-only"
ng-if="(vm.canCollapseBody || vm.form.tags.length) && !vm.editing()"> ng-if="(vm.canCollapseBody || vm.state().tags.length) && !vm.editing()">
<ul class="tag-list"> <ul class="tag-list">
<li class="tag-item" ng-repeat="tag in vm.form.tags"> <li class="tag-item" ng-repeat="tag in vm.state().tags">
<a ng-href="{{vm.tagStreamURL(tag)}}" target="_blank">{{tag}}</a> <a ng-href="{{vm.tagStreamURL(tag)}}" target="_blank">{{tag}}</a>
</li> </li>
</ul> </ul>
...@@ -170,8 +170,8 @@ ...@@ -170,8 +170,8 @@
</button> </button>
<annotation-share-dialog <annotation-share-dialog
group="vm.group()" group="vm.group()"
uri="vm.linkInContext" uri="vm.links().incontext"
is-private="vm.isPrivate" is-private="vm.state().isPrivate"
is-open="vm.showShareDialog" is-open="vm.showShareDialog"
on-close="vm.showShareDialog = false"> on-close="vm.showShareDialog = false">
</annotation-share-dialog> </annotation-share-dialog>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment