Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
21205d1e
Commit
21205d1e
authored
May 22, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-edit-inline' into issue-edit-inline-description-template
[ci skip]
parents
745ec1ac
3f996024
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
99 additions
and
4 deletions
+99
-4
app/assets/javascripts/issue_show/components/app.vue
app/assets/javascripts/issue_show/components/app.vue
+10
-3
app/assets/javascripts/issue_show/components/fields/description_template.vue
...pts/issue_show/components/fields/description_template.vue
+1
-1
app/assets/javascripts/issue_show/components/form.vue
app/assets/javascripts/issue_show/components/form.vue
+3
-0
app/assets/javascripts/issue_show/components/locked_warning.vue
...sets/javascripts/issue_show/components/locked_warning.vue
+20
-0
app/assets/javascripts/issue_show/stores/index.js
app/assets/javascripts/issue_show/stores/index.js
+8
-0
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+32
-0
spec/javascripts/issue_show/components/fields/description_template_spec.js
...issue_show/components/fields/description_template_spec.js
+2
-0
spec/javascripts/issue_show/components/form_spec.js
spec/javascripts/issue_show/components/form_spec.js
+23
-0
No files found.
app/assets/javascripts/issue_show/components/app.vue
View file @
21205d1e
...
...
@@ -103,12 +103,12 @@ export default {
openForm
()
{
if
(
!
this
.
showForm
)
{
this
.
showForm
=
true
;
this
.
store
.
formState
=
{
this
.
store
.
formState
=
Object
.
assign
(
this
.
store
.
formState
,
{
title
:
this
.
state
.
titleText
,
confidential
:
this
.
isConfidential
,
description
:
this
.
state
.
descriptionText
,
move_to_project_id
:
0
,
};
}
)
;
}
},
closeForm
()
{
...
...
@@ -152,7 +152,14 @@ export default {
resource
:
this
.
service
,
method
:
'
getData
'
,
successCallback
:
(
res
)
=>
{
this
.
store
.
updateState
(
res
.
json
());
const
data
=
res
.
json
();
const
shouldUpdate
=
this
.
store
.
stateShouldUpdate
(
data
);
this
.
store
.
updateState
(
data
);
if
(
this
.
showForm
&&
(
shouldUpdate
.
title
||
shouldUpdate
.
description
))
{
this
.
store
.
formState
.
lockedWarningVisible
=
true
;
}
},
errorCallback
(
err
)
{
throw
new
Error
(
err
);
...
...
app/assets/javascripts/issue_show/components/fields/description_template.vue
View file @
21205d1e
...
...
@@ -26,7 +26,7 @@
},
mounted
()
{
// Create the editor for the template
const
editor
=
document
.
querySelector
(
'
.detail-page-description .note-textarea
'
);
const
editor
=
document
.
querySelector
(
'
.detail-page-description .note-textarea
'
)
||
{}
;
editor
.
setValue
=
(
val
)
=>
{
this
.
formState
.
description
=
val
;
};
...
...
app/assets/javascripts/issue_show/components/form.vue
View file @
21205d1e
<
script
>
import
lockedWarning
from
'
./locked_warning.vue
'
;
import
titleField
from
'
./fields/title.vue
'
;
import
descriptionField
from
'
./fields/description.vue
'
;
import
editActions
from
'
./edit_actions.vue
'
;
...
...
@@ -47,6 +48,7 @@
},
},
components
:
{
lockedWarning
,
titleField
,
descriptionField
,
descriptionTemplate
,
...
...
@@ -64,6 +66,7 @@
<
template
>
<form>
<locked-warning
v-if=
"formState.lockedWarningVisible"
/>
<div
class=
"row"
>
<div
class=
"col-sm-4 col-lg-3"
...
...
app/assets/javascripts/issue_show/components/locked_warning.vue
0 → 100644
View file @
21205d1e
<
script
>
export
default
{
computed
:
{
currentPath
()
{
return
location
.
pathname
;
},
},
};
</
script
>
<
template
>
<div
class=
"alert alert-danger"
>
Someone edited the issue at the same time you did. Please check out
<a
:href=
"currentPath"
target=
"_blank"
rel=
"nofollow"
>
the issue
</a>
and make sure your changes will not unintentionally remove theirs.
</div>
</
template
>
app/assets/javascripts/issue_show/stores/index.js
View file @
21205d1e
...
...
@@ -16,6 +16,7 @@ export default class Store {
title
:
''
,
confidential
:
false
,
description
:
''
,
lockedWarningVisible
:
false
,
move_to_project_id
:
0
,
};
}
...
...
@@ -28,4 +29,11 @@ export default class Store {
this
.
state
.
taskStatus
=
data
.
task_status
;
this
.
state
.
updatedAt
=
data
.
updated_at
;
}
stateShouldUpdate
(
data
)
{
return
{
title
:
this
.
state
.
titleText
!==
data
.
title_text
,
description
:
this
.
state
.
descriptionText
!==
data
.
description_text
,
};
}
}
spec/javascripts/issue_show/components/app_spec.js
View file @
21205d1e
...
...
@@ -285,4 +285,36 @@ describe('Issuable output', () => {
});
});
});
describe
(
'
open form
'
,
()
=>
{
it
(
'
shows locked warning if form is open & data is different
'
,
(
done
)
=>
{
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
initialRequest
));
Vue
.
nextTick
()
.
then
(()
=>
new
Promise
((
resolve
)
=>
{
setTimeout
(
resolve
);
}))
.
then
(()
=>
{
vm
.
openForm
();
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
secondRequest
));
return
new
Promise
((
resolve
)
=>
{
setTimeout
(
resolve
);
});
})
.
then
(()
=>
{
expect
(
vm
.
formState
.
lockedWarningVisible
,
).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
),
).
not
.
toBeNull
();
done
();
})
.
catch
(
done
.
fail
);
});
});
});
spec/javascripts/issue_show/components/fields/description_template_spec.js
View file @
21205d1e
...
...
@@ -17,6 +17,8 @@ describe('Issue description template component', () => {
propsData
:
{
formState
,
issuableTemplates
:
[{
name
:
'
test
'
}],
projectPath
:
'
/
'
,
projectNamespace
:
'
/
'
,
},
}).
$mount
();
...
...
spec/javascripts/issue_show/components/form_spec.js
View file @
21205d1e
...
...
@@ -12,12 +12,17 @@ describe('Inline edit form component', () => {
vm
=
new
Component
({
propsData
:
{
canDestroy
:
true
,
canMove
:
true
,
formState
:
{
title
:
'
b
'
,
description
:
'
a
'
,
lockedWarningVisible
:
false
,
},
markdownPreviewUrl
:
'
/
'
,
markdownDocs
:
'
/
'
,
projectsAutocompleteUrl
:
'
/
'
,
projectPath
:
'
/
'
,
projectNamespace
:
'
/
'
,
},
}).
$mount
();
...
...
@@ -42,4 +47,22 @@ describe('Inline edit form component', () => {
done
();
});
});
it
(
'
hides locked warning by default
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
),
).
toBeNull
();
});
it
(
'
shows locked warning if formState is different
'
,
(
done
)
=>
{
vm
.
formState
.
lockedWarningVisible
=
true
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
),
).
not
.
toBeNull
();
done
();
});
});
});
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