Skip to content
Snippets Groups Projects
Commit f7f59593 authored by Tom Robinson's avatar Tom Robinson Committed by GitHub
Browse files

Merge pull request #4053 from metabase/collections-fixes

Collections fixes
parents 2d8d5934 a3f8f519
No related branches found
No related tags found
No related merge requests found
import { createAction, createThunkAction, handleActions, combineReducers } from "metabase/lib/redux"; import { createAction, createThunkAction, handleActions, combineReducers } from "metabase/lib/redux";
import { reset } from 'redux-form'; import { reset } from 'redux-form';
import { goBack } from "react-router-redux"; import { push } from "react-router-redux";
import Urls from "metabase/lib/urls";
import _ from "underscore"; import _ from "underscore";
...@@ -36,7 +37,7 @@ export const saveCollection = createThunkAction(SAVE_COLLECTION, (collection) => ...@@ -36,7 +37,7 @@ export const saveCollection = createThunkAction(SAVE_COLLECTION, (collection) =>
if (response.id != null) { if (response.id != null) {
dispatch(reset("collection")); dispatch(reset("collection"));
} }
dispatch(goBack()) dispatch(push(Urls.collection(response)));
return response; return response;
} catch (e) { } catch (e) {
// redux-form expects an object with either { field: error } or { _error: error } // redux-form expects an object with either { field: error } or { _error: error }
......
...@@ -29,9 +29,11 @@ class CollectionButton extends Component { ...@@ -29,9 +29,11 @@ class CollectionButton extends Component {
} }
render () { render () {
const { id, name, color, slug, isAdmin, push } = this.props; const { id, name, color, slug, isAdmin } = this.props;
return ( return (
<div <Link
to={`/questions/collections/${slug}`}
className="no-decoration"
onMouseEnter={() => this.setState({ hovered: true })} onMouseEnter={() => this.setState({ hovered: true })}
onMouseLeave={() => this.setState({ hovered: false })} onMouseLeave={() => this.setState({ hovered: false })}
> >
...@@ -43,7 +45,6 @@ class CollectionButton extends Component { ...@@ -43,7 +45,6 @@ class CollectionButton extends Component {
borderRadius: 10, borderRadius: 10,
backgroundColor: this.state.hovered ? color : '#fafafa' backgroundColor: this.state.hovered ? color : '#fafafa'
}} }}
onClick={() => push(`/questions/collections/${slug}`)}
> >
{ isAdmin && { isAdmin &&
<div className="absolute top right mt2 mr2 hover-child"> <div className="absolute top right mt2 mr2 hover-child">
...@@ -61,7 +62,7 @@ class CollectionButton extends Component { ...@@ -61,7 +62,7 @@ class CollectionButton extends Component {
/> />
<h3>{ name }</h3> <h3>{ name }</h3>
</div> </div>
</div> </Link>
) )
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment