Add 'send campaign' shortcut link to lists view

This commit is contained in:
Kailash Nadh 2019-03-28 18:18:26 +05:30
parent 3de7b3f560
commit baa618475b
2 changed files with 16 additions and 3 deletions

View File

@ -22,6 +22,7 @@ import Media from "./Media"
import ModalPreview from "./ModalPreview" import ModalPreview from "./ModalPreview"
import moment from "moment" import moment from "moment"
import parseUrl from "querystring"
import ReactQuill from "react-quill" import ReactQuill from "react-quill"
import Delta from "quill-delta" import Delta from "quill-delta"
import "react-quill/dist/quill.snow.css" import "react-quill/dist/quill.snow.css"
@ -374,7 +375,19 @@ class TheFormDef extends React.PureComponent {
return v.id !== 0 ? v.id : null return v.id !== 0 ? v.id : null
}) })
.filter(v => v !== null) .filter(v => v !== null)
} else if (this.props.route.location.search) {
// list_id in the query params.
const p = parseUrl.parse(this.props.route.location.search.substring(1))
if (p.hasOwnProperty("list_id")) {
// eslint-disable-next-line radix
const id = parseInt(p.list_id)
if (id) {
subLists.push(id)
} }
}
}
console.log(subLists)
if (this.record) { if (this.record) {
this.props.pageTitle(record.name + " / Campaigns") this.props.pageTitle(record.name + " / Campaigns")
@ -431,7 +444,7 @@ class TheFormDef extends React.PureComponent {
? subLists ? subLists
: this.props.data[cs.ModelLists].length === 1 : this.props.data[cs.ModelLists].length === 1
? [this.props.data[cs.ModelLists][0].id] ? [this.props.data[cs.ModelLists][0].id]
: [1], : undefined,
rules: [{ required: true }] rules: [{ required: true }]
})( })(
<Select disabled={this.props.formDisabled} mode="multiple"> <Select disabled={this.props.formDisabled} mode="multiple">

View File

@ -261,9 +261,9 @@ class Lists extends React.PureComponent {
return ( return (
<div className="actions"> <div className="actions">
<Tooltip title="Send a campaign"> <Tooltip title="Send a campaign">
<a role="button"> <Link to={`/campaigns/new?list_id=${record.id}`}>
<Icon type="rocket" /> <Icon type="rocket" />
</a> </Link>
</Tooltip> </Tooltip>
<Tooltip title="Edit list"> <Tooltip title="Edit list">
<a <a