forked from jordanjay29/flarum-ext-summaries
-
Notifications
You must be signed in to change notification settings - Fork 7
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
17 changed files
with
1,597 additions
and
1,005 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
{ | ||
"private": true, | ||
"name": "@ianm/synopsis", | ||
"prettier": "@flarum/prettier-config", | ||
"dependencies": { | ||
"flarum-webpack-config": "^2.0.0", | ||
"@flarum/prettier-config": "^1.0.0", | ||
"flarum-tsconfig": "^1.0.2", | ||
"webpack": "^5.88.2", | ||
"webpack-cli": "^5.1.4" | ||
"private": true, | ||
"version": "0.0.0", | ||
"devDependencies": { | ||
"flarum-webpack-config": "^2.0.2", | ||
"webpack": "^5.95.0", | ||
"webpack-cli": "^5.1.4", | ||
"prettier": "^3.3.3", | ||
"@flarum/prettier-config": "^1.0.0", | ||
"flarum-tsconfig": "^1.0.3", | ||
"typescript": "^4.5.4", | ||
"typescript-coverage-report": "^0.6.1" | ||
}, | ||
"scripts": { | ||
"dev": "webpack --mode development --watch", | ||
"build": "webpack --mode production", | ||
"format": "prettier --write src", | ||
"format-check": "prettier --check src" | ||
"dev": "webpack --mode development --watch", | ||
"build": "webpack --mode production", | ||
"analyze": "cross-env ANALYZER=true npm run build", | ||
"format": "prettier --write src", | ||
"format-check": "prettier --check src", | ||
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings", | ||
"build-typings": "npm run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && npm run post-build-typings", | ||
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'", | ||
"check-typings": "tsc --noEmit --emitDeclarationOnly false", | ||
"check-typings-coverage": "typescript-coverage-report" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^3.0.3" | ||
} | ||
"prettier": "@flarum/prettier-config" | ||
} |
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,30 @@ | ||
import Tag from 'flarum/tags/common/models/Tag'; | ||
import SettingsPage from 'flarum/forum/components/SettingsPage'; | ||
import ItemList from 'flarum/common/utils/ItemList'; | ||
import type Mithril from 'mithril'; | ||
import EditTagModal from 'flarum/tags/admin/components/EditTagModal'; | ||
import Stream from 'flarum/common/utils/Stream'; | ||
|
||
declare module 'flarum/tags/common/models/Tag' { | ||
export default interface Tag { | ||
richExcerpts(): boolean; | ||
excerptLength(): number; | ||
} | ||
} | ||
|
||
declare module 'flarum/forum/components/SettingsPage' { | ||
export default interface SettingsPage { | ||
summariesItems(): ItemList<Mithril.Children>; | ||
showSynopsisExcerpts: Stream<boolean>; | ||
showSynopsisExcerptsOnMobile: Stream<boolean>; | ||
showSynopsisExcerptsLoading: boolean; | ||
showSynopsisExcerptsOnMobileLoading: boolean; | ||
} | ||
} | ||
|
||
declare module 'flarum/tags/admin/components/EditTagModal' { | ||
export default interface EditTagModal { | ||
richExcerpts: Stream<boolean>; | ||
excerptLength: Stream<number>; | ||
} | ||
} |
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,4 @@ | ||
import Extend from 'flarum/common/extenders'; | ||
import commonExtend from '../common/extend'; | ||
|
||
export default [...commonExtend]; |
This file was deleted.
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,44 @@ | ||
import app from 'flarum/admin/app'; | ||
import EditTagModal from 'flarum/tags/admin/components/EditTagModal'; | ||
import { extend } from 'flarum/common/extend'; | ||
import Stream from 'flarum/common/utils/Stream'; | ||
|
||
export default function () { | ||
extend(EditTagModal.prototype, 'oninit', function () { | ||
this.richExcerpts = new Stream(this.tag.richExcerpts()); | ||
this.excerptLength = new Stream(this.tag.excerptLength()); | ||
}); | ||
|
||
extend(EditTagModal.prototype, 'submitData', function (data) { | ||
data.richExcerpts = this.richExcerpts(); | ||
data.excerptLength = this.excerptLength(); | ||
|
||
return data; | ||
}); | ||
|
||
extend(EditTagModal.prototype, 'fields', function (items) { | ||
items.add( | ||
'synopsis-excerpt-length', | ||
<div className="Form-group"> | ||
<label>{app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.label')}</label> | ||
<input className="FormControl" type="number" min="0" bidi={this.excerptLength} /> | ||
<div>{app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.help')}</div> | ||
</div>, | ||
5 | ||
); | ||
|
||
items.add( | ||
'synopsis-rich-excerpts', | ||
<div className="Form-group"> | ||
<div> | ||
<label className="checkbox"> | ||
<input type="checkbox" bidi={this.richExcerpts} /> | ||
{app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.label')} | ||
</label> | ||
</div> | ||
<div>{app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.help')}</div> | ||
</div>, | ||
5 | ||
); | ||
}); | ||
} |
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 was deleted.
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,12 @@ | ||
import app from 'flarum/admin/app'; | ||
import extractText from 'flarum/common/utils/extractText'; | ||
|
||
export default function () { | ||
let opts: { [key: string]: string } = {}; | ||
opts = ['first', 'last'].reduce((o: { [key: string]: string }, key) => { | ||
o[key] = extractText(app.translator.trans(`ianm-synopsis.admin.settings.${key}-label`)); | ||
|
||
return o; | ||
}, {}); | ||
return opts; | ||
} |
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 Extend from 'flarum/common/extenders'; | ||
import Tag from 'flarum/tags/common/models/Tag'; | ||
|
||
export default [ | ||
new Extend.Model(Tag) // | ||
.attribute<boolean>('richExcerpts') | ||
.attribute<number>('excerptLength'), | ||
]; |
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,4 @@ | ||
import Extend from 'flarum/common/extenders'; | ||
import commonExtend from '../common/extend'; | ||
|
||
export default [...commonExtend]; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const config = require('flarum-webpack-config'); | ||
|
||
module.exports = config(); | ||
module.exports = config({ | ||
useExtensions: [], | ||
}); |
Oops, something went wrong.