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
Boxiang Sun
gitlab-ce
Commits
bcb5725d
Commit
bcb5725d
authored
Apr 16, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates to component
parent
5f5995dd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
112 deletions
+78
-112
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
...ets/javascripts/ide/components/commit_sidebar/actions.vue
+21
-37
app/assets/javascripts/ide/components/commit_sidebar/message_field.vue
...vascripts/ide/components/commit_sidebar/message_field.vue
+17
-14
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
...javascripts/ide/components/commit_sidebar/radio_group.vue
+31
-55
app/assets/javascripts/ide/constants.js
app/assets/javascripts/ide/constants.js
+3
-0
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+1
-1
spec/javascripts/ide/components/commit_sidebar/message_field_spec.js
...ripts/ide/components/commit_sidebar/message_field_spec.js
+5
-5
No files found.
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
View file @
bcb5725d
<
script
>
<
script
>
import
{
mapState
}
from
'
vuex
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
sprintf
,
__
}
from
'
~/locale
'
;
import
{
sprintf
,
__
}
from
'
~/locale
'
;
import
*
as
consts
from
'
../../stores/modules/commit/constants
'
;
import
*
as
consts
from
'
../../stores/modules/commit/constants
'
;
import
RadioGroup
from
'
./radio_group.vue
'
;
import
RadioGroup
from
'
./radio_group.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
RadioGroup
,
RadioGroup
,
},
},
computed
:
{
computed
:
{
...
mapState
([
...
mapState
([
'
currentBranchId
'
]),
'
currentBranchId
'
,
]),
newMergeRequestHelpText
()
{
return
sprintf
(
__
(
'
Creates a new branch from %{branchName} and re-directs to create a new merge request
'
),
{
branchName
:
this
.
currentBranchId
},
);
},
commitToCurrentBranchText
()
{
commitToCurrentBranchText
()
{
return
sprintf
(
return
sprintf
(
__
(
'
Commit to %{branchName} branch
'
),
__
(
'
Commit to %{branchName} branch
'
),
...
@@ -25,17 +17,11 @@
...
@@ -25,17 +17,11 @@
false
,
false
,
);
);
},
},
commitToNewBranchText
()
{
return
sprintf
(
__
(
'
Creates a new branch from %{branchName}
'
),
{
branchName
:
this
.
currentBranchId
},
);
},
},
},
commitToCurrentBranch
:
consts
.
COMMIT_TO_CURRENT_BRANCH
,
commitToCurrentBranch
:
consts
.
COMMIT_TO_CURRENT_BRANCH
,
commitToNewBranch
:
consts
.
COMMIT_TO_NEW_BRANCH
,
commitToNewBranch
:
consts
.
COMMIT_TO_NEW_BRANCH
,
commitToNewBranchMR
:
consts
.
COMMIT_TO_NEW_BRANCH_MR
,
commitToNewBranchMR
:
consts
.
COMMIT_TO_NEW_BRANCH_MR
,
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -53,13 +39,11 @@
...
@@ -53,13 +39,11 @@
:value=
"$options.commitToNewBranch"
:value=
"$options.commitToNewBranch"
:label=
"__('Create a new branch')"
:label=
"__('Create a new branch')"
:show-input=
"true"
:show-input=
"true"
:help-text=
"commitToNewBranchText"
/>
/>
<radio-group
<radio-group
:value=
"$options.commitToNewBranchMR"
:value=
"$options.commitToNewBranchMR"
:label=
"__('Create a new branch and merge request')"
:label=
"__('Create a new branch and merge request')"
:show-input=
"true"
:show-input=
"true"
:help-text=
"newMergeRequestHelpText"
/>
/>
</div>
</div>
</
template
>
</
template
>
app/assets/javascripts/ide/components/commit_sidebar/message_field.vue
View file @
bcb5725d
<
script
>
<
script
>
import
{
__
}
from
'
../../../locale
'
;
import
{
__
,
sprintf
}
from
'
../../../locale
'
;
import
Icon
from
'
../../../vue_shared/components/icon.vue
'
;
import
popover
from
'
../../../vue_shared/directives/popover
'
;
import
popover
from
'
../../../vue_shared/directives/popover
'
;
import
{
MAX_TITLE_LENGTH
,
MAX_BODY_LENGTH
}
from
'
../../constants
'
;
export
const
MAX_TITLE_LENGTH
=
50
;
export
const
MAX_BODY_LENGTH
=
72
;
export
default
{
export
default
{
directives
:
{
directives
:
{
popover
,
popover
,
},
},
components
:
{
Icon
,
},
props
:
{
props
:
{
text
:
{
text
:
{
type
:
String
,
type
:
String
,
...
@@ -45,13 +47,15 @@ export default {
...
@@ -45,13 +47,15 @@ export default {
},
},
},
},
popoverOptions
:
{
popoverOptions
:
{
html
:
true
,
trigger
:
'
hover
'
,
trigger
:
'
hover
'
,
placement
:
'
top
'
,
placement
:
'
top
'
,
content
:
__
(
`
content
:
sprintf
(
The character highligher helps you keep the subject line to 50 characters
__
(
`
and wrap the body at 72 so they are readable in git.
The character highligher helps you keep the subject line to %{titleLength} characters
and wrap the body at %{bodyLength} so they are readable in git.
`
),
`
),
{
titleLength
:
MAX_TITLE_LENGTH
,
bodyLength
:
MAX_BODY_LENGTH
},
),
},
},
};
};
</
script
>
</
script
>
...
@@ -75,10 +79,9 @@ export default {
...
@@ -75,10 +79,9 @@ export default {
v-popover=
"$options.popoverOptions"
v-popover=
"$options.popoverOptions"
class=
"help-block prepend-left-10"
class=
"help-block prepend-left-10"
>
>
<i
<icon
aria-hidden=
"true"
name=
"question"
class=
"fa fa-question-circle"
/>
></i>
</span>
</span>
</li>
</li>
</ul>
</ul>
...
@@ -99,7 +102,7 @@ export default {
...
@@ -99,7 +102,7 @@ export default {
v-text=
"line.substr(0, getLineLength(index)) || ' '"
v-text=
"line.substr(0, getLineLength(index)) || ' '"
>
>
</span><mark
</span><mark
v-
if
=
"line.length > getLineLength(index)"
v-
show
=
"line.length > getLineLength(index)"
v-text=
"line.substr(getLineLength(index))"
v-text=
"line.substr(getLineLength(index))"
>
>
</mark>
</mark>
...
...
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
View file @
bcb5725d
<
script
>
<
script
>
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
export
default
{
export
default
{
directives
:
{
directives
:
{
tooltip
,
tooltip
,
},
},
...
@@ -26,27 +26,15 @@
...
@@ -26,27 +26,15 @@
required
:
false
,
required
:
false
,
default
:
false
,
default
:
false
,
},
},
helpText
:
{
type
:
String
,
required
:
false
,
default
:
null
,
},
},
},
computed
:
{
computed
:
{
...
mapState
(
'
commit
'
,
[
...
mapState
(
'
commit
'
,
[
'
commitAction
'
]),
'
commitAction
'
,
...
mapGetters
(
'
commit
'
,
[
'
newBranchName
'
]),
]),
...
mapGetters
(
'
commit
'
,
[
'
newBranchName
'
,
]),
},
},
methods
:
{
methods
:
{
...
mapActions
(
'
commit
'
,
[
...
mapActions
(
'
commit
'
,
[
'
updateCommitAction
'
,
'
updateBranchName
'
]),
'
updateCommitAction
'
,
'
updateBranchName
'
,
]),
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -65,18 +53,6 @@
...
@@ -65,18 +53,6 @@
{{
label
}}
{{
label
}}
</
template
>
</
template
>
<slot
v-else
></slot>
<slot
v-else
></slot>
<span
v-if=
"helpText"
v-tooltip
class=
"help-block inline"
:title=
"helpText"
>
<i
class=
"fa fa-question-circle"
aria-hidden=
"true"
>
</i>
</span>
</span>
</span>
</label>
</label>
<div
<div
...
...
app/assets/javascripts/ide/constants.js
0 → 100644
View file @
bcb5725d
// Fuzzy file finder
export
const
MAX_TITLE_LENGTH
=
50
;
export
const
MAX_BODY_LENGTH
=
72
;
app/assets/stylesheets/pages/repo.scss
View file @
bcb5725d
...
@@ -850,7 +850,7 @@
...
@@ -850,7 +850,7 @@
}
}
.help-block
{
.help-block
{
margin-top
:
0
;
margin-top
:
2px
;
color
:
$blue-500
;
color
:
$blue-500
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
...
...
spec/javascripts/ide/components/commit_sidebar/message_field_spec.js
View file @
bcb5725d
...
@@ -75,7 +75,7 @@ describe('IDE commit message field', () => {
...
@@ -75,7 +75,7 @@ describe('IDE commit message field', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.highlights span
'
).
textContent
).
toContain
(
expect
(
vm
.
$el
.
querySelector
(
'
.highlights span
'
).
textContent
).
toContain
(
'
text less than 50 chars
'
,
'
text less than 50 chars
'
,
);
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
)
).
toBeNull
(
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
)
.
style
.
display
).
toBe
(
'
none
'
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -91,7 +91,7 @@ describe('IDE commit message field', () => {
...
@@ -91,7 +91,7 @@ describe('IDE commit message field', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.highlights span
'
).
textContent
).
toContain
(
expect
(
vm
.
$el
.
querySelector
(
'
.highlights span
'
).
textContent
).
toContain
(
'
text less than 50 chars that should not highlighte
'
,
'
text less than 50 chars that should not highlighte
'
,
);
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
)
).
not
.
toBeNull
(
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
)
.
style
.
display
).
not
.
toBe
(
'
none
'
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
).
textContent
).
toBe
(
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
).
textContent
).
toBe
(
'
d. text more than 50 should be highlighted
'
,
'
d. text more than 50 should be highlighted
'
,
);
);
...
@@ -109,7 +109,7 @@ describe('IDE commit message field', () => {
...
@@ -109,7 +109,7 @@ describe('IDE commit message field', () => {
.
$nextTick
()
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.highlights span
'
).
length
).
toBe
(
2
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.highlights span
'
).
length
).
toBe
(
2
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
)).
toBeNull
(
);
expect
(
vm
.
$el
.
querySelector
All
(
'
mark
'
)[
1
].
style
.
display
).
toBe
(
'
none
'
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -123,8 +123,8 @@ describe('IDE commit message field', () => {
...
@@ -123,8 +123,8 @@ describe('IDE commit message field', () => {
.
$nextTick
()
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.highlights span
'
).
length
).
toBe
(
2
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.highlights span
'
).
length
).
toBe
(
2
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
)).
not
.
toBeNull
(
);
expect
(
vm
.
$el
.
querySelector
All
(
'
mark
'
)[
1
].
style
.
display
).
not
.
toBe
(
'
none
'
);
expect
(
vm
.
$el
.
querySelector
(
'
mark
'
)
.
textContent
).
toBe
(
'
in length
'
);
expect
(
vm
.
$el
.
querySelector
All
(
'
mark
'
)[
1
]
.
textContent
).
toBe
(
'
in length
'
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
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