-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1069bfa
commit 45160f2
Showing
9 changed files
with
143 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<% dict_id = modal('Dictionary lookup', size: 'lg') do %> | ||
<% end %> | ||
<table class="table table-hover table-responsive-lg my-4" | ||
data-behavior="dictionary" data-id="<%= dict_id %>"> | ||
<thead> | ||
<th>Component</th> | ||
<th>Language</th> | ||
<th>Grammar</th> | ||
<th>Particle</th> | ||
<th>Description or translation</th> | ||
<th></th> | ||
</thead> | ||
<tbody> | ||
<% | ||
components = { | ||
p1: '1st morpheme', p2: '2nd morpheme', p3: '3rd morpheme', | ||
p4: '4th morpheme', p5: '5th morpheme', xx: 'Full word' | ||
} | ||
fields = { lang: 5, grammar: 15, particle: 15, description: 30 } | ||
%> | ||
<% components.each do |k, v| %> | ||
<tr class='<%= 'table-active' if k == :xx %>'> | ||
<td><b><%= v %></b></td> | ||
<% fields.each do |i, size| %> | ||
<% entry = :"etymology_#{ k }_#{ i }" %> | ||
<td> | ||
<% if i == :particle && k == :xx %> | ||
<%= content_tag(:i, name.last_epithet, id: "name_#{entry}") %> | ||
<% else %> | ||
<%= form.input(entry, input_html: { size: size }, label: false) %> | ||
<% end %> | ||
</td> | ||
<% end %> | ||
<td id="name_etymology_<%= k %>_dict"></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<h1>Etymology sandbox</h1> | ||
<%= simple_form_for(@name) do |f| %> | ||
<div class="rounded border p-3 my-4 bg-light"> | ||
<p> | ||
The etymology sandbox is designed to provide all the tools available to | ||
you in the etymology table of names, without having to create or modify | ||
a name in the system. | ||
</p> | ||
<p> | ||
To get started, simply write the Latin or Latinized name in the field | ||
below, which should trigger an automated proposal of the syllabification. | ||
Continue by filling up the etymology table below, including the usage of | ||
the dictionary lookups. | ||
</p> | ||
<hr/> | ||
<%= help_topic('etymology', | ||
'How do I fill the etymology table?', size: 'xl') %> | ||
<%= help_topic('dictionary', | ||
'How do I use dictionary lookups?', size: 'xl') %> | ||
</div> | ||
|
||
<%= f.input(:name) %> | ||
<%= f.input(:syllabification, label: 'Inferred syllabification') %> | ||
<% @name.name = '...' %> | ||
<%= render(partial: 'etymology_table', locals: { form: f, name: @name }) %> | ||
<% end %> | ||
|
||
<script> | ||
$(document).on("turbolinks:load", function() { | ||
$('#name_name').on("keyup", function() { | ||
var name = $(this).val(); | ||
var part = $("#name_etymology_xx_particle"); | ||
var syll = $("#name_syllabification"); | ||
|
||
$.ajax({ | ||
url: "<%= syllabify_names_url(format: :json) %>", data: { name: name } | ||
}).done(function(data) { | ||
syll.val(data["syllabification"]); | ||
part.html(data["last_epithet"]).val(data["last_epithet"]); | ||
}); | ||
}); | ||
$("#name_name").trigger("keyup"); | ||
}); | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
json.response do | ||
json.status 'ok' | ||
json.message_type 'syllabify' | ||
end | ||
json.syllabification(@syllabification) | ||
json.(@name, :last_epithet) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters