Starting with facets.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
--- /dev/null
+/* Reads content from /js/angular-config.js to make it available as
+ * dynamic content to pre-compiled angular components.
+ * Note this is not an Angular Service, since it may need to be
+ * accessed before a service-loading class can instantiate its services.
+ */
+declare var ANGULAR_CONFIG; // defined in /js/angular-config.js
+
+export class AngularConfig {
+
+ // Return the value found at the specified path in ANGULAR_CONFIG.
+ // E.g. AngularConfig.value('catalog', 'facets');
+ static value(...path: string[]): any {
+ if (typeof ANGULAR_CONFIG === undefined) {
+ return null;
+ }
+
+ let val = ANGULAR_CONFIG;
+
+ Object.keys(arguments).sort().forEach(pos => {
+ const key = arguments[pos];
+ if (val[key] === undefined) { return null; }
+ val = val[key]
+ });
+
+ return val;
+ }
+}
import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
import {CatalogSearchContext, FacetFilter} from '@eg/share/catalog/search-context';
import {StaffCatalogService} from '../catalog.service';
+import {AngularConfig} from '@eg/core/config';
-export const FACET_CONFIG = {
+let facetConfig = AngularConfig.value('catalog', 'facets');
+
+export const FACET_CONFIG = facetConfig || {
display: [
{facetClass : 'author', facetOrder : ['personal', 'corporate']},
{facetClass : 'subject', facetOrder : ['topic']},
<script src="/js/dojo/opensrf/JSON_v1.js"></script>
<script src="/js/dojo/opensrf/opensrf.js"></script>
<script src="/js/dojo/opensrf/opensrf_ws.js"></script>
+ <script src="/js/angular-config.js"></script>
</body>
</html>
--- /dev/null
+
+const ANGULAR_CONFIG = {
+ catalog: {
+ facets: {
+ display: [
+ {facetClass : 'author', facetOrder : ['personal', 'corporate']},
+ {facetClass : 'subject', facetOrder : ['topic']},
+ {facetClass : 'identifier', facetOrder : ['genre']},
+ {facetClass : 'series', facetOrder : ['seriestitle']},
+ {facetClass : 'subject', facetOrder : ['name', 'geographic']}
+ ],
+ displayCount : 5
+ }
+ }
+}
+