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.
console.log
wanted or left over from debugging?Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Thank you for your review, @helo! Keep up the good work!
Congratulations @sirfreeman! You received a personal award!
Click here to view your Board of Honor
Do not miss the last post from @steemitboard:
Hey, @sirfreeman!
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!