mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 13:47:33 +01:00
Challenge fixes (#9528)
* Added challenge member search to progress dropdown * Added leave challenge modal * Allowed editing for challenge leader only * Pevented users from editing challenge task info * Set default progress default to daily * Removed reward filters from user challenge progress
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
type="text", :class="[`${cssClass}-modal-input`]",
|
||||
required, v-model="task.text",
|
||||
autofocus, spellcheck="true",
|
||||
:disabled="groupAccessRequiredAndOnPersonalPage"
|
||||
:disabled="groupAccessRequiredAndOnPersonalPage || challengeAccessRequired"
|
||||
)
|
||||
.form-group
|
||||
label(v-once) {{ $t('notes') }}
|
||||
@@ -34,12 +34,12 @@
|
||||
.svg-icon.destroy-icon(v-html="icons.destroy")
|
||||
input.inline-edit-input.checklist-item.form-control(type="text", :placeholder="$t('newChecklistItem')", @keydown.enter="addChecklistItem($event)", v-model="newChecklistItem")
|
||||
.d-flex.justify-content-center(v-if="task.type === 'habit'")
|
||||
.option-item(:class="optionClass(task.up === true)", @click="task.up = !task.up")
|
||||
.option-item(:class="optionClass(task.up === true)", @click="toggleUpDirection()")
|
||||
.option-item-box
|
||||
.task-control.habit-control(:class="controlClass.up + '-control-habit'")
|
||||
.svg-icon.positive(v-html="icons.positive")
|
||||
.option-item-label(v-once) {{ $t('positive') }}
|
||||
.option-item(:class="optionClass(task.down === true)", @click="task.down = !task.down")
|
||||
.option-item(:class="optionClass(task.down === true)", @click="toggleDownDirection()")
|
||||
.option-item-box
|
||||
.task-control.habit-control(:class="controlClass.down + '-control-habit'")
|
||||
.svg-icon.negative(v-html="icons.negative")
|
||||
@@ -49,19 +49,19 @@
|
||||
span.float-left {{ $t('difficulty') }}
|
||||
// @TODO .svg-icon.info-icon(v-html="icons.information")
|
||||
.d-flex.justify-content-center
|
||||
.option-item(:class="optionClass(task.priority === 0.1)", @click="task.priority = 0.1")
|
||||
.option-item(:class="optionClass(task.priority === 0.1)", @click="setDifficulty(0.1)")
|
||||
.option-item-box
|
||||
.svg-icon.difficulty-trivial-icon(v-html="icons.difficultyTrivial")
|
||||
.option-item-label(v-once) {{ $t('trivial') }}
|
||||
.option-item(:class="optionClass(task.priority === 1)", @click="task.priority = 1")
|
||||
.option-item(:class="optionClass(task.priority === 1)", @click="setDifficulty(1)")
|
||||
.option-item-box
|
||||
.svg-icon.difficulty-normal-icon(v-html="icons.difficultyNormal")
|
||||
.option-item-label(v-once) {{ $t('easy') }}
|
||||
.option-item(:class="optionClass(task.priority === 1.5)", @click="task.priority = 1.5")
|
||||
.option-item(:class="optionClass(task.priority === 1.5)", @click="setDifficulty(1.5)")
|
||||
.option-item-box
|
||||
.svg-icon.difficulty-medium-icon(v-html="icons.difficultyMedium")
|
||||
.option-item-label(v-once) {{ $t('medium') }}
|
||||
.option-item(:class="optionClass(task.priority === 2)", @click="task.priority = 2")
|
||||
.option-item(:class="optionClass(task.priority === 2)", @click="setDifficulty(2)")
|
||||
.option-item-box
|
||||
.svg-icon.difficulty-hard-icon(v-html="icons.difficultyHard")
|
||||
.option-item-label(v-once) {{ $t('hard') }}
|
||||
@@ -72,28 +72,33 @@
|
||||
:clearButton='true',
|
||||
clearButtonIcon='category-select',
|
||||
:clearButtonText='$t("clear")',
|
||||
:todayButton='true',
|
||||
:todayButton='!challengeAccessRequired',
|
||||
todayButtonIcon='category-select',
|
||||
:todayButtonText='$t("today")',
|
||||
:disabled-picker='challengeAccessRequired'
|
||||
)
|
||||
.option(v-if="task.type === 'daily'")
|
||||
label(v-once) {{ $t('startDate') }}
|
||||
datepicker.d-inline-block(
|
||||
v-model="task.startDate",
|
||||
:clearButton='false',
|
||||
:todayButton='true',
|
||||
:todayButton='!challengeAccessRequired',
|
||||
todayButtonIcon='category-select',
|
||||
:todayButtonText='$t("today")',
|
||||
:disabled-picker='challengeAccessRequired'
|
||||
)
|
||||
.option(v-if="task.type === 'daily'")
|
||||
.form-group
|
||||
label(v-once) {{ $t('repeats') }}
|
||||
b-dropdown(:text="$t(task.frequency)")
|
||||
b-dropdown-item(v-for="frequency in ['daily', 'weekly', 'monthly', 'yearly']", :key="frequency", @click="task.frequency = frequency", :class="{active: task.frequency === frequency}")
|
||||
b-dropdown-item(v-for="frequency in ['daily', 'weekly', 'monthly', 'yearly']",
|
||||
:key="frequency", @click="task.frequency = frequency",
|
||||
:disabled='challengeAccessRequired',
|
||||
:class="{active: task.frequency === frequency}")
|
||||
| {{ $t(frequency) }}
|
||||
.form-group
|
||||
label(v-once) {{ $t('repeatEvery') }}
|
||||
input(type="number", v-model="task.everyX", min="0", required)
|
||||
input(type="number", v-model="task.everyX", min="0", required, :disabled='challengeAccessRequired')
|
||||
| {{ repeatSuffix }}
|
||||
br
|
||||
template(v-if="task.frequency === 'weekly'")
|
||||
@@ -102,7 +107,7 @@
|
||||
:key="dayNumber",
|
||||
)
|
||||
label.custom-control.custom-checkbox
|
||||
input.custom-control-input(type="checkbox", v-model="task.repeat[day]")
|
||||
input.custom-control-input(type="checkbox", v-model="task.repeat[day]", :disabled='challengeAccessRequired')
|
||||
span.custom-control-indicator
|
||||
span.custom-control-description(v-once) {{ weekdaysMin(dayNumber) }}
|
||||
template(v-if="task.frequency === 'monthly'")
|
||||
@@ -118,7 +123,7 @@
|
||||
.tags-select.option(v-if="isUserTask")
|
||||
.tags-inline
|
||||
label(v-once) {{ $t('tags') }}
|
||||
.category-wrap(@click="showTagsSelect = !showTagsSelect", v-bind:class="{ active: showTagsSelect }")
|
||||
.category-wrap(@click="toggleTagSelect()", v-bind:class="{ active: showTagsSelect }")
|
||||
span.category-select(v-if='task.tags && task.tags.length === 0')
|
||||
.tags-none {{$t('none')}}
|
||||
.dropdown-toggle
|
||||
@@ -137,7 +142,7 @@
|
||||
.option(v-if="task.type === 'daily' && isUserTask && purpose === 'edit'")
|
||||
.form-group
|
||||
label(v-once) {{ $t('restoreStreak') }}
|
||||
input(type="number", v-model="task.streak", min="0", required)
|
||||
input(type="number", v-model="task.streak", min="0", required, :disabled='challengeAccessRequired')
|
||||
|
||||
.option.group-options(v-if='groupId')
|
||||
label(v-once) Assigned To
|
||||
@@ -598,12 +603,21 @@ export default {
|
||||
dayMapping: 'constants.DAY_MAPPING',
|
||||
}),
|
||||
groupAccessRequiredAndOnPersonalPage () {
|
||||
if (!this.groupId && this.task.group.id) return true;
|
||||
if (!this.groupId && this.task.group && this.task.group.id) return true;
|
||||
return false;
|
||||
},
|
||||
checklistEnabled () {
|
||||
return ['daily', 'todo'].indexOf(this.task.type) > -1 && !this.isOriginalChallengeTask;
|
||||
},
|
||||
isChallengeTask () {
|
||||
return Boolean(this.task.challenge && this.task.challenge.id);
|
||||
},
|
||||
onUserPage () {
|
||||
return !this.challengeId && !this.groupId;
|
||||
},
|
||||
challengeAccessRequired () {
|
||||
return this.onUserPage && this.isChallengeTask;
|
||||
},
|
||||
isOriginalChallengeTask () {
|
||||
let isUserChallenge = Boolean(this.task.userId);
|
||||
return !isUserChallenge && (this.challengeId || this.task.challenge && this.task.challenge.id);
|
||||
@@ -682,6 +696,22 @@ export default {
|
||||
closeTagsPopup () {
|
||||
this.showTagsSelect = false;
|
||||
},
|
||||
setDifficulty (level) {
|
||||
if (this.challengeAccessRequired) return;
|
||||
this.task.priority = level;
|
||||
},
|
||||
toggleUpDirection () {
|
||||
if (this.challengeAccessRequired) return;
|
||||
this.task.up = !this.task.up;
|
||||
},
|
||||
toggleDownDirection () {
|
||||
if (this.challengeAccessRequired) return;
|
||||
this.task.down = !this.task.down;
|
||||
},
|
||||
toggleTagSelect () {
|
||||
if (this.challengeAccessRequired) return;
|
||||
this.showTagsSelect = !this.showTagsSelect;
|
||||
},
|
||||
sortedChecklist (data) {
|
||||
let sorting = clone(this.task.checklist);
|
||||
let movingItem = sorting[data.oldIndex];
|
||||
|
||||
Reference in New Issue
Block a user