Skip to content

Commit

Permalink
feat(copy-to-mine) - add copyToMine in existing public bookmark dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
adixchen committed Aug 30, 2024
1 parent 8e36e53 commit 7795d97
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ apps/codever-keycloak-theme/keycloak-original-themes/*
documentation/keycloak-upgrade/*
/documentation/keycloak-upgrade/
/apps/codever-ui/cypress/dist/videos/
/documentation/docker-migration/
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ <h2 mat-dialog-title>Bookmark already public</h2>
<hr />

<mat-dialog-actions class="app-dialog-actions">
<button
type="button"
class="btn btn-primary btn-sm mr-2"
(click)="copyToMine()"
>
<i class="far fa-copy"></i> Copy to mine
</button>
<button
type="button"
class="btn btn-primary btn-sm mr-2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Bookmark } from '../../../core/model/bookmark';
import { Router } from '@angular/router';

@Component({
selector: 'app-delete-bookmarks-by-tag-dialog',
selector: 'app-public-bookmark-present-dialog',
templateUrl: './public-bookmark-present-dialog.component.html',
styleUrls: ['./public-bookmark-present-dialog.component.scss'],
})
export class PublicBookmarkPresentDialogComponent {
bookmark: Bookmark;

constructor(
private router: Router,
private dialogRef: MatDialogRef<PublicBookmarkPresentDialogComponent>,
@Inject(MAT_DIALOG_DATA) data
) {
this.bookmark = data.bookmark;
}
copyToMine() {
this.dialogRef.close('COPY_TO_MINE');
const link = [`./my-bookmarks/${this.bookmark._id}/copy-to-mine`];
this.router.navigate(link, {
state: { bookmark: this.bookmark },
queryParams: { hidePublicCheckbox: true },
});
}

likeBookmark() {
this.dialogRef.close('LIKE_BOOKMARK');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
>
<div class="form-group">
<label for="location" class="space-btw-wrapper"
><span>Location*</span>
><span>Location*</span>
<span><i class="fas fa-lg fa-bookmark"></i></span
></label>
></label>
<div class="input-group">
<input
type="text"
Expand All @@ -29,7 +29,7 @@
href="{{ bookmarkForm.get('location').value }}"
target="_blank"
title="Jump to location"
><i class="fas fa-external-link-alt"></i
><i class="fas fa-external-link-alt"></i
></a>
</div>
</div>
Expand Down Expand Up @@ -74,7 +74,11 @@
Name is required
</div>
</div>
<div class="form-check" style="margin-bottom: 1.5rem; margin-top: 0.8rem">
<div
*ngIf="!(hidePublicCheckbox === true)"
class="form-check"
style="margin-bottom: 1.5rem; margin-top: 0.8rem"
>
<label class="form-check-label">
<input
#publicBookmark
Expand All @@ -97,7 +101,7 @@
<a
href="https://github.com/CodeverDotDev/bookmarks/blob/master/tags/public-tags-simple.json"
target="_blank"
>recommended tags</a
>recommended tags</a
>
(<em>spam will not be tolerated</em>)
</label>
Expand Down Expand Up @@ -178,7 +182,7 @@
</div>
<div class="form-group form-group-distanced">
<label for="sourceCodeURL"
>Source code URL <i class="fab fa-github"></i
>Source code URL <i class="fab fa-github"></i
></label>
<input
type="url"
Expand All @@ -190,12 +194,12 @@
</div>
<div class="form-group">
<label for="description" style="width: 100%"
>Description - <i class="fab fa-markdown"></i>
>Description - <i class="fab fa-markdown"></i>
<a
class="markdown-link"
href="https://daringfireball.net/projects/markdown/"
target="_blank"
>Markdown is supported</a
>Markdown is supported</a
></label
>
<textarea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class SaveBookmarkFormComponent implements OnInit {

bookmark: Bookmark;

hidePublicCheckbox = false;
constructor(
private publicBookmarkPresentDialog: MatDialog,
private formBuilder: UntypedFormBuilder,
Expand Down Expand Up @@ -192,6 +193,9 @@ export class SaveBookmarkFormComponent implements OnInit {
this.tags.markAsDirty();
});
}

this.hidePublicCheckbox =
this.route.snapshot.queryParams.hidePublicCheckbox;
}

buildForm(): void {
Expand All @@ -218,7 +222,8 @@ export class SaveBookmarkFormComponent implements OnInit {
}

private onChanges() {
const isNewBookmark = !this.isUpdate && !this.copyToMine && !this.cloneBookmark
const isNewBookmark =
!this.isUpdate && !this.copyToMine && !this.cloneBookmark;
if (isNewBookmark) {
this.bookmarkForm
.get('location')
Expand Down Expand Up @@ -657,7 +662,11 @@ export class SaveBookmarkFormComponent implements OnInit {
}

cancelUpdate() {
this._location.back();
console.log('goBAck()...');
if (this.popup) {
window.close();
} else {
this._location.back();
console.log('goBAck()...');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-delete-bookmarks-by-tag-dialog',
selector: 'app-delete-saved-search-dialog',
templateUrl: './delete-saved-search-dialog.component.html',
styleUrls: ['./delete-saved-search-dialog.component.scss'],
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Codever",
"version": "10.0.1",
"version": "10.1.0",
"description": "Codever - bookmarks, snippets and notes manager for developers & co",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down

0 comments on commit 7795d97

Please sign in to comment.