Skip to content

Commit

Permalink
Merge pull request #976 from PlanoramaEvents/development
Browse files Browse the repository at this point in the history
3.4.0-rc2
  • Loading branch information
Gailbear authored Mar 3, 2024
2 parents 76f5902 + 02e684e commit 41d4551
Show file tree
Hide file tree
Showing 24 changed files with 458 additions and 217 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ config/master.key
*/vendor/bundle
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

.nvmrc

# ##############################################################################
#
Expand Down
1 change: 1 addition & 0 deletions app/controllers/configurations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def allowed_params
lock_version
parameter
parameter_value
parameter_json
]
end
end
2 changes: 2 additions & 0 deletions app/controllers/reports/people_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def record_stream_permissions
'Streaming Exceptions',
'Permission to Record',
'Recording Exceptions',
"Topics not to talk about",
'Schedule'
]
)
Expand All @@ -195,6 +196,7 @@ def record_stream_permissions
person.can_stream_exceptions,
person.can_record,
person.can_record_exceptions,
person.excluded_demographic_categories,
person.sessions.scheduled.collect{|s| "'#{s.title}' - #{s.start_time.strftime('%Y-%m-%d %H:%M %Z')} - #{s.duration} mins - #{s.room.name}" }.join(";\n")
]
)
Expand Down
17 changes: 13 additions & 4 deletions app/javascript/administration/playground_component.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<template>
<div class="container-fluid scrollable">
<h1>Preview features</h1>
<h2>Page content editor (for the dashboard)</h2>
<page-content-editor></page-content-editor>
<h2>TwoSidedMultiSelect</h2>
<div class="w-75">
<two-sided-multi-select v-model="multiSelectValue" :options="multiSelectOptions"></two-sided-multi-select>
<pre>
value: {{ multiSelectValue }}
</pre>
</div>
</div>
</template>

<script>
import PageContentEditor from "@/page-content/page_content_editor.vue"
import TwoSidedMultiSelect from "@/components/two_sided_multi_select.vue";
export default {
name: "PlayGroundComponent",
components: {
PageContentEditor
TwoSidedMultiSelect
},
data: () => ({
multiSelectOptions: ["one", "two", "three", "four", "five", "six"],
multiSelectValue: ["two", "three", "six"]
})
}
</script>

Expand Down
101 changes: 101 additions & 0 deletions app/javascript/components/two_sided_multi_select.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<template>
<div class="d-flex w-100 p-3">
<div class="d-flex flex-column w-100">
<label :for="idA">{{ notSelectedLabel }}</label>
<b-select :id="idA" multiple :select-size="7" class="w-100" :options="optionsA" v-model="selectedA"></b-select>
</div>
<div class="d-flex flex-column justify-content-center p-2 mt-4">
<button class="btn btn-primary m-2" :disabled="!selectedA.length" @click="moveToB()"><b-icon-chevron-right></b-icon-chevron-right></button>
<button class="btn btn-primary m-2" :disabled="!selectedB.length" @click="moveToA()"><b-icon-chevron-left></b-icon-chevron-left></button>
</div>
<div class="d-flex flex-column w-100">
<label :for="idB">{{ selectedLabel }}</label>
<b-select :id="idB" multiple :select-size="7" class="w-100" :options="optionsB" v-model="selectedB"></b-select>
</div>
</div>
</template>

