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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c49d5673
Commit
c49d5673
authored
Nov 15, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor issuable description and metadata form sections
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
4428a11e
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
199 additions
and
123 deletions
+199
-123
app/helpers/ee_issuables_helper.rb
app/helpers/ee_issuables_helper.rb
+0
-9
app/helpers/ee_issues_helper.rb
app/helpers/ee_issues_helper.rb
+28
-0
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+0
-14
app/models/issue.rb
app/models/issue.rb
+5
-1
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+1
-1
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+3
-65
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+3
-4
app/views/shared/issuable/form/_description.html.haml
app/views/shared/issuable/form/_description.html.haml
+15
-0
app/views/shared/issuable/form/_metadata.html.haml
app/views/shared/issuable/form/_metadata.html.haml
+41
-0
app/views/shared/issuable/form/_weight.html.haml
app/views/shared/issuable/form/_weight.html.haml
+21
-0
doc/development/limit_ee_conflicts.md
doc/development/limit_ee_conflicts.md
+82
-29
No files found.
app/helpers/ee_issuables_helper.rb
deleted
100644 → 0
View file @
4428a11e
module
EeIssuablesHelper
def
weight_dropdown_label
(
weight
)
if
Issue
.
weight_options
.
include?
(
weight
)
weight
else
h
(
weight
.
presence
||
'Weight'
)
end
end
end
app/helpers/ee_issues_helper.rb
0 → 100644
View file @
c49d5673
module
EeIssuesHelper
def
weight_dropdown_tag
(
issuable
,
opts
=
{},
&
block
)
title
=
issuable
.
weight
||
'Weight'
additional_toggle_class
=
opts
.
delete
(
:toggle_class
)
options
=
{
toggle_class:
"js-weight-select
#{
additional_toggle_class
}
"
,
dropdown_class:
'dropdown-menu-selectable dropdown-menu-weight'
,
title:
'Select weight'
,
placeholder:
'Search weight'
,
data:
{
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[weight]"
,
default_label:
'Weight'
}
}.
deep_merge
(
opts
)
dropdown_tag
(
title
,
options:
options
)
do
capture
(
&
block
)
end
end
def
weight_dropdown_label
(
weight
)
if
Issue
.
weight_filter_options
.
include?
(
weight
)
weight
else
h
(
weight
.
presence
||
'Weight'
)
end
end
end
app/helpers/issues_helper.rb
View file @
c49d5673
...
...
@@ -158,20 +158,6 @@ module IssuesHelper
options_from_collection_for_select
(
options
,
'name'
,
'title'
,
params
[
:due_date
])
end
def
issues_weight_options
(
selected
=
nil
,
edit:
false
)
weights
=
edit
?
edit_weights
:
issue_weights
options_for_select
(
weights
,
selected
||
params
[
:weight
])
end
def
issue_weights
(
weight_array
=
Issue
.
weight_options
)
weight_array
.
zip
(
weight_array
)
end
def
edit_weights
issue_weights
([
Issue
::
WEIGHT_NONE
]
+
Issue
::
WEIGHT_RANGE
.
to_a
)
end
# Required for Banzai::Filter::IssueReferenceFilter
module_function
:url_for_issue
end
app/models/issue.rb
View file @
c49d5673
...
...
@@ -229,8 +229,12 @@ class Issue < ActiveRecord::Base
end
end
def
self
.
weight_filter_options
weight_options
+
[
WEIGHT_ALL
,
WEIGHT_ANY
]
end
def
self
.
weight_options
[
WEIGHT_
ALL
,
WEIGHT_ANY
,
WEIGHT_
NONE
]
+
WEIGHT_RANGE
.
to_a
[
WEIGHT_NONE
]
+
WEIGHT_RANGE
.
to_a
end
def
moved?
...
...
app/views/shared/issuable/_filter.html.haml
View file @
c49d5673
...
...
@@ -36,7 +36,7 @@
=
dropdown_tag
(
weight_dropdown_label
(
params
[
:weight
]),
options:
{
title:
"Filter by weight"
,
toggle_class:
'js-weight-select js-filter-submit'
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search weight"
,
data:
{
field_name:
"weight"
,
default_label:
"Weight"
}
})
do
%ul
-
Issue
.
weight_options
.
each
do
|
weight
|
-
Issue
.
weight_
filter_
options
.
each
do
|
weight
|
%li
%a
{
href:
"#"
,
data:
{
id:
weight
},
class:
(
"is-active"
if
params
[
:weight
]
==
weight
.
to_s
)}
=
weight
...
...
app/views/shared/issuable/_form.html.haml
View file @
c49d5673
...
...
@@ -16,20 +16,9 @@
=
render
'shared/issuable/form/template_selector'
,
issuable:
issuable
=
render
'shared/issuable/form/title'
,
issuable:
issuable
,
form:
form
.form-group.detail-page-description
=
form
.
label
:description
,
'Description'
,
class:
'control-label'
.col-sm-10
=
render
'shared/issuable/form/description'
,
issuable:
issuable
,
form:
form
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
"md-preview"
,
referenced_users:
true
}
do
=
render
'projects/zen'
,
f:
form
,
attr: :description
,
classes:
'note-textarea'
,
placeholder:
"Write a comment or drag your files here..."
,
supports_slash_commands:
!
issuable
.
persisted?
=
render
'projects/notes/hints'
,
supports_slash_commands:
!
issuable
.
persisted?
.clearfix
.error-alert
-
if
issuable
.
is_a?
(
Issue
)
-
if
issuable
.
respond_to?
(
:confidential
)
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
...
...
@@ -37,58 +26,7 @@
=
form
.
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
)
-
has_due_date
=
issuable
.
has_attribute?
(
:due_date
)
%hr
.row
%div
{
class:
(
has_due_date
?
"col-lg-6"
:
"col-sm-12"
)
}
.form-group.issue-assignee
=
form
.
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
=
form
.
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
=
form
.
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?
=
form
.
label
:label_ids
,
"Labels"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
=
form
.
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
issuable
.
respond_to?
(
:weight
)
-
weight_options
=
Issue
.
weight_options
-
weight_options
.
delete
(
Issue
::
WEIGHT_ALL
)
-
weight_options
.
delete
(
Issue
::
WEIGHT_ANY
)
.form-group
=
form
.
label
:label_ids
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
do
Weight
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
-
if
issuable
.
weight
=
form
.
hidden_field
:weight
=
dropdown_tag
(
issuable
.
weight
||
"Weight"
,
options:
{
title:
"Select weight"
,
toggle_class:
'js-weight-select js-issuable-form-weight'
,
dropdown_class:
"dropdown-menu-selectable dropdown-menu-weight"
,
placeholder:
"Search weight"
,
data:
{
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[weight]"
,
default_label:
"Weight"
}
})
do
%ul
-
weight_options
.
each
do
|
weight
|
%li
%a
{
href:
"#"
,
data:
{
id:
weight
,
none:
weight
===
Issue
::
WEIGHT_NONE
},
class:
(
"is-active"
if
issuable
.
weight
==
weight
)}
=
weight
-
if
has_due_date
.col-lg-6
.form-group
=
form
.
label
:due_date
,
"Due date"
,
class:
"control-label"
.col-sm-10
.issuable-form-select-holder
=
form
.
text_field
:due_date
,
id:
"issuable-due-date"
,
class:
"datepicker form-control"
,
placeholder:
"Select due date"
=
render
'shared/issuable/form/metadata'
,
issuable:
issuable
,
form:
form
-
if
issuable
.
can_move?
(
current_user
)
%hr
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
c49d5673
...
...
@@ -168,12 +168,11 @@
-
else
.light
None
.selectbox.hide-collapsed
=
dropdown_tag
(
"Weight"
,
options:
{
title:
"Change weight"
,
toggle_class:
'js-weight-select'
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search weight"
,
data:
{
field_name:
"weight"
,
issue_update:
"
#{
issuable_json_path
(
issuable
)
}
"
,
ability_name:
"
#{
issuable
.
to_ability_name
}
"
}
})
do
=
weight_dropdown_tag
(
issuable
,
title:
'Change weight'
,
data:
{
field_name:
'weight'
,
issue_update:
"
#{
issuable_json_path
(
issuable
)
}
"
,
ability_name:
"
#{
issuable
.
to_ability_name
}
"
})
do
%ul
-
Issue
.
weight_options
.
select
{
|
weight
|
weight
!=
"Everything"
&&
weight
!=
"Any Weight"
}.
each
do
|
weight
|
-
Issue
.
weight_options
.
each
do
|
weight
|
%li
%a
{
href:
"#"
,
data:
{
id:
weight
,
none:
(
"true"
if
weight
==
Issue
::
WEIGHT_NONE
)
},
class:
(
"is-active"
if
params
[
:weight
]
==
weight
.
to_s
)
}
%a
{
href:
"#"
,
data:
{
id:
weight
,
none:
weight
==
Issue
::
WEIGHT_NONE
},
class:
(
"is-active"
if
params
[
:weight
]
==
weight
.
to_s
)
}
=
weight
=
render
"shared/issuable/participants"
,
participants:
issuable
.
participants
(
current_user
)
...
...
app/views/shared/issuable/form/_description.html.haml
0 → 100644
View file @
c49d5673
-
issuable
=
local_assigns
.
fetch
(
:issuable
)
-
form
=
local_assigns
.
fetch
(
:form
)
.form-group.detail-page-description
=
form
.
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:
form
,
attr: :description
,
classes:
'note-textarea'
,
placeholder:
"Write a comment or drag your files here..."
,
supports_slash_commands:
!
issuable
.
persisted?
=
render
'projects/notes/hints'
,
supports_slash_commands:
!
issuable
.
persisted?
.clearfix
.error-alert
app/views/shared/issuable/form/_metadata.html.haml
0 → 100644
View file @
c49d5673
-
issuable
=
local_assigns
.
fetch
(
:issuable
)
-
return
unless
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
.
project
)
-
has_due_date
=
issuable
.
has_attribute?
(
:due_date
)
-
has_labels
=
@labels
&&
@labels
.
any?
-
form
=
local_assigns
.
fetch
(
:form
)
%hr
.row
%div
{
class:
(
has_due_date
?
"col-lg-6"
:
"col-sm-12"
)
}
.form-group.issue-assignee
=
form
.
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
=
form
.
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:
issuable
.
project
.
try
(
:id
),
selected:
issuable
.
assignee_id
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_id]"
,
default_label:
"Assignee"
}
})
.form-group.issue-milestone
=
form
.
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?
=
form
.
label
:label_ids
,
"Labels"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
=
form
.
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"
=
render
"shared/issuable/form/weight"
,
issuable:
issuable
,
form:
form
-
if
has_due_date
.col-lg-6
.form-group
=
form
.
label
:due_date
,
"Due date"
,
class:
"control-label"
.col-sm-10
.issuable-form-select-holder
=
form
.
text_field
:due_date
,
id:
"issuable-due-date"
,
class:
"datepicker form-control"
,
placeholder:
"Select due date"
app/views/shared/issuable/form/_weight.html.haml
0 → 100644
View file @
c49d5673
-
issuable
=
local_assigns
.
fetch
(
:issuable
)
-
return
unless
issuable
.
respond_to?
(
:weight
)
-
has_due_date
=
issuable
.
has_attribute?
(
:due_date
)
-
form
=
local_assigns
.
fetch
(
:form
)
.form-group
=
form
.
label
:label_ids
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
do
Weight
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
-
if
issuable
.
weight
=
form
.
hidden_field
:weight
=
weight_dropdown_tag
(
issuable
,
toggle_class:
'js-issuable-form-weight'
)
do
%ul
-
Issue
.
weight_options
.
each
do
|
weight
|
%li
%a
{
href:
'#'
,
data:
{
id:
weight
,
none:
weight
===
Issue
::
WEIGHT_NONE
},
class:
(
"is-active"
if
issuable
.
weight
==
weight
)
}
=
weight
doc/development/limit_ee_conflicts.md
View file @
c49d5673
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