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
Tatuya Kamada
gitlab-ce
Commits
beff8b9b
Commit
beff8b9b
authored
Aug 27, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swapped out author dropdown and started on swapping out project dropdown
parent
433d8a10
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
27 deletions
+46
-27
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+1
-0
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+13
-0
app/helpers/todos_helper.rb
app/helpers/todos_helper.rb
+10
-16
app/views/dashboard/todos/index.html.haml
app/views/dashboard/todos/index.html.haml
+22
-11
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
beff8b9b
...
...
@@ -202,6 +202,7 @@
var
ref
,
ref1
,
ref2
,
ref3
,
searchFields
,
selector
,
self
;
this
.
el
=
el1
;
this
.
options
=
options
;
console
.
log
(
this
.
options
);
this
.
updateLabel
=
bind
(
this
.
updateLabel
,
this
);
this
.
hidden
=
bind
(
this
.
hidden
,
this
);
this
.
opened
=
bind
(
this
.
opened
,
this
);
...
...
app/helpers/issuables_helper.rb
View file @
beff8b9b
...
...
@@ -49,6 +49,19 @@ module IssuablesHelper
end
end
def
project_dropdown_label
(
project_id
,
default_label
)
return
default_label
if
project_id
.
nil?
return
"Any project"
if
project_id
==
"0"
project
=
Project
.
find_by
(
id:
project_id
)
if
project
project
.
name_with_namespace
||
project
.
name
else
default_label
end
end
def
milestone_dropdown_label
(
milestone_title
,
default_label
=
"Milestone"
)
if
milestone_title
==
Milestone
::
Upcoming
.
name
milestone_title
=
Milestone
::
Upcoming
.
title
...
...
app/helpers/todos_helper.rb
View file @
beff8b9b
...
...
@@ -78,13 +78,11 @@ module TodosHelper
end
def
todo_actions_options
actions
=
[
OpenStruct
.
new
(
id:
''
,
title:
'Any Action'
)
,
OpenStruct
.
new
(
id:
Todo
::
ASSIGNED
,
title:
'Assigned'
)
,
OpenStruct
.
new
(
id:
Todo
::
MENTIONED
,
title:
'Mentioned'
)
[
{
id:
''
,
text:
'Any Action'
}
,
{
id:
Todo
::
ASSIGNED
,
text:
'Assigned'
}
,
{
id:
Todo
::
MENTIONED
,
text:
'Mentioned'
}
]
options_from_collection_for_select
(
actions
,
'id'
,
'title'
,
params
[
:action_id
])
end
def
todo_projects_options
...
...
@@ -92,22 +90,18 @@ module TodosHelper
projects
=
projects
.
includes
(
:namespace
)
projects
=
projects
.
map
do
|
project
|
OpenStruct
.
new
(
id:
project
.
id
,
title:
project
.
name_with_namespace
)
{
id:
project
.
id
,
text:
project
.
name_with_namespace
}
end
projects
.
unshift
(
OpenStruct
.
new
(
id:
''
,
title:
'Any Project'
))
options_from_collection_for_select
(
projects
,
'id'
,
'title'
,
params
[
:project_id
])
projects
.
unshift
({
id:
''
,
text:
'Any Project'
}).
to_json
end
def
todo_types_options
types
=
[
OpenStruct
.
new
(
title:
'Any Type'
,
name:
''
)
,
OpenStruct
.
new
(
title:
'Issue'
,
name:
'Issue'
)
,
OpenStruct
.
new
(
title:
'Merge Request'
,
name:
'MergeRequest'
)
[
{
text:
'Any Type'
,
id:
''
}
,
{
text:
'Issue'
,
id:
'Issue'
}
,
{
text:
'Merge Request'
,
id:
'MergeRequest'
}
]
options_from_collection_for_select
(
types
,
'name'
,
'title'
,
params
[
:type
])
end
private
...
...
app/views/dashboard/todos/index.html.haml
View file @
beff8b9b
...
...
@@ -28,20 +28,23 @@
.row-content-block.second-block
=
form_tag
todos_filter_path
(
without:
[
:project_id
,
:author_id
,
:type
,
:action_id
]),
method: :get
,
class:
'filter-form'
do
.filter-item.inline
=
select_tag
(
'project_id'
,
todo_projects_options
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Project'
})
-
if
params
[
:project_id
].
present?
=
hidden_field_tag
(
:project_id
,
params
[
:project_id
])
=
dropdown_tag
(
project_dropdown_label
(
params
[
:project_id
],
'Project'
),
options:
{
toggle_class:
'js-project-search js-filter-submit'
,
title:
'Filter by project'
,
filter:
true
,
filterInput:
'input#search'
,
dropdown_class:
'dropdown-menu-selectable dropdown-menu-project js-filter-submit'
,
placeholder:
'Search projects'
,
data:
{
data:
todo_projects_options
,
selected:
params
[
:project_id
],
field_name:
'project_id'
,
default_label:
'Project'
}
})
.filter-item.inline
=
users_select_tag
(
:author_id
,
selected:
params
[
:author_id
],
placeholder:
'Author'
,
class:
'trigger-submit'
,
any_user:
"Any Author"
,
first_user:
true
,
current_user:
true
)
-
if
params
[
:author_id
].
present?
=
hidden_field_tag
(
:author_id
,
params
[
:author_id
])
=
dropdown_tag
(
user_dropdown_label
(
params
[
:author_id
],
'Author'
),
options:
{
toggle_class:
'js-user-search js-filter-submit js-author-search'
,
title:
'Filter by author'
,
filter:
true
,
filterInput:
'input#search'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author js-filter-submit'
,
placeholder:
'Search authors'
,
data:
{
any_user:
'Any Author'
,
first_user:
(
current_user
.
username
if
current_user
),
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
selected:
params
[
:author_id
],
field_name:
'author_id'
,
default_label:
'Author'
}
})
.filter-item.inline
=
select_tag
(
'type'
,
todo_types_options
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Type'
})
-#
= select_tag('type', todo_types_options,
-#
class: 'select2 trigger-submit', include_blank: true,
-#
data: {placeholder: 'Type'})
.filter-item.inline.actions-filter
=
select_tag
(
'action_id'
,
todo_actions_options
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Action'
})
-#
= select_tag('action_id', todo_actions_options,
-#
class: 'select2 trigger-submit', include_blank: true,
-#
data: {placeholder: 'Action'})
.pull-right
.dropdown.inline.prepend-left-10
...
...
@@ -80,6 +83,14 @@
:javascript
new
UsersSelect
();
$projectDropdown
=
$
(
'
.js-project-search
'
);
$projectDropdown
.
glDropdown
({
filterable
:
true
,
selectable
:
true
,
fieldName
:
'
project_id
'
,
data
:
$projectDropdown
.
data
(
'
data
'
)
});
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
event
.
preventDefault
();
Turbolinks
.
visit
(
this
.
action
+
'
&
'
+
$
(
this
).
serialize
());
...
...
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