more fixes & polish

This commit is contained in:
Andrew Brown 2019-07-22 18:06:36 -05:00
parent cbf9b81b91
commit 5e24366be5
4 changed files with 43 additions and 40 deletions

View File

@ -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);
}
}
});

View File

@ -4,7 +4,7 @@ class Notebook.DocumentEditor
window.editor = new MediumEditor('#editor',
targetBlank: true
autoLink: true
autoLink: false
buttonLabels: 'fontawesome'
toolbar: buttons: [
'bold'

View File

@ -101,11 +101,11 @@
<% else %>
<%= link_to new_polymorphic_path(entity_class, document_entity: entity.id), class: entity_class.color + '-text' do %>
<i class="material-icons left">add</i>
New page
New <%= entity_class.name %>
<% end %>
<%= link_to '#', class: entity_class.color + '-text right js-link-entity', data: { id: entity.id } do %>
<i class="material-icons left">link</i>
Link page
Link existing
<% end %>
<% end %>
</div>
@ -130,7 +130,7 @@
<% end %>
<% if analysis.document_entities.where(entity_type: 'Character').any? %>
<% if analysis.document_entities.where(entity_type: 'Character').any? && false %>
<div class="col s12 m6">
<div class="card">
<div class="card-content">
@ -139,38 +139,6 @@
</div>
</div>
</div>
<div class="col s12">
<div class="card">
<div class="card-content">
<div class="card-title">Character emotions</div>
<table class="highlight">
<tr>
<th>Character</th>
<th>Dominant emotion</th>
<th>Recessive emotion</th>
</tr>
<% analysis.document_entities.where(entity_type: 'Character').each do |character| %>
<tr>
<td><%= character.text %></td>
<td>
<div class="chip <%= EmotionService.color_for_emotion(character.dominant_emotion.first.first) %> lighten-3">
<%= character.dominant_emotion.first.first.to_s.titleize %>
(<%= (character.dominant_emotion.first.second * 100).round %>%)
</div>
</td>
<td>
<div class="chip <%= EmotionService.color_for_emotion(character.recessive_emotion.first.first) %> lighten-3">
<%= character.recessive_emotion.first.first.to_s.titleize %>
(<%= (character.recessive_emotion.first.second * 100).round %>%)
</div>
</td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
</div>
<% end %>
</div>

View File

@ -36,6 +36,41 @@
</div>
</div>
</div>
<% if analysis.document_entities.order('relevance desc').where(entity_type: 'Character').any? %>
<div class="col s12">
<div class="card">
<div class="card-content">
<div class="card-title">Character emotions</div>
<table class="highlight">
<tr>
<th>Character</th>
<th>Dominant emotion</th>
<th>Recessive emotion</th>
</tr>
<% analysis.document_entities.where(entity_type: 'Character').each do |character| %>
<tr>
<td><%= character.text %></td>
<td>
<div class="chip <%= EmotionService.color_for_emotion(character.dominant_emotion.first.first) %> lighten-3">
<%= character.dominant_emotion.first.first.to_s.titleize %>
(<%= (character.dominant_emotion.first.second * 100).round %>%)
</div>
</td>
<td>
<div class="chip <%= EmotionService.color_for_emotion(character.recessive_emotion.first.first) %> lighten-3">
<%= character.recessive_emotion.first.first.to_s.titleize %>
(<%= (character.recessive_emotion.first.second * 100).round %>%)
</div>
</td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
</div>
<% end %>
</div>
<style>