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
0f43c307
Commit
0f43c307
authored
Nov 14, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move issuable title form to a new partial
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
f27f9803
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
52 deletions
+53
-52
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+0
-5
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+21
-47
app/views/shared/issuable/form/_title.html.haml
app/views/shared/issuable/form/_title.html.haml
+32
-0
No files found.
app/helpers/issuables_helper.rb
View file @
0f43c307
...
...
@@ -30,11 +30,6 @@ module IssuablesHelper
end
end
def
can_add_template?
(
issuable
)
names
=
issuable_templates
(
issuable
)
names
.
empty?
&&
can?
(
current_user
,
:push_code
,
@project
)
&&
!
@project
.
private?
end
def
template_dropdown_tag
(
issuable
,
&
block
)
title
=
selected_template
(
issuable
)
||
"Choose a template"
options
=
{
...
...
app/views/shared/issuable/_form.html.haml
View file @
0f43c307
-
form
=
local_assigns
.
fetch
(
:f
)
-
project
=
@target_project
||
@project
=
form_errors
(
issuable
)
...
...
@@ -10,44 +11,17 @@
and make sure your changes will not unintentionally remove theirs
.form-group
=
f
.
label
:title
,
class:
'control-label'
=
f
orm
.
label
:title
,
class:
'control-label'
=
render
'shared/issuable/form/template_selector'
,
issuable:
issuable
%div
{
class:
issuable_templates
(
issuable
).
any?
?
'col-sm-7 col-lg-8'
:
'col-sm-10'
}
=
f
.
text_field
:title
,
maxlength:
255
,
autofocus:
true
,
autocomplete:
'off'
,
class:
'form-control pad'
,
required:
true
-
if
issuable
.
is_a?
(
MergeRequest
)
%p
.help-block
.js-wip-explanation
%a
.js-toggle-wip
{
href:
""
,
tabindex:
-
1
}
Remove the
%code
WIP:
prefix from the title
to allow this
%strong
Work In Progress
merge request to be merged when it's ready.
.js-no-wip-explanation
%a
.js-toggle-wip
{
href:
""
,
tabindex:
-
1
}
Start the title with
%code
WIP:
to prevent a
%strong
Work In Progress
merge request from being merged before it's ready.
-
if
can_add_template?
(
issuable
)
%p
.help-block
Add
=
link_to
"description templates"
,
help_page_path
(
'user/project/description_templates'
),
tabindex:
-
1
to help your contributors communicate effectively!
=
render
'shared/issuable/form/title'
,
issuable:
issuable
,
form:
form
.form-group.detail-page-description
=
f
.
label
:description
,
'Description'
,
class:
'control-label'
=
f
orm
.
label
:description
,
'Description'
,
class:
'control-label'
.col-sm-10
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
"md-preview"
,
referenced_users:
true
}
do
=
render
'projects/zen'
,
f:
f
,
attr: :description
,
=
render
'projects/zen'
,
f:
f
orm
,
attr: :description
,
classes:
'note-textarea'
,
placeholder:
"Write a comment or drag your files here..."
,
supports_slash_commands:
!
issuable
.
persisted?
...
...
@@ -59,8 +33,8 @@
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
=
f
.
label
:confidential
do
=
f
.
check_box
:confidential
=
f
orm
.
label
:confidential
do
=
f
orm
.
check_box
:confidential
This issue is confidential and should only be visible to team members with at least Reporter access.
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
.
project
)
...
...
@@ -69,32 +43,32 @@
.row
%div
{
class:
(
has_due_date
?
"col-lg-6"
:
"col-sm-12"
)
}
.form-group.issue-assignee
=
f
.
label
:assignee_id
,
"Assignee"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
=
f
orm
.
label
:assignee_id
,
"Assignee"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
-
if
issuable
.
assignee_id
=
f
.
hidden_field
:assignee_id
=
f
orm
.
hidden_field
:assignee_id
=
dropdown_tag
(
user_dropdown_label
(
issuable
.
assignee_id
,
"Assignee"
),
options:
{
toggle_class:
"js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search"
,
title:
"Select assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit"
,
placeholder:
"Search assignee"
,
data:
{
first_user:
current_user
.
try
(
:username
),
null_user:
true
,
current_user:
true
,
project_id:
project
.
try
(
:id
),
selected:
issuable
.
assignee_id
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_id]"
,
default_label:
"Assignee"
}
})
.form-group.issue-milestone
=
f
.
label
:milestone_id
,
"Milestone"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
=
f
orm
.
label
:milestone_id
,
"Milestone"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
=
render
"shared/issuable/milestone_dropdown"
,
selected:
issuable
.
milestone
,
name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[milestone_id]"
,
show_any:
false
,
show_upcoming:
false
,
extra_class:
"js-issuable-form-dropdown js-dropdown-keep-input"
,
dropdown_title:
"Select milestone"
.form-group
-
has_labels
=
@labels
&&
@labels
.
any?
=
f
.
label
:label_ids
,
"Labels"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
=
f
.
hidden_field
:label_ids
,
multiple:
true
,
value:
''
=
f
orm
.
label
:label_ids
,
"Labels"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
=
f
orm
.
hidden_field
:label_ids
,
multiple:
true
,
value:
''
.col-sm-10
{
class:
"#{"
col
-
lg
-
8
" if has_due_date} #{'issuable-form-padding-top' if !has_labels}"
}
.issuable-form-select-holder
=
render
"shared/issuable/label_dropdown"
,
classes:
[
"js-issuable-form-dropdown"
],
selected:
issuable
.
labels
,
data_options:
{
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[label_ids][]"
,
show_any:
false
},
dropdown_title:
"Select label"
-
if
has_due_date
.col-lg-6
.form-group
=
f
.
label
:due_date
,
"Due date"
,
class:
"control-label"
=
f
orm
.
label
:due_date
,
"Due date"
,
class:
"control-label"
.col-sm-10
.issuable-form-select-holder
=
f
.
text_field
:due_date
,
id:
"issuable-due-date"
,
class:
"datepicker form-control"
,
placeholder:
"Select due date"
=
f
orm
.
text_field
:due_date
,
id:
"issuable-due-date"
,
class:
"datepicker form-control"
,
placeholder:
"Select due date"
-
if
issuable
.
can_move?
(
current_user
)
%hr
...
...
@@ -112,15 +86,15 @@
%hr
-
if
@merge_request
.
new_record?
.form-group
=
f
.
label
:source_branch
,
class:
'control-label'
=
f
orm
.
label
:source_branch
,
class:
'control-label'
.col-sm-10
.issuable-form-select-holder
=
f
.
select
(
:source_branch
,
[
@merge_request
.
source_branch
],
{
},
{
class:
'source_branch select2 span2'
,
disabled:
true
})
=
f
orm
.
select
(
:source_branch
,
[
@merge_request
.
source_branch
],
{
},
{
class:
'source_branch select2 span2'
,
disabled:
true
})
.form-group
=
f
.
label
:target_branch
,
class:
'control-label'
=
f
orm
.
label
:target_branch
,
class:
'control-label'
.col-sm-10
.issuable-form-select-holder
=
f
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
true
},
{
class:
'target_branch select2 span2'
,
disabled:
@merge_request
.
new_record?
,
data:
{
placeholder:
"Select branch"
}
})
=
f
orm
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
true
},
{
class:
'target_branch select2 span2'
,
disabled:
@merge_request
.
new_record?
,
data:
{
placeholder:
"Select branch"
}
})
-
if
@merge_request
.
new_record?
=
link_to
'Change branches'
,
mr_change_branches_path
(
@merge_request
)
...
...
@@ -136,9 +110,9 @@
-
is_footer
=
!
(
issuable
.
is_a?
(
MergeRequest
)
&&
issuable
.
new_record?
)
.row-content-block
{
class:
(
is_footer
?
"footer-block"
:
"middle-block"
)}
-
if
issuable
.
new_record?
=
f
.
submit
"Submit
#{
issuable
.
class
.
model_name
.
human
.
downcase
}
"
,
class:
'btn btn-create'
=
f
orm
.
submit
"Submit
#{
issuable
.
class
.
model_name
.
human
.
downcase
}
"
,
class:
'btn btn-create'
-
else
=
f
.
submit
'Save changes'
,
class:
'btn btn-save'
=
f
orm
.
submit
'Save changes'
,
class:
'btn btn-save'
-
if
!
issuable
.
persisted?
&&
!
issuable
.
project
.
empty_repo?
&&
(
guide_url
=
contribution_guide_path
(
issuable
.
project
))
.inline.prepend-left-10
...
...
@@ -155,4 +129,4 @@
method: :delete
,
class:
'btn btn-danger btn-grouped'
=
link_to
'Cancel'
,
polymorphic_path
([
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
issuable
]),
class:
'btn btn-grouped btn-cancel'
=
f
.
hidden_field
:lock_version
=
f
orm
.
hidden_field
:lock_version
app/views/shared/issuable/form/_title.html.haml
0 → 100644
View file @
0f43c307
-
issuable
=
local_assigns
.
fetch
(
:issuable
)
-
form
=
local_assigns
.
fetch
(
:form
)
-
no_issuable_templates
=
issuable_templates
(
issuable
).
empty?
-
div_class
=
no_issuable_templates
?
'col-sm-10'
:
'col-sm-7 col-lg-8'
%div
{
class:
div_class
}
=
form
.
text_field
:title
,
required:
true
,
maxlength:
255
,
autofocus:
true
,
autocomplete:
'off'
,
class:
'form-control pad'
-
if
issuable
.
respond_to?
(
:work_in_progress?
)
%p
.help-block
.js-wip-explanation
%a
.js-toggle-wip
{
href:
''
,
tabindex:
-
1
}
Remove the
%code
WIP:
prefix from the title
to allow this
%strong
Work In Progress
merge request to be merged when it's ready.
.js-no-wip-explanation
%a
.js-toggle-wip
{
href:
''
,
tabindex:
-
1
}
Start the title with
%code
WIP:
to prevent a
%strong
Work In Progress
merge request from being merged before it's ready.
-
if
no_issuable_templates
&&
can?
(
current_user
,
:push_code
,
issuable
.
project
)
%p
.help-block
Add
=
link_to
'description templates'
,
help_page_path
(
'user/project/description_templates'
),
tabindex:
-
1
to help your contributors communicate effectively!
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