Coder Social home page Coder Social logo

meteor-missing-helpers's Introduction

Missing UI template helpers for Meteor

Build Status

This project was inspired by awesome template tags and filters shipped with Django.

Installation:

meteor add msamoylov:missing-helpers

Template helpers:

  1. {{stripTags yourStringWithHTML}}. This global template helper removes HTML tags from your string. It's possible to provide a second parameter with the list of allowed tags. For instance, {{stripTags yourStringWithHTML "<strong><p>"}}
  2. {{hasVerifiedEmail userObject}}. Can be useful for prompting users to verify their email addresses. If the parameter is omitted, the helper uses ```{{currentUser}}`` variable.
  3. {{currentYear}} returns a string with the current year. Can be useful for generating a footer with your copyright.
  4. {{formatDateTime createdAt formatString}} returns a formatted date according to moment.js formatting rules. For instance, {{formatDateTime createdAt "MMM D"}} produces "Jan 13", and {{formatDateTime createdAt}} does "2015-01-13T23:44:50+02:00"
  5. {{timeSince createdAt}} returns relative time since a given date. A wrapper for moment().fromNow()
  6. {{truncateChars yourString length}} truncates a string after a certain number of characters.
  7. {{linebreaksbr yourText}} converts all newlines in a piece of plain text to HTML line breaks (<br>). If you provide a second parameter as true, it will remove the existing newlines from text.

Low-level utilities:

  1. MissingUtility.cleanTags(yourStringWithHTML) removes all HTML tags from a given string. The second parameter accepts a string with allowed tags. For instance, MissingUtility.cleanTags(yourStringWithHTML, '<strong><p>').
  2. MissingUtility.hasVerifiedEmail(userObject) determines if a user has verified his email address.
  3. MissingUtility.truncateChars(yourString, length) truncates a string after a certain number of characters.
  4. MissingUtility.nl2br(yourText) converts all newlines in a piece of plain text to HTML line breaks (<br>). If you provide a second parameter as true, it will remove the existing newlines from text.

meteor-missing-helpers's People

Contributors

arrel avatar msamoylov avatar victorhooi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.