// var components = {}; // var globalIds; function updateNamespace(ns) { conjur.app.namespace.currentNamespace = ns; // it won't work with reactjs 11.0 -- state should be set from within component // components[kind].setState({currentNamespace: ns, members: lists[kind].members(ns)}); } $(document).ready(function() { conjur.initialize(); _.mixin(_.str.exports()); // Use delegation to avoid initial DOM selection and allow all matching elements to bubble $(document).delegate('a', 'click', function(evt) { // Get the anchor href and protcol var href = $(this).attr('href'); var protocol = this.protocol + '//'; // Ensure the protocol is not part of URL, meaning its relative. // Stop the event bubbling to ensure the link will not cause a page refresh. if (href.slice(0,protocol.length) !== protocol && href[0] !== '#') { evt.preventDefault(); // Note by using Backbone.history.navigate, router events will not be // triggered. If this is a problem, change this to navigate on your // router. Backbone.history.navigate(href, {trigger:true}); } }); conjur.app.router = new conjur.Workspace(); conjur.app.router.on('all', function(route, router) { console.log('router.all', route, conjur.app.flash); if (route != 'route') { return; } if (conjur.app.flash) { var old = conjur.app.flash; conjur.app.flash = null; var $flash = $('#flash'); var $text = $('.text', $flash); $text.text(old); $flash.show(); } else { $('#flash').hide(); } }); Backbone.history.start({pushState: true}); React.renderComponent(conjur.views.NavSearchForm(null), document.getElementById('inlineSearchContainer')); });