Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-release merge for v0.3.3 #102

Merged
merged 5 commits into from
Jun 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30,868 changes: 30,868 additions & 0 deletions annotations/static/annotations/js/angular.js

Large diffs are not rendered by default.

11,008 changes: 11,008 additions & 0 deletions annotations/static/annotations/js/jquery-1.12.4.js

Large diffs are not rendered by default.

1,765 changes: 0 additions & 1,765 deletions annotations/static/annotations/js/text.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* Appellations.
*/

angular.module('annotationApp').factory('appellationService', ['$rootScope', '$q', 'Appellation', function($rootScope, $q, Appellation) {
angular.module('annotationApp').factory('appellationService',
['$rootScope', '$q', 'Appellation',
function($rootScope, $q, Appellation) {
return {
appellations: [], // Holds all currently loaded Appellations.
appellationHash: {}, // Indexes Appellations by their interpretation.
Expand All @@ -14,14 +16,18 @@ angular.module('annotationApp').factory('appellationService', ['$rootScope', '$q
* Add appellation ID and class to appellated words.
*/
tagWordAsAppellation: function(appellation) {
// Could be here.
var tokenIds = appellation.tokenIds.split(',');
tokenIds.forEach(function(tokenId) {
// Hovering over an appellation displays a tooltip that shows
// the label and type of the interpretation (concept).
$('word#' + tokenId).attr('appellation', appellation.id)
.attr('data-toggle', 'tooltip')
.addClass('appellation')
.tooltip({container: 'body', title: appellation.interpretation_label + ' (' + appellation.interpretation_type_label + ')'}); // Fix jumpiness.
.tooltip({
container: 'body',
title: appellation.interpretation_label + ' (' + appellation.interpretation_type_label + ')'
}); // Fix jumpiness.
});
},

Expand Down
14 changes: 12 additions & 2 deletions annotations/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,22 @@ def get_snippet_relation(relationset):
for t in tokenIds:
annotation_map[t] = relation['predicate__interpretation__label']

for appellation in Appellation.objects.filter(pk__in=appellation_ids).values('tokenIds', 'interpretation__label', 'interpretation_id'):
appellation_fields = [
'tokenIds',
'interpretation__label',
'interpretation_id',
'interpretation__merged_with_id',
'interpretation__merged_with__label',
]
for appellation in Appellation.objects.filter(pk__in=appellation_ids).values(*appellation_fields):

tokenIds = appellation['tokenIds'].split(',')
annotated_words.append(tokenIds)
for t in tokenIds:
annotation_map[t] = appellation['interpretation__label']
if appellation['interpretation__merged_with_id']:
annotation_map[t] = appellation['interpretation__merged_with__label']
else:
annotation_map[t] = appellation['interpretation__label']

# Group sequences of tokens from appellations together if they are in close
# proximity.
Expand Down
4 changes: 4 additions & 0 deletions annotations/templates/annotations/angular.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
<script src="{% static "annotations/js/angular-resource.min.js" %}"></script>
<script src="{% static "annotations/js/angucomplete-alt.js" %}"></script>
<script src="{% static "annotations/js/ui-bootstrap-tpls-1.2.5.min.js" %}"></script>
<script src="{% static "annotations/js/isteven-multi-select.js" %}"></script>

<script src="{% static "annotations/js/bootstrap-multiselect.js" %}"></script>
<script src="{% static "annotations/js/bootstrap-multiselect-collapsible-groups.js" %}"></script>
3 changes: 0 additions & 3 deletions annotations/templates/annotations/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@

<script src="{% static "annotations/js/bootstrap.min.js" %}"></script>
<script src="{% static "annotations/js/d3.min.js" %}"></script>
<script src="{% static "annotations/js/isteven-multi-select.js" %}"></script>


<script src="{% static "annotations/js/bootstrap-multiselect.js" %}"></script>
<script src="{% static "annotations/js/bootstrap-multiselect-collapsible-groups.js" %}"></script>


<script>
Expand Down
64 changes: 15 additions & 49 deletions annotations/templates/annotations/text.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% load staticfiles %}
{% load app_filters %}

<html ng-app="annotationApp">
<html>
<head>
<script type="text/javascript" src="https://diging.atlassian.net/s/feb56a6b15dfe1c4dce860c5ec0d0c12-T/en_USugtsph-ren-off/70107/dd3ed69607618acd4f2d9e33519d4b21/2.0.7/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=da09a5cd"></script>
{% include "annotations/scripts.html" %}
<script>
function stripTrailingSlash(str) {
if(str.substr(-1) === '/') {
Expand All @@ -16,16 +16,11 @@
</script>

{% include "annotations/stylesheets.html" %}
{% include "annotations/angular.html" %}
{% include "annotations/scripts.html" %}

<script>
var TEXTID = {{ textid }},
USERID = {{ userid }};
</script>

{% include "annotations/textApp.html" %}

<script>
// If the window scrolls below the top of the main content, the right-
// hand column should scroll with it.
Expand Down Expand Up @@ -72,14 +67,16 @@
sticky_relocate();
});
</script>
{% include "annotations/angular.html" %}
{% include "annotations/textApp.html" %}
<title>{{ title }}</title>

{% csrf_token %}

<!-- Mobile support. We want to be slightly zoomed out, or else the interface is simply too mashed. -->
<meta name="viewport" content="width=device-width, initial-scale=0.75">
</head>
<body ng-cloak><!-- ng-cloak prevents unrendered angular templates from being displayed. -->
<body ng-app="annotationApp"><!-- ng-cloak prevents unrendered angular templates from being displayed. -->
{% include "annotations/header.html" %}

<!-- csrf_ajax.js gets the CSRF token for this page, and pre-configures AJAX requests. -->
Expand Down Expand Up @@ -117,45 +114,8 @@
<strong>{{text.relation_count}}</strong> relations have been encoded by {{ annotators|length }}
user{% if annotators|length > 1 %}s{% endif %} on the basis of this text.{% endif %}
</p>
<!-- <div class="panel panel-default metadata-panel">
<div class="panel-heading">
<span class="h2">{{ text.title }}</span>
{% if text.originalResource %}
<a href="{{ text.originalResource }}"
type="button" id="originalResourceLink"
class="btn btn-primary pull-right"
data-toggle="tooltip"
title="Open original resource in a new tab"
target="_blank">
<span class="glyphicon glyphicon-new-window "></span>
</a>
<script>$('#originalResourceLink').tooltip();</script>
{% endif %}
</div>
<div class="panel-body">
<div>
<span class="label label-default">URI</span> {{ text.uri }}
</div>
{% if text.source %}
<div>
<span class="label label-default">Source</span> {{ text.source }}
</div>
{% endif %}
<div>
<span class="label label-default">Created</span> {{ text.created }}
</div>
<div>
<span class="label label-default">Added by</span> {{ text.addedBy }}
</div>
<div>
<span class="label label-default">Added</span> {{ text.added }}
</div>
</div>
</div> -->

<div class="panel panel-default">
<!-- <div class="panel-heading">
<span class="h4">Content</span>
</div> -->
<div class="panel-body">
{{ text.tokenizedContent|safe }}
</div>
Expand Down Expand Up @@ -196,12 +156,16 @@
data-placement="left">
<span class="glyphicon glyphicon-plus"></span>
</a>
<script>$('#createRelationButton').tooltip();</script>
<script>
$(function() {
$('#createRelationButton').tooltip();
});
</script>
</div>
<!-- </li> -->
</ul>
</div>
<div class="panel-body">
<div class="panel-body" ng-cloak>
<div class="tab-content action-body">
{% include "annotations/text/appellationTab.html" %}
{% include "annotations/text/relationTab.html" %}
Expand All @@ -210,9 +174,11 @@
</div>
</div>
</div>
<div class="alert alert-warning">Press the <kbd>esc</kbd> key to reset the interface.</div>.
<div class="alert alert-warning">Press the <kbd>esc</kbd> key to reset the interface.</div>
</div>
</div>
</div>

</body>

</html>
6 changes: 4 additions & 2 deletions annotations/templates/annotations/text/graphTab.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load staticfiles %}

<script src="{% static 'annotations/js/cytoscape.min.js' %}"></script>



<div class="tab-pane col-xs-12" id="tabGraph">
Expand All @@ -11,6 +11,8 @@
</div>

</div>

<script src="{% static 'annotations/js/cytoscape.min.js' %}"></script>
<script>

/**
Expand Down Expand Up @@ -174,7 +176,7 @@
cy.on('unselect', 'node', function(event) {
var node = event.cyTarget;
node._private.data.appellations.forEach(function(appellation_id) {
$('[appellation='+appellation_id+']').removeClass('networkHighlight')
$('[appellation='+appellation_id+']').removeClass('networkHighlight');
});
})

Expand Down
2 changes: 0 additions & 2 deletions annotations/templates/annotations/textApp.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% load staticfiles %}

<script src="{% static "annotations/js/text/app.js" %}"></script>

<!-- Resources -->
<script src="{% static "annotations/js/text/resources/appellationResource.js" %}"></script>
<script src="{% static "annotations/js/text/resources/conceptResource.js" %}"></script>
Expand Down
1 change: 1 addition & 0 deletions annotations/templatetags/app_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
def safe_text(s):
return mark_safe(s)


@register.filter
def current_fields(form):
fields = []
Expand Down
Loading