<script>
import { v4 as uuid } from 'uuid';
export default {
name: "TwoSidedMultiSelect",
props: {
value: {
type: Array,
default: () => []
},
options: {
type: Array,
default: () => []
},
notSelectedLabel: {
type: String,
default: 'Not Selected'
},
selectedLabel: {
type: String,
default: 'Selected'
},
id: {
type: String,
default: () => uuid()
}
},
data: () => ({
selectedA: [],
selectedB: [],
}),
computed: {
optionsValueSet() {
return new Set(this.options.map(o => o?.value ?? o));
},
valueSet() {
return new Set(this.value);
},
optionsA() {
return this.options.filter(o => this.optionsValueSet.difference(this.valueSet).has(o?.value ?? o))
},
optionsB() {
return this.options.filter(o => this.valueSet.has(o?.value ?? o));
},
idA() {
return `${this.id}-select-a`
},
idB() {
return `${this.id}-select-b`
}
},
watch: {
selectedA(newVal, oldVal) {
if(!oldVal.length && newVal.length) {
this.selectedB = []
}
},
selectedB(newVal, oldVal) {
if(!oldVal.length && newVal.length) {
this.selectedA = []
}
},
},
methods: {
emitAll(val) {
this.$emit('input', val)
this.$emit('change', val)
},
moveToA() {
this.emitAll([...this.valueSet.difference(new Set(this.selectedB))]);
this.selectedB = [];
},
moveToB() {
this.emitAll([...this.valueSet.union(new Set(this.selectedA))]);
this.selectedA = [];
}
}
}
</script>
<style>
</style>
40 changes: 33 additions & 7 deletions app/javascript/configurations/config_editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
inline
>Yes</b-form-checkbox></label>
</div>
<div v-else>
<div v-else-if="parameter.parameter_name === 'people_hidden_fields'">
<two-sided-multi-select
v-model="configuration.parameter_json"
:options="peopleHideableFieldsOptions"
not-selected-label="Visible"
selected-label="Hidden"
@change="onChange"
></two-sided-multi-select>
</div>
<div v-else-if="parameter.parameter_type !== 'JSON'">
<b-form-input
v-model="configuration.parameter_value"
:state="calcValid(errors,valid)"
Expand All @@ -49,16 +58,19 @@ import configurationMixin from './configuration.mixin';
import { ValidationProvider } from 'vee-validate';
import TimezoneSelector from "../components/timezone_selector.vue"
import settingsMixin from "@/store/settings.mixin";
import { peopleHiddenFieldsMixin } from './people_hidden_fields.mixin';
import {startCase} from "lodash";
import { CONFIGURATION_LABEL_OVERRIDES } from '@/constants/strings';
import { CONFIGURATION_LABEL_OVERRIDES, LINKED_FIELD_LABELS } from '@/constants/strings';
import TwoSidedMultiSelect from '@/components/two_sided_multi_select.vue';
const { DateTime } = require("luxon");
export default {
name: "ConfigEditor",
components: {
ValidationProvider,
TimezoneSelector
TimezoneSelector,
TwoSidedMultiSelect,
},
props: {
parameter: {
Expand Down Expand Up @@ -99,7 +111,8 @@ export default {
mixins: [
modelMixin,
configurationMixin,
settingsMixin
settingsMixin,
peopleHiddenFieldsMixin,
],
methods: {
calcValid(errors, valid) {
Expand All @@ -115,25 +128,38 @@ export default {
let new_val = arg
if (this.is_valid) {
if (this.parameter.parameter_type == 'DateTime') {
if (this.parameter.parameter_type === 'DateTime') {
if (arg.length == 0) return
if (this.parameter.parameter_name == "convention_end_time") {
if (this.parameter.parameter_name === "convention_end_time") {
new_val = DateTime.fromISO(arg, {zone: this.timezone}).endOf('day').minus({ hours: 8 }).toString()
} else {
new_val = DateTime.fromISO(arg, {zone: this.timezone}).startOf('day').plus({ hours: 6 }).toString()
}
}
if (typeof this.parameter.configuration.id === 'undefined') {
let newconfig = {
parameter_value: new_val,
parameter: this.parameter.parameter_name
}
if (this.parameter.parameter_type === 'JSON') {
newconfig.parameter_json = new_val;
} else {
newconfig.parameter_value = new_val;
}
this.createConfiguration(newconfig).then(
(data) => {
this.configuration = data
}
)
} else if (this.parameter.parameter_type === 'JSON') {
this.configuration.parameter_json = new_val;
this.save(this.configuration).then(
(data) => {
this.configuration = data
}
)
} else {
this.configuration.parameter_value = new_val
this.save(this.configuration).then(
Expand Down
25 changes: 25 additions & 0 deletions app/javascript/configurations/people_hidden_fields.mixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { settingsMixin } from "@/store/settings.mixin";
import { LINKED_FIELD_LABELS } from "@/constants/strings";

export const peopleHiddenFieldsMixin = {
mixins: [
settingsMixin
],
computed: {
peopleHideableFieldsOptions() {
return Object.entries(this.currentSettings.attributes.Person).filter(([_, {hidable}]) => hidable ).map(([value, _]) => ({text: LINKED_FIELD_LABELS["Person"][value] || value, value}))
},
// can't use configByName here because that's parameter_value centric
hiddenFields() {
return this.currentSettings.configs?.find(c => c.parameter === 'people_hidden_fields')?.parameter_json || []
}
},
methods: {
filterFieldList(fields) {
return fields.filter(field => !this.hiddenFields.includes(field));
},
isHidden(field) {
return this.hiddenFields.includes(field);
}
}
}
6 changes: 3 additions & 3 deletions app/javascript/constants/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ module.exports = {
do_not_assign_with: "Anyone that should not be assigned to be on a panel with participant",
is_local: "Local to the event",
moderation_experience: "Moderating Experience",
can_stream: "Permission to be included in a livestreamed program",
can_record: "Permission to be included in a recorded program",
can_stream: "Permission to be included in a livestreamed programme",
can_record: "Permission to be included in a recorded programme",
can_stream_exceptions: "Livestreams excluded topics",
can_record_exceptions: "Recordings excluded topics",
name: "Name",
Expand All @@ -273,7 +273,7 @@ module.exports = {
registration_number: "Ticket Number",
global_diaspora: "Member of the global diaspora",
non_anglophone: "Represent something other than a purely anglophone perspective",
excluded_demographic_categories: "Demographic categories that apply, but should not be discussed on panels that include participant",
excluded_demographic_categories: "Participant's demographic categories that should not be discussed on panels that include them",
},
PERSON_SAVE_SUCCESS: "Profile record saved successfully",
PERSON_NEVER_LOGGED_IN: "Never logged in",
Expand Down
12 changes: 8 additions & 4 deletions app/javascript/people/person_tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@
</b-tab>
<b-tab title="Session Selection" :active="tab === 'session-selection'" lazy>
<session-selector
v-if="person && hasOpenForInterest"
v-if="person && hasOpenForInterest && person_can_select_sessions"
v-model="person"
defaultSortBy='sessions.title'
:model="sessionModel"
defaultFilter='{"op":"all","queries":[["open_for_interest", "=", true]]}'
></session-selector>
<div v-if="!hasOpenForInterest" class="container-fluid mt-5">
<div v-if="!hasOpenForInterest || !person_can_select_sessions" class="container-fluid mt-5">
<h5 class="font-italic text-muted">Coming soon!</h5>
</div>
</b-tab>
<b-tab title="Session Rankings" :active="tab === 'session-ranking'" lazy>
<session-ranker
v-if="person && hasOpenForInterest"
v-if="person && hasOpenForInterest && person_can_select_sessions"
defaultSortBy='interest_ranking,session_assignments.updated_at'
:defaultSortDesc="true"
:perPage="null"
:model="sessionAssignmentModel"
:defaultFilter="rankedFilter"
:person_id="person.id"
></session-ranker>
<div v-if="!hasOpenForInterest" class="container-fluid d-flex mt-5">
<div v-if="!hasOpenForInterest || !person_can_select_sessions" class="container-fluid d-flex mt-5">
<h5 class="font-italic text-muted">Coming soon!</h5>
</div>
</b-tab>
Expand Down Expand Up @@ -127,6 +127,10 @@ export default {
hasOpenForInterest: false,
}),
computed: {
person_can_select_sessions() {
let selectedPerson = this.selected_model(personModel);
return !["not_set", "declined", "rejected"].includes(selectedPerson.con_state)
},
tabsArray() {
const baseTabs = [
'edit',
Expand Down
Loading

0 comments on commit 41d4551

Please sign in to comment.