diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 0000000..75991ff
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,21 @@
+
+
+Issue Link: [ISSUE](ISSUE LINK HERE)
+
+## Description
+
+
+
+## Type of Change:
+
+- [ ] Bug fix (non-breaking change which fixes an issue)
+- [ ] New feature (non-breaking change which adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to change)
+- [ ] Maintenance or Refactor (non-breaking change which does not affect existing functionality)
+
+## Checklist
+
+- [ ] I tested my changes locally
+- [ ] I added tests to cover new functionality
+- [ ] All new and existing tests are passing (`bundle exec rspec`)
+- [ ] I updated my branch with master so that they can be merged easily
diff --git a/.gitignore b/.gitignore
index 072bcce..69c7ce7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
+.env
+
# Ignore bundler config.
/.bundle
diff --git a/Gemfile b/Gemfile
index 5368675..1ebeb27 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,8 +5,8 @@ ruby '3.0.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.4', '>= 6.1.4.4'
-# Use sqlite3 as the database for Active Record
-gem 'sqlite3', '~> 1.4'
+# Use pg as the database for Active Record
+gem 'pg', '~> 1.3', '>= 1.3.5'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
@@ -28,6 +28,8 @@ gem 'jbuilder', '~> 2.7'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
+gem 'dotenv-rails'
+
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
@@ -54,3 +56,7 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+
+group :production do
+ gem 'exception_notification'
+end
diff --git a/Gemfile.lock b/Gemfile.lock
index bc7d072..e0d85db 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -79,8 +79,16 @@ GEM
childprocess (4.1.0)
concurrent-ruby (1.1.9)
crass (1.0.6)
+ dotenv (2.8.1)
+ dotenv-rails (2.8.1)
+ dotenv (= 2.8.1)
+ railties (>= 3.2)
erubi (1.10.0)
+ exception_notification (4.5.0)
+ actionmailer (>= 5.2, < 8)
+ activesupport (>= 5.2, < 8)
ffi (1.15.5)
+ ffi (1.15.5-x64-mingw32)
globalid (1.0.0)
activesupport (>= 5.0)
i18n (1.10.0)
@@ -103,8 +111,14 @@ GEM
minitest (5.15.0)
msgpack (1.4.5)
nio4r (2.5.8)
+ nokogiri (1.13.1-x64-mingw32)
+ racc (~> 1.4)
nokogiri (1.13.1-x86_64-darwin)
racc (~> 1.4)
+ nokogiri (1.13.1-x86_64-linux)
+ racc (~> 1.4)
+ pg (1.3.5)
+ pg (1.3.5-x64-mingw32)
public_suffix (4.0.6)
puma (5.6.2)
nio4r (~> 2.0)
@@ -153,6 +167,8 @@ GEM
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
ffi (~> 1.9)
+ sassc (2.4.0-x64-mingw32)
+ ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
@@ -172,7 +188,6 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
- sqlite3 (1.4.2)
thor (1.2.1)
tilt (2.0.10)
turbolinks (5.2.1)
@@ -180,6 +195,8 @@ GEM
turbolinks-source (5.2.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
+ tzinfo-data (1.2022.1)
+ tzinfo (>= 1.0.0)
web-console (4.2.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
@@ -202,21 +219,25 @@ GEM
zeitwerk (2.5.4)
PLATFORMS
+ x64-mingw32
x86_64-darwin-20
+ x86_64-linux
DEPENDENCIES
bootsnap (>= 1.4.4)
byebug
capybara (>= 3.26)
+ dotenv-rails
+ exception_notification
jbuilder (~> 2.7)
listen (~> 3.3)
+ pg (~> 1.3, >= 1.3.5)
puma (~> 5.0)
rack-mini-profiler (~> 2.0)
rails (~> 6.1.4, >= 6.1.4.4)
sass-rails (>= 6)
selenium-webdriver
spring
- sqlite3 (~> 1.4)
turbolinks (~> 5)
tzinfo-data
web-console (>= 4.1.0)
@@ -227,4 +248,4 @@ RUBY VERSION
ruby 3.0.1p64
BUNDLED WITH
- 2.2.33
+ 2.3.10
diff --git a/app/assets/.DS_Store b/app/assets/.DS_Store
new file mode 100644
index 0000000..cd3a2cf
Binary files /dev/null and b/app/assets/.DS_Store differ
diff --git a/app/assets/images/.DS_Store b/app/assets/images/.DS_Store
new file mode 100644
index 0000000..5008ddf
Binary files /dev/null and b/app/assets/images/.DS_Store differ
diff --git a/app/assets/images/girl.jpg b/app/assets/images/girl.jpg
deleted file mode 100644
index cc4072d..0000000
Binary files a/app/assets/images/girl.jpg and /dev/null differ
diff --git a/app/assets/images/girl3.jpg b/app/assets/images/girl3.jpg
new file mode 100644
index 0000000..cbc22bf
Binary files /dev/null and b/app/assets/images/girl3.jpg differ
diff --git a/app/assets/images/girl4.jpg b/app/assets/images/girl4.jpg
new file mode 100644
index 0000000..ba136c8
Binary files /dev/null and b/app/assets/images/girl4.jpg differ
diff --git a/app/assets/images/girl5.jpg b/app/assets/images/girl5.jpg
new file mode 100644
index 0000000..2294e50
Binary files /dev/null and b/app/assets/images/girl5.jpg differ
diff --git a/app/assets/images/girl6.jpg b/app/assets/images/girl6.jpg
new file mode 100644
index 0000000..e43561c
Binary files /dev/null and b/app/assets/images/girl6.jpg differ
diff --git a/app/assets/images/girl7.jpg b/app/assets/images/girl7.jpg
new file mode 100644
index 0000000..09fd64e
Binary files /dev/null and b/app/assets/images/girl7.jpg differ
diff --git a/app/assets/images/girl8.jpg b/app/assets/images/girl8.jpg
new file mode 100644
index 0000000..e362976
Binary files /dev/null and b/app/assets/images/girl8.jpg differ
diff --git a/app/assets/images/girl9.jpg b/app/assets/images/girl9.jpg
new file mode 100644
index 0000000..bf1efe8
Binary files /dev/null and b/app/assets/images/girl9.jpg differ
diff --git a/app/assets/images/searching2.jpg b/app/assets/images/searching2.jpg
new file mode 100644
index 0000000..8351810
Binary files /dev/null and b/app/assets/images/searching2.jpg differ
diff --git a/app/assets/images/searching3.jpg b/app/assets/images/searching3.jpg
new file mode 100644
index 0000000..9dd8d7b
Binary files /dev/null and b/app/assets/images/searching3.jpg differ
diff --git a/app/assets/images/searching4.jpg b/app/assets/images/searching4.jpg
new file mode 100644
index 0000000..65be23f
Binary files /dev/null and b/app/assets/images/searching4.jpg differ
diff --git a/app/assets/images/searching5.jpg b/app/assets/images/searching5.jpg
new file mode 100644
index 0000000..774de18
Binary files /dev/null and b/app/assets/images/searching5.jpg differ
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 0d9397f..c51c98f 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -17,9 +17,9 @@
.jumbo-background {
/* opacity: 0.5; */
- filter: grayscale(100%);
- background-image: url('girl.jpg');
- background-size: 850px;
+ /* filter: grayscale(100%); */
+ background-image: url('girl4.jpg');
+ background-size: 1450px;
border-radius: 10%
@@ -33,8 +33,8 @@
src: url('Disturbed.otf');
}
- table, h1 {
+ h1 {
font-family: 'Disturbed.otf';
- color: blue;
+ color: brown;
}
diff --git a/app/assets/stylesheets/morecss.scss b/app/assets/stylesheets/morecss.scss
index eacfd4f..cd92089 100644
--- a/app/assets/stylesheets/morecss.scss
+++ b/app/assets/stylesheets/morecss.scss
@@ -1,6 +1,7 @@
.navbar {
+ background-color: #f7635e;
position: relative;
min-height: 10px;
margin-bottom: -5px;
@@ -26,13 +27,14 @@
.button {
position: relative;
- // background-color: grey;
+ background-color: #F0F8FF;
border: none;
- color: grey;
+ // font
+ color: black;
padding: 1px 2px;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
border-radius: 10%;
- border: 2px solid blue;
+ // border: 2px solid blue;
text-align: center;
transition-duration: 0.4s;
text-decoration: none;
@@ -44,7 +46,7 @@
.button:after {
content: "";
- background: #f1f1f1;
+ background: #f#F0F8FF;
display: block;
position: absolute;
padding-top: 300%;
@@ -63,32 +65,27 @@
}
.button:hover {
- background-color: blue; /* Green */
+ background-color: #e4b7b7; /* Green */
color: white;
}
body {
// grey
- background-color: blue;
+ background-color: white;
// font
- color: blue;
+ color: #3d0c02;
margin: 33px;
-
- background-image: linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,0.5)), url("searching.jpg");
-
+ background-image: url("searching5.jpg");
background-size: cover;
-
- // opacity: 0.3;
-
}
body, p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
- font-size: 13px;
- line-height: 18px; }
+ font-size: 18px;
+ line-height: 30px; }
img {
- filter: grayscale(100%);
+ // filter: grayscale(100%);
}
pre {
@@ -101,11 +98,11 @@ body, p, ol, ul, td {
color: blue; }
a:visited {
- color: blue; }
+ color: #1e90ff; }
a:hover {
color: white;
- background-color: blue; }
+ background-color: #1e90ff; }
th {
padding-bottom: 5px; }
diff --git a/app/javascript/packs/ajax_operations.js b/app/javascript/packs/ajax_operations.js
deleted file mode 100644
index 2402977..0000000
--- a/app/javascript/packs/ajax_operations.js
+++ /dev/null
@@ -1,905 +0,0 @@
-function handle_ajax(event)
-{
- console.log('DOM fully loaded and parsed');
-
- // Headers
- const authHeader = localStorage.getItem("authHeader");
-
- // Missing People
- // CRUD MissingPerson Results Divs
- const createMissingPersonResultsDiv = document.getElementById('create_missing_person_results_div');
- const readMissingPersonResultsDiv = document.getElementById('read_missing_person_results_div');
- const updateMissingPersonResultsDiv = document.getElementById('update_missing_person_results_div');
- const deleteMissingPersonResultsDiv = document.getElementById('delete_missing_person_results_div');
- const crudOperationsDiv = document.getElementById('crud_operations_div');
-
- // Status Reports CRUD results divs
- const createStatusReportResultsDiv = document.getElementById('create_status_report_results_div');
- const readStatusReportResultsDiv = document.getElementById('read_status_report_results_div');
- const updateStatusReportResultsDiv = document.getElementById('update_status_report_results_div');
- const deleteStatusReportResultsDiv = document.getElementById('delete_status_report_results_div');
- // API'S divs
- // FBI
- const fbiResultsDiv = document.getElementById('fbi_results_div');
- // Twitter
- const twitterResultsDiv = document.getElementById('twitter_results_div');
- // Newdata
- const newsdataResultsDiv = document.getElementById('newsdata_results_div');
- // Missing People CRUD:
- // Create, Missing People
- const createName = document.getElementById('create_name');
-
- const createSex = document.getElementById('create_sex');
-
- const createRace = document.getElementById('create_race');
-
- const createAge = document.
- getElementById('create_age');
-
- const createHairColor = document.getElementById('create_hair_color');
-
- const createWeight = document.getElementById('create_weight');
-
- const createMissingPersonButton = document.getElementById('create_missing_person_button');
-
- // Read, Missing People
- const readMissingPeopleButton = document.getElementById('read_missing_people_button');
-
- // Update, Missing People
- const updateMissingPersonId = document.getElementById('update_missing_person_id');
-
- const updateName = document.getElementById('update_name');
-
- const updateSex = document.getElementById('update_sex');
-
- const updateRace = document.getElementById('update_race');
-
- const updateAge = document.
- getElementById('update_age');
-
- const updateHairColor = document.getElementById('update_hair_color');
-
- const updateWeight = document.getElementById('update_weight');
-
- const updateMissingPersonButton = document.getElementById('update_missing_person_button');
-
- // Delete, Missing People
- const deleteMissingPersonId = document.getElementById('delete_missing_person_id');
-
- const deleteMissingPersonButton = document.getElementById('delete_missing_person_button');
-
- // Status Reports CRUD
-
- // Create, Status Reports
- const createIdMissingPersonStatusReport = document.getElementById('create_id_missing_person_status_report');
-
- const createOutsideAgencyId = document.getElementById('create_outside_agency_id');
-
- const createDescription = document.getElementById('create_description');
-
- const createDetails = document.getElementById('create_details');
-
- const createImageUrl = document.getElementById('create_image_url');
-
- const createStatusReportButton = document.getElementById('create_status_report_button');
-
- // Read, Status Reports
- const readStatusReportsMissingPersonId = document.getElementById('read_status_reports_missing_person_id');
-
- const readStatusReportsButton = document.getElementById('read_status_reports_button');
-
- // Update, Status Reports
- const updateStatusReportMissingPersonId = document.getElementById('update_status_report_missing_person_id');
-
- const updateStatusReportId = document.getElementById('update_status_report_id');
-
- const updateOutsideAgencyId = document.getElementById('update_outside_agency_id');
-
- const updateDescription = document.getElementById('update_description');
-
- const updateDetails = document.getElementById('update_details');
-
- const updateImageUrl = document.getElementById('update_image_url');
-
- const updateStatusReportButton = document.getElementById('update_status_report_button');
-
- // Delete, Status Reports
- const deleteStatusReportMissingPersonId = document.getElementById('delete_status_report_missing_person_id');
-
- const deleteStatusReportId = document.getElementById('delete_status_report_id');
-
- const deleteStatusReportButton = document.getElementById('delete_status_report_button');
- // API'S
- // FBI API
- const fbiApiWord = document.getElementById('fbi_api_word');
- const fbiApiButton = document.getElementById('fbi_api_button');
- // Twitter API
- const twitterApiWord = document.getElementById('twitter_api_word');
- const twitterApiButton = document.getElementById('twitter_api_button');
- // Newsdata API
- const newsdataApiWord = document.getElementById('newsdata_api_word');
- const newsdataApiButton = document.getElementById('newsdata_api_button');
- // Paths
- const missingPeoplePath = 'http://localhost:3001/api/v1/missing_persons';
- const fbiPath = 'http://localhost:3001/api/v1/fbi';
- const twitterPath = 'http://localhost:3001/api/v1/twitter';
- const newsdataPath = 'http://localhost:3001/api/v1/newsdata';
-
- // CRUD operations
- crudOperationsDiv.addEventListener('click', async (event) =>
- {
- // Create, Missing People
- if (event.target == createMissingPersonButton)
- {
- // Collect data
- // It should be var createMissingPersonData = { missing_person: (name: createName.value, ...}}
- var createMissingPersonData =
- {
- missing_person:
- {
- name: createName.value,
- sex: createSex.value,
- race: createRace.value,
- age: createAge.value,
- hair_color: createHairColor.value,
- weight: createWeight.value
- }
- }
- // HTTP Call
- fetch(missingPeoplePath,
- {
- method: 'POST',
- headers:
- {
- 'Content-Type': 'application/json',
- 'authorization': authHeader
- },
- body: JSON.stringify(createMissingPersonData)
- })
- // Display text
- .then((createMissingPersonResponse) =>
- {
- // Results
- if (createMissingPersonResponse.status === 201)
- {
- createMissingPersonResponse.json()
- .then((createMissingPersonData) =>
- {
-
- // HTML TABLE
- let text = "
"
- for (let x in createMissingPersonData)
- {
- text += "";
- text += "" +
- createMissingPersonData[x].id + " ";
- text += "" +
- createMissingPersonData[x].name + " ";
- text += "" +
- createMissingPersonData[x].sex + " ";
- text += "" +
- createMissingPersonData[x].race + " ";
- text += "" +
- createMissingPersonData[x].age + " ";
- text += "" +
- createMissingPersonData[x].hair_color + " ";
- text += "" +
- createMissingPersonData[x].weight + " ";
- }
- text += "
"
- createMissingPersonResultsDiv.innerHTML = text;
-
- // JSON ONLY
- createMissingPersonResultsDiv.innerHTML = '';
- let displayText = document.createElement('P');
- displayText.textContent = JSON.stringify(createMissingPersonData);
- createMissingPersonResultsDiv.appendChild(displayText);
- });
- }
- // Status
- else
- {
- createMissingPersonResponse.json()
- .then((createMissingPersonData) =>
- {
- alert(`Return code ${createMissingPersonResponse.status} ${createMissingPersonResponse.statusText}`);
- })
- .catch((createMissingPersonError) =>
- {
- console.log(createMissingPersonError);
- alert(createMissingPersonError);
- });
- }
- }) // .then((createMissingPersonResponse)
- }
-
- // Read, Missing People
- else if (event.target === readMissingPeopleButton)
- {
- fetch(missingPeoplePath,
- {
- headers:
- {
- 'Content-Type':'application/json',
- 'authorization':authHeader
- }
- })
- .then((listMissingPeopleResponse) =>
- {
- console.log(listMissingPeopleResponse);
- if (listMissingPeopleResponse.status === 200)
- {
- readMissingPersonResultsDiv.innerHTML = '';
- listMissingPeopleResponse.json()
- .then((listMissingPeopleData) =>
- {
- console.log(listMissingPeopleData);
- if (listMissingPeopleData.length === 0)
- {
- let textDisplay = document.createElement('P')
- textDisplay.textContent = "No Available Missing Persons Files."
- readMissingPersonResultsDiv.appendChild(textDisplay)
- }
- else
- {
- // HTML TABLE
- let text = ""
- for (let x in listMissingPeopleData)
- {
- text += "";
- text += "" +
- listMissingPeopleData[x].id + " ";
- text += "" +
- listMissingPeopleData[x].name + " ";
- text += "" +
- listMissingPeopleData[x].sex + " ";
- text += "" +
- listMissingPeopleData[x].race + " ";
- text += "" +
- listMissingPeopleData[x].age + " ";
- text += "" +
- listMissingPeopleData[x].hair_color + " ";
- text += "" +
- listMissingPeopleData[x].weight + " ";
- }
- text += "
"
- readMissingPersonResultsDiv.innerHTML = text;
-
- // JSON ONLY
- // for (let i = 0; i < listMissingPeopleData.length; i++)
- // {
- // let textDisplay = document.createElement('P');
- // textDisplay.textContent = JSON.stringify(listMissingPeopleData[i]);
- // readMissingPersonResultsDiv.appendChild(textDisplay);
- // }
- }
- });// .then((listMissingPeopleData)
- }
- else
- {
- alert(`Return code ${listMissingPeopleResponse.status} ${listMissingPeopleResponse.statusText}`);
- }
- })// .then((listMissingPeopleResponse)
- .catch((listMissingPeopleError) =>
- {
- console.log(listMissingPeopleError);
- alert(listMissingPeopleError);
- });
- }
- // Update
- else if (event.target === updateMissingPersonButton)
- {
- var updateMissingPersonData =
- {
- missing_person:
- {
- name: updateName.value,
- sex: updateSex.value,
- race: updateRace.value,
- age: updateAge.value,
- hair_color: updateHairColor.value,
- weight: updateWeight.value
- }
- }
- if (!updateMissingPersonData.update_name) {
- delete updateMissingPersonData.update_name
- }
- if (updateMissingPersonData.update_sex) {
- delete updateMissingPersonData.update_sex
- }
- if (!updateMissingPersonData.update_race) {
- delete updateMissingPersonData.update_race
- }
- if (updateMissingPersonData.update_age) {
- delete updateMissingPersonData.update_age
- }
- if (!updateMissingPersonData.update_hair_color) {
- delete updateMissingPersonData.update_hair_color
- }
- if (updateMissingPersonData.update_weight) {
- delete updateMissingPersonData.update_weight
- }
- fetch(`${missingPeoplePath}/${updateMissingPersonId.value}`,
- {
- method: 'PUT',
- headers:
- {
- 'Content-Type': 'application/json',
- 'authorization': authHeader
- },
- body: JSON.stringify(updateMissingPersonData)
- })
- .then((updateMissingPersonResponse) =>
- {
- if (updateMissingPersonResponse.status === 200)
- {
- updateMissingPersonResponse.json()
- .then((data) =>
- {
- updateMissingPersonResultsDiv.innerHTML = '';
- let parag = document.createElement('P');
- parag.textContent = JSON.stringify(data);
- updateMissingPersonResultsDiv.appendChild(parag);
- });
- }
- else
- {
- updateMissingPersonResponse.json()
- .then((data) =>
- {
- alert(`Return code ${updateMissingPersonResponse.status} ${updateMissingPersonResponse.statusText} ${JSON.stringify(data)}`);
- })
- .catch((error) =>
- {
- console.log(error);
- alert(error);
- });
- }
- });
- }
- // Delete, Missing People
- else if (event.target === deleteMissingPersonButton)
- {
- try
- {
- const deleteMissingPersonResponse = await
- fetch
- (`${missingPeoplePath}/${delete_missing_person_id.value}`,
- {
- method: 'DELETE',
- headers:
- {
- 'Content-Type': 'application/json',
- 'authorization': authHeader
- }
- }
- )
- const deleteMissingPersonData = await
- deleteMissingPersonResponse.json()
- if (deleteMissingPersonResponse.status === 200)
- {
- deleteMissingPersonResultsDiv.innerHTML = ''
- let textDisplay = document.createElement('P')
- textDisplay.textContent = JSON.stringify(deleteMissingPersonData)
- deleteMissingPersonResultsDiv.appendChild(textDisplay);
- }
- else
- {
- alert(`Return code ${deleteMissingPersonResponse.status} ${deleteMissingPersonResponse.statusText} ${JSON.stringify(deleteMissingPersonData)}`);
- }
- }// end try
- catch (deleteMissingPersonError) {
- console.log(deleteMissingPersonError);
- alert(deleteMissingPersonError);
- }
- }// end else if
- // Status Reports CRUD
- // Create, Status Reports
- else if (event.target === createStatusReportButton)
- {
- try
- {
- var createStatusReportData =
- {
- status_report:
- {
- case_id: createOutsideAgencyId.value,
- description: createDescription.value,
- details: createDetails.value,
- image_url: createImageUrl.value
- }
- }
- const createStatusReportResponse = await
- fetch
- (
- `${missingPeoplePath}/${createIdMissingPersonStatusReport.value}/status_reports`,
- {
- method: 'POST',
- headers:
- {
- 'Content-Type': 'application/json',
- 'authorization': authHeader
- },
- body: JSON.stringify(createStatusReportData)
- }
- )
- const createStatusReportDataHtml = await
- createStatusReportResponse.json()
- if (createStatusReportResponse.status === 201)
- {
- createStatusReportResultsDiv.innerHTML = ''
- let textDisplay = document.createElement('P')
- textDisplay.textContent = JSON.stringify(createStatusReportDataHtml)
- createStatusReportResultsDiv.appendChild(textDisplay);
- }
- else
- {
- alert(`Return code ${createStatusReportResponse.status} ${createStatusReportResponse.statusText} ${JSON.stringify(createStatusReportDataHtml)}`);
- }
- }// end try
- catch(createStatusReportError)
- {
- console.log(createStatusReportError);
- alert(createStatusReportError)
- }
- }// end else if
- // Read, Status Reports
- else if (event.target === readStatusReportsButton)
- {
- try
- {
- const readStatusReportResponse = await
- // HTTP call
- fetch
- (
- `${missingPeoplePath}/${readStatusReportsMissingPersonId.value}/status_reports`,
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- 'authorization': authHeader
- }
- }
- )
- const readStatusReportsHtmlData = await readStatusReportResponse.json()
- if (readStatusReportResponse.status === 200)
- {
- readStatusReportResultsDiv.innerHTML = ''
- if (readStatusReportsHtmlData.length === 0)
- {
- let textDisplay = document.createElement('P')
- textDisplay.textContent = "There are no status reports for this missing person."
- readStatusReportResultsDiv.appendChild(textDisplay)
- }
- else
- {
- // JSON ONLY
- for (let i = 0; i < readStatusReportsHtmlData.length; i++)
- {
- let textDisplay = document.createElement('P');
- textDisplay.textContent = JSON.stringify(readStatusReportsHtmlData[i]);
- readStatusReportResultsDiv.appendChild(textDisplay);
- }
- }
- }
- else
- {
- alert(`Return code ${readStatusReportsHtmlData.status} ${readStatusReportsHtmlData.statusText} ${JSON.stringify(data)}`);
- }// end try
- } catch (readStatusReportsError) {
- console.log(readStatusReportsError);
- alert(readStatusReportsError);
- }
- }// end else if
- // Update Status Reports
- else if (event.target === updateStatusReportButton)
- {
- try
- {
- var updateStatusReportsData =
- {
- status_report:
- {
- case_id: updateOutsideAgencyId.value,
- description: updateDescription.value,
- details: updateDetails.value,
- image_url: updateImageUrl.value
- }
- }
- if (!updateStatusReportsData.case_id)
- {delete updateStatusReportsData.case_id}
- if (!updateStatusReportsData.description)
- {delete updateStatusReportsData.description}
- if (!updateStatusReportsData.details)
- {delete updateStatusReportsData.details}
- if (!updateStatusReportsData.image_url)
- {delete updateStatusReportsData.image_url}
- const updateStatusReportResponse = await
- fetch
- (
- `${missingPeoplePath}/${updateStatusReportMissingPersonId.value}/status_reports/${updateStatusReportId.value}`,
- {
- method: 'PATCH',
- headers:
- {
- 'Content-Type':'application/json',
- 'authorization':authHeader
- },
- body: JSON.stringify(updateStatusReportsData)
- }
- )
- const updateStatusReportsHtmlData =
- await updateStatusReportResponse.json()
- if (updateStatusReportResponse.status === 200)
- {
- updateStatusReportResultsDiv.innerHTML = ''
- let textDisplay = document.createElement('P')
- textDisplay.textContent = JSON.stringify(updateStatusReportsHtmlData)
- updateStatusReportResultsDiv.appendChild(textDisplay);
- }
- else
- {
- alert(`Return code ${updateStatusReportResponse.status} ${updateStatusReportResponse.statusText} ${JSON.stringify(updateStatusReportsHtmlData)}`);
- }
- }// end try
- catch (updateStatusReportError)
- {
- console.log(updateStatusReportError);
- alert(updateStatusReportError);
- }
- }// end else if
- // Delete, Status Reports
- else if (event.target === deleteStatusReportButton)
- {
- try
- {
- const deleteStatusReportResponse = await
- fetch
- (
- `${missingPeoplePath}/${deleteStatusReportMissingPersonId.value}/status_reports/ ${deleteStatusReportId.value}`,
- {
- method: 'DELETE',
- headers:
- {
- 'Content-Type':'application/json',
- 'authorization':authHeader
- }
- })// await fetch
- const deleteStatusReportData = await
- deleteStatusReportResponse.json()
- if (deleteStatusReportResponse.status === 200)
- {
- deleteStatusReportResultsDiv.innerHTML = ''
- let displayText = document.createElement('P')
- displayText.textContent = JSON.stringify(deleteStatusReportData)
- deleteStatusReportResultsDiv.appendChild(displayText);
- }
- else
- {
- alert(`Return code ${deleteStatusReportResponse.status} ${deleteStatusReportResponse.statusText} ${JSON.stringify(deleteStatusReportData)} `);
- }
- }// try
- catch (deleteStatusReportError)
- {
- console.log(deleteStatusReportError);
- alert(deleteStatusReportError);
- }
- }// end else if
- // API'S
- // FBI
- else if (event.target === fbiApiButton)
- {
- fetch(fbiPath)
- .then(
- function(fbiApiResponseData){
- return fbiApiResponseData.json();//json.data
- }
- )
- .then(
- function(fbiApiResponseData)
- {
- console.log(fbiApiResponseData);
- var fbiEntry = fbiApiWord.value
- let text = ""
- for (let x in fbiApiResponseData.items)
- {
- if (fbiEntry === 'all')
- {
- text += "";
- text += "" +
- fbiApiResponseData.items[x].title + " ";
- text += "" +
- fbiApiResponseData.items[x].description + " ";
- text += "" +
- fbiApiResponseData.items[x].details + " ";
- text += "" +
- fbiApiResponseData.items[x].sex + " ";
- text += "" +
- fbiApiResponseData.items[x].race_raw + " ";
- text += "" +
- fbiApiResponseData.items[x].uid + " ";
- text += "" +
- fbiApiResponseData.items[x].hair_raw + " ";
- text += "" +
- fbiApiResponseData.items[x].weight + " ";
- text += "" +
- fbiApiResponseData.items[x].url + " ";
- text += "" +
- fbiApiResponseData.items[x].person_classification + " ";
- }
- else if (fbiEntry === 'title')
- {
- text += "";
- text += "" +
- fbiApiResponseData.items[x].title + " ";
- }
- else if (fbiEntry === 'description')
- {
- text += "";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].description + " ";
- }
- else if (fbiEntry === 'details')
- {
- text += "";
- text += " ";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].details + " ";
- }
- else if (fbiEntry === 'sex')
- {
- text += "";
- text += " ";
- text += " ";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].sex + " ";
- }
- else if (fbiEntry === 'race')
- {
- text += "";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].race_raw + " ";
- }
- else if (fbiEntry === 'id')
- {
- text += "";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].uid + " ";
- }
- else if (fbiEntry === 'hair color')
- {
- text += "";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].hair_raw + " ";
- }
- else if (fbiEntry === 'weight')
- {
- text += "";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].weight + " ";
- }
- else if (fbiEntry === 'url')
- {
- text += "";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " "; text += "" +
- fbiApiResponseData.items[x].url + " ";
- }
- else if (fbiEntry === 'classification')
- {
- text += "";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += " ";
- text += "" +
- fbiApiResponseData.items[x].person_classification + " ";
- }
-
- }
- text += "
"
- fbiResultsDiv.innerHTML = text;
- }
- )
- }// end else if
- // twitter fetch
- else if(event.target === twitterApiButton)
- {
- fetch(twitterPath,
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- 'authorization': authHeader
- }
- }
- )
- .then(
- function(twitterApiResponseData){
- return twitterApiResponseData.json();//json.data
- }
- )
- .then(
- function(twitterApiResponseData)
- {
- console.log(twitterApiResponseData);
- // HTML TABLE
- var twitterEntry = twitterApiWord.value
- let text = ""
- for (let x in twitterApiResponseData.data)
- if (twitterEntry === 'all')
- {
- text += "";
- text += "" +
- twitterApiResponseData.data[x].id + " ";
- text += "" +
- twitterApiResponseData.data[x].text + " ";
- }
- else if (twitterEntry === 'id')
- {
- text += "";
- text += "" +
- twitterApiResponseData.data[x].id + " ";
- }
- else if (twitterEntry === 'text')
- {
- text += "";
- text += " ";
- text += "" +
- twitterApiResponseData.data[x].text + " ";
- }
- text += "
"
- twitterResultsDiv.innerHTML = text;
- // JSON ONLY
- // // var twitterApiResponse = twitterApiRequest.response;
- // // var twitterApiParsedData = JSON.parse(twitterApiResponse);
- // // console.log(twitterApiParsedData);
- // if(twitterApiWord.value == 's')
- // {
- // var textData = twitterApiParsedData.data[0].text;
- // }
- // var textDisplay = document.createElement('li');
- // textDisplay.innerHTML = textData;
- // twitterResultsDiv.appendChild(textDisplay);
- }
- )
- }// end else if
- // Newsdata API
- else if (event.target === newsdataApiButton)
- {
- fetch(newsdataPath)
- .then
- (
- function(newsdataApiResponse)
- {
- return newsdataApiResponse.json();
- }
- )
- .then
- (
- function(newsdataApiResponseData)
- {
- console.log(newsdataApiResponseData);
- // HTML TABLE
- var newsdataEntry = newsdata_api_word.value
- let text = ""
- for (let x in newsdataApiResponseData.results)
- {
- if (newsdataEntry === 'all')
- {
- text += "";
- text += "" +
- newsdataApiResponseData.results[x].title + " ";
- text += "" +
- newsdataApiResponseData.results[x].link + " ";
- text += "" +
- newsdataApiResponseData.results[x].description + " ";
- }
- else if (newsdataEntry === 'title')
- {
- text += "";
- text += "" +
- newsdataApiResponseData.results[x].title + " ";
- text += " ";
- text += " ";
- }
- else if (newsdataEntry === 'link')
- {
- text += "";
- text += " ";
- text += "" +
- newsdataApiResponseData.results[x].link + " ";
- text += "";
- text += " ";
- }
- else if (newsdataEntry === 'description')
- {
- text += "";
- text += " ";
- text += " ";
- text += "" +
- newsdataApiResponseData.results[x].description + " ";
- }
- }
- text += "
"
- newsdataResultsDiv.innerHTML = text;
-
-
- // JSON ONLY
- // var word = newsdataApiWord.value
- // if (word === 'title'){
- // var textData = newsdataApiResponseData.results[1].title;
- // }
- // else if (word === 'description'){
- // var textData = newsdataApiResponseData.results[1].description;
- // }
- // else if (word === 'link'){
- // var textData = newsdataApiResponseData.results[1].link;
- // }
- // var textDisplay = document.createElement('P');
- // textDisplay.innerHTML = textData;
- // newsdataResultsDiv.appendChild(textDisplay);
- }
- )// end .then
- } // end else if
- });// crudOperationsDiv
-}// function handle ajax
-document.addEventListener('DOMContentLoaded', handle_ajax(event));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// :)
diff --git a/app/javascript/packs/fbi_operations.js b/app/javascript/packs/fbi_operations.js
new file mode 100644
index 0000000..27a8cbb
--- /dev/null
+++ b/app/javascript/packs/fbi_operations.js
@@ -0,0 +1,393 @@
+function handle_fbi_ajax(event)
+{
+ const readMissingPersonResultsDiv = document.getElementById('read_missing_person_results_div');
+ console.log('DOM fully loaded and parsed');
+ // Headers
+ const authHeader = localStorage.getItem("authHeader");
+ // API divs
+ const fbiOperationsDiv = document.getElementById('fbi_operations_div');
+ const fbiResultsDiv = document.getElementById('fbi_results_div');
+ const fbiApiWord = document.getElementById('fbi_api_word');
+ const fbiApiButton = document.getElementById('fbi_api_button');
+ const fbiCreateMissingNameButton = document.getElementById('fbi_create_missing_name_button');
+ const fbiMenu = document.getElementById('fbi_menu');
+ const body = document.getElementById('body');
+ const backend = body.getAttribute('data-backend');
+ // Paths
+ //const missingPeoplePath = 'https://help-find-back.herokuapp.com/api/v1/missing_persons';
+ //const fbiPath = 'https://help-find-back.herokuapp.com/api/v1/fbi';
+ const missingPeoplePath = backend + "/api/v1/missing_persons";
+ const fbiPath = backend + "/api/v1/fbi";
+
+ // FBI operations
+ fbiOperationsDiv.addEventListener('click', async (event) =>
+ {
+ if (event.target === fbiApiButton)
+ {
+ fetch(fbiPath)
+ .then(
+ function(fbiApiResponseData){
+ return fbiApiResponseData.json();//json.data
+ }
+ )
+ .then(
+ function(fbiApiResponseData)
+ {
+ console.log(fbiApiResponseData);
+ var fbiEntry = fbiApiWord.value
+ var counter = 1
+ var index = 0
+ var i = parseInt(fbiEntry) - 1
+ let text = ""
+ var fbiMenuWord = fbiMenu.value
+ const fbiApiResponseArray = []
+ for (let x in fbiApiResponseData.items)
+ for (let s in fbiApiResponseData.items[x].subjects)
+ if (fbiApiResponseData.items[x].subjects[s] === 'Kidnappings and Missing Persons' || fbiApiResponseData.items[x].subjects[s] === 'ViCAP Missing Persons' )
+ {
+ fbiApiResponseArray[index] = fbiApiResponseData.items[x]
+ ++index
+
+ if (fbiEntry || fbiMenuWord === 'all')
+ {
+ text += "";
+ text += "" +
+ (counter ++) + " ";
+ text += "" +
+ fbiApiResponseData.items[x].title + " ";
+ text += "" +
+ fbiApiResponseData.items[x].description + " ";
+ text += "" +
+ fbiApiResponseData.items[x].details + " ";
+ text += "" +
+ fbiApiResponseData.items[x].sex + " ";
+ text += "" +
+ fbiApiResponseData.items[x].race_raw + " ";
+ text += "" +
+ fbiApiResponseData.items[x].uid + " ";
+ text += "" +
+ fbiApiResponseData.items[x].hair_raw + " ";
+ text += "" +
+ fbiApiResponseData.items[x].weight + " ";
+ text += "" +
+ fbiApiResponseData.items[x].url + " ";
+ text += "" +
+ fbiApiResponseData.items[x].person_classification + " ";
+ text += "" +
+ fbiApiResponseData.items[x].subjects[s] + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'title')
+ {
+ text += "";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].title + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'description')
+ {
+ if (fbiApiResponseData.items[x].description.length > 25) {
+ fbiApiResponseData.items[x].description = fbiApiResponseData.items[x].description.substring(0, 24) + "...";
+
+ text += "";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].description + " ";
+
+ }
+ else {
+ text += "";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].description + " ";
+ }
+
+
+ }
+ else if (fbiEntry || fbiMenuWord === 'details')
+ {
+ if (fbiApiResponseData.items[x].details.length > 25) {
+ fbiApiResponseData.items[x].details = fbiApiResponseData.items[x].details.substring(0, 24) + "...";
+
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].details + " ";
+ }
+ else
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].details + " ";
+ }
+ }
+ else if (fbiEntry || fbiMenuWord === 'sex')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].sex + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'race')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].race_raw + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'id')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].uid + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'hair color')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].hair_raw + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'weight')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].weight + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'url')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " "; text += "" +
+ fbiApiResponseData.items[x].url + " ";
+ }
+ else if (fbiEntry || fbiMenuWord === 'classification')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += " ";
+ text += "" +
+ fbiApiResponseData.items[x].person_classification + " ";
+ }
+ }
+ // number entry
+ if (parseInt(fbiEntry))
+ {
+ // display chosen fbi id
+ text += "";
+ text += "" +
+ fbiEntry + " ";
+ text += "" +
+ fbiApiResponseArray[i].title + " ";
+ text += "" +
+ fbiApiResponseArray[i].description + " ";
+ text += "" +
+ fbiApiResponseArray[i].details + " ";
+ text += "" +
+ fbiApiResponseArray[i].sex + " ";
+ text += "" +
+ fbiApiResponseArray[i].race_raw + " ";
+ text += "" +
+ fbiApiResponseArray[i].uid + " ";
+ text += "" +
+ fbiApiResponseArray[i].hair_raw + " ";
+ text += "" +
+ fbiApiResponseArray[i].weight + " ";
+ text += "" +
+ fbiApiResponseArray[i].url + " ";
+ text += "" +
+ fbiApiResponseArray[i].person_classification + " ";
+ // create missing person
+ var createMissingPersonData =
+ {
+ missing_person:
+ {
+ name: fbiApiResponseArray[i].title,
+ sex: fbiApiResponseArray[i].sex,
+ race: fbiApiResponseArray[i].race_raw,
+ hair_color: fbiApiResponseArray[i].hair_raw,
+ weight: fbiApiResponseArray[i].weight
+ }
+ }
+ // HTTP Call
+ fetch(missingPeoplePath,
+ {
+ method: 'POST',
+ headers:
+ {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ },
+ body: JSON.stringify(createMissingPersonData)
+ })
+ // Display text
+ .then((createMissingPersonResponse) =>
+ {
+ // Results
+ if (createMissingPersonResponse.status === 201)
+ {
+ createMissingPersonResponse.json()
+ .then((createMissingPersonData) =>
+ {
+ console.log(createMissingPersonData);
+ });
+ }
+ // Status
+ else
+ {
+ createMissingPersonResponse.json()
+ .then((createMissingPersonData) =>
+ {
+ //alert(`Return code ${createMissingPersonResponse.status} ${createMissingPersonResponse.statusText}`);
+ alert(`Could not create a new missing person, a person with the same name is already exists`);
+ })
+ .catch((createMissingPersonError) =>
+ {
+ console.log(createMissingPersonError);
+ alert(createMissingPersonError);
+ });
+ }
+ }) // .then((createMissingPersonResponse)
+ // missing person entered into database
+ fetch(missingPeoplePath,
+ {
+ headers:
+ {
+ 'Content-Type':'application/json',
+ 'authorization':authHeader
+ }
+ })
+ .then((listMissingPeopleResponse) =>
+ {
+ console.log(listMissingPeopleResponse);
+ if (listMissingPeopleResponse.status === 200)
+ {
+ readMissingPersonResultsDiv.innerHTML = '';
+ listMissingPeopleResponse.json()
+ .then((listMissingPeopleData) =>
+ {
+ console.log(listMissingPeopleData);
+ if (listMissingPeopleData.length === 0)
+ {
+ let textDisplay = document.createElement('P')
+ textDisplay.textContent = "No Available Missing Persons Files."
+ readMissingPersonResultsDiv.appendChild(textDisplay)
+ }
+ else
+ {
+ // display last missing persons table entry
+ var listMissingPeopleLastIndex = (listMissingPeopleData.length)-1
+ let text = ""
+ text += "";
+ text += "" +
+ listMissingPeopleData[listMissingPeopleLastIndex].id + " ";
+ text += "" +
+ listMissingPeopleData[listMissingPeopleLastIndex].name + " ";
+ text += "" +
+ listMissingPeopleData[listMissingPeopleLastIndex].sex + " ";
+ text += "" +
+ listMissingPeopleData[listMissingPeopleLastIndex].race + " ";
+ text += "" +
+ listMissingPeopleData[listMissingPeopleLastIndex].age + " ";
+ text += "" +
+ listMissingPeopleData[listMissingPeopleLastIndex].hair_color + " ";
+ text += "" +
+ listMissingPeopleData[listMissingPeopleLastIndex].weight + " ";
+ text += "
"
+ readMissingPersonResultsDiv.innerHTML = text;
+ // status report entered into database
+ var createStatusReportData =
+ {
+ status_report:
+ {
+ case_id: fbiApiResponseArray.items[i].uid,
+ description: fbiApiResponseArray.items[i].description,
+ details: fbiApiResponseArray.items[i].details,
+ image_url: fbiApiResponseArray.items[i].url
+ }
+ }
+ var fbiCreateIdMissingPersonStatusReport = listMissingPeopleData[(listMissingPeopleData.length)-1].id
+ fetch
+ (
+ `${missingPeoplePath}/${parseInt(fbiCreateIdMissingPersonStatusReport)}/status_reports`,
+ {
+ method: 'POST',
+ headers:
+ {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ },
+ body: JSON.stringify(createStatusReportData)
+ }
+ )
+ }
+ });// .then((listMissingPeopleData)
+ }
+ else
+ {
+ alert(`Return code ${listMissingPeopleResponse.status} ${listMissingPeopleResponse.statusText}`);
+ }
+ })// end .then((listMissingPeopleResponse)
+ .catch((listMissingPeopleError) =>
+ {
+ console.log(listMissingPeopleError);
+ alert(listMissingPeopleError);
+ });
+ }// end if parse
+ text += "
"
+ fbiResultsDiv.innerHTML = text;
+ }
+ )
+ }// end else if
+ });// end fbiOperationsDiv
+}// function handle fbi ajax
+document.addEventListener('DOMContentLoaded', handle_fbi_ajax(event));
+// :)
diff --git a/app/javascript/packs/missing_people_operations.js b/app/javascript/packs/missing_people_operations.js
new file mode 100644
index 0000000..3ed286f
--- /dev/null
+++ b/app/javascript/packs/missing_people_operations.js
@@ -0,0 +1,351 @@
+function handle_missing_people_ajax(event)
+{
+ console.log('DOM fully loaded and parsed');
+ // Headers
+ const authHeader = localStorage.getItem("authHeader");
+ // Missing People
+ // CRUD MissingPerson Results Divs
+ const createMissingPersonResultsDiv = document.getElementById('create_missing_person_results_div');
+ const readMissingPersonResultsDiv = document.getElementById('read_missing_person_results_div');
+ const updateMissingPersonResultsDiv = document.getElementById('update_missing_person_results_div');
+ const deleteMissingPersonResultsDiv = document.getElementById('delete_missing_person_results_div');
+ const missingPeopleCrudOperationsDiv = document.getElementById('missing_people_crud_operations_div');
+ // Missing People CRUD:
+ // Create, Missing People
+ const createName = document.getElementById('create_name');
+ const createSex = document.getElementById('create_sex');
+ const createRace = document.getElementById('create_race');
+ const createAge = document.getElementById('create_age');
+ const createHairColor = document.getElementById('create_hair_color');
+ const createWeight = document.getElementById('create_weight');
+ const createMissingPersonButton = document.getElementById('create_missing_person_button');
+ // Read, Missing People
+ const readMissingPeopleButton = document.getElementById('read_missing_people_button');
+ // Update, Missing People
+ const updateMissingPersonId = document.getElementById('update_missing_person_id');
+ const updateName = document.getElementById('update_name');
+ const updateSex = document.getElementById('update_sex');
+ const updateRace = document.getElementById('update_race');
+ const updateAge = document.getElementById('update_age');
+ const updateHairColor = document.getElementById('update_hair_color');
+ const updateWeight = document.getElementById('update_weight');
+ const updateMissingPersonButton = document.getElementById('update_missing_person_button');
+ // Delete, Missing People
+ const deleteMissingPersonId = document.getElementById('delete_missing_person_id');
+ const deleteMissingPersonButton = document.getElementById('delete_missing_person_button');
+ const body = document.getElementById('body');
+ const backend = body.getAttribute('data-backend');
+ // // Paths
+ //const missingPeoplePath = 'https://help-find-back.herokuapp.com/api/v1/missing_persons';
+ const missingPeoplePath = backend + "/api/v1/missing_persons";
+
+ // CRUD operations
+ missingPeopleCrudOperationsDiv.addEventListener('click', async (event) =>
+ {
+ // Create, Missing People
+ if (event.target == createMissingPersonButton)
+ {
+ // Collect data
+ // It should be var createMissingPersonData = { missing_person: (name: createName.value, ...}}
+ var createMissingPersonData =
+ {
+ missing_person:
+ {
+ name: createName.value,
+ sex: createSex.value,
+ race: createRace.value,
+ age: createAge.value,
+ hair_color: createHairColor.value,
+ weight: createWeight.value
+ }
+ }
+ // HTTP Call
+ fetch(missingPeoplePath,
+ {
+ method: 'POST',
+ headers:
+ {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ },
+ body: JSON.stringify(createMissingPersonData)
+ })
+ // Display text
+ .then((createMissingPersonResponse) =>
+ {
+ // Results
+ if (createMissingPersonResponse.status === 201)
+ {
+ createMissingPersonResponse.json()
+ .then((createMissingPersonData) =>
+ {
+ console.log(createMissingPersonData);
+ // HTML TABLE
+ let text = ""
+ // for (let x in createMissingPersonData)
+ // {
+ text += "";
+ text += "" +
+ createMissingPersonData.id + " ";
+ text += "" +
+ createMissingPersonData.name + " ";
+ text += "" +
+ createMissingPersonData.sex + " ";
+ text += "" +
+ createMissingPersonData.race + " ";
+ text += "" +
+ createMissingPersonData.age + " ";
+ text += "" +
+ createMissingPersonData.hair_color + " ";
+ text += "" +
+ createMissingPersonData.weight + " ";
+ // }
+ text += "
"
+ createMissingPersonResultsDiv.innerHTML = text;
+
+ // JSON ONLY
+ // createMissingPersonResultsDiv.innerHTML = '';
+ // let displayText = document.createElement('P');
+ // displayText.textContent = JSON.stringify(createMissingPersonData);
+ // createMissingPersonResultsDiv.appendChild(displayText);
+ });
+ }
+ // Status
+ else
+ {
+ createMissingPersonResponse.json()
+ .then((createMissingPersonData) =>
+ {
+ alert(`Return code ${createMissingPersonResponse.status} ${createMissingPersonResponse.statusText}`);
+ })
+ .catch((createMissingPersonError) =>
+ {
+ console.log(createMissingPersonError);
+ alert(createMissingPersonError);
+ });
+ }
+ }) // .then((createMissingPersonResponse)
+ }
+
+ // Read, Missing People
+ else if (event.target === readMissingPeopleButton)
+ {
+ fetch(missingPeoplePath,
+ {
+ headers:
+ {
+ 'Content-Type':'application/json',
+ 'authorization':authHeader
+ }
+ })
+ .then((listMissingPeopleResponse) =>
+ {
+ console.log(listMissingPeopleResponse);
+ if (listMissingPeopleResponse.status === 200)
+ {
+ readMissingPersonResultsDiv.innerHTML = '';
+ listMissingPeopleResponse.json()
+ .then((listMissingPeopleData) =>
+ {
+ console.log(listMissingPeopleData);
+ if (listMissingPeopleData.length === 0)
+ {
+ let textDisplay = document.createElement('P')
+ textDisplay.textContent = "No Available Missing Persons Files."
+ readMissingPersonResultsDiv.appendChild(textDisplay)
+ }
+ else
+ {
+ // HTML TABLE
+ let text = ""
+ for (let x in listMissingPeopleData)
+ {
+ text += "";
+ text += "" +
+ listMissingPeopleData[x].id + " ";
+ text += "" +
+ listMissingPeopleData[x].name + " ";
+ text += "" +
+ listMissingPeopleData[x].sex + " ";
+ text += "" +
+ listMissingPeopleData[x].race + " ";
+ text += "" +
+ listMissingPeopleData[x].age + " ";
+ text += "" +
+ listMissingPeopleData[x].hair_color + " ";
+ text += "" +
+ listMissingPeopleData[x].weight + " ";
+ }
+ text += "
"
+ readMissingPersonResultsDiv.innerHTML = text;
+
+ // JSON ONLY
+ // for (let i = 0; i < listMissingPeopleData.length; i++)
+ // {
+ // let textDisplay = document.createElement('P');
+ // textDisplay.textContent = JSON.stringify(listMissingPeopleData[i]);
+ // readMissingPersonResultsDiv.appendChild(textDisplay);
+ // }
+ }
+ });// .then((listMissingPeopleData)
+ }
+ else
+ {
+ alert(`Return code ${listMissingPeopleResponse.status} ${listMissingPeopleResponse.statusText}`);
+ }
+ })// .then((listMissingPeopleResponse)
+ .catch((listMissingPeopleError) =>
+ {
+ console.log(listMissingPeopleError);
+ alert(listMissingPeopleError);
+ });
+ }
+ // Update
+ else if (event.target === updateMissingPersonButton)
+ {
+ var updateMissingPersonData =
+ {
+ missing_person:
+ {
+ name: updateName.value,
+ sex: updateSex.value,
+ race: updateRace.value,
+ age: updateAge.value,
+ hair_color: updateHairColor.value,
+ weight: updateWeight.value
+ }
+ }
+ if (!updateMissingPersonData.update_name) {
+ delete updateMissingPersonData.update_name
+ }
+ if (updateMissingPersonData.update_sex) {
+ delete updateMissingPersonData.update_sex
+ }
+ if (!updateMissingPersonData.update_race) {
+ delete updateMissingPersonData.update_race
+ }
+ if (updateMissingPersonData.update_age) {
+ delete updateMissingPersonData.update_age
+ }
+ if (!updateMissingPersonData.update_hair_color) {
+ delete updateMissingPersonData.update_hair_color
+ }
+ if (updateMissingPersonData.update_weight) {
+ delete updateMissingPersonData.update_weight
+ }
+ fetch(`${missingPeoplePath}/${updateMissingPersonId.value}`,
+ {
+ method: 'PUT',
+ headers:
+ {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ },
+ body: JSON.stringify(updateMissingPersonData)
+ })
+ .then((updateMissingPersonResponse) =>
+ {
+ if (updateMissingPersonResponse.status === 200)
+ {
+ updateMissingPersonResponse.json()
+ .then((updateMissingPersonData) =>
+ {
+ // HTML TABLE
+ let text = ""
+ // for (let x in createMissingPersonData)
+ // {
+ text += "";
+ text += "" +
+ updateMissingPersonData.id + " ";
+ text += "" +
+ updateMissingPersonData.name + " ";
+ text += "" +
+ updateMissingPersonData.sex + " ";
+ text += "" +
+ updateMissingPersonData.race + " ";
+ text += "" +
+ updateMissingPersonData.age + " ";
+ text += "" +
+ updateMissingPersonData.hair_color + " ";
+ text += "" +
+ updateMissingPersonData.weight + " ";
+ // }
+ text += "
"
+ updateMissingPersonResultsDiv.innerHTML = text;
+ // JSON only
+ // updateMissingPersonResultsDiv.innerHTML = '';
+ // let parag = document.createElement('P');
+ // parag.textContent = JSON.stringify(data);
+ // updateMissingPersonResultsDiv.appendChild(parag);
+ });
+ }
+ else
+ {
+ updateMissingPersonResponse.json()
+ .then((data) =>
+ {
+ alert(`Return code ${updateMissingPersonResponse.status} ${updateMissingPersonResponse.statusText} ${JSON.stringify(data)}`);
+ })
+ .catch((error) =>
+ {
+ console.log(error);
+ alert(error);
+ });
+ }
+ });
+ }
+ // Delete, Missing People
+ else if (event.target === deleteMissingPersonButton)
+ {
+ try
+ {
+ const deleteMissingPersonResponse = await
+ fetch
+ (`${missingPeoplePath}/${delete_missing_person_id.value}`,
+ {
+ method: 'DELETE',
+ headers:
+ {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ }
+ }
+ )
+ const deleteMissingPersonData = await
+ deleteMissingPersonResponse.json()
+ if (deleteMissingPersonResponse.status === 200)
+ {
+ // HTML
+ // logon create HTML element
+ var word = deleteMissingPersonData.message;
+
+ // // create element
+ var displayText = document.createElement('li');
+ //
+ // // add data to list item
+ displayText.innerHTML = word;
+ //
+ // // add to HTML
+ deleteMissingPersonResultsDiv.appendChild(displayText);
+
+ // JSON only
+ // deleteMissingPersonResultsDiv.innerHTML = ''
+ // let textDisplay = document.createElement('P')
+ // textDisplay.textContent = JSON.stringify(deleteMissingPersonData)
+ // deleteMissingPersonResultsDiv.appendChild(textDisplay);
+ }
+ else
+ {
+ alert(`Return code ${deleteMissingPersonResponse.status} ${deleteMissingPersonResponse.statusText} ${JSON.stringify(deleteMissingPersonData)}`);
+ }
+ }// end try
+ catch (deleteMissingPersonError) {
+ console.log(deleteMissingPersonError);
+ alert(deleteMissingPersonError);
+ }
+ }// end else if
+ });// crudOperationsDiv
+}// function handle ajax
+document.addEventListener('DOMContentLoaded', handle_missing_people_ajax(event));
+
+// :)
diff --git a/app/javascript/packs/newsdata_operations.js b/app/javascript/packs/newsdata_operations.js
new file mode 100644
index 0000000..ddfe00e
--- /dev/null
+++ b/app/javascript/packs/newsdata_operations.js
@@ -0,0 +1,91 @@
+function handle_newsdata_ajax(event)
+{
+ // const readMissingPersonResultsDiv = document.getElementById('read_missing_person_results_div');
+ console.log('DOM fully loaded and parsed');
+ // Header
+ const authHeader = localStorage.getItem("authHeader");
+ // Twitter API divs
+ const newsdataOperationsDiv = document.getElementById('newsdata_operations_div');
+ const newsdataResultsDiv = document.getElementById('newsdata_results_div');
+ const newsdataApiWord = document.getElementById('newsdata_api_word');
+ const newsdataApiButton = document.getElementById('newsdata_api_button');
+ const newsdataCreateMissingNameButton = document.getElementById('newsdata_create_missing_name_button')
+ const newsdataMenu = document.getElementById('newsdata_menu');
+ const body = document.getElementById('body');
+ const backend = body.getAttribute('data-backend');
+
+ // Paths
+ // const missingPeoplePath = 'https://help-find-back.herokuapp.com/api/v1/missing_persons';
+ //const newsdataPath = 'https://help-find-back.herokuapp.com/api/v1/newsdata';
+ const missingPeoplePath = backend + "/api/v1/missing_persons";
+ const newsdataPath = backend + "/api/v1/newsdata";
+ // Twitter operations
+ newsdataOperationsDiv.addEventListener('click', async (event) =>
+ {
+ // API'S
+ // Newsdata API
+ if (event.target === newsdataApiButton)
+ {
+ fetch(newsdataPath)
+ .then
+ (
+ function(newsdataApiResponse)
+ {
+ return newsdataApiResponse.json();
+ }
+ )
+ .then
+ (
+ function(newsdataApiResponseData)
+ {
+ console.log(newsdataApiResponseData);
+ // HTML TABLE
+ var newsdataEntry = newsdata_api_word.value
+ let text = ""
+ for (let x in newsdataApiResponseData.results)
+ {
+ if (newsdataEntry === 'all')
+ {
+ text += "";
+ text += "" +
+ newsdataApiResponseData.results[x].title + " ";
+ text += "" +
+ newsdataApiResponseData.results[x].link + " ";
+ text += "" +
+ newsdataApiResponseData.results[x].description + " ";
+ }
+ else if (newsdataEntry === 'title')
+ {
+ text += "";
+ text += "" +
+ newsdataApiResponseData.results[x].title + " ";
+ text += " ";
+ text += " ";
+ }
+ else if (newsdataEntry === 'link')
+ {
+ text += "";
+ text += " ";
+ text += "" +
+ newsdataApiResponseData.results[x].link + " ";
+ text += "";
+ text += " ";
+ }
+ else if (newsdataEntry === 'description')
+ {
+ text += "";
+ text += " ";
+ text += " ";
+ text += "" +
+ newsdataApiResponseData.results[x].description + " ";
+ }
+ }
+ text += "
"
+ newsdataResultsDiv.innerHTML = text;
+ }
+ )// end .then
+ } // end else if
+ });// end newsdataOperationsDiv
+}// function handle newsdata ajax
+document.addEventListener('DOMContentLoaded', handle_newsdata_ajax(event));
+// :)
diff --git a/app/javascript/packs/session_operations.js b/app/javascript/packs/session_operations.js
index 4c7d5ad..ff8d270 100644
--- a/app/javascript/packs/session_operations.js
+++ b/app/javascript/packs/session_operations.js
@@ -1,15 +1,20 @@
function handle_session (event) {
console.log('DOM fully loaded and parsed');
+ const body = document.getElementById('body');
+ const backend = body.getAttribute('data-backend');
// Backend API controller path
- const usersHelpFindBackPath = 'http://localhost:3001/users';
+ //const usersHelpFindBackPath = 'https://help-find-back.herokuapp.com/users';
+ const usersHelpFindBackPath = backend + "/users";
// session rest operations
const sessionRestOperationsDiv = document.getElementById('session_rest_operations_div');
// display ajax results
- const ajaxResultsDiv = document.getElementById('ajax_results_div');
+ const createUserResultsDiv = document.getElementById('create_user_results_div');
+ const logonResultsDiv = document.getElementById('logon_results_div');
+ const logoffResultsDiv = document.getElementById('logoff_results_div');
// buttons
const createUserButton = document.getElementById('create_user_button')
@@ -60,11 +65,23 @@ function handle_session (event) {
createUserResponse.json()
.then((createUserData) =>
{
- // add json data to HTML
- ajaxResultsDiv.innerHTML = '';
- let textDisplay=document.createElement('P');
- textDisplay.textContent=JSON.stringify(createUserData);
- ajaxResultsDiv.appendChild(textDisplay);
+ // logon create HTML element
+ var word = createUserData.message;
+
+ // // create element
+ var displayText = document.createElement('li');
+ //
+ // // add data to list item
+ displayText.innerHTML = word;
+ //
+ // // add to HTML
+ createUserResultsDiv.appendChild(displayText);
+
+ // // add json data to HTML
+ // ajaxResultsDiv.innerHTML = '';
+ // let textDisplay=document.createElement('P');
+ // textDisplay.textContent=JSON.stringify(createUserData);
+ // ajaxResultsDiv.appendChild(textDisplay);
});
}
@@ -112,15 +129,28 @@ function handle_session (event) {
if (logonResponse.status === 201)
{
// add data
- ajaxResultsDiv.innerHTML = '';
+ logonResultsDiv.innerHTML = '';
logonResponse.json()
.then((logonUserData) =>
{
// logon create HTML element
- let textDisplay = document.createElement('P');
- textDisplay.textContent = JSON.stringify(logonUserData);
- ajaxResultsDiv.appendChild(textDisplay);
- logonResponse.headers
+ var word = logonUserData.message;
+
+ // // create element
+ var displayText = document.createElement('li');
+ //
+ // // add data to list item
+ displayText.innerHTML = word;
+ //
+ // // add to HTML
+ logonResultsDiv.appendChild(displayText);
+
+ // JSON only
+ // let textDisplay = document.createElement('P');
+ // textDisplay.textContent = JSON.stringify(logonUserData);
+ // ajaxResultsDiv.appendChild(textDisplay);
+ // logonResponse.headers
+
// .forEach(function(value, key)
// {
// headersTextDisplay = document.createElement('P');
@@ -157,10 +187,24 @@ function handle_session (event) {
logOffResponse.json()
.then((logOffData) =>
{
- ajaxResultsDiv.innerHTML = "";
- let textDisplay = document.createElement('P');
- textDisplay.textContent = JSON.stringify(logOffData);
- ajaxResultsDiv.appendChild(textDisplay);
+ // HTML
+ // logon create HTML element
+ var word = logOffData.message;
+
+ // // create element
+ var displayText = document.createElement('li');
+ //
+ // // add data to list item
+ displayText.innerHTML = word;
+ //
+ // // add to HTML
+ logoffResultsDiv.appendChild(displayText);
+
+ // JSON only
+ // ajaxResultsDiv.innerHTML = "";
+ // let textDisplay = document.createElement('P');
+ // textDisplay.textContent = JSON.stringify(logOffData);
+ // ajaxResultsDiv.appendChild(textDisplay);
});
}
else
diff --git a/app/javascript/packs/status_reports_operations.js b/app/javascript/packs/status_reports_operations.js
new file mode 100644
index 0000000..1c6eeb8
--- /dev/null
+++ b/app/javascript/packs/status_reports_operations.js
@@ -0,0 +1,261 @@
+function handle_status_reports_ajax(event)
+{
+ console.log('DOM fully loaded and parsed');
+ // Headers
+ const authHeader = localStorage.getItem("authHeader");
+ const statusReportsCrudOperationsDiv = document.getElementById('status_reports_crud_operations_div');
+ // Status Reports CRUD results divs
+ const createStatusReportResultsDiv = document.getElementById('create_status_report_results_div');
+ const readStatusReportResultsDiv = document.getElementById('read_status_report_results_div');
+ const updateStatusReportResultsDiv = document.getElementById('update_status_report_results_div');
+ const deleteStatusReportResultsDiv = document.getElementById('delete_status_report_results_div');
+ // Status Reports CRUD
+ // Create, Status Reports
+ const createIdMissingPersonStatusReport = document.getElementById('create_id_missing_person_status_report');
+ const createOutsideAgencyId = document.getElementById('create_outside_agency_id');
+ const createDescription = document.getElementById('create_description');
+ const createDetails = document.getElementById('create_details');
+ const createImageUrl = document.getElementById('create_image_url');
+ const createStatusReportButton = document.getElementById('create_status_report_button');
+ // Read, Status Reports
+ const readStatusReportsMissingPersonId = document.getElementById('read_status_reports_missing_person_id');
+ const readStatusReportsButton = document.getElementById('read_status_reports_button');
+ // Update, Status Reports
+ const updateStatusReportMissingPersonId = document.getElementById('update_status_report_missing_person_id');
+ const updateStatusReportId = document.getElementById('update_status_report_id');
+ const updateOutsideAgencyId = document.getElementById('update_outside_agency_id');
+ const updateDescription = document.getElementById('update_description');
+ const updateDetails = document.getElementById('update_details');
+ const updateImageUrl = document.getElementById('update_image_url');
+ const updateStatusReportButton = document.getElementById('update_status_report_button');
+ // Delete, Status Reports
+ const deleteStatusReportMissingPersonId = document.getElementById('delete_status_report_missing_person_id');
+ const deleteStatusReportId = document.getElementById('delete_status_report_id');
+ const deleteStatusReportButton = document.getElementById('delete_status_report_button');
+ const body = document.getElementById('body');
+ const backend = body.getAttribute('data-backend');
+ // Paths
+ //const missingPeoplePath = 'https://help-find-back.herokuapp.com/api/v1/missing_persons';
+ const missingPeoplePath = backend + "/api/v1/missing_persons";
+ // CRUD operations
+ statusReportsCrudOperationsDiv.addEventListener('click', async (event) =>
+ {
+ // Status Reports CRUD
+ // Create, Status Reports
+ if (event.target === createStatusReportButton)
+ {
+ try
+ {
+ var createStatusReportData =
+ {
+ status_report:
+ {
+ case_id: createOutsideAgencyId.value,
+ description: createDescription.value,
+ details: createDetails.value,
+ image_url: createImageUrl.value
+ }
+ }
+ const createStatusReportResponse = await
+ fetch
+ (
+ `${missingPeoplePath}/${createIdMissingPersonStatusReport.value}/status_reports`,
+ {
+ method: 'POST',
+ headers:
+ {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ },
+ body: JSON.stringify(createStatusReportData)
+ }
+ )
+ const createStatusReportDataHtml = await
+ createStatusReportResponse.json()
+ if (createStatusReportResponse.status === 201)
+ {
+ createStatusReportResultsDiv.innerHTML = ''
+ let textDisplay = document.createElement('P')
+ textDisplay.textContent = JSON.stringify(createStatusReportDataHtml)
+ createStatusReportResultsDiv.appendChild(textDisplay);
+ }
+ else
+ {
+ alert(`Return code ${createStatusReportResponse.status} ${createStatusReportResponse.statusText} ${JSON.stringify(createStatusReportDataHtml)}`);
+ }
+ }// end try
+ catch(createStatusReportError)
+ {
+ console.log(createStatusReportError);
+ alert(createStatusReportError)
+ }
+ }// end else if
+ // Read, Status Reports
+ else if (event.target === readStatusReportsButton)
+ {
+ try
+ {
+ const readStatusReportResponse = await
+ // HTTP call
+ fetch
+ (
+ `${missingPeoplePath}/${readStatusReportsMissingPersonId.value}/status_reports`,
+ {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ }
+ }
+ )
+ const readStatusReportsHtmlData = await readStatusReportResponse.json()
+ if (readStatusReportResponse.status === 200)
+ {
+ readStatusReportResultsDiv.innerHTML = ''
+ if (readStatusReportsHtmlData.length === 0)
+ {
+ let textDisplay = document.createElement('P')
+ textDisplay.textContent = "There are no status reports for this missing person."
+ readStatusReportResultsDiv.appendChild(textDisplay)
+ }
+ else
+ {
+ // HTML TABLE
+ let text = ""
+ for (let x in readStatusReportsHtmlData)
+ {
+ text += "";
+ text += "" +
+ readStatusReportsHtmlData[x].id + " ";
+ text += "" +
+ readStatusReportsHtmlData[x].missing_person_id + " ";
+ text += "" +
+ readStatusReportsHtmlData[x].description + " ";
+ text += "" +
+ readStatusReportsHtmlData[x].details + " ";
+ text += "" +
+ readStatusReportsHtmlData[x].case_id + " ";
+ text += "" +
+ readStatusReportsHtmlData[x].image_url + " ";
+
+ }
+ text += "
"
+ readStatusReportResultsDiv.innerHTML = text;
+
+ // JSON ONLY
+ // for (let i = 0; i < readStatusReportsHtmlData.length; i++)
+ // {
+ // let textDisplay = document.createElement('P');
+ // textDisplay.textContent = JSON.stringify(readStatusReportsHtmlData[i]);
+ // readStatusReportResultsDiv.appendChild(textDisplay);
+ // }
+ }
+ }
+ else
+ {
+ alert(`Return code ${readStatusReportsHtmlData.status} ${readStatusReportsHtmlData.statusText} ${JSON.stringify(readStatusReportsHtmlData)}`);
+ }// end try
+ } catch (readStatusReportsError) {
+ console.log(readStatusReportsError);
+ alert(readStatusReportsError);
+ }
+ }// end else if
+ // Update Status Reports
+ else if (event.target === updateStatusReportButton)
+ {
+ try
+ {
+ var updateStatusReportsData =
+ {
+ status_report:
+ {
+ case_id: updateOutsideAgencyId.value,
+ description: updateDescription.value,
+ details: updateDetails.value,
+ image_url: updateImageUrl.value
+ }
+ }
+ if (!updateStatusReportsData.case_id)
+ {delete updateStatusReportsData.case_id}
+ if (!updateStatusReportsData.description)
+ {delete updateStatusReportsData.description}
+ if (!updateStatusReportsData.details)
+ {delete updateStatusReportsData.details}
+ if (!updateStatusReportsData.image_url)
+ {delete updateStatusReportsData.image_url}
+ const updateStatusReportResponse = await
+ fetch
+ (
+ `${missingPeoplePath}/${updateStatusReportMissingPersonId.value}/status_reports/${updateStatusReportId.value}`,
+ {
+ method: 'PATCH',
+ headers:
+ {
+ 'Content-Type':'application/json',
+ 'authorization':authHeader
+ },
+ body: JSON.stringify(updateStatusReportsData)
+ }
+ )
+ const updateStatusReportsHtmlData =
+ await updateStatusReportResponse.json()
+ if (updateStatusReportResponse.status === 200)
+ {
+ updateStatusReportResultsDiv.innerHTML = ''
+ let textDisplay = document.createElement('P')
+ textDisplay.textContent = JSON.stringify(updateStatusReportsHtmlData)
+ updateStatusReportResultsDiv.appendChild(textDisplay);
+ }
+ else
+ {
+ alert(`Return code ${updateStatusReportResponse.status} ${updateStatusReportResponse.statusText} ${JSON.stringify(updateStatusReportsHtmlData)}`);
+ }
+ }// end try
+ catch (updateStatusReportError)
+ {
+ console.log(updateStatusReportError);
+ alert(updateStatusReportError);
+ }
+ }// end else if
+ // Delete, Status Reports
+ else if (event.target === deleteStatusReportButton)
+ {
+ try
+ {
+ const deleteStatusReportResponse = await
+ fetch
+ (
+ `${missingPeoplePath}/${deleteStatusReportMissingPersonId.value}/status_reports/ ${deleteStatusReportId.value}`,
+ {
+ method: 'DELETE',
+ headers:
+ {
+ 'Content-Type':'application/json',
+ 'authorization':authHeader
+ }
+ })// await fetch
+ const deleteStatusReportData = await
+ deleteStatusReportResponse.json()
+ if (deleteStatusReportResponse.status === 200)
+ {
+ deleteStatusReportResultsDiv.innerHTML = ''
+ let displayText = document.createElement('P')
+ displayText.textContent = JSON.stringify(deleteStatusReportData)
+ deleteStatusReportResultsDiv.appendChild(displayText);
+ }
+ else
+ {
+ alert(`Return code ${deleteStatusReportResponse.status} ${deleteStatusReportResponse.statusText} ${JSON.stringify(deleteStatusReportData)} `);
+ }
+ }// try
+ catch (deleteStatusReportError)
+ {
+ console.log(deleteStatusReportError);
+ alert(deleteStatusReportError);
+ }
+ }// end else if
+ });// crudOperationsDiv
+}// function handle ajax
+document.addEventListener('DOMContentLoaded', handle_status_reports_ajax(event));
+
+// :)
diff --git a/app/javascript/packs/twitter_operations.js b/app/javascript/packs/twitter_operations.js
new file mode 100644
index 0000000..9a66dcd
--- /dev/null
+++ b/app/javascript/packs/twitter_operations.js
@@ -0,0 +1,82 @@
+function handle_twitter_ajax(event)
+{
+ const readMissingPersonResultsDiv = document.getElementById('read_missing_person_results_div');
+ console.log('DOM fully loaded and parsed');
+ // Header
+ const authHeader = localStorage.getItem("authHeader");
+ // Twitter API divs
+ const twitterOperationsDiv = document.getElementById('twitter_operations_div');
+ const twitterResultsDiv = document.getElementById('twitter_results_div');
+ const twitterApiWord = document.getElementById('twitter_api_word');
+ const twitterApiButton = document.getElementById('twitter_api_button');
+ const twitterCreateMissingNameButton = document.getElementById('twitter_create_missing_name_button')
+ const twitterMenu = document.getElementById('twitter_menu');
+ const body = document.getElementById('body');
+ const backend = body.getAttribute('data-backend');
+ // Paths
+ //const missingPeoplePath = 'https://help-find-back.herokuapp.com/api/v1/missing_persons';
+ const missingPeoplePath = backend + "/api/v1/missing_persons";
+ //const twitterPath = 'https://help-find-back.herokuapp.com/api/v1/twitter';
+ const twitterPath = backend + "/api/v1/twitter";
+ // Twitter operations
+ twitterOperationsDiv.addEventListener('click', async (event) =>
+ {
+ if(event.target === twitterApiButton)
+ {
+ fetch(twitterPath,
+ {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'authorization': authHeader
+ }
+ }
+ )
+ .then(
+ function(twitterApiResponseData){
+ return twitterApiResponseData.json();//json.data
+ }
+ )
+ .then(
+ function(twitterApiResponseData)
+ {
+ console.log(twitterApiResponseData);
+ // HTML TABLE
+ var twitterEntry = twitterApiWord.value
+ let text = ""
+ for (let x in twitterApiResponseData.data)
+ if (twitterEntry === 'all')
+
+ //for (let x in twitterApiResponseData.items[x].subjects)
+ //if (twitterApiResponseData.items[x].subjects[s] === 'Kidnappings and Missing Persons' ||
+ //twitterApiResponseData.items[x].subjects[s] === 'ViCAP Missing Persons' )
+
+ {
+ text += "";
+ text += "" +
+ twitterApiResponseData.data[x].id + " ";
+ text += "" +
+ twitterApiResponseData.data[x].text + " ";
+ }
+ else if (twitterEntry === 'id')
+ {
+ text += "";
+ text += "" +
+ twitterApiResponseData.data[x].id + " ";
+ }
+ else if (twitterEntry === 'text')
+ {
+ text += "";
+ text += " ";
+ text += "" +
+ twitterApiResponseData.data[x].text + " ";
+ }
+ text += "
"
+ twitterResultsDiv.innerHTML = text;
+ }
+ )
+ }// end else if
+ });// end twitterOperationsDiv
+}// function handle twitter ajax
+document.addEventListener('DOMContentLoaded', handle_twitter_ajax(event));
+// :)
diff --git a/app/views/ajax/about.html.erb b/app/views/ajax/about.html.erb
index 428cf21..5c2fad5 100644
--- a/app/views/ajax/about.html.erb
+++ b/app/views/ajax/about.html.erb
@@ -1,48 +1,53 @@
-
-About
-
+
+
+
+Awareness
-
-“Finding missing persons is a cooperative effort between police, media, missing person experts and advocates, private investigators and especially the public.”
-
- Lauth Investigations
+
+Information
+
+Teamwork
+“Finding missing persons is a cooperative effort between police, media, missing person experts and advocates, private investigators and especially the public.”
-<%= link_to "Home", "home" %>
-
+
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
+
+Helpful Links
+
+
+<%= link_to "National Center for Missing & Exploited Children", "https://www.missingkids.org/home" %>
-<%= link_to 'Search Newsdata', 'newsdata' %>
+<%= link_to 'California Missing Persons', 'https://oag.ca.gov/missing' %>
+
-<%= link_to 'Missing Files', 'missing_files' %>
+<%= link_to 'National Missing and Unidentified Persons System (NamUs)', 'https://namus.nij.ojp.gov/' %>
-<%= link_to 'Status Reports', 'status_reports' %>
+<%= link_to 'U.S. Department of Justice', 'https://www.justice.gov/actioncenter/report-and-identify-missing-persons#:~:text=ACT%20IMMEDIATELY%20if%20you%20believe,800%2D843%2D5678).' %>
-<%= link_to 'Login/Logoff', 'session' %>
-
+<%= link_to 'International Commission on Missing Persons', 'https://www.icmp.int/' %>
+
+
+
+
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'missing_people_operations' %>
diff --git a/app/views/ajax/create_session.html.erb b/app/views/ajax/create_session.html.erb
new file mode 100644
index 0000000..4c364ab
--- /dev/null
+++ b/app/views/ajax/create_session.html.erb
@@ -0,0 +1,39 @@
+
+
+
+Create User
+
+
+
+
+
User Email
+
+
+
+
User Password
+
+
+
+
+
+
+
Create
+
+
+
+
+
+
+
+
+
+ <%= javascript_pack_tag 'session_operations' %>
diff --git a/app/views/ajax/fbi.html.erb b/app/views/ajax/fbi.html.erb
index fb06121..5c97051 100644
--- a/app/views/ajax/fbi.html.erb
+++ b/app/views/ajax/fbi.html.erb
@@ -1,23 +1,58 @@
-
-FBI Search
-
+FBI Search
-
-
-
Valid Options: all, title, description, details, sex, race, id, hair color, weight, classification, url
-
-
+
Valid Options
+
+
Column Sort: all, title, description, details, sex, race, id, hair color, weight, classification, url
+
+
Enter Row ID To Load Database
+
+
+
+
+
+
Return results
-
-
+
Last Person Entered Into Missing People Database
+
+
+
+ ID
+ Name
+ Sex
+ Race
+ Age
+ Hair Color
+ Weight
+
+
+
+
+
+
+
+
FBI Data returned
+ ID Row
Title
Description
Details
@@ -28,6 +63,7 @@
Weight
URL
Classification
+ Subjects
@@ -35,38 +71,12 @@
-
-
-
-
-
-
-<%= link_to "Home", "home" %>
-
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-<%= link_to 'Missing Files Center', 'missing_files' %>
+
-
-<%= link_to 'Status Reports', 'status_reports' %>
-
+
-<%= link_to 'Login/Logoff', 'session' %>
-
-
-
-<%= link_to 'About', 'about' %>
-
-
-
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'fbi_operations' %>
diff --git a/app/views/ajax/home.html.erb b/app/views/ajax/home.html.erb
index 42b6f62..b7c91de 100644
--- a/app/views/ajax/home.html.erb
+++ b/app/views/ajax/home.html.erb
@@ -1,40 +1,81 @@
-
+
+
Home
+
+
+
+
+
+
+
+
+ Global search
+
+ Explore a variety of recent updates
+
+
+
+
+
+
+ Expert investigators
+
+ Find the right expertise for your case
+
+
+
+
+
+ Active users forum
+
+ Join the knowledge sharing community
+
+
+
+
+
+ Join our volunteers
+
+ Navigating the missing persons process
+
+
+
+
+ Popular sources
+
+
+
+
+
+ Top rated sources
+
+
+
+
+
+ Latest updates
+
+
+
+
+
+
+
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-
-<%= link_to 'Missing People', 'missing_files' %>
-
-
-<%= link_to 'Status Reports', 'status_reports' %>
-
-
-<%= link_to 'Login/Logoff', 'session' %>
-
-
-<%= link_to 'About', 'about' %>
-
-
-
-
-<%= javascript_pack_tag 'ajax_operations' %>
+
+
+
+ CTD Crawfish class Practicum 2022
+<%= javascript_pack_tag 'missing_people_operations' %>
diff --git a/app/views/ajax/logoff_session.html.erb b/app/views/ajax/logoff_session.html.erb
new file mode 100644
index 0000000..212b460
--- /dev/null
+++ b/app/views/ajax/logoff_session.html.erb
@@ -0,0 +1,26 @@
+
+
+
User Logoff
+
+
+
+
+
+
+
+
+ Logoff
+
+
+
+
+
+
+
+
+
+
+
+
+
+<%= javascript_pack_tag 'session_operations' %>
diff --git a/app/views/ajax/logon_session.html.erb b/app/views/ajax/logon_session.html.erb
new file mode 100644
index 0000000..9ec4481
--- /dev/null
+++ b/app/views/ajax/logon_session.html.erb
@@ -0,0 +1,48 @@
+
+
+
+User Logon
+
+
+
+
+
User Email
+
+
+
User Password
+
+
+
+
+
+
+
Logon
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= javascript_pack_tag 'session_operations' %>
\ No newline at end of file
diff --git a/app/views/ajax/missing_create.html.erb b/app/views/ajax/missing_create.html.erb
index 9802636..adb8377 100644
--- a/app/views/ajax/missing_create.html.erb
+++ b/app/views/ajax/missing_create.html.erb
@@ -1,19 +1,18 @@
-
+
Missing People
-
+
- Create A Missing Person Profile
-
+
Create a Missing Person Profile
+
Name
-
Sex
@@ -40,12 +39,14 @@
-
+
Create New
-
+
+
File Created:
+
-
-
-
-
-
-
-
-
- <%= link_to "Home", "home" %>
-
-
+
- <%= link_to 'Search FBI', 'fbi' %>
+ <%= link_to 'See All Files', 'missing_read' %>
-
+
- <%= link_to 'Search Twitter', 'twitter' %>
+ <%= link_to 'Update File', 'missing_update' %>
-
+
- <%= link_to 'Search Newsdata', 'newsdata' %>
+ <%= link_to 'Delete File', 'missing_delete' %>
+
-
- <%= link_to 'Status Reports', 'status_reports' %>
-
+
- <%= link_to 'Login/Logoff', 'session' %>
+
+
- <%= link_to 'About', 'about' %>
+
- <%= javascript_pack_tag 'ajax_operations' %>
+ <%= javascript_pack_tag 'missing_people_operations' %>
diff --git a/app/views/ajax/missing_delete.html.erb b/app/views/ajax/missing_delete.html.erb
index 005f1b0..bd94261 100644
--- a/app/views/ajax/missing_delete.html.erb
+++ b/app/views/ajax/missing_delete.html.erb
@@ -1,10 +1,10 @@
-
+
Missing People
-
+
Delete A Missing Person's Profile
@@ -13,66 +13,47 @@
-
+
Delete Profile
+
-
-
+
+
+
+
+
+
+ <%= link_to 'Create New File', 'missing_create' %>
-
-
-
-
-
+
+ <%= link_to 'See All Files', 'missing_read' %>
-
-
-<%= link_to "Home", "home" %>
+ <%= link_to 'Update File', 'missing_update' %>
+
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-
-<%= link_to 'Status Reports', 'status_reports' %>
-
-<%= link_to 'Login/Logoff', 'session' %>
-
-
-<%= link_to 'About', 'about' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'missing_people_operations' %>
diff --git a/app/views/ajax/missing_files.html.erb b/app/views/ajax/missing_files.html.erb
new file mode 100644
index 0000000..0af27ff
--- /dev/null
+++ b/app/views/ajax/missing_files.html.erb
@@ -0,0 +1,38 @@
+
+Missing People
+
+
+
+
+<%= link_to 'Create New File', 'missing_create' %>
+
+
+
+
+<%= link_to 'See All Files', 'missing_read' %>
+
+
+
+<%= link_to 'Update File', 'missing_update' %>
+
+
+
+<%= link_to 'Delete File', 'missing_delete' %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<%= javascript_pack_tag 'missing_people_operations' %>
diff --git a/app/views/ajax/missing_read.html.erb b/app/views/ajax/missing_read.html.erb
index 7c219a6..1c95276 100644
--- a/app/views/ajax/missing_read.html.erb
+++ b/app/views/ajax/missing_read.html.erb
@@ -1,10 +1,9 @@
-
+
Missing People
-
-
+
@@ -31,7 +30,20 @@
+
+
+
+
+ <%= link_to 'Create New File', 'missing_create' %>
+
+
+ <%= link_to 'Update File', 'missing_update' %>
+
+
+
+ <%= link_to 'Delete File', 'missing_delete' %>
+
@@ -44,31 +56,7 @@
-<%= link_to "Home", "home" %>
-
-
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-
-
-<%= link_to 'Status Reports', 'status_reports' %>
-
-
-
-<%= link_to 'Login/Logoff', 'session' %>
-
-
-<%= link_to 'About', 'about' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'missing_people_operations' %>
diff --git a/app/views/ajax/missing_update.html.erb b/app/views/ajax/missing_update.html.erb
index 20b4215..31f929d 100644
--- a/app/views/ajax/missing_update.html.erb
+++ b/app/views/ajax/missing_update.html.erb
@@ -1,10 +1,10 @@
-
+
Missing People
-
+
@@ -44,12 +44,16 @@
-
+
Update Profile
+
+
+
File Updated:
+
@@ -70,42 +74,32 @@
-
-
-
+
+ <%= link_to 'Create New File', 'missing_create' %>
-
-
-
-
-<%= link_to "Home", "home" %>
-
-
-<%= link_to 'Search FBI', 'fbi' %>
+ <%= link_to 'See All Files', 'missing_read' %>
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
+
-<%= link_to 'Search Newsdata', 'newsdata' %>
+ <%= link_to 'Delete File', 'missing_delete' %>
+
-
+
+
+
-<%= link_to 'Status Reports', 'status_reports' %>
-
+
-<%= link_to 'Login/Logoff', 'session' %>
+
+
+
-
-<%= link_to 'About', 'about' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'missing_people_operations' %>
diff --git a/app/views/ajax/newsdata.html.erb b/app/views/ajax/newsdata.html.erb
index 6eda463..e67dd15 100644
--- a/app/views/ajax/newsdata.html.erb
+++ b/app/views/ajax/newsdata.html.erb
@@ -1,15 +1,22 @@
-
+
Newsdata API Search
-
-
Valid options: all, title, link, description
-
+
+
+ Choose a Search Option :
-
+
+ --Please choose an option--
+ All
+ Title
+ Link
+ Description
+
+
Newsdata Results
@@ -37,21 +44,8 @@
-<%= link_to 'Home', 'home' %>
-
-
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-
-<%= link_to 'Login/Logout', 'session' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'newsdata_operations' %>
diff --git a/app/views/ajax/session.html.erb b/app/views/ajax/session.html.erb
index 60bffbf..057e6a4 100644
--- a/app/views/ajax/session.html.erb
+++ b/app/views/ajax/session.html.erb
@@ -1,62 +1,15 @@
-
Help Find API User Session
-
-
-
-
Create User
-
-
User Email
-
-
-
-
-
User Password
-
-
-
-
-
Create User
-
-
-
-
-
-
-
-
-
User Logon
-
User Email
-
-
-
-
-
User Password
-
-
-
-
-
Log on
-
-
-
-
-
-
-
-
User Logoff
-
Logoff
-
-
-
+
User Session
-
-
-
Status:
-
-
-
+
+<%= link_to 'Create User', 'ajax/create_session' %>
+
+<%= link_to 'Logon', 'ajax/logon_session' %>
+
+<%= link_to 'Logoff', 'ajax/logoff_session' %>
+
@@ -64,37 +17,12 @@
-
-
-<%= link_to 'Home', '/ajax/home' %>
-
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-<%= link_to 'Missing Files', 'missing_read' %>
-
-
-
-<%= link_to 'Status Reports', 'status_reports_read' %>
-
-
-
-<%= link_to 'Login/Logoff', 'session' %>
-
-
-<%= link_to 'About', 'about' %>
diff --git a/app/views/ajax/status_reports_create.html.erb b/app/views/ajax/status_reports_create.html.erb
index f4df6b5..6a51e54 100644
--- a/app/views/ajax/status_reports_create.html.erb
+++ b/app/views/ajax/status_reports_create.html.erb
@@ -1,8 +1,8 @@
-
+
Status Reports
-
+
Create Missing Person Status Report
@@ -60,31 +60,10 @@
-
-
-<%= link_to "Home", "home" %>
-
-
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-
-
-<%= link_to 'Login/Logoff', 'missing_files' %>
-
-
-<%= link_to 'Login/Logoff', 'session' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'status_reports_operations' %>
diff --git a/app/views/ajax/status_reports_delete.html.erb b/app/views/ajax/status_reports_delete.html.erb
index dd2d146..6ab8b50 100644
--- a/app/views/ajax/status_reports_delete.html.erb
+++ b/app/views/ajax/status_reports_delete.html.erb
@@ -1,8 +1,6 @@
Status Reports
-
-
-
+
Delete A Missing Persons' Status Report
@@ -45,26 +43,6 @@
-<%= link_to "Home", "home" %>
-
-
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-
-
-<%= link_to 'Login/Logoff', 'missing_files' %>
-
-
-<%= link_to 'Login/Logoff', 'session' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'status_reports_operations' %>
diff --git a/app/views/ajax/status_reports_read.html.erb b/app/views/ajax/status_reports_read.html.erb
index dcf55b5..c7731d3 100644
--- a/app/views/ajax/status_reports_read.html.erb
+++ b/app/views/ajax/status_reports_read.html.erb
@@ -1,63 +1,47 @@
-
+
Status Reports
-
+
-
-
Display Missing Person Status Reports
+
+
Display Missing Person Status Reports
-
Missing Person ID
-
+
Missing Person ID
+
-
+
+
-
Display All
+
Display All
-
+
-
-
-
-
- ID
- Name
- Sex
- Race
- Age
- Hair Color
- Weight
-
-
-
-
-
-
+
+
+
+
+ Status Report ID
+ Missing Person ID
+ Description
+ Details
+ Agency Reference ID
+ URL
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-<%= link_to "Home", "home" %>
-
-
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-
-<%= link_to 'Login/Logoff', 'session' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'status_reports_operations' %>
diff --git a/app/views/ajax/status_reports_update.html.erb b/app/views/ajax/status_reports_update.html.erb
index fbb1612..8e38431 100644
--- a/app/views/ajax/status_reports_update.html.erb
+++ b/app/views/ajax/status_reports_update.html.erb
@@ -1,8 +1,8 @@
-
+
Status Reports
-
+
@@ -68,26 +68,7 @@
-<%= link_to "Home", "home" %>
-
-
-
-<%= link_to 'Search FBI', 'fbi' %>
-
-
-
-<%= link_to 'Search Twitter', 'twitter' %>
-
-
-<%= link_to 'Search Newsdata', 'newsdata' %>
-
-
-
-<%= link_to 'Login/Logoff', 'missing_files' %>
-
-
-<%= link_to 'Login/Logoff', 'session' %>
-<%= javascript_pack_tag 'ajax_operations' %>
+<%= javascript_pack_tag 'status_reports_operations' %>
diff --git a/app/views/ajax/twitter.html.erb b/app/views/ajax/twitter.html.erb
index b00da5b..273a5b6 100644
--- a/app/views/ajax/twitter.html.erb
+++ b/app/views/ajax/twitter.html.erb
@@ -1,15 +1,22 @@
+
-
Twitter API Search
+
Twitter Search
-
+