Browse Source

Merge branch 'master' of github.com:tracim/tracim_front

AlexiCauvin 7 years ago
parent
commit
64863d24d3
1 changed files with 5 additions and 9 deletions
  1. 5 9
      src/container/Sidebar.jsx

+ 5 - 9
src/container/Sidebar.jsx View File

41
   handleClickWorkspace = (wsId, newIsOpenInSidebar) => this.props.dispatch(setWorkspaceListIsOpenInSidebar(wsId, newIsOpenInSidebar))
41
   handleClickWorkspace = (wsId, newIsOpenInSidebar) => this.props.dispatch(setWorkspaceListIsOpenInSidebar(wsId, newIsOpenInSidebar))
42
 
42
 
43
   handleClickAllContent = wsId => {
43
   handleClickAllContent = wsId => {
44
+    this.props.dispatch(updateWorkspaceFilter([]))
45
+
44
     this.props.history.push(`${PAGE_NAME.WS_CONTENT}/${wsId}`)
46
     this.props.history.push(`${PAGE_NAME.WS_CONTENT}/${wsId}`)
45
   }
47
   }
46
 
48
 
47
   handleClickContentFilter = (wsId, filter) => {
49
   handleClickContentFilter = (wsId, filter) => {
48
-    const { workspaceIdInUrl } = this.state
49
     const { workspace, history, dispatch } = this.props
50
     const { workspace, history, dispatch } = this.props
50
 
51
 
51
-    const filterList = (() => {
52
-      if (wsId !== workspaceIdInUrl) return [filter] // load a different workspace => reset filters
53
-
54
-      if (workspace.filter.includes(filter)) return workspace.filter.filter(f => f !== filter) // remove the filter
55
-      else return [...workspace.filter, filter] // add the filter
56
-    })()
52
+    const newFilter = workspace.filter.includes(filter) ? [] : [filter] // use an array to allow multiple filters (NYI)
57
 
53
 
58
-    dispatch(updateWorkspaceFilter(filterList))
54
+    dispatch(updateWorkspaceFilter(newFilter))
59
 
55
 
60
-    history.push(`${PAGE_NAME.WS_CONTENT}/${wsId}/${filterList.join(';')}`) // workspace.filter gets updated on react redraw from match.params
56
+    history.push(`${PAGE_NAME.WS_CONTENT}/${wsId}/${newFilter.join(';')}`) // workspace.filter gets updated on react redraw from match.params
61
   }
57
   }
62
 
58
 
63
   handleClickToggleSidebar = () => this.setState(prev => ({sidebarClose: !prev.sidebarClose}))
59
   handleClickToggleSidebar = () => this.setState(prev => ({sidebarClose: !prev.sidebarClose}))