Skip to content

Commit 7795d97

Browse files
committed
feat(copy-to-mine) - add copyToMine in existing public bookmark dialog
1 parent 8e36e53 commit 7795d97

File tree

7 files changed

+45
-14
lines changed

7 files changed

+45
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ apps/codever-keycloak-theme/keycloak-original-themes/*
66
documentation/keycloak-upgrade/*
77
/documentation/keycloak-upgrade/
88
/apps/codever-ui/cypress/dist/videos/
9+
/documentation/docker-migration/

apps/codever-ui/src/app/my-bookmarks/save-bookmark-form/public-bookmark-present-dialog/public-bookmark-present-dialog.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ <h2 mat-dialog-title>Bookmark already public</h2>
1212
<hr />
1313

1414
<mat-dialog-actions class="app-dialog-actions">
15+
<button
16+
type="button"
17+
class="btn btn-primary btn-sm mr-2"
18+
(click)="copyToMine()"
19+
>
20+
<i class="far fa-copy"></i> Copy to mine
21+
</button>
1522
<button
1623
type="button"
1724
class="btn btn-primary btn-sm mr-2"

apps/codever-ui/src/app/my-bookmarks/save-bookmark-form/public-bookmark-present-dialog/public-bookmark-present-dialog.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
import { Component, Inject } from '@angular/core';
22
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
33
import { Bookmark } from '../../../core/model/bookmark';
4+
import { Router } from '@angular/router';
45

56
@Component({
6-
selector: 'app-delete-bookmarks-by-tag-dialog',
7+
selector: 'app-public-bookmark-present-dialog',
78
templateUrl: './public-bookmark-present-dialog.component.html',
89
styleUrls: ['./public-bookmark-present-dialog.component.scss'],
910
})
1011
export class PublicBookmarkPresentDialogComponent {
1112
bookmark: Bookmark;
1213

1314
constructor(
15+
private router: Router,
1416
private dialogRef: MatDialogRef<PublicBookmarkPresentDialogComponent>,
1517
@Inject(MAT_DIALOG_DATA) data
1618
) {
1719
this.bookmark = data.bookmark;
1820
}
21+
copyToMine() {
22+
this.dialogRef.close('COPY_TO_MINE');
23+
const link = [`./my-bookmarks/${this.bookmark._id}/copy-to-mine`];
24+
this.router.navigate(link, {
25+
state: { bookmark: this.bookmark },
26+
queryParams: { hidePublicCheckbox: true },
27+
});
28+
}
1929

2030
likeBookmark() {
2131
this.dialogRef.close('LIKE_BOOKMARK');

apps/codever-ui/src/app/my-bookmarks/save-bookmark-form/save-bookmark-form.component.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
>
1111
<div class="form-group">
1212
<label for="location" class="space-btw-wrapper"
13-
><span>Location*</span>
13+
><span>Location*</span>
1414
<span><i class="fas fa-lg fa-bookmark"></i></span
15-
></label>
15+
></label>
1616
<div class="input-group">
1717
<input
1818
type="text"
@@ -29,7 +29,7 @@
2929
href="{{ bookmarkForm.get('location').value }}"
3030
target="_blank"
3131
title="Jump to location"
32-
><i class="fas fa-external-link-alt"></i
32+
><i class="fas fa-external-link-alt"></i
3333
></a>
3434
</div>
3535
</div>
@@ -74,7 +74,11 @@
7474
Name is required
7575
</div>
7676
</div>
77-
<div class="form-check" style="margin-bottom: 1.5rem; margin-top: 0.8rem">
77+
<div
78+
*ngIf="!(hidePublicCheckbox === true)"
79+
class="form-check"
80+
style="margin-bottom: 1.5rem; margin-top: 0.8rem"
81+
>
7882
<label class="form-check-label">
7983
<input
8084
#publicBookmark
@@ -97,7 +101,7 @@
97101
<a
98102
href="https://github.com/CodeverDotDev/bookmarks/blob/master/tags/public-tags-simple.json"
99103
target="_blank"
100-
>recommended tags</a
104+
>recommended tags</a
101105
>
102106
(<em>spam will not be tolerated</em>)
103107
</label>
@@ -178,7 +182,7 @@
178182
</div>
179183
<div class="form-group form-group-distanced">
180184
<label for="sourceCodeURL"
181-
>Source code URL <i class="fab fa-github"></i
185+
>Source code URL <i class="fab fa-github"></i
182186
></label>
183187
<input
184188
type="url"
@@ -190,12 +194,12 @@
190194
</div>
191195
<div class="form-group">
192196
<label for="description" style="width: 100%"
193-
>Description - <i class="fab fa-markdown"></i>
197+
>Description - <i class="fab fa-markdown"></i>
194198
<a
195199
class="markdown-link"
196200
href="https://daringfireball.net/projects/markdown/"
197201
target="_blank"
198-
>Markdown is supported</a
202+
>Markdown is supported</a
199203
></label
200204
>
201205
<textarea

apps/codever-ui/src/app/my-bookmarks/save-bookmark-form/save-bookmark-form.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export class SaveBookmarkFormComponent implements OnInit {
113113

114114
bookmark: Bookmark;
115115

116+
hidePublicCheckbox = false;
116117
constructor(
117118
private publicBookmarkPresentDialog: MatDialog,
118119
private formBuilder: UntypedFormBuilder,
@@ -192,6 +193,9 @@ export class SaveBookmarkFormComponent implements OnInit {
192193
this.tags.markAsDirty();
193194
});
194195
}
196+
197+
this.hidePublicCheckbox =
198+
this.route.snapshot.queryParams.hidePublicCheckbox;
195199
}
196200

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

220224
private onChanges() {
221-
const isNewBookmark = !this.isUpdate && !this.copyToMine && !this.cloneBookmark
225+
const isNewBookmark =
226+
!this.isUpdate && !this.copyToMine && !this.cloneBookmark;
222227
if (isNewBookmark) {
223228
this.bookmarkForm
224229
.get('location')
@@ -657,7 +662,11 @@ export class SaveBookmarkFormComponent implements OnInit {
657662
}
658663

659664
cancelUpdate() {
660-
this._location.back();
661-
console.log('goBAck()...');
665+
if (this.popup) {
666+
window.close();
667+
} else {
668+
this._location.back();
669+
console.log('goBAck()...');
670+
}
662671
}
663672
}

apps/codever-ui/src/app/user/user-dashboard/my-searches/delete-saved-search-dialog/delete-saved-search-dialog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component, Inject } from '@angular/core';
22
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
33

44
@Component({
5-
selector: 'app-delete-bookmarks-by-tag-dialog',
5+
selector: 'app-delete-saved-search-dialog',
66
templateUrl: './delete-saved-search-dialog.component.html',
77
styleUrls: ['./delete-saved-search-dialog.component.scss'],
88
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Codever",
3-
"version": "10.0.1",
3+
"version": "10.1.0",
44
"description": "Codever - bookmarks, snippets and notes manager for developers & co",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",

0 commit comments

Comments
 (0)