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
Kazuhiko Shiozaki
gitlab-ce
Commits
a9ea06ed
Commit
a9ea06ed
authored
Mar 09, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed ruby style errors
parent
f3afcb87
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
62 deletions
+96
-62
app/helpers/dropdowns_helper.rb
app/helpers/dropdowns_helper.rb
+75
-30
app/views/help/ui.html.haml
app/views/help/ui.html.haml
+3
-3
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+18
-29
No files found.
app/helpers/dropdowns_helper.rb
View file @
a9ea06ed
module
DropdownsHelper
def
dropdown_tag
(
toggle_text
,
id:
nil
,
toggle_class:
nil
,
dropdown_class:
nil
,
title:
false
,
filter:
false
,
placeholder:
""
,
footer_content:
false
,
data
:
{},
&
block
)
def
dropdown_tag
(
toggle_text
,
options
:
{},
&
block
)
content_tag
:div
,
class:
"dropdown"
do
toggle_hash
=
data
.
merge
({
toggle:
"dropdown"
})
data_attr
=
{
toggle:
"dropdown"
}
dropdown_output
=
""
dropdown_output
+=
content_tag
:button
,
class:
"dropdown-menu-toggle
#{
toggle_class
}
"
,
id:
id
,
type:
"button"
,
data:
toggle_hash
do
output
=
content_tag
(
:span
,
toggle_text
,
class:
"dropdown-toggle-text"
)
output
<<
icon
(
'chevron-down'
)
output
.
html_safe
if
options
.
has_key?
(
:data
)
data_attr
=
options
[
:data
].
merge
(
data_attr
)
end
dropdown_output
+=
content_tag
:div
,
class:
"dropdown-menu dropdown-select
#{
dropdown_class
}
"
do
output
=
""
dropdown_output
=
dropdown_toggle
(
toggle_text
,
data_attr
,
options
)
if
title
output
+=
content_tag
:div
,
class:
"dropdown-title"
do
title_output
=
content_tag
(
:span
,
title
)
dropdown_output
<<
content_tag
(
:div
,
class:
"dropdown-menu dropdown-select
#{
options
[
:dropdown_class
]
if
options
.
has_key?
(
:dropdown_class
)
}
"
)
do
output
=
""
title_output
+=
content_tag
:button
,
class:
"dropdown-title-button dropdown-menu-close"
,
aria:
{
label:
"close"
},
type:
"button"
do
icon
(
'times'
)
end
.
html_safe
end
if
options
.
has_key?
(
:title
)
output
<<
dropdown_title
(
options
[
:title
])
end
if
filter
output
+=
content_tag
:div
,
class:
"dropdown-input"
do
filter_output
=
search_field_tag
nil
,
nil
,
class:
"dropdown-input-field"
,
placeholder:
placeholder
filter_output
+=
icon
(
'search'
)
filter_output
.
html_safe
end
if
options
.
has_key?
(
:filter
)
output
<<
dropdown_filter
(
options
[
:placeholder
])
end
output
+=
content_tag
:div
,
class:
"dropdown-content"
do
capture
(
&
block
)
if
block
&&
!
footer_content
output
<<
content_tag
(
:div
,
class:
"dropdown-content"
)
do
capture
(
&
block
)
if
block
&&
!
options
.
has_key?
(
:footer_content
)
end
if
block
&&
footer_content
output
+=
content_tag
:div
,
class:
"dropdown-footer"
do
if
block
&&
options
.
has_key?
(
:footer_content
)
output
<<
content_tag
(
:div
,
class:
"dropdown-footer"
)
do
capture
(
&
block
)
end
end
output
+=
content_tag
:div
,
class:
"dropdown-loading"
do
icon
(
'spinner spin'
)
end
output
<<
dropdown_loading
output
.
html_safe
end
...
...
@@ -52,4 +38,63 @@ module DropdownsHelper
dropdown_output
.
html_safe
end
end
def
dropdown_toggle
(
toggle_text
,
data_attr
,
options
)
content_tag
(
:button
,
class:
"dropdown-menu-toggle
#{
options
[
:toggle_class
]
if
options
.
has_key?
(
:toggle_class
)
}
"
,
id:
(
options
[
:id
]
if
options
.
has_key?
(
:id
)),
type:
"button"
,
data:
data_attr
)
do
output
=
content_tag
(
:span
,
toggle_text
,
class:
"dropdown-toggle-text"
)
output
<<
icon
(
'chevron-down'
)
output
.
html_safe
end
end
def
dropdown_title
(
title
,
back:
false
)
content_tag
:div
,
class:
"dropdown-title"
do
title_output
=
""
if
back
title_output
<<
content_tag
(
:button
,
class:
"dropdown-title-button dropdown-menu-back"
,
aria:
{
label:
"Go back"
},
type:
"button"
)
do
icon
(
'arrow-left'
)
end
end
title_output
<<
content_tag
(
:span
,
title
)
title_output
<<
content_tag
(
:button
,
class:
"dropdown-title-button dropdown-menu-close"
,
aria:
{
label:
"Close"
},
type:
"button"
)
do
icon
(
'times'
)
end
title_output
.
html_safe
end
end
def
dropdown_filter
(
placeholder
)
content_tag
:div
,
class:
"dropdown-input"
do
filter_output
=
search_field_tag
nil
,
nil
,
class:
"dropdown-input-field"
,
placeholder:
placeholder
filter_output
<<
icon
(
'search'
)
filter_output
.
html_safe
end
end
def
dropdown_content
(
&
block
)
content_tag
(
:div
,
class:
"dropdown-content"
)
do
if
block
capture
(
&
block
)
end
end
end
def
dropdown_footer
(
&
block
)
content_tag
(
:div
,
class:
"dropdown-footer"
)
do
if
block
capture
(
&
block
)
end
end
end
def
dropdown_loading
content_tag
:div
,
class:
"dropdown-loading"
do
icon
(
'spinner spin'
)
end
end
end
app/views/help/ui.html.haml
View file @
a9ea06ed
...
...
@@ -409,8 +409,8 @@
=
icon
(
'spinner spin'
)
:javascript
$
(
'
#js-project-dropdown
'
).
glDropdown
({
data
:
function
(
callback
)
{
Api
.
projects
(
""
,
"
last_activity_at
"
,
function
(
data
)
{
data
:
function
(
term
,
callback
)
{
Api
.
projects
(
term
,
"
last_activity_at
"
,
function
(
data
)
{
callback
(
data
);
});
},
...
...
@@ -433,7 +433,7 @@
.example
%div
=
dropdown_tag
(
"Projects"
,
title:
"Go to project"
,
filter:
true
,
placeholder:
"Filter projects"
)
=
dropdown_tag
(
"Projects"
,
options:
{
title:
"Go to project"
,
filter:
true
,
placeholder:
"Filter projects"
}
)
%h2
#panels
Panels
...
...
app/views/shared/issuable/_filter.html.haml
View file @
a9ea06ed
...
...
@@ -9,20 +9,20 @@
.filter-item.inline
-
if
params
[
:author_id
]
=
hidden_field_tag
(
:author_id
,
params
[
:author_id
])
=
dropdown_tag
(
"Author"
,
toggle_class:
"js-user-search js-filter-submit"
,
title:
"Filter by author"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search authors"
,
data:
{
any_user:
"Any Author"
,
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
selected:
params
[
:author_id
],
field_name:
"author_id"
})
=
dropdown_tag
(
"Author"
,
options:
{
toggle_class:
"js-user-search js-filter-submit"
,
title:
"Filter by author"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search authors"
,
data:
{
any_user:
"Any Author"
,
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
selected:
params
[
:author_id
],
field_name:
"author_id"
}
})
.filter-item.inline
-
if
params
[
:assignee_id
]
=
hidden_field_tag
(
:assignee_id
,
params
[
:assignee_id
])
=
dropdown_tag
(
"Assignee"
,
toggle_class:
"js-user-search js-filter-submit"
,
title:
"Filter by assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search assignee"
,
data:
{
any_user:
"Any Author"
,
first_user:
true
,
null_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
selected:
params
[
:assignee_id
],
field_name:
"assignee_id"
})
=
dropdown_tag
(
"Assignee"
,
options:
{
toggle_class:
"js-user-search js-filter-submit"
,
title:
"Filter by assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search assignee"
,
data:
{
any_user:
"Any Author"
,
first_user:
true
,
null_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
selected:
params
[
:assignee_id
],
field_name:
"assignee_id"
}
})
.filter-item.inline.milestone-filter
-
if
params
[
:milestone_title
]
=
hidden_field_tag
(
:milestone_title
,
params
[
:milestone_title
])
=
dropdown_tag
(
"Milestone"
,
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
@project
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
)
})
do
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
@project
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
)
}
})
do
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_milestone
,
@project
%li
...
...
@@ -45,16 +45,10 @@
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
.dropdown-page-one
.dropdown-title
%span
Filter by label
%button
.dropdown-title-button.dropdown-menu-close
{
type:
"button"
,
aria:
{
label:
"close"
}}
=
icon
(
'times'
)
.dropdown-input
=
search_field_tag
nil
,
nil
,
class:
"dropdown-input-field"
,
placeholder:
"Search labels"
=
icon
(
'search'
)
.dropdown-content
.dropdown-footer
=
dropdown_title
(
"Filter by label"
)
=
dropdown_filter
(
"Search labels"
)
=
dropdown_content
=
dropdown_footer
do
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_label
,
@project
%li
...
...
@@ -68,14 +62,8 @@
View labels
-
if
can?
current_user
,
:admin_label
,
@project
.dropdown-page-two
.dropdown-title
%button
.dropdown-title-button.dropdown-menu-back
{
aria:
{
label:
"Go back"
}}
=
icon
(
'arrow-left'
)
%span
Create new label
%button
.dropdown-title-button.dropdown-menu-close
{
type:
"button"
,
aria:
{
label:
"close"
}}
=
icon
(
'times'
)
.dropdown-content
=
dropdown_title
(
"Create new label"
,
back:
true
)
=
dropdown_content
do
%input
#new_label_color
{
type:
"hidden"
}
%input
#new_label_name
.dropdown-input-field
{
type:
"text"
,
placeholder:
"Name new label"
}
.dropdown-label-color-preview.js-dropdown-label-color-preview
...
...
@@ -85,6 +73,7 @@
&
nbsp
%button
.btn.btn-primary.js-new-label-btn
{
type:
"button"
}
Create
=
dropdown_loading
.dropdown-loading
=
icon
(
'spinner spin'
)
...
...
@@ -95,18 +84,18 @@
.issues_bulk_update.hide
=
form_tag
bulk_update_namespace_project_issues_path
(
@project
.
namespace
,
@project
),
method: :post
do
.filter-item.inline
=
dropdown_tag
(
"Status"
,
toggle_class:
"js-issue-status"
,
title:
"Change status"
,
dropdown_class:
"dropdown-menu-selectable"
,
data:
{
field_name:
"update[state_event]"
}
)
do
=
dropdown_tag
(
"Status"
,
options:
{
toggle_class:
"js-issue-status"
,
title:
"Change status"
,
dropdown_class:
"dropdown-menu-selectable"
,
data:
{
field_name:
"update[state_event]"
}
}
)
do
%ul
%li
%a
{
href:
"#"
,
data:
{
id:
"reopen"
}}
Open
%li
%a
{
href:
"#"
,
data:
{
id:
"close"
}}
Closed
.filter-item.inline
=
dropdown_tag
(
"Assignee"
,
toggle_class:
"js-user-search"
,
title:
"Assign to"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search authors"
,
data:
{
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
field_name:
"update[assignee_id]"
})
=
dropdown_tag
(
"Assignee"
,
options:
{
toggle_class:
"js-user-search"
,
title:
"Assign to"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search authors"
,
data:
{
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
field_name:
"update[assignee_id]"
}
})
.filter-item.inline
=
dropdown_tag
(
"Milestone"
,
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"update[milestone_id]"
,
project_id:
@project
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
),
use_id:
true
})
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"update[milestone_id]"
,
project_id:
@project
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
),
use_id:
true
}
})
=
hidden_field_tag
'update[issues_ids]'
,
[]
=
hidden_field_tag
:state_event
,
params
[
:state_event
]
.filter-item.inline
...
...
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