Skip to content

Commit

Permalink
Automatically expand task in project if there's a single task
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Nov 6, 2023
1 parent 8976aa5 commit 5fc8860
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/static/app/js/components/TaskList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import '../css/TaskList.scss';
import TaskListItem from './TaskListItem';
import PropTypes from 'prop-types';
import $ from 'jquery';
import HistoryNav from '../classes/HistoryNav';
import { _, interpolate } from '../classes/gettext';

class TaskList extends React.Component {
Expand All @@ -19,6 +20,8 @@ class TaskList extends React.Component {
constructor(props){
super(props);

this.historyNav = new HistoryNav(props.history);

this.state = {
tasks: [],
error: "",
Expand Down Expand Up @@ -54,6 +57,10 @@ class TaskList extends React.Component {

this.taskListRequest =
$.getJSON(this.props.source, json => {
if (json.length === 1){
this.historyNav.addToQSList("project_task_expanded", json[0].id);
}

this.setState({
tasks: json
});
Expand All @@ -67,7 +74,7 @@ class TaskList extends React.Component {
.always(() => {
this.setState({
loading: false
})
});
});
}

Expand Down

0 comments on commit 5fc8860

Please sign in to comment.