-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import os | ||
|
||
if os.name == 'nt': | ||
# Windows has a different strftime format for dates without leading 0 | ||
# https://stackoverflow.com/questions/904928/python-strftime-date-without-leading-0 | ||
DATE_FORMAT = '%#d %B %Y' | ||
else: | ||
DATE_FORMAT = '%-d %B %Y' |
46 changes: 46 additions & 0 deletions
46
wagtail_ab_testing/static_src/components/PageEditorTab/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
interface AbTest { | ||
id: number; | ||
name: string; | ||
started_at: string; | ||
status: string; | ||
} | ||
|
||
interface PageEditorTabProps { | ||
tests: AbTest[]; | ||
} | ||
|
||
const PageEditorTab: FunctionComponent<PageEditorTabProps> = ({ tests }) => { | ||
return ( | ||
<div className="nice-padding"> | ||
<table className="listing"> | ||
<thead> | ||
<tr> | ||
<th className="title">{gettext('Started at')}</th> | ||
<th>{gettext('Test name')}</th> | ||
<th>{gettext('Status')}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{tests.map(test => ( | ||
<tr key={test.id}> | ||
<td className="title">{test.started_at}</td> | ||
<td>{test.name}</td> | ||
<td> | ||
<span className="status-tag primary"> | ||
{test.status} | ||
</span> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
}; | ||
|
||
export function initPageEditorTab(element: HTMLElement, props: any) { | ||
ReactDOM.render(<PageEditorTab {...props} />, element); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters