Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #665 Allow editing of frontend elements on actions in app #670

Merged
merged 3 commits into from
Apr 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 30 additions & 25 deletions frontend/src/scenes/actions/ActionStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,33 +229,38 @@ export class ActionStep extends Component {
)
}
AutocaptureFields({ step, isEditor, actionId }) {
if (!isEditor)
return (
<span>
<AppEditorLink actionId={actionId} style={{ margin: '1rem 0' }} className="btn btn-sm btn-light">
Select element on site <i className="fi flaticon-export" />
</AppEditorLink>
<br />
<a href="https://github.com/PostHog/posthog/wiki/Actions" target="_blank">
See documentation
</a>{' '}
on how to set up actions.
</span>
)
return (
<div>
<this.Option
item="href"
label="Link href"
selector={this.state.element && 'a[href="' + this.state.element.getAttribute('href') + '"]'}
/>
<this.Option item="text" label="Text" />
<this.Option item="selector" label="Selector" selector={step.selector} />
<this.Option
item="url"
extra_options={<this.URLMatching step={step} isEditor={isEditor} />}
label="URL"
/>
{!isEditor && (
<span>
<AppEditorLink
actionId={actionId}
style={{ margin: '1rem 0' }}
className="btn btn-sm btn-light"
>
Select element on site <i className="fi flaticon-export" />
</AppEditorLink>
<a href="https://docs.posthog.com/#/features/actions" target="_blank" style={{ marginLeft: 8 }}>
See documentation.
</a>{' '}
</span>
)}
{(isEditor || step.selector || step.href || step.text) && (
<span>
<this.Option
item="href"
label="Link href"
selector={this.state.element && 'a[href="' + this.state.element.getAttribute('href') + '"]'}
/>
<this.Option item="text" label="Text" />
<this.Option item="selector" label="Selector" selector={step.selector} />
<this.Option
item="url"
extra_options={<this.URLMatching step={step} isEditor={isEditor} />}
label="URL"
/>
</span>
)}
</div>
)
}
Expand Down