Skip to content

Commit

Permalink
Merge pull request #363 from NFDI4Chem/various-bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
NishaSharma14 authored Aug 21, 2022
2 parents 9c8d59b + 04b76f2 commit 0f09b62
Show file tree
Hide file tree
Showing 13 changed files with 418 additions and 489 deletions.
2 changes: 1 addition & 1 deletion app/Actions/Project/DeleteProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class DeleteProject
*/
public function delete($project)
{
$project->delete();
// $project->delete();
}
}
2 changes: 1 addition & 1 deletion app/Actions/Study/UpdateStudy.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function update(Study $study, array $input)
])->save();

if (array_key_exists('tags_array', $input)) {
$study->syncTagsWithType($input['tags_array'], 'Study');
$study->syncTagsWithType(array_filter($input['tags_array']), 'Study');
}
});
}
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ public function settings(Request $request, Project $project)
}

return Inertia::render('Project/Settings', [
'project' => $project,
'studies' => $project->studies,
'project' => $project
]);
}

Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/StudyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ public function moleculeStore(Request $request, Study $study)
$molecule = Molecule::firstOrCreate([
'STANDARD_INCHI' => $inchi,
], [
'FORMULA' => $request->get('formula'),
'INCHI_KEY' => $request->get('InChIKey'),
'MOL' => $request->get('mol'),
'FORMULA' => $request->get('formula') ? $request->get('formula') : '',
'INCHI_KEY' => $request->get('InChIKey') ? $request->get('InChIKey') : '',
'MOL' => $request->get('mol') ? $request->get('mol') : '',
]);
$sample->molecules()->syncWithPivotValues([$molecule->id], ['percentage_composition' => $request->get('percentage')], false);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Resources/DatasetResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function toArray($request)
'slug' => $this->slug,
'description' => $this->description,
'type' => $this->type,
'project' => $this->project->slug,
'study' => $this->study->slug,
'project' => $this->project ? $this->project->slug : '',
'study' => $this->study ? $this->study->slug : '',
'owner' => new UserResource($this->owner),
'dataset_photo_url' => $this->dataset_photo_url,
'is_public' => $this->is_public,
Expand Down
7 changes: 2 additions & 5 deletions app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ class Project extends Model implements Auditable
];

protected static $marks = [
Like::class,
Bookmark::class,
Reaction::class,
Favorite::class,
Like::class
];

/**
Expand Down Expand Up @@ -209,7 +206,7 @@ public function projectInvitations()
}

/**
* Remove the given user from the team.
* Remove the given user from the project.
*
* @param \App\Models\User $user
* @return void
Expand Down
11 changes: 11 additions & 0 deletions app/Models/Study.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ public function molecules()
return $this->sample()->molecules();
}

/**
* Remove the given user from the study.
*
* @param \App\Models\User $user
* @return void
*/
public function removeUser($user)
{
$this->users()->detach($user);
}

/**
* Determine if the model should be searchable.
*
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Public/Project/Files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</span>
</div>
<p
class="mt-2 px-2 py-1 block text-sm font-medium text-gray-900 pointer-events-none"
class="mt-2 px-2 py-1 block truncate text-sm font-medium text-gray-900 pointer-events-none"
>
{{ file.name }}
</p>
Expand Down
8 changes: 5 additions & 3 deletions resources/js/Pages/Public/Project/License.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
class="grid grid-cols-1 gap-y-6 sm:grid-cols-6 sm:gap-x-6"
>
<div class="sm:col-span-6">
<p class="mt-1 text-md text-blue-gray-500">
{{ project.data.license.description }}
</p>
<p
style="max-width: 100ch !important"
class="prose mt-1 text-sm text-blue-gray-500"
v-html="project.data.license.description"
></p>
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions resources/js/Pages/Public/Project/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<div
class="grid grid-cols-1 gap-y-6 sm:grid-cols-6 sm:gap-x-6"
>
<div class="sm:col-span-6">
<div class="col-span-6">
<p
style="max-width: 100ch !important"
class="prose mt-1 text-sm text-blue-gray-500"
v-html="md(project.data.description)"
></p>
</div>
<div>
<div class="sm:col-span-12">
<a
v-for="tag in project.data.tags"
:key="tag.id"
Expand All @@ -32,15 +32,15 @@

<div class="pt-8 gap-y-6 sm:grid-cols-6 sm:gap-x-6">
<div class="sm:col-span-6">
<h2 class="text-xl font-medium text-blue-gray-900">
<h2 class="text-xl font-extrabold mb-3 text-blue-gray-900">
Submitter(s)
</h2>
</div>
<div class="mt-1 grid grid-cols-1 gap-4 sm:grid-cols-2">
<div
v-for="user in project.data.users"
:key="user.email"
class="relative rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm flex items-center space-x-3 hover:border-gray-400 focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-pink-500"
class="relative rounded-lg border border-gray-300 bg-white p-5 shadow-sm flex items-center space-x-3 hover:border-gray-400 focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-pink-500"
>
<div class="flex-shrink-0">
<img
Expand Down Expand Up @@ -78,7 +78,7 @@
class="pt-8 gap-y-6 sm:grid-cols-6 sm:gap-x-6"
>
<div class="sm:col-span-6">
<h2 class="text-xl font-medium text-blue-gray-900">
<h2 class="text-xl font-extrabold mb-3 text-blue-gray-900">
Author(s)
</h2>
<!-- <p class="mt-1 text-sm text-blue-gray-500">
Expand Down
6 changes: 3 additions & 3 deletions resources/js/Pages/Public/Project/Studies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
>
<div class="gap-y-6 sm:grid-cols-6 sm:gap-x-6">
<div class="sm:col-span-6">
<h2 class="text-xl font-medium text-blue-gray-900">
<h2 class="text-xl font-extrabold text-blue-gray-900">
Studies ({{ project.data.studies.length }})
</h2>
<p class="mt-1 text-sm text-blue-gray-500 mb-4">
<!-- <p class="mt-1 text-sm text-blue-gray-500 mb-4">
This information will be displayed publicly so be
careful what you share.
</p>
</p> -->
</div>
<div class="mt-1 grid grid-cols-1 gap-4 sm:grid-cols-2">
<div
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Study/Datasets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
></div>
</div>
<!-- <p
class="mt-2 block text-sm font-medium text-gray-900 truncate pointer-events-none"
class="mt-2 block text-sm font-medium truncate text-gray-900 truncate pointer-events-none"
>
{{ file.title }}
</p>
Expand Down
Loading

0 comments on commit 0f09b62

Please sign in to comment.