How to use the mithril.buildQueryString function in mithril

To help you get started, we’ve selected a few mithril examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tutao / tutanota / src / app.js View on Github external
const calendarViewResolver = createViewResolver(() => _asyncImport("src/calendar/CalendarView.js")
		.then(module => new module.CalendarView()), true)

	let start = "/"
	if (!state.prefix) {
		state.prefix = location.pathname[location.pathname.length - 1] !== '/'
			? location.pathname : location.pathname.substring(0, location.pathname.length - 1)

		let query = m.parseQueryString(location.search)
		let redirectTo = query['r'] // redirection triggered by the server (e.g. the user reloads /mail/id by pressing F5)
		if (redirectTo) {
			delete query['r']
		} else {
			redirectTo = ""
		}
		let newQueryString = m.buildQueryString(query)
		if (newQueryString.length > 0) {
			newQueryString = "?" + newQueryString
		}
		let target = redirectTo + newQueryString + location.hash
		if (target === "" || target[0] !== "/") target = "/" + target
		history.replaceState(null, "", neverNull(state.prefix) + target)
		start = target
	}
	m.route.prefix = neverNull(state.prefix)

	// keep in sync with RewriteAppResourceUrlHandler.java
	m.route(document.body, start, {
		"/": {
			onmatch: (args, requestedPath) => forceLogin(args, requestedPath)
		},
		"/login": loginViewResolver,
github gocd / gocd / server / webapp / WEB-INF / rails / webpack / single_page_apps / new_dashboard.js View on Github external
function currentView(viewName, replace = false) {
    const current = queryObject();
    if (!arguments.length) {
      return current.viewName || personalizeVM.names()[0];
    }

    const route = window.location.hash.replace(/^#!/, "");

    if (current.viewName !== viewName) {
      const path = [
        window.location.pathname,
        viewName ? `?${m.buildQueryString($.extend({}, current, {viewName}))}` : "",
        route ? `#!${route}` : ""
      ].join("");

      history[replace ? "replaceState" : "pushState"](null, "", path);

      if (route) {
        m.route.set(route, null, {replace: true}); // force m.route() evaluation
      }
    }

    personalizeVM.loadingView(true);

    // Explicit set always refreshes; even if the viewName didn't change,
    // we should refresh because the filter definition may have changed as
    // currentView() is called after every personalization save operation.
    repeater().restart();
github gocd / gocd / server / webapp / WEB-INF / rails / webpack / helpers / spark_routes.ts View on Github external
static apiUsersSearchPath(searchText: string) {
    return `/go/api/user_search?${m.buildQueryString({q: searchText})}`;
  }
github gocd / gocd / server / src / main / webapp / WEB-INF / rails / webpack / helpers / spark_routes.ts View on Github external
static apiPipelineActivity(params: { [key: string]: string | number }) {
    return `/go/pipelineHistory.json?${m.buildQueryString(params)}`;
  }
github gocd / gocd / server / webapp / WEB-INF / rails / webpack / helpers / spark_routes.ts View on Github external
static apiCurrentAccessTokensPath(filter?: "all" | "revoked" | "active") {
    if (filter) {
      return `/go/api/current_user/access_tokens?${m.buildQueryString({filter})}`;
    } else {
      return `/go/api/current_user/access_tokens`;
    }
  }
github gocd / gocd / server / webapp / WEB-INF / rails.new / webpack / helpers / spark_routes.js View on Github external
pipelineMaterialSearchPath: (pipelineName, fingerprint, searchText) => {
    const queryString = m.buildQueryString({
      fingerprint,
      pipeline_name: pipelineName, //eslint-disable-line camelcase
      search_text:   searchText //eslint-disable-line camelcase
    });
    return `/go/api/internal/material_search?${queryString}`;
  },
github gocd / gocd / server / webapp / WEB-INF / rails / webpack / helpers / spark_routes.ts View on Github external
static showDashboardPath(viewName?: string, allowEmpty?: boolean): string {
    const params: any = {};

    if (viewName) {
      Object.assign(params, { viewName });
    }

    if ("boolean" === typeof allowEmpty) {
      Object.assign(params, { allowEmpty });
    }

    return Object.keys(params).length ?
      `/go/api/dashboard?${m.buildQueryString(params)}` :
      "/go/api/dashboard";
  }
github gocd / gocd / server / src / main / webapp / WEB-INF / rails / webpack / helpers / spark_routes.ts View on Github external
static showDashboardPath(viewName?: string, allowEmpty?: boolean): string {
    const params: any = {};

    if (viewName) {
      Object.assign(params, {viewName});
    }

    if ("boolean" === typeof allowEmpty) {
      Object.assign(params, {allowEmpty});
    }

    return Object.keys(params).length ?
      `/go/api/dashboard?${m.buildQueryString(params)}` :
      "/go/api/dashboard";
  }
github gocd / gocd / server / src / main / webapp / WEB-INF / rails / webpack / helpers / spark_routes.ts View on Github external
static apiCurrentAccessTokensPath(filter?: "all" | "revoked" | "active") {
    if (filter) {
      return `/go/api/current_user/access_tokens?${m.buildQueryString({filter})}`;
    } else {
      return `/go/api/current_user/access_tokens`;
    }
  }
github gocd / gocd / server / src / main / webapp / WEB-INF / rails / webpack / helpers / spark_routes.ts View on Github external
static showAnalyticsPath(pluginId: string, metric: AnalyticsCapability, params: { [key: string]: string | number }) {
    return `/go/analytics/${pluginId}/${metric.type}/${metric.id}?${m.buildQueryString(params)}`;
  }