-
Notifications
You must be signed in to change notification settings - Fork 20
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
1 parent
baf98c0
commit 1237521
Showing
12 changed files
with
2,880 additions
and
59 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Component from 'flarum/Component'; | ||
import ItemList from 'flarum/utils/ItemList'; | ||
import listItems from 'flarum/helpers/listItems'; | ||
import avatar from 'flarum/helpers/avatar'; | ||
|
||
export default class BlogAuthor extends Component { | ||
view() { | ||
return ( | ||
<div className={"FlarumBlog-Article-Author"}> | ||
<div className={`FlarumBlog-Article-Author-background ${this.props.loading ? 'FlarumBlog-Author-Ghost' : ''}`} style={{ backgroundColor: this.props.article && this.props.article.user() ? this.props.article && this.props.article.user().color() : null }} /> | ||
|
||
<div className={"FlarumBlog-Article-Author-Avatar"}>{this.props.article && this.props.article.user() ? avatar(this.props.article.user()) : <span className={"Avatar FlarumBlog-Author-Ghost"} />}</div> | ||
|
||
{this.props.article && this.props.article.user() && ( | ||
<div className={"FlarumBlog-Article-Author-Info"}> | ||
<span className={"FlarumBlog-Article-Author-Name"}>{this.props.article.user().displayName()}</span> | ||
<p className={"FlarumBlog-Article-Author-Bio"}>{this.props.article.user().bio && this.props.article.user().bio()}</p> | ||
|
||
<ul className={"FlarumBlog-Article-Author-Extended"}> | ||
{listItems(this.items().toArray())} | ||
</ul> | ||
</div> | ||
)} | ||
|
||
{this.props.loading && ( | ||
<div> | ||
<span className={"FlarumBlog-Article-Author-Name FlarumBlog-Author-Ghost"}> </span> | ||
<p className={"FlarumBlog-Article-Author-Bio FlarumBlog-Author-Ghost"}> </p> | ||
<p className={"FlarumBlog-Article-Author-Bio FlarumBlog-Author-Ghost"}> </p> | ||
<p className={"FlarumBlog-Article-Author-Bio FlarumBlog-Author-Ghost"}> </p> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
items() { | ||
return new ItemList(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
js/src/forum/components/BlogItemSidebar/BlogItemSidebar.js
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,27 @@ | ||
import Component from 'flarum/Component'; | ||
import ItemList from 'flarum/utils/ItemList'; | ||
import listItems from 'flarum/helpers/listItems'; | ||
import BlogAuthor from './BlogAuthor'; | ||
import BlogCategories from '../BlogCategories'; | ||
|
||
export default class BlogItemSidebar extends Component { | ||
view() { | ||
return ( | ||
<div className={"FlarumBlog-Article-Sidebar"}> | ||
<ul> | ||
{listItems(this.items().toArray())} | ||
</ul> | ||
</div> | ||
) | ||
} | ||
|
||
items() { | ||
const itemlist = new ItemList(); | ||
|
||
itemlist.add("author", BlogAuthor.component(this.props), 0); | ||
|
||
itemlist.add("categories", BlogCategories.component(this.props), 0); | ||
|
||
return itemlist; | ||
} | ||
} |
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,47 @@ | ||
import ComposerBody from 'flarum/components/ComposerBody'; | ||
import Button from 'flarum/components/Button'; | ||
import {extend} from 'flarum/extend'; | ||
|
||
export default class ArticleComposer extends ComposerBody { | ||
init() { | ||
super.init(); | ||
|
||
this.previewContent = false; | ||
} | ||
|
||
// Render | ||
render() { | ||
const hasContent = (this.content() && this.content() !== ""); | ||
|
||
return ( | ||
<div className={"Flarum-Support-ArticleComposer"}> | ||
<div className={"Flarum-Support-ArticleComposer-tabs"}> | ||
<Button className={!this.previewContent && "AricleComposerButtonSelected"} onclick={() => this.previewContent = false}>{app.translator.trans('v17development-flarum-support.forum.composer.write')}</Button> | ||
<Button className={this.previewContent && "AricleComposerButtonSelected"} onclick={() => this.previewContent = true}>{app.translator.trans('v17development-flarum-support.forum.composer.view')}</Button> | ||
</div> | ||
|
||
<div className={"Composer Flarum-Support-ComposeArticle-body"}> | ||
{this.previewContent ? ( | ||
<div className={"Flarum-Support-ArticleComposer-preview"} config={hasContent && this.configPreview.bind(this)}> | ||
{!hasContent && ( | ||
app.translator.trans('v17development-flarum-support.forum.composer.nothing_to_preview') | ||
)} | ||
</div> | ||
) : this.view()} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
// Initialize preview content | ||
configPreview(element) { | ||
s9e.TextFormatter.preview(this.content() || '', element); | ||
} | ||
|
||
// Submit trigger | ||
onsubmit() { | ||
if(this.props.onsubmit) { | ||
this.props.onsubmit(); | ||
} | ||
} | ||
} |
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