add summary field to challenges and guilds (#8960)

* create new summary field for challenges

* finish implementating summary for challenges, add some support for guilds

* make small improvements to challenges code

* fix lint errors

* add more code to support summaries for guilds (still more needed)

* fix existing tests by adding summary field

* make existing tests pass

* WIP make "Public Challenges" text translatable

* change "leader" locale key to "guildOrPartyLeader" to make searches for it easier

* remove v-once from h2 headings

* remove failed attempt to localise text in <script>

* add quick-and-dirty error checking for guild not having categories

* make "Public Challenges" text translatable

* rename final ...PlaceHolder strings to ...Placeholder (lower-case "h") for consistency with existing Placeholder strings
This commit is contained in:
Alys
2017-08-23 06:39:45 +10:00
committed by GitHub
parent bd46e3e195
commit 7d0ab1ba25
14 changed files with 199 additions and 92 deletions

View File

@@ -154,7 +154,8 @@ let api = {};
* @apiParam (Body) {UUID} challenge.groupId The id of the group to which the challenge belongs
* @apiParam (Body) {String} challenge.name The full name of the challenge
* @apiParam (Body) {String} challenge.shortName A shortened name for the challenge, to be used as a tag
* @apiParam (Body) {String} [challenge.description] A description of the challenge
* @apiParam (Body) {String} [challenge.summary] A short summary advertising the main purpose of the challenge; maximum 250 characters; if not supplied, challenge.name will be used
* @apiParam (Body) {String} [challenge.description] A detailed description of the challenge
* @apiParam (Body) {Boolean} [official=false] Whether or not a challenge is an official Habitica challenge (requires admin)
* @apiParam (Body) {Number} [challenge.prize=0] Number of gems offered as a prize to challenge winner
*
@@ -220,6 +221,9 @@ api.createChallenge = {
group.challengeCount += 1;
if (!req.body.summary) {
req.body.summary = req.body.name;
}
req.body.leader = user._id;
req.body.official = user.contributor.admin && req.body.official ? true : false;
let challenge = new Challenge(Challenge.sanitize(req.body));
@@ -591,6 +595,7 @@ api.exportChallengeCsv = {
*
* @apiParam (Path) {UUID} challengeId The challenge _id
* @apiParam (Body) {String} [challenge.name] The new full name of the challenge.
* @apiParam (Body) {String} [challenge.summary] The new challenge summary.
* @apiParam (Body) {String} [challenge.description] The new challenge description.
* @apiParam (Body) {String} [challenge.leader] The UUID of the new challenge leader.
*