We found some publications available for import from Academics Analytics. Click here to review your publications, check the entries that you would like to import, then click on the "Import" button.
+
+
+
+
+
+
+
+
+
Academics Analytics Publications
+
+
+
+ @foreach ($publications as $publication)
+
+
{{ $publication->data['year'] }}
+
{{ $publication->data['title'] }}
+
+ @endforeach
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/profiles/edit/layout.blade.php b/resources/views/profiles/edit/layout.blade.php
index 0c971312..1ce2f041 100644
--- a/resources/views/profiles/edit/layout.blade.php
+++ b/resources/views/profiles/edit/layout.blade.php
@@ -1,6 +1,8 @@
From 23f9482fed8e144dbfd26c46366faadc4ba7abfd Mon Sep 17 00:00:00 2001
From: Betsy Castro <5490820+betsyecastro@users.noreply.github.com>
Date: Thu, 6 Oct 2022 13:53:57 -0500
Subject: [PATCH 02/46] Renders academics analytics publications in a modal
through a livewire component when a button is clicked
---
app/Http/Controllers/ProfilesController.php | 8 +----
.../AcademicsAnalyticsPublications.php | 31 ++++++++++++++++++
app/Profile.php | 16 +++-------
...academics-analytics-publications.blade.php | 20 ++++++++++++
...ics_analytics_publications_modal.blade.php | 32 +++++++++++++++++++
.../profiles/edit/_autosort_info.blade.php | 7 ++++
..._import_academics_analytics_data.blade.php | 29 -----------------
.../views/profiles/edit/layout.blade.php | 3 +-
.../profiles/edit/publications.blade.php | 4 +--
9 files changed, 99 insertions(+), 51 deletions(-)
create mode 100644 app/Http/Livewire/AcademicsAnalyticsPublications.php
create mode 100644 resources/views/livewire/academics-analytics-publications.blade.php
create mode 100644 resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
delete mode 100644 resources/views/profiles/edit/_import_academics_analytics_data.blade.php
diff --git a/app/Http/Controllers/ProfilesController.php b/app/Http/Controllers/ProfilesController.php
index 93a89aba..56d30e70 100644
--- a/app/Http/Controllers/ProfilesController.php
+++ b/app/Http/Controllers/ProfilesController.php
@@ -237,12 +237,6 @@ public function edit(Profile $profile, $section)
->route('profiles.show', $profile->slug)
->with('flash_message', 'Publications updated via ORCID.');
}
-
- $publications = Cache::get('profile_publications', $profile->updateAcademicsAnalytics());
-
- //Cache::tags(['profile_publications'])->add('profile_publications', $profile->updateAcademicsAnalytics(), 86400);
-
-
$data = $profile->data()->$section()->get();
// if no data, include one item to use as a template
@@ -253,7 +247,7 @@ public function edit(Profile $profile, $section)
$data->push($record);
}
- return view('profiles.edit', compact('profile', 'section', 'data', 'publications'));
+ return view('profiles.edit', compact('profile', 'section', 'data'));
}
/**
diff --git a/app/Http/Livewire/AcademicsAnalyticsPublications.php b/app/Http/Livewire/AcademicsAnalyticsPublications.php
new file mode 100644
index 00000000..1066303e
--- /dev/null
+++ b/app/Http/Livewire/AcademicsAnalyticsPublications.php
@@ -0,0 +1,31 @@
+ 'loadPublications()'];
+
+ public function mount()
+ {
+ //$this->modal_visible = true;
+ $this->publications = $this->profile->getAcademicsAnalyticsPublications();
+ }
+
+ public function render()
+ {
+ // dd($this->profile, $this->publications);
+ return view('livewire.academics-analytics-publications', [
+ 'profile' => $this->profile,
+ //'modal_visible' => $this->modal_visible,
+ 'publications' => $this->publications,
+ ]);
+ }
+}
diff --git a/app/Profile.php b/app/Profile.php
index 5e8d8c73..025eac7b 100644
--- a/app/Profile.php
+++ b/app/Profile.php
@@ -236,7 +236,7 @@ public function hasAcademicsAnalyticsManagedPublications()
return $this->information()->where('data->academics_analytics_managed', '1')->exists();
}
- public function updateAcademicsAnalytics()
+ public function getAcademicsAnalyticsPublications()
{
$academics_analytics_id = $this->information()->get(array('data'))->toArray()[0]['data']['academics_analytics_id'];
@@ -264,7 +264,7 @@ public function updateAcademicsAnalytics()
$datum = json_decode($res->getBody()->getContents(), true);
$current_publications_dois = $this->publications->pluck('data.doi')->filter()->values();
- $datum = collect($datum)->whereNotIn('DOI', $current_publications_dois);
+ $datum = collect($datum )->whereNotIn('DOI', $current_publications_dois);
$publications = collect();
foreach($datum as $key => $record){
@@ -278,11 +278,10 @@ public function updateAcademicsAnalytics()
$record = ProfileData::firstOrNew([
'profile_id' => $this->id,
- 'type' => 'publications',
- 'data->doi' => $doi,
'sort_order' => $record['ArticleYear'] ?? null,
], [
'data' => [
+ 'doi' => $doi,
'url' => $url,
'title' => $record['ArticleTitle'],
'doi' => $record['DOI'],
@@ -291,15 +290,10 @@ public function updateAcademicsAnalytics()
'status' => 'Published'
],
]);
-
+ $record->id = strval(rand(-100000, -1));
$publications->push($record);
}
-
- Cache::put('profile_publications', $publications, now()->addMinutes(40));
-
- Cache::tags(['profile_data'])->flush();
- //¸¸ran through process successfully
- return $publications;
+ return $publications;
}
public function updateDatum($section, $request)
diff --git a/resources/views/livewire/academics-analytics-publications.blade.php b/resources/views/livewire/academics-analytics-publications.blade.php
new file mode 100644
index 00000000..a0604258
--- /dev/null
+++ b/resources/views/livewire/academics-analytics-publications.blade.php
@@ -0,0 +1,20 @@
+
+ @foreach ($publications as $pub)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ $pub['data']['year'] }}
+
{{ $pub['data']['title'] }}
+
+ @endforeach
+
\ No newline at end of file
diff --git a/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php b/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
new file mode 100644
index 00000000..28c90ea1
--- /dev/null
+++ b/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
Academics Analytics Publications
+
+
+
+
+
+
+
Import
+
Year
+
Title
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/views/profiles/edit/_autosort_info.blade.php b/resources/views/profiles/edit/_autosort_info.blade.php
index 0233fba3..2f1276ce 100644
--- a/resources/views/profiles/edit/_autosort_info.blade.php
+++ b/resources/views/profiles/edit/_autosort_info.blade.php
@@ -9,5 +9,12 @@
To manually sort all entries, leave
the Year field empty (and include it as a part of @if(isset($suggestion)) {{ $suggestion }} @else another field @endisset instead).
+
+ To review your publications available for import from external sources use the buttons:
+
+
+
We found some publications available for import from Academics Analytics. Click here to review your publications, check the entries that you would like to import, then click on the "Import" button.
-
-
-
-
-
-
-
-
-
Academics Analytics Publications
-
-
-
- @foreach ($publications as $publication)
-
-
{{ $publication->data['year'] }}
-
{{ $publication->data['title'] }}
-
- @endforeach
-
-
-
-
-
-
\ No newline at end of file
diff --git a/resources/views/profiles/edit/layout.blade.php b/resources/views/profiles/edit/layout.blade.php
index 1ce2f041..4a370504 100644
--- a/resources/views/profiles/edit/layout.blade.php
+++ b/resources/views/profiles/edit/layout.blade.php
@@ -1,9 +1,8 @@
- @endforeach
-
\ No newline at end of file
+
+ @foreach ($publications as $pub)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ $pub['data']['year'] }}
+
{{ $pub['data']['title'] }}
+
+ @endforeach
+
+
+
+
+ {{ $publications->links() }}
+
+
\ No newline at end of file
diff --git a/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php b/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
index 28c90ea1..e88eb6a1 100644
--- a/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
+++ b/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
@@ -7,20 +7,11 @@
Academics Analytics Publications
-
-
-
-
-
-
Import
-
Year
-
Title
-
-
-
-
-
-
+
+
+
+
+
+
+
+ @endif
\ No newline at end of file
diff --git a/resources/views/livewire/show-modal.blade.php b/resources/views/livewire/show-modal.blade.php
new file mode 100644
index 00000000..f38251f0
--- /dev/null
+++ b/resources/views/livewire/show-modal.blade.php
@@ -0,0 +1,56 @@
+
\ No newline at end of file
diff --git a/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php b/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
index e88eb6a1..dc73b08f 100644
--- a/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
+++ b/resources/views/profiles/edit/_academics_analytics_publications_modal.blade.php
@@ -8,10 +8,8 @@