/* * Config to provide global vars and configuration for visualisations and custom scripts * Martin Lewis-Dalgarno * December 2022 */ // Create a config to be passed into objects // NOTE - iconPath and urls are processed by template engine to render server side - may show as invalid JS in editor // Permissions are passed in so front end scripts know what to show - backend route also protected in case any script readers try to be clever ;P let config = { debugMode: false, route_name: globalRouteName, preload: { conventionId: 114, delegationId: 862, }, permissions: { can_edit_groupings: 'False' }, visualisations: { requestUrls: { getAllEventsCommitteeBySession: '/vis/getAllEventsCommitteeBySession/-1/', committeeMusicTreeJson: '/vis/committee_music_tree_json/-1', committeeMusicTreeJsonWithDocumentId: '/vis/committee_music_tree_json/-1/-2', getPersonConventionInvolvements: '/vis/getPersonConventionInvolvements/-1/', getAllConventionTrees: '/vis/getAllConventionTrees/-1/', getSearchTermResultInRadialTree: '/vis/getSearchTermResultInRadialTree/-1/-2', getSearchTermResultInRadialTreeCommittee: '/vis/getSearchTermResultInRadialTreeCommittee/-1/-2', getCommentarySessionMaps: '/vis/commentary_session_maps/-1', getConventionSessionMap: '/vis/convention_session_map/-1', sessionSearch: '/vis/session_search/-1/-2', sessionSearchWithCommitteeId: '/vis/session_search/-1/-2/-3', getTreesForCommittee: '/vis/getTreeForCommittee/-1', getTreesForCommitteeWithSessionId: '/vis/getTreeForCommittee/-1/-2', listResourcesJson: '/vis/list_resources_json/-1', getDocumentRelationshipsGraph: '/vis/document_relationships_graph/-1', getDocumentTree: '/vis/document_tree/-1', getKeywords: '/vis/getKeywords', getKeywordsInConvention: '/vis/getKeywordsInConvention/', getKeywordDescription: '/vis/get_keyword_description/-1', getListOfEventsBasedOnKeywordEventType: '/vis/getListOfEventsBasedOnKeywordEventType/', getKeyDocumentsByConvention: '/vis/key_documents/-1', documentsVisualizeHighlightRoute: '/vis/documents_visualize_highlight_route/-1/-2', getCommitteesAndSessions: '/vis/getCommitteesAndSessions', getSearchResultForDocumentFlow: '/vis/getSearchResultForDocumentFlow/-1/-2', getRelatedEvents: '/vis/getRelatedEvents/-1', getTextForProposal: '/vis/getTextForProposal', getEventItem: '/vis/getEventItem/-1', getTargetDocumentId: '/vis/getTargetDocumentId', getSearchTermResultInRadialTreeUpToEvent: '/vis/getSearchTermResultInRadialTreeUpToEvent/-1/-2', getPersonVotesCommitteeBySession: '/vis/getPersonVotesCommitteeBySession/-1/', getProjectionData: '/vis/projection_data/-1/', getResourceMaps: '/vis/resource_maps/-1', getHighlightsForEvent: '/vis/getHighlightsForEvent', getTreeWhenCurrentDocumentRowClicked: '/vis/getTreeWhenCurrentDocumentRowClicked', compareAncestorDocuments: '/vis/compare_ancestor_documents/-1', compareAncestorDocumentsWithUntil: '/vis/compare_ancestor_documents/-1/-2', getEventDataAll: '/vis/getEventDataAll/-1', getEventDataAllWithType: '/vis/getEventDataAll/-1/-2', getSubDecisionEventDataAll: '/vis/getSubDecisionEventDataAll/-1', getSessionEventDetailsNoTextWithPermission: '/vis/getSessionEventDetailsNoTextWithPermission/-1/-2', getResources: '/vis/getResources', getCommentaries: '/vis/getCommentaries', getPermissionCanEditTimeline: '/vis/getPermissionCanEditTimeline', getConventionSummaryJson: '/vis/convention_summary_json/-1', getSessionEventDetailsJSON: '/vis/getSessionEventDetailsJSON/-1', getSessionEventDetailsInAddEventJSON: '/vis/getSessionEventDetailsInAddEventJSON/-1/-2/-3', putKeywordsInDropdown: '/vis/putKeywordsInDropdown/', getValidProposalsWithoutTexts: '/vis/getValidProposalsWithoutTexts', getDocumentVersionObject: '/vis/getDocumentVersionObject', getTargetEventDetails: '/vis/getTargetEventDetails/-1/', getTargetEventDetailsFromSubdecision: '/vis/getTargetEventDetailsFromSubdecision/-1/', }, }, urls: { api: { updateResourceGroupingParentId: '/m2/api/resource_groupings/-1/parent_group_id/-2', deleteResourceGrouping: '/m2/api/resource_groupings/-1', putUpdateResourceGrouping: '/m2/api/resource_groupings/-1', postCreateResourceGrouping: '/m2/api/resource_groupings/-1', getResourceGroupings: '/m2/api/resource_groupings/-1', getConventionSubGroups: '/m2/audit/api/conventionSubGroups/-1', getCollectionItems: '/m2/audit/api/collectionItemsList/-1/-2', nuclino: { getNotes: '/m2/api/nuclino/content/-1/-2', saveNotes: '/m2/api/nuclino/update/-1', }, lookup: { negotiations:{ list: '/m2/api/negotations/list', }, committees:{ list: '/m2/api/negotation/-1/committees/list', }, entity: { search: '/m2/api/entity/search', create: '/m2/api/entity/create', link: '/m2/api/entity/link/', unlink: '/m2/api/entity/unlink/', }, person: { search: '/m2/api/person/search', create: '/m2/api/person/create', link: '/m2/api/person/link/resource_collection/', unlink: '/m2/api/person/unlink/resource_collection/', } } }, form: { addResourceCollection: { submit: { path: '/resource_collections/create/', type: 'POST' } }, editResourceCollection: { submit: { path: '/resource_collections/update/-1/', type: 'PUT' } }, editResourceItem: { submit: { path: '/resource_collections/document_resource/-1/update/', type: 'PUT' }, }, addResourceItem: { submit: { path: '/resource_collections/document_resource/-1/create/', type: 'POST' }, types: ['text/image','file','link'], fields: { 'text/image': [ { label: 'Text Format', id: 'itemFormat', type: 'select', options: [ {text: 'Text', value: 'text/text'}, {text: 'Markdown', value: 'text/markdown'}, ], required: true }, { label: 'Text Content', id: 'itemContent', type: 'textarea', required: false }, { label: 'Image', id: 'image', type: 'file' } ], 'file': [ { label: 'File', id: 'itemBinary', type: 'file', required: true }, /*{ label: 'Transcription', id: 'itemTranscription', type: 'textarea' }*/ ], 'link': [ { label: 'URL', id: 'itemURL', type: 'url', required: true } ] } } }, // Wrap these in an audit object displayNegotiation: '/negotiation/-1/full-record', displayResourceCollection: '/resource_collections/-1/', displayCommentaryCollection: '/commentaries/commentary_collections/-1', displayCommittee: '/m2/committee/-1', displayDelegation: '/m2/delegation/-1', displaySession: '/m2/session/-1', displayPerson: '/m2/person/-1', displayItem: { 'resource': '/resource_collections/-1/resource_item/-2', 'commentary': '/m2/commentaries/-1/commentary_item/-2', }, baseUrl: '/m2/', currentPath: '/m2/js/config.js', committee: { view_details: '/m2/committee/-1', }, votingRecord: '/m2/votingRecord/-1', eventExtraDescription: '/m2/event_exta_description/-1', }, pages: { library: { section: librarySection, // Passed from global setting in base2 template }, }, imgPath: 'img/', iconPath: '/m2/static/img/icons2', contentFilter: { elements: { searchInputClass: 'quill-filter-input', searchSelectClass: 'quill-filter-select', searchMultiSelectClass: 'quill-filter-multi-select', resultTotalClass: 'quill-filter-result-total', wrapperClass: 'quill-filter-wrapper', contentSwitchTriggerClass: 'quill-content-switch-trigger' } }, validation: { emailRegex: /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/, }, utilities: { elements: { jumpToBadgeClass: 'jump-to-badge', jumpToCodeClass: 'jump-to-code', chevronButtonClass: 'btn-chevron', selectVisibilityToggleClass: 'select-visibility-toggle', toggleContentTriggerClass: 'quill-toggle-content-trigger', toggleContentViewClass: 'quill-toggle-content-view', btnUpdateTotalClass: 'btn-update-filter-total', btnBoxSwitchClass: 'quill-box-select', btnToggleColsClass: 'quill-toggle-cols', heightMatchClass: 'quill-height-matcher', contactFormPrepopulateButtonClass: 'btn-contact-form-trigger', toggleHiddenClass: 'quill-toggle-hidden', animateSpinOnHoverClass: 'btn-hover-spin', }, jumpToUrlPath: "/m2/fetch/-1" }, notifications: { data: [], elements: { containerId: 'quill-notifications' }, templatePath: { success: "/m2/static/html/notification-success.html", error: "/m2/static/html/notification-error.html", warning: "/m2/static/html/notification-warning.html", confirmation: "/m2/static/html/notification-confirmation.html", }, }, forms: { elements: { buttonSubmitClass: 'btn-quill-form', feedbackClass: 'invalid-feedback', linkApiClass: 'quill-api-link' } }, subMenu: { elements: { secondaryNavLinkClass: 'secondary-nav-link', secondaryNavClass: 'secondary-nav', dropdownOpenMenuClass: 'dropdown-open-menu', dropdownCloseLinkClass: 'dropdown-close-link', scrollToLinkClass: 'in-page-scroll-link' }, animateSpeed: 150, waitForAccordionOpenTime: 100 }, sidebar: { elements: { linkTriggerClass: 'sidebar-content-link', sidebarTitleId: 'sidebar-label', sidebarId: 'offcanvas-sidebar', sidebarContentClass: 'sidebar-content', }, }, visualisationHandler: { elements: { triggerClass: 'quill-visualisation-trigger', contextSwitchClass: 'quill-convention-context-switch' } }, bookmarks: { localStorageKeyPrefix: 'quill-bookmarks-', localStorageKeyUser: 'guest', elements: { containerId: 'bookmarks-container', itemsId: 'bookmarks-items', linkClass: 'btn-save-bookmark', clearAllDataClass: 'btn-clear-all-bookmarks', }, }, search: { general_search: { categories: ['conventions','sessions','events','committees','delegations','people','resource_collections','resources', 'commentary_collections','commentaries'], results_per_page: 5, }, /* general_search: { groups: ['organised_events','groups_and_people','resources','commentaries'], groups_with_categories: { organised_events: { categories: ['conventions','sessions','events'] }, groups_and_people: { categories: ['committees','delegations','people'] }, resources: { categories: ['resource_collections','resources'] }, commentaries: { categories: ['commentary_collections','commentaries'] } }, results_per_page: 5, },*/ elements: { navSearchInputClass: 'quill-search-input', quickSearchTagClass: 'quill-quick-search-tag', navSearchFilterCategoryClass: 'quill-search-filter-category', navSearchFilterConventionClass: 'quill-search-filter-convention-id', searchFiltersModalId: 'quill-search-filter-options', searchLoaderClass: 'fa-quill-search-loading', searchInstantResultsClass: 'quill-nav-search-results', searchInstantResultsGeneralClass: 'quill-nav-search-results-general', searchInstantResultsDateClass: 'quill-nav-search-results-date', searchInstantResultsPhraseClass: 'quill-nav-search-results-phrase', searchClearIconClass: 'fa-quill-search-clear', searchDefaultIconClass: 'fa-quill-search-default', btnCloseSearchResultsClass: 'btn-quill-search-results-close', btnViewAllSearchResultsClass: 'btn-view-full-search-results', allSearchResultsId: 'full-search-results', wrapperAllSearchResultsId: 'wrapper-full-search-results', wrapperPageContentId: 'page-content-wrap', btnToggleFullResultsColumnId: 'btn-toggle-results-column' }, searchPath: "/m2/api/v1/search/-1", jumpCodeSearchPath: "/m2/api/v1/jump_code/-1", dateMatchSearchPath: "/m2/api/v1/search_date/-1", phraseSearchPath: "/m2/api/v1/ngram_search/-1", searchTypingTimeout: 1500, resultGroups: ['commentaries','commentary_collections','committees','conventions','delegations','events','people','resource_collections','resources','sessions'] }, templates: { loading: { iconPath: "/m2/static/img/loading-dots.svg" }, notifications: { success: "/m2/static/html/notification-success.html", error: "/m2/static/html/notification-error.html", warning: "/m2/static/html/notification-warning.html", confirmation: "/m2/static/html/notification-confirmation.html", }, bookmarks: { default: { loaded: false, path: "/m2/static/html/bookmark.html", html: null } }, search: { results: { general: { loaded: false, path: "/m2/static/html/search_results/general_search_2.html", html: null }, date: { loaded: false, path: "/m2/static/html/search_results/date_search.html", html: null }, phrase: { loaded: false, path: "/m2/static/html/search_results/phrase_search.html", html: null } } } }, iconHelp: { elements: { pageWrapperId: 'icon-help-pages', pageClass: 'icon-help-page', navButtonClass: 'icon-help-nav-button', toggleViewButtonId: 'icon-help-toggle-view' }, data: [ { title: 'Individuals and Opinion Rights', subtitle: 'Displayed with a round icon', icons: [ { label: 'Joining a committee', image: 'icon-people-join.svg', }, { label: 'Leaving a committee', image: 'icon-people-leave.svg', }, { label: 'Elected to a position', image: 'icon-people-vote.svg', }, { label: 'Roll-call', image: 'icon-people-attendance.svg', }, ] }, { title: 'Amending of Documents', subtitle: 'Displayed with parchment coloured, square icons', icons: [ { label: 'Create a proposal', image: 'icon-doc-subtype-script-add.svg' }, { label: 'Create a document (line by line revision)', image: 'icon-doc-subtype-script-amend.svg' }, { label: 'Document amendment proposed', image: 'icon-doc-amend.svg' }, { label: 'Document taken from another committee', image: 'icon-doc-subtype-script-import.svg' }, { label: 'Amendment taken from another committee', image: 'icon-doc-amend-import.svg' }, { label: 'Debate a proposal', image: 'icon-doc-debate.svg' } ] }, { title: 'Explicit Document Subtypes', subtitle: 'Displayed with parchment coloured, square backgrounds with specific icons', icons: [ { label: 'Legislative text', image: 'icon-doc-subtype-legislation-add.svg' }, { label: 'Formal resolutions', image: 'icon-doc-subtype-decision-add.svg' }, { label: 'Message to be sent elsewhere', image: 'icon-doc-subtype-message-add.svg' }, { label: 'Petition to be considered', image: 'icon-doc-subtype-petition-add.svg' }, { label: 'Rules & Order of Business', image: 'icon-doc-subtype-procedure-add.svg' } ] }, { title: 'Decisions Taken', subtitle: 'Diamond shaped, purple icons', icons: [ { label: 'Drop a proposal', image: 'icon-decision-drop.svg' }, { label: 'Refer a proposal to another committee', image: 'icon-decision-refer.svg' }, { label: 'Adopt a proposal', image: 'icon-decision-adopt.svg' }, { label: 'Other vote (continue debate)', image: 'icon-decision-forward.svg' }, { label: 'Reject a proposal', image: 'icon-decision-reject.svg' }, { label: 'Postpone a debate', image: 'icon-decision-postpone.svg' } ] }, { title: 'Procedural proposals', subtitle: 'How committees work rather than document amends and represented by blue, hexagon shaped icons', icons: [ { label: 'Procedural motion', image: 'icon-procedure-motion.svg' }, { label: 'Procedural motion with sub-decisions', image: 'icon-procedure-motion-with-subdecisions.svg' }, { label: 'Debate on a procedural motion', image: 'icon-procedure-debate.svg' } ] } ] } }