Skip to content
Permalink
Browse files

Initial import

  • Loading branch information
tobias-klein committed Feb 2, 2019
1 parent c35fa0e commit f7538ad2f5c7afe95290463454a6e18ed4de0438
Showing with 31,111 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +174 −0 app/bible_browser/bible_browser_communication_controller.js
  3. +1,113 −0 app/bible_browser/bible_browser_controller.js
  4. +481 −0 app/bible_browser/translation_wizard.js
  5. +217 −0 app/tags/tags_communication_controller.js
  6. +1,783 −0 app/tags/tags_controller.js
  7. +10 −0 config/config.json
  8. BIN css/images/expand.gif
  9. BIN css/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png
  10. BIN css/images/ui-bg_flat_15_cd0a0a_40x100.png
  11. BIN css/images/ui-bg_glass_100_e4f1fb_1x400.png
  12. BIN css/images/ui-bg_glass_50_3baae3_1x400.png
  13. BIN css/images/ui-bg_glass_80_d7ebf9_1x400.png
  14. BIN css/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png
  15. BIN css/images/ui-bg_highlight-hard_70_000000_1x100.png
  16. BIN css/images/ui-bg_highlight-soft_100_deedf7_1x100.png
  17. BIN css/images/ui-bg_highlight-soft_25_ffef8f_1x100.png
  18. BIN css/images/ui-icons_2694e8_256x240.png
  19. BIN css/images/ui-icons_2e83ff_256x240.png
  20. BIN css/images/ui-icons_3d80b3_256x240.png
  21. BIN css/images/ui-icons_72a7cf_256x240.png
  22. BIN css/images/ui-icons_ffffff_256x240.png
  23. BIN css/jquery-ui/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png
  24. BIN css/jquery-ui/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png
  25. BIN css/jquery-ui/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png
  26. BIN css/jquery-ui/cupertino/images/ui-bg_glass_50_3baae3_1x400.png
  27. BIN css/jquery-ui/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png
  28. BIN css/jquery-ui/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png
  29. BIN css/jquery-ui/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png
  30. BIN css/jquery-ui/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png
  31. BIN css/jquery-ui/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png
  32. BIN css/jquery-ui/cupertino/images/ui-icons_2694e8_256x240.png
  33. BIN css/jquery-ui/cupertino/images/ui-icons_2e83ff_256x240.png
  34. BIN css/jquery-ui/cupertino/images/ui-icons_3d80b3_256x240.png
  35. BIN css/jquery-ui/cupertino/images/ui-icons_72a7cf_256x240.png
  36. BIN css/jquery-ui/cupertino/images/ui-icons_ffffff_256x240.png
  37. +467 −0 css/jquery-ui/cupertino/jquery-ui-1.8.16.custom.css
  38. +1 −0 css/jquery-ui/cupertino/jquery-ui.css
  39. +31 −0 css/jquery-ui/cupertino/jquery-ui.selectmenu.css
  40. +382 −0 css/jquery.steps.css
  41. +1,077 −0 css/main.css
  42. +438 −0 css/toolbox.css
  43. BIN images/down.gif
  44. BIN images/ezra_project_logo.jpg
  45. BIN images/filter.png
  46. BIN images/loading_animation.gif
  47. BIN images/loading_animation2.gif
  48. BIN images/loading_animation3.gif
  49. BIN images/loading_animation4.gif
  50. BIN images/rails.png
  51. BIN images/up.gif
  52. +592 −0 index.html
  53. +556 −0 init.js
  54. +8,650 −0 lib/jquery-ui/jquery-ui-1.8.16.custom.js
  55. +531 −0 lib/jquery-ui/jquery-ui-1.8.16.custom.min.js
  56. +1 −0 lib/jquery-ui/jquery-ui.js
  57. +1 −0 lib/jquery-ui/jquery-ui.min.js
  58. +868 −0 lib/jquery-ui/jquery-ui.selectmenu.js
  59. +117 −0 lib/jquery/jquery.elastic.js
  60. +6 −0 lib/jquery/jquery.elastic.min.js
  61. +302 −0 lib/jquery/jquery.glow.js
  62. +21 −0 lib/jquery/jquery.glow.min.js
  63. +543 −0 lib/jquery/jquery.jeditable.js
  64. +38 −0 lib/jquery/jquery.jeditable.min.js
  65. +9,266 −0 lib/jquery/jquery.js
  66. +4 −0 lib/jquery/jquery.min.js
  67. +64 −0 lib/jquery/jquery.safe_enter.js
  68. +66 −0 lib/jquery/jquery.sort_elements.js
  69. +2,042 −0 lib/jquery/jquery.steps.js
  70. +88 −0 main.js
  71. +27 −0 migrations/20180408202938-create-bible-translation.js
  72. +25 −0 migrations/20180408211048-create-bible-book.js
  73. +37 −0 migrations/20180408212546-create-verse.js
  74. +31 −0 migrations/20180409000846-create-verse-reference.js
  75. +30 −0 migrations/20180409152011-create-tag.js
  76. +30 −0 migrations/20180409152932-create-verse-tag.js
  77. +29 −0 migrations/20180410002548-addIndexes.js
  78. +11 −0 migrations/20180411172005-addIndexToVersesAbsoluteVerseNr.js
  79. +17 −0 migrations/20180413050821-addMoreIndexsToVerseReferences.js
  80. +83 −0 models/biblebook.js
  81. +229 −0 models/bibletranslation.js
  82. +48 −0 models/index.js
  83. +27 −0 models/tag.js
  84. +305 −0 models/verse.js
  85. +19 −0 models/versereference.js
  86. +50 −0 models/versetag.js
  87. +38 −0 package.json
  88. +3 −0 renderer.js
  89. +78 −0 seeders/20180408211615-default-bible-books.js
  90. +62 −0 templates/verse_list.pug
