From 5e24366be561ffeb2dee1eb105dfef732bd8ede1 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 22 Jul 2019 18:06:36 -0500 Subject: [PATCH] more fixes & polish --- .../javascripts/d3-charts/radar_chart.js | 8 ++-- app/assets/javascripts/document_editor.coffee | 2 +- .../analysis/sections/_entities.html.erb | 38 ++----------------- .../analysis/sections/_sentiment.html.erb | 35 +++++++++++++++++ 4 files changed, 43 insertions(+), 40 deletions(-) diff --git a/app/assets/javascripts/d3-charts/radar_chart.js b/app/assets/javascripts/d3-charts/radar_chart.js index 8340339e..aebf5e50 100644 --- a/app/assets/javascripts/d3-charts/radar_chart.js +++ b/app/assets/javascripts/d3-charts/radar_chart.js @@ -263,10 +263,10 @@ function RadarChart(id, data, options) { line.push(word); tspan.text(line.join(" ")); if (tspan.node().getComputedTextLength() > width) { - line.pop(); - tspan.text(line.join(" ")); - line = [word]; - tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word); + line.pop(); + tspan.text(line.join(" ")); + line = [word]; + tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word); } } }); diff --git a/app/assets/javascripts/document_editor.coffee b/app/assets/javascripts/document_editor.coffee index f08f417e..be80cc00 100644 --- a/app/assets/javascripts/document_editor.coffee +++ b/app/assets/javascripts/document_editor.coffee @@ -4,7 +4,7 @@ class Notebook.DocumentEditor window.editor = new MediumEditor('#editor', targetBlank: true - autoLink: true + autoLink: false buttonLabels: 'fontawesome' toolbar: buttons: [ 'bold' diff --git a/app/views/documents/analysis/sections/_entities.html.erb b/app/views/documents/analysis/sections/_entities.html.erb index 3180ea77..bce8df05 100644 --- a/app/views/documents/analysis/sections/_entities.html.erb +++ b/app/views/documents/analysis/sections/_entities.html.erb @@ -101,11 +101,11 @@ <% else %> <%= link_to new_polymorphic_path(entity_class, document_entity: entity.id), class: entity_class.color + '-text' do %> add - New page + New <%= entity_class.name %> <% end %> <%= link_to '#', class: entity_class.color + '-text right js-link-entity', data: { id: entity.id } do %> link - Link page + Link existing <% end %> <% end %> @@ -130,7 +130,7 @@ <% end %> - <% if analysis.document_entities.where(entity_type: 'Character').any? %> + <% if analysis.document_entities.where(entity_type: 'Character').any? && false %>
@@ -139,38 +139,6 @@
-
-
-
-
Character emotions
- - - - - - - <% analysis.document_entities.where(entity_type: 'Character').each do |character| %> - - - - - - <% end %> -
CharacterDominant emotionRecessive emotion
<%= character.text %> -
- <%= character.dominant_emotion.first.first.to_s.titleize %> - (<%= (character.dominant_emotion.first.second * 100).round %>%) -
-
-
- <%= character.recessive_emotion.first.first.to_s.titleize %> - (<%= (character.recessive_emotion.first.second * 100).round %>%) -
-
-
-
-
- <% end %> diff --git a/app/views/documents/analysis/sections/_sentiment.html.erb b/app/views/documents/analysis/sections/_sentiment.html.erb index 727cc37e..143ec3e5 100644 --- a/app/views/documents/analysis/sections/_sentiment.html.erb +++ b/app/views/documents/analysis/sections/_sentiment.html.erb @@ -36,6 +36,41 @@ + + <% if analysis.document_entities.order('relevance desc').where(entity_type: 'Character').any? %> +
+
+
+
Character emotions
+ + + + + + + <% analysis.document_entities.where(entity_type: 'Character').each do |character| %> + + + + + + <% end %> +
CharacterDominant emotionRecessive emotion
<%= character.text %> +
+ <%= character.dominant_emotion.first.first.to_s.titleize %> + (<%= (character.dominant_emotion.first.second * 100).round %>%) +
+
+
+ <%= character.recessive_emotion.first.first.to_s.titleize %> + (<%= (character.recessive_emotion.first.second * 100).round %>%) +
+
+
+
+
+ + <% end %>