summaryrefslogtreecommitdiffstats
path: root/client/components/sidebar/sidebarCustomFields.js
diff options
context:
space:
mode:
authorPouyan Savoli <papoola@hotmail.com>2017-08-25 02:59:20 +0200
committerPouyan Savoli <papoola@hotmail.com>2017-09-22 22:59:32 +0200
commitade3c02122d262c72bd7c4fd1cbcab8e136184ba (patch)
treea87395d7e048b1d16f9fb636884bf2cd503d475f /client/components/sidebar/sidebarCustomFields.js
parent43a58c92ac3862668ef87d20fe7b09470e26cf66 (diff)
downloadwekan-ade3c02122d262c72bd7c4fd1cbcab8e136184ba.tar.gz
wekan-ade3c02122d262c72bd7c4fd1cbcab8e136184ba.tar.bz2
wekan-ade3c02122d262c72bd7c4fd1cbcab8e136184ba.zip
Create custom fields creation UI added to Board Menu, Model in progress
Diffstat (limited to 'client/components/sidebar/sidebarCustomFields.js')
-rw-r--r--client/components/sidebar/sidebarCustomFields.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/client/components/sidebar/sidebarCustomFields.js b/client/components/sidebar/sidebarCustomFields.js
new file mode 100644
index 00000000..da03f484
--- /dev/null
+++ b/client/components/sidebar/sidebarCustomFields.js
@@ -0,0 +1,55 @@
+BlazeComponent.extendComponent({
+
+ customFields() {
+ return CustomFields.find({
+ boardId: Session.get('currentBoard'),
+ });
+ },
+
+ events() {
+ return [{
+ 'click .js-open-create-custom-field': Popup.open('createCustomField'),
+ 'click .js-edit-custom-field'() {
+ // todo
+ },
+ 'click .js-delete-custom-field': Popup.afterConfirm('customFieldDelete', function() {
+ const customFieldId = this._id;
+ CustomFields.remove(customFieldId);
+ Popup.close();
+ }),
+ }];
+ },
+
+}).register('customFieldsSidebar');
+
+Template.createCustomFieldPopup.helpers({
+
+});
+
+Template.createCustomFieldPopup.events({
+ 'click .js-field-show-on-card'(event) {
+ let $target = $(event.target);
+ if(!$target.hasClass('js-field-show-on-card')){
+ $target = $target.parent();
+ }
+ $target.find('.materialCheckBox').toggleClass('is-checked');
+ $target.toggleClass('is-checked');
+ },
+ 'submit'(evt, tpl) {
+ evt.preventDefault();
+
+ const name = tpl.find('.js-field-name').value.trim();
+ const type = tpl.find('.js-field-type').value.trim();
+ const showOnCard = tpl.find('.js-field-show-on-card.is-checked') != null;
+ //console.log("Create",name,type,showOnCard);
+
+ CustomFields.insert({
+ boardId: Session.get('currentBoard'),
+ name: name,
+ type: type,
+ showOnCard: showOnCard
+ });
+
+ Popup.back();
+ },
+}); \ No newline at end of file