@@ -0,0 +1,2 @@
/node_modules
package-lock.json
@@ -0,0 +1,174 @@
/* This file is part of Ezra Project.
Copyright (C) 2018 Tobias Klein <contact@ezra-project.tklein.info>
Ezra Project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Ezra Project is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Ezra Project. See the file COPYING.
If not, see <http://www.gnu.org/licenses/>. */

const pug = require('pug');
const path = require('path');

var verse_list_template_file = path.join(__dirname, 'templates/verse_list.pug');
const verseListTemplate = pug.compileFile(verse_list_template_file);

function BibleBrowserCommunicationController() {
this.request_book_text = function(book_short_title,
render_function,
start_verse_number=0,
number_of_verses=0) {

if (current_bible_translation_id == null || current_bible_translation_id == "") {
$('#verse-list-loading-indicator').hide();
return;
}

models.BibleBook.findOne({ where: { shortTitle: book_short_title }}).then(bibleBook => {
var bibleTranslationId = current_bible_translation_id;

bibleBook.getVerses(bibleTranslationId=bibleTranslationId,
start_verse_number,
number_of_verses).then(verses => {

bibleBook.getVerseTags(bibleTranslationId=bibleTranslationId).then(verseTags => {
var groupedVerseTags = models.VerseTag.groupVerseTagsByVerse(verseTags);

var verses_as_html = verseListTemplate({
renderVerseMetaInfo: true,
renderBibleBookHeaders: false,
bibleBooks: [bibleBook],
verses: verses,
verseTags: groupedVerseTags,
reference_separator: reference_separator
});

render_function(verses_as_html);
});
});
});
};

this.request_verse_preview = function(book_short_title, chapter, verse) {
var absolute_verse_number = reference_to_absolute_verse_nr(book_short_title, chapter, verse);
//console.log("absolute_verse_number: " + absolute_verse_number);
$('#cr-edit-box-verse-preview').load('/bible_books/' + book_short_title + '/verses/' + absolute_verse_number + '.txt',
bible_browser_controller.communication_controller.on_verse_preview_load);
};

this.request_cross_references_for_verse = function(verse_id) {
$.ajax({
url: '/verses/' + verse_id + '/cross_references',
type: 'GET',
processData: true,
dataType: "xml",
success: bible_browser_controller.render_cross_references_in_preview_box
});
};

this.request_tags_for_menu = function() {
models.Tag.getGlobalAndBookTags().then(tags => {
bible_browser_controller.render_tags_in_menu(tags);
});
};

this.submit_new_cross_reference = function(verse_id, book, absolute_verse_number) {
var xml_param = "";
xml_param +=
"<cross_reference>" +
"<book>" + book + "</book>" +
"<absolute_verse_number>" + absolute_verse_number + "</absolute_verse_number>" +
"</cross_reference>";

xml_param = $.create_xml_doc(xml_param);

$.ajax({
type: 'POST',
url: '/verses/' + verse_id + '/cross_references',
contentType: "text/xml",
data: xml_param,
processData: false,
success: bible_browser_controller.communication_controller.on_new_cross_reference
});
};

this.on_verse_preview_load = function(response) {
//console.log("verse preview load!");
};

this.on_new_cross_reference = function(response) {
$('#cr-edit-box-verse-preview').empty();
$('#cr-edit-box-input').val('');
bible_browser_controller.communication_controller.request_cross_references_for_verse(
bible_browser_controller.current_cr_verse_id
);
};

this.destroy_cross_reference = function(cross_reference_id) {
$.ajax({
type: 'DELETE',
url: '/cross_references/' + cross_reference_id,
processData: false,
success: bible_browser_controller.communication_controller.process_server_response_after_cr_destruction
});
};

this.process_server_response_after_cr_destruction = function(response) {
if (response == "success") {
$('#cr-edit-box-verse-preview').empty();
$('#cr-edit-box-input').val('');
bible_browser_controller.communication_controller.request_cross_references_for_verse(
bible_browser_controller.current_cr_verse_id
);
} else {
alert('An error occurred while trying to delete the cross reference!');
}
};

this.request_verses_for_selected_tags = function(selected_tags, render_function, renderVerseMetaInfo=true) {
if (selected_tags == '') {
return;
}

var bibleTranslationId = null;
if (current_bible_translation_id == null) {
bibleTranslationId = 1;
} else {
bibleTranslationId = current_bible_translation_id;
}

models.Verse.findByTagIds(bibleTranslationId=bibleTranslationId, tagIds=selected_tags).then(verses => {
models.BibleBook.findByTagIds(tagIds=selected_tags).then(bibleBooks => {
var verseIds = [];
for (v of verses) {
verseIds.push(v.id);
}

models.VerseTag.findByVerseIds(bibleTranslationId=bibleTranslationId, verseIds=verseIds.join(',')).then(verseTags => {
var groupedVerseTags = models.VerseTag.groupVerseTagsByVerse(verseTags);

var verses_as_html = verseListTemplate({
renderBibleBookHeaders: true,
renderVerseMetaInfo: renderVerseMetaInfo,
bibleBooks: bibleBooks,
verses: verses,
verseTags: groupedVerseTags,
reference_separator: reference_separator
});

render_function(verses_as_html);
});
});
});
};
}

0 comments on commit f7538ad

Please sign in to comment.
You can’t perform that action at this time.