-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #34 - support the bw_pages shortcode format= parameter
- Loading branch information
1 parent
562730d
commit 9fa9c82
Showing
5 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
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
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,72 @@ | ||
const format_options = [ | ||
{ label: 'Default', value: 'LIER',}, | ||
{ label: 'Link,image', value: 'LI', }, | ||
{ label: 'Link, image, excerpt', value: 'LIE' }, | ||
{ label: 'Image, link', value: 'IL', }, | ||
{ label: 'Image, link, excerpt', value: 'ILE' }, | ||
{ label: 'Link, Image, Date, Author', value: 'LI/d/a'}, | ||
{ label: 'None', value: '' }, | ||
]; | ||
|
||
const single_format_options = [ | ||
{ label: 'None', value: null, }, | ||
{ label: 'Title', value: 'T', }, | ||
{ label: 'Link', value: 'L', }, | ||
{ label: 'Image', value: 'I', }, | ||
{ label: 'Excerpt', value: 'E', }, | ||
{ label: 'Read more', value: 'R', }, | ||
{ label: 'Div', value: '/', }, | ||
{ label: 'Fields', value: '_',}, | ||
{ label: 'Space', value: ' ',}, | ||
{ label: 'Content', value: 'C',}, | ||
{ label: 'Categories', value: 'c', }, | ||
{ label: 'Tags', value: 't'}, | ||
{ label: 'Author', value: 'a'}, | ||
{ label: 'Date', value: 'd' }, | ||
{ label: 'Edit', value: 'e' }, | ||
]; | ||
|
||
const { select, subscribe } = wp.data; | ||
const { Component } = wp.element; | ||
const { SelectControl } = wp.components; | ||
|
||
export class Formats extends Component { | ||
constructor() { | ||
super(...arguments); | ||
this.state = { | ||
formats: format_options, | ||
}; | ||
} | ||
|
||
formatsSelect( props ) { | ||
var formats = this.state.formats; | ||
if (formats) { | ||
//var options = formats.map((format) => this.formatsOption(format)); | ||
return ( | ||
<SelectControl label="Format" value={this.props.format} | ||
options={format_options} | ||
onChange={this.props.onChange} | ||
/> | ||
); | ||
} else { | ||
return (<p>Loading formats</p>); | ||
} | ||
} | ||
|
||
|
||
|
||
/** | ||
* Map the format_option to a select list option | ||
* | ||
* @param format | ||
* @returns {{label: *, value: *}} | ||
*/ | ||
formatOption( format ) { | ||
return( { value: format.value, label: format.label }); | ||
} | ||
|
||
render() { | ||
return( this.formatsSelect() | ||
); | ||
} | ||
} |
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