Coder Social home page Coder Social logo

meteor-comments-ui's Introduction

Meteor Comments UI

This package lets you add disqus like comment functionality in a matter of seconds. Comments-ui uses the Meteor accounts system which (in constrast to disqus) makes it easy to get the data and use it to your wishes.

<div class="comment-section">
    {{> commentsBox id=documentId}}
</div>

documentId could be the id of a blog post, news article or a custom defined string that stands for your guestbook.

How to install

meteor add arkham:comments-ui

UI Templates

There are two default templates for Bootstrap 3 and Semantic UI with according html, configure it like following.

// On the Client
Comments.ui.config({
   template: 'bootstrap'
});

semantic-ui is the default, because of the semantic markup that is written with it.

Customization

Templates

You can customize the output of the commentsBox by adding a customTemplate parameter.

<template name="myComments">
    <ul>
        {{#each comment}}
            ...
            <li>{{content}}</li>
            ...
        {{/each}}
    </ul>
</template>


<template name="post">
    {{> commentsBox id=post._id customTemplate="myComments"}}
</template>

Have a look at the default template to see what data you have available. There are predefined classes that have an action suffix on their classes, that define when to act on certain events (for example create-action, edit-action and so on).

Schema

Changing the Simple Schema definition is possible by using changeSchema.

Comments.changeSchema(function (currentSchema) {
  currentSchema.image = { type: Object, optional: true };
});

Text Strings

You might see that there is a lot of predefined text that is shown in the commentsBox component. You can change those by calling a setContent method.

Comments.ui.setContent({
  title: 'Kommentieren',
  save: 'Speichern',
  reply: 'Antworten',
  edit: 'Editieren',
  'placeholder-textarea': 'Teile uns deine Meinung mit',
  'add-button-reply': 'Antwort hinzufügen',
  'add-button': 'Kommentar hinzufügen',
  'load-more': 'Mehr Kommentare laden'
});

The configurable values are:

  • title Title of the box
  • add-button Button text for adding comments
  • placeholder-textarea Placeholder for commenting textarea
  • save, edit and remove Action texts
  • load-more Load more button text

Configurable values

You can configure following values that changed the comments-ui functionality.

Comments.ui.config({
    limit: 20, // default 10
    loadMoreCount: 20, // default 20
    template: 'bootstrap', // default 'semantic-ui'
    defaultAvatar: 'my/defaultavatarimage.png' // default 'http://s3.amazonaws.com/37assets/svn/765-default-avatar.png'
});

meteor-comments-ui's People

Contributors

matteodem avatar zyleee 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.