Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
817
Issues
817
List
Boards
Labels
Service Desk
Milestones
Merge Requests
69
Merge Requests
69
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
a2859ce2
Commit
a2859ce2
authored
2 hours ago
by
Ben Hayward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added confirmation of leave on blog editing
parent
831c5249
feat/confirm-leave-dialog-blogs-349
1 merge request
!398
[Spring/HipsterHedgehog](feat) Discard changes when creating and editing blogs #349
Pipeline
#69007693
failed with stages
in 8 minutes and 11 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
confirm-leave-dialog.service.ts
src/app/common/services/confirm-leave-dialog.service.ts
+2
-3
blog.module.ts
src/app/modules/blogs/blog.module.ts
+2
-1
edit.ts
src/app/modules/blogs/edit/edit.ts
+13
-2
No files found.
src/app/common/services/confirm-leave-dialog.service.ts
View file @
a2859ce2
...
...
@@ -17,8 +17,7 @@ export class DialogService {
* Returns observable resolving to `true`=confirm or `false`=cancel
*/
confirm
(
message
?:
string
):
Observable
<
boolean
>
{
const
confirmation
=
window
.
confirm
(
message
||
'
Is it OK?
'
);
return
of
(
confirmation
);
const
confirmation
=
window
.
confirm
(
message
||
'
Is it OK?
'
);
return
of
(
confirmation
);
};
}
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/blog.module.ts
View file @
a2859ce2
...
...
@@ -17,11 +17,12 @@ import { BlogTileComponent } from './tile/tile.component';
import
{
WireModule
}
from
'
../wire/wire.module
'
;
import
{
CommentsModule
}
from
'
../comments/comments.module
'
;
import
{
HashtagsModule
}
from
'
../hashtags/hashtags.module
'
;
import
{
CanDeactivateGuardService
}
from
'
../../services/can-deactivate-guard
'
;
const
routes
:
Routes
=
[
{
path
:
'
blog/view/:guid/:title
'
,
component
:
BlogViewInfinite
},
{
path
:
'
blog/view/:guid
'
,
component
:
BlogViewInfinite
},
{
path
:
'
blog/edit/:guid
'
,
component
:
BlogEdit
},
{
path
:
'
blog/edit/:guid
'
,
component
:
BlogEdit
,
canDeactivate
:
[
CanDeactivateGuardService
]
},
{
path
:
'
blog/:filter
'
,
component
:
BlogListComponent
},
{
path
:
'
blog
'
,
redirectTo
:
'
/blog/top
'
,
pathMatch
:
'
full
'
},
{
path
:
'
:username/blog/:slugid
'
,
component
:
BlogViewInfinite
},
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/edit/edit.ts
View file @
a2859ce2
import
{
Component
,
ViewChild
}
from
'
@angular/core
'
;
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
Subscription
}
from
'
rxjs
'
;
import
{
Subscription
,
Observable
}
from
'
rxjs
'
;
import
{
MindsTitle
}
from
'
../../../services/ux/title
'
;
import
{
ACCESS
,
LICENSES
}
from
'
../../../services/list-options
'
;
...
...
@@ -12,6 +12,7 @@ import { WireThresholdInputComponent } from '../../wire/threshold-input/threshol
import
{
HashtagsSelectorComponent
}
from
'
../../hashtags/selector/selector.component
'
;
import
{
Tag
}
from
'
../../hashtags/types/tag
'
;
import
{
InMemoryStorageService
}
from
"
../../../services/in-memory-storage.service
"
;
import
{
DialogService
}
from
"
../../../common/services/confirm-leave-dialog.service
"
;
@
Component
({
moduleId
:
module
.
id
,
...
...
@@ -74,7 +75,8 @@ export class BlogEdit {
public
router
:
Router
,
public
route
:
ActivatedRoute
,
public
title
:
MindsTitle
,
protected
inMemoryStorageService
:
InMemoryStorageService
protected
inMemoryStorageService
:
InMemoryStorageService
,
private
dialogService
:
DialogService
,
)
{
this
.
getCategories
();
...
...
@@ -148,6 +150,14 @@ export class BlogEdit {
});
}
canDeactivate
():
Observable
<
boolean
>
|
boolean
{
if
(
!
this
.
editing
)
{
return
true
;
}
return
this
.
dialogService
.
confirm
(
'
Discard changes?
'
);
}
ngOnDestroy
()
{
if
(
this
.
paramsSubscription
)
{
this
.
paramsSubscription
.
unsubscribe
();
...
...
@@ -232,6 +242,7 @@ export class BlogEdit {
blog
.
mature
=
blog
.
mature
?
1
:
0
;
blog
.
monetization
=
blog
.
monetization
?
1
:
0
;
blog
.
monetized
=
blog
.
monetized
?
1
:
0
;
this
.
editing
=
false
;
this
.
inProgress
=
true
;
this
.
canSave
=
false
;
this
.
check_for_banner
().
then
(()
=>
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment