How to use the @ember/string.dasherize function in @ember/string

To help you get started, we’ve selected a few @ember/string 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 discourse / discourse / app / assets / javascripts / discourse / lib / show-modal.js.es6 View on Github external
export default function(name, opts) {
  opts = opts || {};
  const container = Discourse.__container__;

  // We use the container here because modals are like singletons
  // in Discourse. Only one can be shown with a particular state.
  const route = container.lookup("route:application");
  const modalController = route.controllerFor("modal");

  modalController.set("modalClass", opts.modalClass);

  const controllerName = opts.admin ? `modals/${name}` : name;
  modalController.set("name", controllerName);

  let controller = container.lookup("controller:" + controllerName);
  const templateName = opts.templateName || dasherize(name);

  const renderArgs = { into: "modal", outlet: "modalBody" };
  if (controller) {
    renderArgs.controller = controllerName;
  } else {
    // use a basic controller
    renderArgs.controller = "basic-modal-body";
    controller = container.lookup(`controller:${renderArgs.controller}`);
  }

  if (opts.addModalBodyView) {
    renderArgs.view = "modal-body";
  }

  const modalName = `modal/${templateName}`;
  const fullName = opts.admin ? `admin/templates/${modalName}` : modalName;
github TryGhost / Ghost-Admin / lib / koenig-editor / addon / lib / dnd / constants.js View on Github external
import {dasherize} from '@ember/string';

// we use data attributes rather than classes even though they can be slower
// because in many instances our draggable/droppable element's classes attribute
// could be dynamically generated which could remove our DnD classes when changed

export const CONTAINER_DATA_ATTR = 'koenigDndContainer';
export const CONTAINER_SELECTOR = `[data-${dasherize(CONTAINER_DATA_ATTR)}]`;

export const DRAGGABLE_DATA_ATTR = 'koenigDndDraggable';
export const DRAGGABLE_SELECTOR = `[data-${dasherize(DRAGGABLE_DATA_ATTR)}]`;

export const DROPPABLE_DATA_ATTR = 'koenigDndDroppable';
export const DROPPABLE_SELECTOR = `[data-${dasherize(DROPPABLE_DATA_ATTR)}]`;

export const DRAG_DISABLED_DATA_ATTR = 'koenigDndDisabled';
export const DRAG_DISABLED_SELECTOR = `[data-${dasherize(DRAG_DISABLED_DATA_ATTR)}]`;

export const DROP_INDICATOR_ID = 'koenig-drag-drop-indicator';
export const DROP_INDICATOR_ZINDEX = 10000;

export const GHOST_CONTAINER_ID = 'koenig-drag-drop-ghost-container';

export const GHOST_ZINDEX = DROP_INDICATOR_ZINDEX + 1;
github TryGhost / Ghost-Admin / lib / koenig-editor / addon / lib / dnd / constants.js View on Github external
import {dasherize} from '@ember/string';

// we use data attributes rather than classes even though they can be slower
// because in many instances our draggable/droppable element's classes attribute
// could be dynamically generated which could remove our DnD classes when changed

export const CONTAINER_DATA_ATTR = 'koenigDndContainer';
export const CONTAINER_SELECTOR = `[data-${dasherize(CONTAINER_DATA_ATTR)}]`;

export const DRAGGABLE_DATA_ATTR = 'koenigDndDraggable';
export const DRAGGABLE_SELECTOR = `[data-${dasherize(DRAGGABLE_DATA_ATTR)}]`;

export const DROPPABLE_DATA_ATTR = 'koenigDndDroppable';
export const DROPPABLE_SELECTOR = `[data-${dasherize(DROPPABLE_DATA_ATTR)}]`;

export const DRAG_DISABLED_DATA_ATTR = 'koenigDndDisabled';
export const DRAG_DISABLED_SELECTOR = `[data-${dasherize(DRAG_DISABLED_DATA_ATTR)}]`;

export const DROP_INDICATOR_ID = 'koenig-drag-drop-indicator';
export const DROP_INDICATOR_ZINDEX = 10000;

export const GHOST_CONTAINER_ID = 'koenig-drag-drop-ghost-container';

export const GHOST_ZINDEX = DROP_INDICATOR_ZINDEX + 1;
github peec / ember-css-transitions / addon / modifiers / css-transition.js View on Github external
async didUpdateArguments() {
    for (let key of this.validArgs) {
      let prevValue = this.prev[key];
      let value = this.args.named[key];
      this.prev[key] = value; // update previous value

      if (prevValue !== value) {
        let className = dasherize(key);

        if (value) {
          this.addClass(className);
          await this.transition('add', className);

          if (this.args.named.didTransitionIn) {
            this.args.named.didTransitionIn(className);
          }
        } else {
          await this.transition('remove', className);

          if (this.args.named.didTransitionOut) {
            this.args.named.didTransitionOut(className);
          }
        }
      }
github willviles / ember-scrollmagic / tests / dummy / app / examples.js View on Github external
export const examples = definitions.map(example => {
  return assign({}, example, {
    slug: dasherize(example.title)
  });
})
github cardstack / cardstack / packages / core / addon / components / field-renderer.js View on Github external
get fieldEditor() {
    return `fields/${dasherize(this.sanitizedType)}-editor`;
  }
github NYCPlanning / labs-zap-search / app / controllers / index.js View on Github external
selectSearchResult({ communityDistricts }, { geometry }) {
    const foundDistrict = lookupCommunityDistrict([communityDistricts, geometry]);
    
    this.transitionToRoute('show-geography', { queryParams: { 'community-districts': [dasherize(foundDistrict)] } });
  }
}
github cardstack / cardstack / packages / cardhost / app / components / field-renderer.js View on Github external
get fieldEditor() {
    return `fields/${dasherize(this.sanitizedType)}-editor`;
  }
github cardstack / cardstack / packages / cardhost / app / components / card-renderer.js View on Github external
get isolatedComponentName() {
    return `cards/${dasherize(this.componentName)}/isolated`;
  }
}
github tomasbasham / ember-cli-analytics / addon / services / analytics.js View on Github external
_lookupAdapter(adapterName) {
    assert('Could not find integration without a name', adapterName);

    const owner = getOwner(this);
    const dasherizedAdapterName = dasherize(adapterName);
    const localAdapter = owner.lookup(`ember-cli-analytics@integration:${dasherizedAdapterName}`);
    const adapter = owner.lookup(`integration:${dasherizedAdapterName}`);

    return adapter ? adapter : localAdapter;
  }
});

@ember/string

A set of utilities to transform strings

MIT
Latest version published 5 months ago

Package Health Score

73 / 100
Full package analysis

Similar packages