Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
910d2b37
Commit
910d2b37
authored
6 years ago
by
Paul Kaplan
Browse files
Options
Downloads
Patches
Plain Diff
Make the requiredProjectId work with the online editor
parent
9c736fa8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/containers/tips-library.jsx
+14
-9
14 additions, 9 deletions
src/containers/tips-library.jsx
with
14 additions
and
9 deletions
src/containers/tips-library.jsx
+
14
−
9
View file @
910d2b37
...
...
@@ -35,6 +35,12 @@ class TipsLibrary extends React.PureComponent {
]);
}
handleItemSelect
(
item
)
{
analytics
.
event
({
category
:
'
library
'
,
action
:
'
Select How-to
'
,
label
:
item
.
id
});
/*
Support tutorials that require specific starter projects.
If a tutorial declares "requiredProjectId", check that the URL contains
...
...
@@ -42,18 +48,15 @@ class TipsLibrary extends React.PureComponent {
TODO remove this at first opportunity. If this is still here after HOC2018,
blame Eric R. Andrew is also on record saying "this is temporary".
UPDATE well now Paul is wrapped into this as well. Sigh...
eventually we will find a solution that doesn't involve loading a whole project
*/
if
(
item
.
requiredProjectId
&&
window
.
location
.
href
.
indexOf
(
item
.
requiredProjectId
)
===
-
1
)
{
const
urlParams
=
`
?tutorial=
${
item
.
urlId
}
#
${
item
.
requiredProject
Id
}
`
;
return
window
.
open
(
window
.
location
.
pathname
+
urlParams
,
'
_blank
'
);
if
(
item
.
requiredProjectId
&&
(
item
.
requiredProjectId
!==
this
.
props
.
projectId
)
)
{
const
urlParams
=
`
/projects/
${
item
.
requiredProjectId
}
?tutorial=
${
item
.
url
Id
}
`
;
return
window
.
open
(
window
.
location
.
origin
+
urlParams
,
'
_blank
'
);
}
this
.
props
.
onActivateDeck
(
item
.
id
);
analytics
.
event
({
category
:
'
library
'
,
action
:
'
Select How-to
'
,
label
:
item
.
id
});
}
render
()
{
const
decksLibraryThumbnailData
=
Object
.
keys
(
decksLibraryContent
).
map
(
id
=>
({
...
...
@@ -87,11 +90,13 @@ TipsLibrary.propTypes = {
intl
:
intlShape
.
isRequired
,
onActivateDeck
:
PropTypes
.
func
.
isRequired
,
onRequestClose
:
PropTypes
.
func
,
projectId
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
]),
visible
:
PropTypes
.
bool
};
const
mapStateToProps
=
state
=>
({
visible
:
state
.
scratchGui
.
modals
.
tipsLibrary
visible
:
state
.
scratchGui
.
modals
.
tipsLibrary
,
projectId
:
state
.
scratchGui
.
projectState
.
projectId
});
const
mapDispatchToProps
=
dispatch
=>
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment