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

Feat add esv bible view #1

Merged
merged 5 commits into from
Apr 27, 2024
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
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"nativephp/electron": "^0.5.0",
"transprime-research/php-url": "^1.0",
"willvincent/feeds": "^2.5"
},
"require-dev": {
Expand Down
55 changes: 54 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions resources/views/bible-ready-main.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Bible Ready - {{ request('book', 'John') }} {{ request('chapter', 1) }} ESV</title>
</head>
<body>

<div class="tab-pane container fade" id="bible-ready">
<div class="card mb-3 border-0">
<div class="row g-0">
<div class="col-12">
<div class="card-body">
<iframe
src="{{
\Transprime\Url\Url::make(
fullDomain: url('/bible-ready'),
query: ['book' => request('book', 'John'), 'chapter' => request('chapter', 1)],
)
}}"
class="mt-2"
style="border: 0; width: 100%; height: 100%;"
></iframe>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
5 changes: 5 additions & 0 deletions resources/views/esv-bible-ready.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@php
$book = request('book', 'John');
$chapter = request('chapter', 1);
@endphp
{!! \Illuminate\Support\Facades\Http::get("https://www.esv.org/${book}+${chapter}/") !!}
208 changes: 147 additions & 61 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
@@ -1,86 +1,151 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Laravel</title>
<title>Laravel</title>

<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,600&display=swap" rel="stylesheet" />
@vite(['resources/css/app.css'])
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
<!-- Styles -->
<style>
</style>
</head>
<body class="antialiased">
<div style="max-width: 400px; min-width: 400px; min-height:250px; max-height: 250px">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="tab" href="#verse">Daily Verse</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#reader">Reader</a>
</li>
</ul>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,600&display=swap" rel="stylesheet"/>
@vite(['resources/css/app.css'])
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm"
crossorigin="anonymous"></script>
<!-- Styles -->
<style>
</style>
</head>
<body class="antialiased">
<div style="max-width: 400px; min-width: 400px; min-height:250px; max-height: 250px">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="tab" href="#verse">Daily Verse</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#reader">Reader</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#bible-ready">Bible Ready</a>
</li>
</ul>

<!-- Tab panes -->
<div class="tab-content mt-1">
<div class="tab-pane container active" id="verse">
<div class="card mb-3 border-0" style="max-width: 400px; min-width: 400px; min-height:250px; max-height: 250px">
<div class="row g-0">
<div class="col-4 bg-light">
<img src="{{ asset('images/bible.jpg') }}" class="img-fluid rounded-start" alt="...">
<div class="small text-truncate">
<sup>
<a href="{{ $link }}" class="">{{ $link }}</a>
</sup>
</div>
<!-- Tab panes -->
<div class="tab-content mt-1">
<div class="tab-pane container active" id="verse">
<div class="card mb-3 border-0"
style="max-width: 400px; min-width: 400px; min-height:250px; max-height: 250px">
<div class="row g-0">
<div class="col-4 bg-light">
<img src="{{ asset('images/bible.jpg') }}" class="img-fluid rounded-start" alt="...">
<div class="small text-truncate">
<sup>
<a href="{{ $link }}" class="">{{ $link }}</a>
</sup>
</div>
<div class="col-8">
<div class="card-body">
<h5 class="card-title">{{ $scripture_reference }} {{ $reference_version }}</h5>
<p class="card-text small">{!! $content !!}</p>
<p class="card-text"><small class="text-body-secondary">{{ $date }}</small></p>
</div>
</div>
<div class="col-8">
<div class="card-body">
<h5 class="card-title">{{ $scripture_reference }} {{ $reference_version }}</h5>
<p class="card-text small">{!! $content !!}</p>
<p class="card-text"><small class="text-body-secondary">{{ $date }}</small></p>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane container fade" id="reader">
<div class="card mb-3 border-0">
<div class="row g-0">
<div class="col-12">
<div class="card-body">
<h5 class="card-title border-bottom py-1">Bible Reader</h5>
<form class="row" method="get">
<div class="col-6">
<label for="book" class="form-label">Book</label>
<input
class="form-control"
list="books"
id="book"
name="book"
value="{{ request('book', 'John') }}"
placeholder="Type to search...">
<datalist id="books">
@foreach($books ?? [] as $book)
<option value="{{ $book }}" onclick="getAudio('book', '{{ $book }}')">
@endforeach
</datalist>
</div>
<div class="col-4">
<label for="chapter" class="form-label">Chapter</label>
<input
class="form-control"
list="chapters"
id="chapter"
name="chapter"
value="{{ request('chapter', '1') }}"
placeholder="Search...">
<datalist id="chapters">
@foreach($chapters ?? [] as $chapter)
<option value="{{ $chapter }}">
@endforeach
</datalist>
</div>
<div class="col-2">
<label for="submit" class="form-label">..</label>
<button type="submit" class="btn btn-outline-dark">Go</button>
</div>
</form>

<iframe
src="https://www.esv.org/audio-player/ {{request('book', 'John') }} + {{ request('chapter', '1') }}"
class="mt-2"
style="border: 0; width: 100%; height: 109px;"
></iframe>
</div>
</div>
</div>
</div>
<div class="tab-pane container fade" id="reader">
<div class="card mb-3 border-0">
<div class="row g-0">
<div class="col-12">
<div class="card-body">
<h5 class="card-title border-bottom py-1">Bible Reader</h5>
</div>
<div class="tab-pane container fade" id="bible-ready">
<div class="card mb-3 border-0">
<div class="row g-0">
<div class="col-12">
<div class="card-body">
<h5 class="card-title border-bottom py-1">Bible Ready</h5>
<div class="row">
<form class="row" method="get">
<div class="col-6">
<label for="book" class="form-label">Book</label>
<input
class="form-control"
list="books"
id="book"
id="bible-ready-book"
name="book"
value="{{ request('book', 'John') }}"
placeholder="Type to search...">
placeholder="Type to search..."
onchange="updateReadyBook(this)"
>
<datalist id="books">
@foreach($books ?? [] as $book)
<option value="{{ $book }}" onclick="getAudio('book', '{{ $book }}')">
@endforeach
</datalist>
</div>
<div class="col-4">
<label for="chapter" class="form-label">Chapter</label>
<label for="bible-ready-chapter" class="form-label">Chapter</label>
<input
class="form-control"
list="chapters"
id="chapter"
id="bible-ready-chapter"
name="chapter"
value="{{ request('chapter', '1') }}"
placeholder="Search...">
placeholder="Search..."
onchange="updateReadyChapter(this)"
>
<datalist id="chapters">
@foreach($chapters ?? [] as $chapter)
<option value="{{ $chapter }}">
Expand All @@ -89,22 +154,43 @@ class="form-control"
</div>
<div class="col-2">
<label for="submit" class="form-label">..</label>
<button type="submit" class="btn btn-outline-dark">Go</button>
<a class="btn btn-outline-dark" id="bible-ready-open-btn" href="{{ route('bible-ready-main') }}" target="_blank">Open</a>
</div>
</form>

<iframe
src="https://www.esv.org/audio-player/ {{request('book', 'John') }} + {{ request('chapter', '1') }}"
class="mt-2"
style="border: 0; width: 100%; height: 109px;"
></iframe>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<script>
let bibleReadyUrl = {{ \Illuminate\Support\Js::from(route('bible-ready-main')) }};
let bibleReadyBook = "John";
let bibleReadyChapter = 1;

let url = bibleReadyUrl;

function updateReadyBook(el) {
bibleReadyBook = el.value;

updateBibleReadyUrl();
}

function updateReadyChapter(el) {
bibleReadyChapter = el.value;

updateBibleReadyUrl();
}

</body>
function updateBibleReadyUrl() {
url = bibleReadyUrl + "?book="+ bibleReadyBook + "&chapter=" + bibleReadyChapter;
console.log({url})
document.getElementById("bible-ready-open-btn")
.href = url;
}
</script>
</body>
</html>
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
|
*/

Route::view('bible-ready', 'esv-bible-ready');
Route::view('bible-ready-main', 'bible-ready-main')->name('bible-ready-main');
Route::get('/', function () {
$feed = \Feeds::make('http://www.biblegateway.com/usage/votd/rss/votd.rdf?31');

Expand Down