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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
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
content_tag
:div
,
class:
"dropdown"
do
toggle_hash
=
data
.
merge
({
toggle:
"dropdown"
})
data_attr
=
{
toggle:
"dropdown"
}
dropdown_output
=
""
if
options
.
has_key?
(
:data
)
dropdown_output
+=
content_tag
:button
,
class:
"dropdown-menu-toggle
#{
toggle_class
}
"
,
id:
id
,
type:
"button"
,
data:
toggle_hash
do
data_attr
=
options
[
:data
].
merge
(
data_attr
)
output
=
content_tag
(
:span
,
toggle_text
,
class:
"dropdown-toggle-text"
)
output
<<
icon
(
'chevron-down'
)
output
.
html_safe
end
end
dropdown_output
+=
content_tag
:div
,
class:
"dropdown-menu dropdown-select
#{
dropdown_class
}
"
do
dropdown_output
=
dropdown_toggle
(
toggle_text
,
data_attr
,
options
)
output
=
""
if
title
dropdown_output
<<
content_tag
(
:div
,
class:
"dropdown-menu dropdown-select
#{
options
[
:dropdown_class
]
if
options
.
has_key?
(
:dropdown_class
)
}
"
)
do
output
+=
content_tag
:div
,
class:
"dropdown-title"
do
output
=
""
title_output
=
content_tag
(
:span
,
title
)
title_output
+=
content_tag
:button
,
class:
"dropdown-title-button dropdown-menu-close"
,
aria:
{
label:
"close"
},
type:
"button"
do
if
options
.
has_key?
(
:title
)
icon
(
'times'
)
output
<<
dropdown_title
(
options
[
:title
])
end
.
html_safe
end
end
end
if
filter
if
options
.
has_key?
(
:filter
)
output
+=
content_tag
:div
,
class:
"dropdown-input"
do
output
<<
dropdown_filter
(
options
[
:placeholder
])
filter_output
=
search_field_tag
nil
,
nil
,
class:
"dropdown-input-field"
,
placeholder:
placeholder
filter_output
+=
icon
(
'search'
)
filter_output
.
html_safe
end
end
end
output
+=
content_tag
:div
,
class:
"dropdown-content"
do
output
<<
content_tag
(
:div
,
class:
"dropdown-content"
)
do
capture
(
&
block
)
if
block
&&
!
footer_content
capture
(
&
block
)
if
block
&&
!
options
.
has_key?
(
:footer_content
)
end
end
if
block
&&
footer_content
if
block
&&
options
.
has_key?
(
:footer_content
)
output
+=
content_tag
:div
,
class:
"dropdown-footer"
do
output
<<
content_tag
(
:div
,
class:
"dropdown-footer"
)
do
capture
(
&
block
)
capture
(
&
block
)
end
end
end
end
output
+=
content_tag
:div
,
class:
"dropdown-loading"
do
output
<<
dropdown_loading
icon
(
'spinner spin'
)
end
output
.
html_safe
output
.
html_safe
end
end
...
@@ -52,4 +38,63 @@ module DropdownsHelper
...
@@ -52,4 +38,63 @@ module DropdownsHelper
dropdown_output
.
html_safe
dropdown_output
.
html_safe
end
end
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
end
app/views/help/ui.html.haml
View file @
a9ea06ed
...
@@ -409,8 +409,8 @@
...
@@ -409,8 +409,8 @@
=
icon
(
'spinner spin'
)
=
icon
(
'spinner spin'
)
:javascript
:javascript
$
(
'
#js-project-dropdown
'
).
glDropdown
({
$
(
'
#js-project-dropdown
'
).
glDropdown
({
data
:
function
(
callback
)
{
data
:
function
(
term
,
callback
)
{
Api
.
projects
(
""
,
"
last_activity_at
"
,
function
(
data
)
{
Api
.
projects
(
term
,
"
last_activity_at
"
,
function
(
data
)
{
callback
(
data
);
callback
(
data
);
});
});
},
},
...
@@ -433,7 +433,7 @@
...
@@ -433,7 +433,7 @@
.example
.example
%div
%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
%h2
#panels
Panels
...
...
app/views/shared/issuable/_filter.html.haml
View file @
a9ea06ed
...
@@ -9,20 +9,20 @@
...
@@ -9,20 +9,20 @@
.filter-item.inline
.filter-item.inline
-
if
params
[
:author_id
]
-
if
params
[
:author_id
]
=
hidden_field_tag
(
:author_id
,
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"
,
=
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"
})
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
.filter-item.inline
-
if
params
[
:assignee_id
]
-
if
params
[
:assignee_id
]
=
hidden_field_tag
(
:assignee_id
,
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"
,
=
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"
})
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
.filter-item.inline.milestone-filter
-
if
params
[
:milestone_title
]
-
if
params
[
:milestone_title
]
=
hidden_field_tag
(
:milestone_title
,
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"
,
=
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
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
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_milestone
,
@project
-
if
can?
current_user
,
:admin_milestone
,
@project
%li
%li
...
@@ -45,16 +45,10 @@
...
@@ -45,16 +45,10 @@
=
icon
(
'chevron-down'
)
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
.dropdown-page-one
.dropdown-page-one
.dropdown-title
=
dropdown_title
(
"Filter by label"
)
%span
=
dropdown_filter
(
"Search labels"
)
Filter by label
=
dropdown_content
%button
.dropdown-title-button.dropdown-menu-close
{
type:
"button"
,
aria:
{
label:
"close"
}}
=
dropdown_footer
do
=
icon
(
'times'
)
.dropdown-input
=
search_field_tag
nil
,
nil
,
class:
"dropdown-input-field"
,
placeholder:
"Search labels"
=
icon
(
'search'
)
.dropdown-content
.dropdown-footer
%ul
.dropdown-footer-list
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_label
,
@project
-
if
can?
current_user
,
:admin_label
,
@project
%li
%li
...
@@ -68,14 +62,8 @@
...
@@ -68,14 +62,8 @@
View labels
View labels
-
if
can?
current_user
,
:admin_label
,
@project
-
if
can?
current_user
,
:admin_label
,
@project
.dropdown-page-two
.dropdown-page-two
.dropdown-title
=
dropdown_title
(
"Create new label"
,
back:
true
)
%button
.dropdown-title-button.dropdown-menu-back
{
aria:
{
label:
"Go back"
}}
=
dropdown_content
do
=
icon
(
'arrow-left'
)
%span
Create new label
%button
.dropdown-title-button.dropdown-menu-close
{
type:
"button"
,
aria:
{
label:
"close"
}}
=
icon
(
'times'
)
.dropdown-content
%input
#new_label_color
{
type:
"hidden"
}
%input
#new_label_color
{
type:
"hidden"
}
%input
#new_label_name
.dropdown-input-field
{
type:
"text"
,
placeholder:
"Name new label"
}
%input
#new_label_name
.dropdown-input-field
{
type:
"text"
,
placeholder:
"Name new label"
}
.dropdown-label-color-preview.js-dropdown-label-color-preview
.dropdown-label-color-preview.js-dropdown-label-color-preview
...
@@ -85,6 +73,7 @@
...
@@ -85,6 +73,7 @@
&
nbsp
&
nbsp
%button
.btn.btn-primary.js-new-label-btn
{
type:
"button"
}
%button
.btn.btn-primary.js-new-label-btn
{
type:
"button"
}
Create
Create
=
dropdown_loading
.dropdown-loading
.dropdown-loading
=
icon
(
'spinner spin'
)
=
icon
(
'spinner spin'
)
...
@@ -95,18 +84,18 @@
...
@@ -95,18 +84,18 @@
.issues_bulk_update.hide
.issues_bulk_update.hide
=
form_tag
bulk_update_namespace_project_issues_path
(
@project
.
namespace
,
@project
),
method: :post
do
=
form_tag
bulk_update_namespace_project_issues_path
(
@project
.
namespace
,
@project
),
method: :post
do
.filter-item.inline
.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
%ul
%li
%li
%a
{
href:
"#"
,
data:
{
id:
"reopen"
}}
Open
%a
{
href:
"#"
,
data:
{
id:
"reopen"
}}
Open
%li
%li
%a
{
href:
"#"
,
data:
{
id:
"close"
}}
Closed
%a
{
href:
"#"
,
data:
{
id:
"close"
}}
Closed
.filter-item.inline
.filter-item.inline
=
dropdown_tag
(
"Assignee"
,
toggle_class:
"js-user-search"
,
title:
"Assign to"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
=
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]"
})
placeholder:
"Search authors"
,
data:
{
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
field_name:
"update[assignee_id]"
}
})
.filter-item.inline
.filter-item.inline
=
dropdown_tag
(
"Milestone"
,
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
=
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
})
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
'update[issues_ids]'
,
[]
=
hidden_field_tag
:state_event
,
params
[
:state_event
]
=
hidden_field_tag
:state_event
,
params
[
:state_event
]
.filter-item.inline
.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