SirFreeman avatar

Update on KnackSteem Development

sirfreeman

Published: 05 Dec 2018 › Updated: 05 Dec 2018Update on KnackSteem Development

Update on KnackSteem Development

Repository

https://github.com/knacksteem/knacksteem.org

Pull Request

https://github.com/knacksteem/knacksteem.org/pull/63

This PR add a new tagging feature for the knacksteem editor, which uses tag validation on the first tag to be apart of the knacksteem category. Also with this PR the following issues were fixed.

https://github.com/knacksteem/knacksteem.org/issues/55

https://github.com/knacksteem/knacksteem.org/issues/59

https://github.com/knacksteem/knacksteem.org/issues/57

A simple validation for the tags below

/**
 * @method checkTags -- method to validate tags for any error
 * 
 * @param {Array} rule -- all rules to validate
 * 
 * @param {Array} value -- all values from tag selection
 * 
 * @param {Function} callback -- callback funtion
 */

checkTags = (rule, value, callback) => {
    
    if (!value || value.length < 1 || value.length > 4) {
      callback('You have to add 1 to 4 tags');
    };

    if (value){
      const {isComment} = this.props;
      const {categories} = this.props.articles;
      if (!isComment && categories.map(elem => elem.key).indexOf(value[0]) === -1) {
        callback('first tag must be any of the following; graphics, art, vlog, knack, techtrends ');
      }   
    }

    value
      .map(tag => ({ tag, valid: /^[a-z0-9]+(-[a-z0-9]+)*$/.test(tag) }))
      .filter(tag => !tag.valid)
      .map(tag => callback(`Tag ${tag.tag} is invalid`));

    callback();
};

If there are no values, or the values in the array are less than for, we initiate a callback. that informs the user.Next we also check if the tag is a valid tag with the regex matching.

What's next?

Integration of Voting Slider and fixing some bugs on the repo.

Commits

https://github.com/knacksteem/knacksteem.org/pull/63/commits/4bbffdbc39e28852e3db3908662ddc6447874fc7

https://github.com/knacksteem/knacksteem.org/pull/63/commits/3663453d7f65f1f623294d481a509a7749eecfe2

https://github.com/knacksteem/knacksteem.org/pull/63/commits/20ee2367ca544e3e555ab22ad72c3298b517cbbf

Github Account

https://github.com/ogbiyoyosky

Leave Update on KnackSteem Development to:

Written by

Am a Biochemical technologist, also a full stack developer. I love laravel, the lucid architecture guy.

Read more #utopian-io posts


Best Posts From SirFreeman

We have not curated any of sirfreeman's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From SirFreeman