Skip to content

Commit

Permalink
Merge pull request #958 from PlanoramaEvents/staging
Browse files Browse the repository at this point in the history
3.3.1
  • Loading branch information
Gailbear authored Feb 22, 2024
2 parents 1f23b85 + 7cf5eb9 commit 7114a0a
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 22 deletions.
6 changes: 4 additions & 2 deletions app/javascript/sessions/session_sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@
<dt>Session Environment</dt>
<dd class="ml-2 font-italic">{{SESSION_ENVIRONMENT[selected.environment]}}</dd>
<dt>Public Tags</dt>
<dd class="ml-2 font-italic">{{ formatTags(selected.tag_list) }}</dd>
<dd class="ml-2 font-italic" v-if="selected.tag_list.length">{{ formatTags(selected.tag_list) }}</dd>
<dd class="ml-2 font-italic text-muted" v-if="!selected.tag_list.length">None Selected</dd>
<dt>Admin Labels</dt>
<dd class="ml-2 font-italic">{{ formatTags(selected.label_list) }}</dd>
<dd class="ml-2 font-italic" v-if="selected.label_list.length">{{ formatTags(selected.label_list) }}</dd>
<dd class="ml-2 font-italic text-muted" v-if="!selected.label_list.length">None Selected</dd>
<dt>Room Setup</dt>
<dd class="ml-2 font-italic" v-if="selected.room_set">{{selected.room_set.name}}</dd>
<dd class="ml-2 font-italic text-muted" v-if="!selected.room_set">None Selected</dd>
Expand Down
11 changes: 5 additions & 6 deletions app/javascript/sessions/tag_display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p>{{ label }} <edit-button v-b-modal:[modalId]></edit-button></p>
<span :class="clazz" v-for="tag in value" :key="tag">{{tagFormatter(tag)}}</span>
<span v-if="!value.length" class="text-muted font-italic">{{ SESSION_NO_TAGS(label) }}</span>
<edit-modal :id="modalId" :title="modalTitle" @ok="$emit('input', mutableValue)" @hide="clearValue()">
<edit-modal :id="modalId" :title="modalTitle" @ok="$emit('input', mutableValue)" @hide="clearValue()" @show="initValue()">
<b-form-select
v-model="mutableValue"
:options="modalOptions"
Expand Down Expand Up @@ -70,13 +70,12 @@ export default {
},
methods: {
clearValue() {
this.imutableValue = []
this.imutableValue = [];
},
initValue() {
this.imutableValue = this.value;
}
},
mounted() {
// Initialize here works better that trying to do something in get
this.imutableValue = this.value
}
}
</script>

Expand Down
7 changes: 5 additions & 2 deletions app/javascript/store/tags.mixin.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { curatedTagModel as model } from "@/store/curated_tag.store"
import { FETCH } from "@/store/model.store";

// this now does nothing on purpose because the backend is handling caps
// however if we ever need it it's still here
export const tagFormatter = (tag) => {
if (!tag) return '';
return tag.split(' ').map(t => t[0].toUpperCase() + t.slice(1)).join(' ');
return tag;
// if (!tag) return '';
// return tag.split(' ').map(t => t[0].toUpperCase() + t.slice(1)).join(' ');
}

export const tagsMixin = {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/surveys/survey_question.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
:disabled="!answerable"
>{{choice.answer}}</b-form-select-option>
</b-form-select>
<b-form-invalid-feedback>{{ errors[0] }}</b-form-invalid-feedback>
<b-form-invalid-feedback :force-show="!calcValid(errors, valid)">{{ errors[0] }}</b-form-invalid-feedback>
</validation-provider>
<email-field-veevalidate
:answerable="answerable"
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/taggable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
ActsAsTaggableOn.remove_unused_tags = true

# use lower case for all tags ???? (TODO: check)
ActsAsTaggableOn.force_lowercase = true
ActsAsTaggableOn.force_lowercase = false
98 changes: 91 additions & 7 deletions lib/tasks/curated_tags.rake
Original file line number Diff line number Diff line change
@@ -1,9 +1,72 @@

namespace :curated_tags do
# The G24 lists of labels and tags
LABELS = [
'Cross-Area',
'Duplicate - Do Not Use',
'Definite Possibility',
'Possibility',
'Ready for Review',
'Ready for Diversity Review',
'In Review',
'Ready for Scheduling',
'Do Not Change Room',
'Do Not Reschedule',
'Do Not Change Assignments',
'Chris Baker (Fangorn)',
'Claire Brialey and Mark Plummer',
'Ken MacLeod',
'Nnedi Okorafor',
'Terri Windling',
'Tanya DePass',
'Catherine Heymans',
'Tendai Huchu',
'3 Black Halflings',
'Hugo Finalist',
'Reserve',
'Assignment in Progress',
'Assignment Complete'
]

TAGS = [
"Agents",
"AI",
"Astronomy",
"Bioscience",
"Chemistry",
"Climate Change",
"Computer Science",
"Conrunning",
"Contracts",
"Crafting",
"Editing",
"Engineering",
"Erotica",
"Fantasy",
"Guest of Honour",
"History",
"Horror",
"Mathematics",
"Physics",
"Post-War SF and Fandom",
"Publishing",
"Roleplaying",
"Romance",
"Science and Society",
"Science Fiction",
"Scotland",
"Special Guest",
"Video Games",
"Worldbuilding",
"Writing",
"Our Future in Space",
"Our Future on Earth",
"Our Future Selves"
]

desc ""
task labels: :environment do
names = ['ready for review', 'ready for scheduling', 'cross-cutting', 'do not move']
names.each do |name|
LABELS.each do |name|
tag = CuratedTag.find_by name: name, context: 'label'
next if tag

Expand All @@ -16,11 +79,7 @@ namespace :curated_tags do

desc ""
task tags: :environment do
names = [
'science fiction', 'fantasy', 'romance', 'erotica', 'worldbuilding', 'literature', '101',
'astronomy','bioscience','chemistry','computer science','engineering','mathematics','physics'
]
names.each do |name|
TAGS.each do |name|
tag = CuratedTag.find_by name: name, context: 'tag'
next if tag

Expand All @@ -30,4 +89,29 @@ namespace :curated_tags do
})
end
end

# A brute force mechanism to update DB tags with the correct case...
desc ""
task fix_case: :environment do
TAGS.each do |name|
fix_tag(name: name, context: 'tag')
end
LABELS.each do |name|
fix_tag(name: name, context: 'label')
end
end

def fix_tag(name:, context:)
ctag = CuratedTag.where("name ILIKE ? and context = ?", name, context).first
if ctag
ctag.name = name
ctag.save

tag = ActsAsTaggableOn::Tag.where("name ILIKE ?", name).first
if tag
tag.name = name
tag.save
end
end
end
end
6 changes: 3 additions & 3 deletions lib/tasks/rbac.rake
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ namespace :rbac do
"show": true,
"update": false
},
"currated_tag": {
"curated_tag": {
"create": false,
"destroy": false,
"index": true,
Expand Down Expand Up @@ -634,7 +634,7 @@ namespace :rbac do
"show": true,
"update": false
},
"currated_tag": {
"curated_tag": {
"create": false,
"destroy": false,
"index": true,
Expand Down Expand Up @@ -973,7 +973,7 @@ namespace :rbac do
"show": true,
"update": true
},
"currated_tag": {
"curated_tag": {
"create": true,
"destroy": true,
"index": true,
Expand Down

0 comments on commit 7114a0a

Please sign in to comment.