diff --git a/app/javascript/dashboard/helper/commons.js b/app/javascript/dashboard/helper/commons.js index 40ff06c83..85e997802 100644 --- a/app/javascript/dashboard/helper/commons.js +++ b/app/javascript/dashboard/helper/commons.js @@ -61,3 +61,10 @@ export const createPendingMessage = data => { return pendingMessage; }; + +export const convertToSlug = text => { + return text + .toLowerCase() + .replace(/[^\w ]+/g, '') + .replace(/ +/g, '_'); +}; diff --git a/app/javascript/dashboard/helper/specs/commons.spec.js b/app/javascript/dashboard/helper/specs/commons.spec.js index 2df5e36b5..379e97e86 100644 --- a/app/javascript/dashboard/helper/specs/commons.spec.js +++ b/app/javascript/dashboard/helper/specs/commons.spec.js @@ -1,4 +1,8 @@ -import { getTypingUsersText, createPendingMessage } from '../commons'; +import { + getTypingUsersText, + createPendingMessage, + convertToSlug, +} from '../commons'; describe('#getTypingUsersText', () => { it('returns the correct text is there is only one typing user', () => { @@ -83,3 +87,9 @@ describe('#createPendingMessage', () => { expect(pending.attachments.length).toBe(1); }); }); + +describe('convertToSlug', () => { + it('should convert to slug', () => { + expect(convertToSlug('Test@%^&*(){}>.!@`~_ ing')).toBe('test__ing'); + }); +}); diff --git a/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json b/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json index a3bbd1254..d7bcb597a 100644 --- a/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json @@ -35,7 +35,29 @@ }, "API": { "SUCCESS_MESSAGE": "Attribute added successfully", - "ERROR_MESSAGE": "Could not connect to Woot Server, Please try again later" + "ERROR_MESSAGE": "Could not able to create an attribute, Please try again later" + } + }, + "DELETE": { + "BUTTON_TEXT": "Delete", + "API": { + "SUCCESS_MESSAGE": "Attribute deleted successfully.", + "ERROR_MESSAGE": "Couldn't delete the attribute. Try again." + }, + "CONFIRM": { + "TITLE": "Are you sure want to delete - %{attributeName}", + "PLACE_HOLDER": "Please type {attributeName} to confirm", + "MESSAGE": "Deleting will remove the attribute", + "YES": "Delete ", + "NO": "Cancel" + } + }, + "EDIT": { + "TITLE": "Edit attribute", + "UPDATE_BUTTON_TEXT": "Update", + "API": { + "SUCCESS_MESSAGE": "Attribute updated successfully", + "ERROR_MESSAGE": "There was an error updating attribute, please try again" } }, "TABS": { diff --git a/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue b/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue index 632e520e1..d374a104d 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue @@ -85,6 +85,8 @@ diff --git a/app/javascript/dashboard/routes/dashboard/settings/attributes/EditAttribute.vue b/app/javascript/dashboard/routes/dashboard/settings/attributes/EditAttribute.vue new file mode 100644 index 000000000..d8a3a3fc5 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/attributes/EditAttribute.vue @@ -0,0 +1,162 @@ +