Commit a88097b1 authored by Kushal Pandya's avatar Kushal Pandya Committed by Jarka Kadlecová

[ci skip] Update todos dropdown

parent f7de209a
...@@ -39,6 +39,7 @@ export default class Todos { ...@@ -39,6 +39,7 @@ export default class Todos {
} }
initFilters() { initFilters() {
this.initFilterDropdown($('.js-group-search'), 'group_id', ['text']);
this.initFilterDropdown($('.js-project-search'), 'project_id', ['text']); this.initFilterDropdown($('.js-project-search'), 'project_id', ['text']);
this.initFilterDropdown($('.js-type-search'), 'type'); this.initFilterDropdown($('.js-type-search'), 'type');
this.initFilterDropdown($('.js-action-search'), 'action_id'); this.initFilterDropdown($('.js-action-search'), 'action_id');
...@@ -47,6 +48,7 @@ export default class Todos { ...@@ -47,6 +48,7 @@ export default class Todos {
} }
initFilterDropdown($dropdown, fieldName, searchFields) { initFilterDropdown($dropdown, fieldName, searchFields) {
if ($dropdown.length) {
$dropdown.glDropdown({ $dropdown.glDropdown({
fieldName, fieldName,
selectable: true, selectable: true,
...@@ -56,6 +58,7 @@ export default class Todos { ...@@ -56,6 +58,7 @@ export default class Todos {
clicked: () => $dropdown.closest('form.filter-form').submit(), clicked: () => $dropdown.closest('form.filter-form').submit(),
}); });
} }
}
updateRowStateClicked(e) { updateRowStateClicked(e) {
e.stopPropagation(); e.stopPropagation();
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
isAddTodo: { isTodo: {
type: Boolean, type: Boolean,
required: false, required: false,
default: true, default: true,
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
}, },
data() { data() {
return { return {
isButtonTypeAddTodo: this.isAddTodo, isButtonTypeTodo: this.isTodo,
isActionActive: false, isActionActive: false,
}; };
}, },
...@@ -49,13 +49,13 @@ export default { ...@@ -49,13 +49,13 @@ export default {
'btn btn-default btn-todo issuable-header-btn float-right'; 'btn btn-default btn-todo issuable-header-btn float-right';
}, },
buttonLabel() { buttonLabel() {
return this.isButtonTypeAddTodo ? MARK_TEXT : TODO_TEXT; return this.isButtonTypeTodo ? MARK_TEXT : TODO_TEXT;
}, },
collapsedButtonIconClasses() { collapsedButtonIconClasses() {
return this.isButtonTypeAddTodo ? 'todo-undone' : ''; return this.isButtonTypeTodo ? 'todo-undone' : '';
}, },
collapsedButtonIcon() { collapsedButtonIcon() {
return this.isButtonTypeAddTodo ? 'check-circle' : 'plus-square'; return this.isButtonTypeTodo ? 'check-circle' : 'plus-square';
}, },
}, },
}; };
......
...@@ -102,6 +102,10 @@ ...@@ -102,6 +102,10 @@
type: Boolean, type: Boolean,
required: true, required: true,
}, },
todoExists: {
type: Boolean,
required: true,
},
namespace: { namespace: {
type: String, type: String,
required: false, required: false,
...@@ -182,6 +186,7 @@ ...@@ -182,6 +186,7 @@
:initial-labels="labels" :initial-labels="labels"
:initial-participants="participants" :initial-participants="participants"
:initial-subscribed="subscribed" :initial-subscribed="subscribed"
:initial-todo-exists="todoExists"
:namespace="namespace" :namespace="namespace"
:update-path="updateEndpoint" :update-path="updateEndpoint"
:labels-path="labelsPath" :labels-path="labelsPath"
......
...@@ -10,6 +10,7 @@ export default () => { ...@@ -10,6 +10,7 @@ export default () => {
// Convert backend casing to match frontend style guide // Convert backend casing to match frontend style guide
props.epicId = props.epic_id; props.epicId = props.epic_id;
props.todoExists = props.todo_exists;
props.startDate = props.start_date; props.startDate = props.start_date;
props.endDate = props.end_date; props.endDate = props.end_date;
......
...@@ -61,6 +61,10 @@ export default { ...@@ -61,6 +61,10 @@ export default {
type: Boolean, type: Boolean,
required: true, required: true,
}, },
initialTodoExists: {
type: Boolean,
required: true,
},
namespace: { namespace: {
type: String, type: String,
required: false, required: false,
...@@ -222,6 +226,7 @@ export default { ...@@ -222,6 +226,7 @@ export default {
v-if="!collapsed" v-if="!collapsed"
:collapsed="collapsed" :collapsed="collapsed"
:issuable-id="epicId" :issuable-id="epicId"
:is-todo="initialTodoExists"
issuable-type="epic" issuable-type="epic"
/> />
</div> </div>
...@@ -232,6 +237,7 @@ export default { ...@@ -232,6 +237,7 @@ export default {
<sidebar-todo <sidebar-todo
:collapsed="collapsed" :collapsed="collapsed"
:issuable-id="epicId" :issuable-id="epicId"
:is-todo="initialTodoExists"
issuable-type="epic" issuable-type="epic"
/> />
</div> </div>
......
...@@ -14,7 +14,7 @@ module EE ...@@ -14,7 +14,7 @@ module EE
return default_label if group_id.nil? return default_label if group_id.nil?
return "Any group" if group_id == "0" return "Any group" if group_id == "0"
group = Group.find_by(id: group_id) group = ::Group.find_by(id: group_id)
if group if group
group.full_name group.full_name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment