Skip to content

Commit

Permalink
Merge pull request #535 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
1.6.5
  • Loading branch information
Gailbear authored Jul 31, 2022
2 parents 9606a50 + dedf232 commit b3f0912
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 24 deletions.
2 changes: 2 additions & 0 deletions app/controllers/reports/session_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def session_copy_edit_status
worksheet.append_row(
[
'Session',
'Description',
'Areas',
'Status',
'Copy Edited',
Expand All @@ -24,6 +25,7 @@ def session_copy_edit_status
worksheet.append_row(
[
session.title,
session.description, # NOTE: there is no mechanism for format HTML for excel so put the desc in and see what happens
session.area_list.sort.join(';'),
session.status,
session.proofed ? 'Y' : 'N',
Expand Down
44 changes: 31 additions & 13 deletions app/javascript/components/table_vue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,25 @@
</div>
</div>

<div class="d-flex">
<div class="d-flex align-items-center">
<slot name="left-controls" v-bind:editableIds="editableIds"></slot>
<b-pagination class="ml-auto"
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
first-text="First"
last-text="Last"
prev-text="Prev"
next-text="Next"
></b-pagination>
</div>
<b-pagination
class="mb-0 mr-3 ml-auto"
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
first-text="First"
last-text="Last"
prev-text="Prev"
next-text="Next"
></b-pagination>
<b-form @submit="setCurrentPage()" inline>
<b-form-group label="Go to page" label-cols="auto">
<b-input type="number" v-model="tempCurrentPage" style="width: 5.5rem;"></b-input>
</b-form-group>
<b-button type="submit" variant="primary" class="ml-1">Go</b-button>
</b-form>
</div>
<div class="d-flex mb-1">
<span v-if="totalRows != fullTotalRows">Search Results: {{totalRows}}</span>
<span class="ml-auto">{{countCaption}}</span>
Expand All @@ -86,8 +93,14 @@

@row-selected="onRowSelected"
@sort-changed="onSortChanged"
:busy="tableBusy"
>
<template #head(selected)="selected">
<template #table-busy>
<div class="d-flex justify-content-center">
<b-spinner variant="primary"></b-spinner>
</div>
</template>
<template #head(selected)>
<b-form-checkbox
name="select-all-checkbox"
value="select_all"
Expand Down Expand Up @@ -129,6 +142,11 @@
prev-text="Prev"
next-text="Next"
></b-pagination>
<div class="d-flex justify-content-end">
<b-form-group label="Number of Records" label-cols="auto" class="mb-0">
<b-form-select :options="[10, 20, 50]" v-model="perPage"></b-form-select>
</b-form-group>
</div>
</div>
</template>

Expand Down Expand Up @@ -190,7 +208,7 @@ export default {
selected_items: [],
editable_ids: [],
keep: false, // semaphore to catch "false" unselect
selecedRowNbr: -1 // keep track of selected row to keep display
selecedRowNbr: -1, // keep track of selected row to keep display
}
},
computed: {
Expand Down
5 changes: 5 additions & 0 deletions app/javascript/store/app.store.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
export const MAGICAL_RELOAD = 'MAGICAL RELOAD'
export const SET_PER_PAGE = 'SET PER PAGE';

export const appStore = {
state: {
magicalReload: 0,
reloadedAt: new Date(),
perPage: 20
},
mutations: {
[MAGICAL_RELOAD] (state) {
state.magicalReload += 1;
state.reloadedAt = new Date();
},
[SET_PER_PAGE] (state, amt) {
state.perPage = amt;
}
}
}
47 changes: 41 additions & 6 deletions app/javascript/store/table.mixin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import modelMixin from "./model.mixin";
import { mapState, mapMutations } from 'vuex';
import { SET_PER_PAGE } from "./app.store";

export const tableMixin = {
mixins: [modelMixin],
Expand All @@ -11,10 +13,6 @@ export const tableMixin = {
type: Boolean,
default: false
},
perPage: {
type: Number,
default: 20
},
defaultFilter: {
type: String,
default: null
Expand All @@ -37,9 +35,22 @@ export const tableMixin = {
fullTotalRows: 0,
correctOrder: [],
url: null,
shall_clear: true
shall_clear: true,
tempCurrentPage: 1,
tableBusy: false,
}),
computed: {
...mapState({
storedPerPage: 'perPage'
}),
perPage: {
get() {
return this.storedPerPage;
},
set(val) {
this.setPerPage(val);
}
},
sortedCollection() {
// if we modify a single member of the collection, we no longer necessarily return the right order
// therefore, use the order we captured at ingestion to restore the right order
Expand All @@ -52,6 +63,9 @@ export const tableMixin = {
}
},
methods: {
...mapMutations({
setPerPage: SET_PER_PAGE
}),
removeFromCollection(id) {
this.correctOrder = this.correctOrder.filter( el => el != id)
},
Expand All @@ -64,7 +78,17 @@ export const tableMixin = {
]
}
},
setCurrentPage() {
const maxPage = Math.ceil(this.totalRows / this.perPage);
const oldCurrentPage = this.currentPage;
this.currentPage = Math.max(Math.min(this.tempCurrentPage, maxPage), 1);
if(oldCurrentPage === this.currentPage) {
// make sure it updates an illegal value if there's one in the ui still
this.tempCurrentPage = this.currentPage;
}
},
fetchPaged(clear=true) {
this.tableBusy = true;
this.shall_clear = clear
let _filter = JSON.stringify(this.filter)

Expand Down Expand Up @@ -101,19 +125,29 @@ export const tableMixin = {
this.fullTotalRows = data._jv.json.meta.full_total;
}
res(data);
}).catch(rej); // TODO maybe actually handle it here??
}).catch(rej).finally(() => this.tableBusy = false); // TODO maybe actually handle it here??
})
}
},
mounted() {
this.sortBy = this.defaultSortBy;
this.sortDesc = this.defaultSortDesc
this.url = this.defaultUrl
this.tempCurrentPage = this.currentPage;
// NOTE: if we do fatch paged here it will ignore any filters etc that are setup
// and will cause some weird behavious if we have initial filters
// this.fetchPaged();
},
watch: {
perPage(newVal, oldVal) {
if (newVal != oldVal) {
if (this.currentPage === 1) {
this.fetchPaged(this.shall_clear);
} else {
this.currentPage = 1;
}
}
},
currentPage(newVal, oldVal) {
// console.debug("currentpage changed:", newVal, oldVal)
// when we change the desired page to a new one, fetch again
Expand All @@ -122,6 +156,7 @@ export const tableMixin = {
// have to pass anything in here, it should just work
this.fetchPaged(this.shall_clear);
}
this.tempCurrentPage = this.currentPage;
},
filter(newVal, oldVal) {
// console.debug("filter changed:", newVal, oldVal)
Expand Down
6 changes: 3 additions & 3 deletions db/seeds/development/survey.seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
thank_you: Faker::Lorem.sentence,
submit_string: 'submit',
use_captcha: Faker::Boolean.boolean(true_ratio: 0.8),
public: Faker::Boolean.boolean(true_ratio: 0.8),
public: false,
transition_accept_status: nil,
transition_decline_status: nil,
welcome: Faker::Lorem.sentence,
Expand Down Expand Up @@ -94,7 +94,7 @@
thank_you: Faker::Lorem.sentence,
submit_string: 'submit',
use_captcha: Faker::Boolean.boolean(true_ratio: 0.8),
public: Faker::Boolean.boolean(true_ratio: 0.8),
public: false,
transition_accept_status: nil,
transition_decline_status: nil,
welcome: Faker::Lorem.sentence,
Expand Down Expand Up @@ -168,7 +168,7 @@
thank_you: Faker::Lorem.sentence,
submit_string: 'submit',
use_captcha: Faker::Boolean.boolean(true_ratio: 0.8),
public: Faker::Boolean.boolean(true_ratio: 0.8),
public: false,
transition_accept_status: [nil, :probable, :accepted].sample,
transition_decline_status: [nil, :not_set, :declined].sample,
welcome: Faker::Lorem.sentence,
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This software is open source! If you'd like to contribute, please email planoram

[Planorama Data Privacy & Protection Policy](/planorama/privacy)

Production version: 1.6.4
Production version: 1.6.5

Staging version: 1.6.4
Staging version: 1.6.5

<script type="text/javascript" src="https://chicon-planorama.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e-T/r5gghz/b/3/bc54840da492f9ca037209037ef0522a/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=816c99a7"></script>

0 comments on commit b3f0912

Please sign in to comment.