UI updates (#151)
* infer card title * Infer entry body & image * infer image * Better terminology: EntryListing accept a single Collection * remove log * Refactored Collections VO into selectors * use selectors when showning card * fixed size cards * Added 'bio' and 'biography' to collection description inference synonyms * Removed unused card file * throw error instance * bugfix for file based collections * lint * moved components with css to own folder * Search Bugfix: More than one collection might be returned * Changed sidebar implementation. Closes #104 & #152 * Show spinning loading for unpublished entries * Refactored Sidebar into a separate container * Make preview widgets more robust
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { createEntry } from '../../../valueObjects/Entry';
|
||||
import _ from 'lodash';
|
||||
import Collection from '../../../valueObjects/Collection';
|
||||
import { createEntry } from '../../../valueObjects/Entry';
|
||||
import { selectEntrySlug } from '../../../reducers/collections';
|
||||
|
||||
function getSlug(path) {
|
||||
const m = path.match(/([^\/]+?)(\.[^\/\.]+)?$/);
|
||||
@ -102,12 +102,11 @@ export default class Algolia {
|
||||
if (this.entriesCache.collection === collection && this.entriesCache.page === page) {
|
||||
return Promise.resolve({ page: this.entriesCache.page, entries: this.entriesCache.entries });
|
||||
} else {
|
||||
const collectionModel = new Collection(collection);
|
||||
return this.request(`${ this.searchURL }/indexes/${ collection.get('name') }`, {
|
||||
params: { page },
|
||||
}).then((response) => {
|
||||
const entries = response.hits.map((hit) => {
|
||||
const slug = collectionModel.entrySlug(hit.path);
|
||||
const slug = selectEntrySlug(collection, hit.path);
|
||||
return createEntry(collection.get('name'), slug, hit.path, { data: hit.data, partial: true });
|
||||
});
|
||||
this.entriesCache = { collection, pagination: response.page, entries };
|
||||
|
Reference in New Issue
Block a user