-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flarum 1.3 compat by switching to camelCase relations (#34)
Update to Webpack 5 Remove leftover commas Fix console errors when editing discussion answers
- Loading branch information
1 parent
86aa88f
commit 751b055
Showing
23 changed files
with
3,335 additions
and
8,020 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
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.
Large diffs are not rendered by default.
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
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,13 @@ | ||
import Model from 'flarum/common/Model'; | ||
import Field from './Field'; | ||
|
||
export default class Answer extends Model { | ||
content = Model.attribute<string>('content'); | ||
is_suggested = Model.attribute<boolean>('is_suggested'); | ||
sort = Model.attribute<number | null>('sort'); | ||
field = Model.hasOne<Field>('field'); | ||
|
||
apiEndpoint() { | ||
return '/fof/mason/answers' + (this.exists ? '/' + this.data.id : ''); | ||
} | ||
} |
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,24 @@ | ||
import Model from 'flarum/common/Model'; | ||
import computed from 'flarum/common/utils/computed'; | ||
import Answer from './Answer'; | ||
|
||
export default class Field extends Model { | ||
name = Model.attribute<string>('name'); | ||
description = Model.attribute<string | null>('description'); | ||
min_answers_count = Model.attribute<number>('min_answers_count'); | ||
max_answers_count = Model.attribute<number>('max_answers_count'); | ||
show_when_empty = Model.attribute<boolean>('show_when_empty'); | ||
user_values_allowed = Model.attribute<boolean>('user_values_allowed'); | ||
validation = Model.attribute<string | null>('validation'); | ||
icon = Model.attribute<string | null>('icon'); | ||
sort = Model.attribute<number | null>('sort'); | ||
deleted_at = Model.attribute('deleted_at', Model.transformDate); | ||
allAnswers = Model.hasMany<Answer>('allAnswers'); | ||
suggestedAnswers = Model.hasMany<Answer>('suggestedAnswers'); | ||
required = computed<boolean>('min_answers_count', (min_answers_count) => min_answers_count > 0); | ||
multiple = computed<boolean>('max_answers_count', (max_answers_count) => max_answers_count > 1); | ||
|
||
apiEndpoint() { | ||
return '/fof/mason/fields' + (this.exists ? '/' + this.data.id : ''); | ||
} | ||
} |
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
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
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