Skip to content

Commit

Permalink
Add 'send campaign' shortcut link to lists view
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Mar 28, 2019
1 parent 3de7b3f commit baa6184
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion frontend/my/src/Campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Media from "./Media"
import ModalPreview from "./ModalPreview"

import moment from "moment"
import parseUrl from "querystring"
import ReactQuill from "react-quill"
import Delta from "quill-delta"
import "react-quill/dist/quill.snow.css"
Expand Down Expand Up @@ -374,8 +375,20 @@ class TheFormDef extends React.PureComponent {
return v.id !== 0 ? v.id : 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) {
this.props.pageTitle(record.name + " / Campaigns")
} else {
Expand Down Expand Up @@ -431,7 +444,7 @@ class TheFormDef extends React.PureComponent {
? subLists
: this.props.data[cs.ModelLists].length === 1
? [this.props.data[cs.ModelLists][0].id]
: [1],
: undefined,
rules: [{ required: true }]
})(
<Select disabled={this.props.formDisabled} mode="multiple">
Expand Down
4 changes: 2 additions & 2 deletions frontend/my/src/Lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ class Lists extends React.PureComponent {
return (
<div className="actions">
<Tooltip title="Send a campaign">
<a role="button">
<Link to={`/campaigns/new?list_id=${record.id}`}>
<Icon type="rocket" />
</a>
</Link>
</Tooltip>
<Tooltip title="Edit list">
<a
Expand Down

0 comments on commit baa6184

Please sign in to comment.