diff --git a/public/js/bucket-single.js b/public/js/bucket-single.js
index abca208..cf2214e 100644
--- a/public/js/bucket-single.js
+++ b/public/js/bucket-single.js
@@ -124,7 +124,7 @@ __webpack_require__.r(__webpack_exports__);
getComponent
) {
return template(
- '
',
+ '',
[
{
'type': bindingTypes.IF,
@@ -135,11 +135,11 @@ __webpack_require__.r(__webpack_exports__);
return _scope.state.errors.length > 0;
},
- 'redundantAttribute': 'expr18',
- 'selector': '[expr18]',
+ 'redundantAttribute': 'expr15',
+ 'selector': '[expr15]',
'template': template(
- '',
+ '',
[
{
'type': bindingTypes.EACH,
@@ -170,8 +170,8 @@ __webpack_require__.r(__webpack_exports__);
]
),
- 'redundantAttribute': 'expr19',
- 'selector': '[expr19]',
+ 'redundantAttribute': 'expr16',
+ 'selector': '[expr16]',
'itemName': 'error',
'indexName': null,
@@ -289,7 +289,7 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
getComponent
) {
return template(
- '',
+ '',
[
{
'type': bindingTypes.IF,
@@ -300,8 +300,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
return _scope.state.note && _scope.state.note._id;
},
- 'redundantAttribute': 'expr7',
- 'selector': '[expr7]',
+ 'redundantAttribute': 'expr17',
+ 'selector': '[expr17]',
'template': template(
null,
@@ -332,8 +332,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
return !_scope.state.note || (_scope.state.note && !_scope.state.note._id);
},
- 'redundantAttribute': 'expr8',
- 'selector': '[expr8]',
+ 'redundantAttribute': 'expr18',
+ 'selector': '[expr18]',
'template': template(
'\n Create\n ',
@@ -349,8 +349,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
return _scope.state.note && _scope.state.note._id;
},
- 'redundantAttribute': 'expr9',
- 'selector': '[expr9]',
+ 'redundantAttribute': 'expr19',
+ 'selector': '[expr19]',
'template': template(
'\n Save\n ',
diff --git a/public/js/create-bucket.js b/public/js/create-bucket.js
index b406f16..96a557f 100644
--- a/public/js/create-bucket.js
+++ b/public/js/create-bucket.js
@@ -124,7 +124,7 @@ __webpack_require__.r(__webpack_exports__);
getComponent
) {
return template(
- '',
+ '',
[
{
'type': bindingTypes.IF,
@@ -135,11 +135,11 @@ __webpack_require__.r(__webpack_exports__);
return _scope.state.errors.length > 0;
},
- 'redundantAttribute': 'expr18',
- 'selector': '[expr18]',
+ 'redundantAttribute': 'expr15',
+ 'selector': '[expr15]',
'template': template(
- '',
+ '',
[
{
'type': bindingTypes.EACH,
@@ -170,8 +170,8 @@ __webpack_require__.r(__webpack_exports__);
]
),
- 'redundantAttribute': 'expr19',
- 'selector': '[expr19]',
+ 'redundantAttribute': 'expr16',
+ 'selector': '[expr16]',
'itemName': 'error',
'indexName': null,
diff --git a/public/js/users.js b/public/js/users.js
index 37cacd1..e387960 100644
--- a/public/js/users.js
+++ b/public/js/users.js
@@ -124,7 +124,7 @@ __webpack_require__.r(__webpack_exports__);
getComponent
) {
return template(
- '',
+ '',
[
{
'type': bindingTypes.IF,
@@ -135,11 +135,11 @@ __webpack_require__.r(__webpack_exports__);
return _scope.state.errors.length > 0;
},
- 'redundantAttribute': 'expr18',
- 'selector': '[expr18]',
+ 'redundantAttribute': 'expr15',
+ 'selector': '[expr15]',
'template': template(
- '',
+ '',
[
{
'type': bindingTypes.EACH,
@@ -170,8 +170,8 @@ __webpack_require__.r(__webpack_exports__);
]
),
- 'redundantAttribute': 'expr19',
- 'selector': '[expr19]',
+ 'redundantAttribute': 'expr16',
+ 'selector': '[expr16]',
'itemName': 'error',
'indexName': null,
@@ -266,18 +266,18 @@ __webpack_require__.r(__webpack_exports__);
getComponent
) {
return template(
- '',
+ '',
[
{
'type': bindingTypes.SLOT,
'attributes': [],
'name': 'title',
- 'redundantAttribute': 'expr25',
- 'selector': '[expr25]'
+ 'redundantAttribute': 'expr31',
+ 'selector': '[expr31]'
},
{
- 'redundantAttribute': 'expr26',
- 'selector': '[expr26]',
+ 'redundantAttribute': 'expr32',
+ 'selector': '[expr32]',
'expressions': [
{
@@ -297,8 +297,8 @@ __webpack_require__.r(__webpack_exports__);
]
},
{
- 'redundantAttribute': 'expr27',
- 'selector': '[expr27]',
+ 'redundantAttribute': 'expr33',
+ 'selector': '[expr33]',
'expressions': [
{
@@ -314,8 +314,8 @@ __webpack_require__.r(__webpack_exports__);
]
},
{
- 'redundantAttribute': 'expr28',
- 'selector': '[expr28]',
+ 'redundantAttribute': 'expr34',
+ 'selector': '[expr34]',
'expressions': [
{
@@ -356,7 +356,7 @@ __webpack_require__.r(__webpack_exports__);
'exports': {
state: {
element: undefined,
- data: []
+ data: false
},
/**
@@ -364,10 +364,10 @@ __webpack_require__.r(__webpack_exports__);
*
*/
onBeforeMount() {
-
- // getting innerHtml before rendering component
- this.content = this.root.innerHTML;
- this.root.innerHTML = '';
+ if (this.root.innerHTML) {
+ this.content = this.root.innerHTML;
+ this.root.innerHTML = '';
+ }
if (!this.props.event) {
console.error('sidebar-button: attribute for name of custom event is missing')
@@ -376,6 +376,10 @@ __webpack_require__.r(__webpack_exports__);
if (!this.props.selector) {
console.error('sidebar-button: attribute for selector to send custom event is missing')
}
+
+ if (this.props.data) {
+ this.state.data = this.props.data
+ }
},
/**
@@ -386,7 +390,9 @@ __webpack_require__.r(__webpack_exports__);
this.state.element = document.querySelector(this.props.selector)
// adding innerHtml to button
- this.$('button').innerHTML = this.content;
+ if (this.content) {
+ this.$('button').innerHTML = this.content;
+ }
},
/**
@@ -398,8 +404,13 @@ __webpack_require__.r(__webpack_exports__);
handleClick(event) {
event.preventDefault()
- const customEvent = new CustomEvent(this.props.event)
- this.state.element.dispatchEvent(customEvent, this.state.data)
+ const customEvent = new CustomEvent(this.props.event, {
+ 'detail': {
+ 'data': this.state.data
+ }
+ })
+
+ this.state.element.dispatchEvent(customEvent)
}
},
@@ -410,11 +421,11 @@ __webpack_require__.r(__webpack_exports__);
getComponent
) {
return template(
- '',
+ '',
[
{
- 'redundantAttribute': 'expr6',
- 'selector': '[expr6]',
+ 'redundantAttribute': 'expr20',
+ 'selector': '[expr20]',
'expressions': [
{
@@ -428,6 +439,13 @@ __webpack_require__.r(__webpack_exports__);
}
}
]
+ },
+ {
+ 'type': bindingTypes.SLOT,
+ 'attributes': [],
+ 'name': 'default',
+ 'redundantAttribute': 'expr21',
+ 'selector': '[expr21]'
}
]
);
@@ -477,8 +495,12 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
this.fetch()
},
- handleClick() {
+ handleUpdate(event, user) {
+ const customEvent = new CustomEvent('app-users-form-open', {
+ 'detail': user
+ })
+ document.querySelector('app-users-form').dispatchEvent(customEvent);
},
handleDelete(event, user) {
@@ -503,12 +525,9 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
// @TODO find a better solution to create body text
'body': 'Do you want delete ' + user.email + '?'
}
- });
+ })
this.$('#user-delete-confirm').dispatchEvent(customEvent);
-
- /**
- */
},
/**
@@ -531,7 +550,7 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
getComponent
) {
return template(
- '\n Email\n | \n Display Name\n | \n Roles\n |
---|
|
',
+ '\n Email\n | \n Display Name\n | \n Roles\n |
---|
|
',
[
{
'type': bindingTypes.EACH,
@@ -539,11 +558,11 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
'condition': null,
'template': template(
- ' | | | | ',
+ ' | | | | ',
[
{
- 'redundantAttribute': 'expr11',
- 'selector': '[expr11]',
+ 'redundantAttribute': 'expr7',
+ 'selector': '[expr7]',
'expressions': [
{
@@ -563,8 +582,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
]
},
{
- 'redundantAttribute': 'expr12',
- 'selector': '[expr12]',
+ 'redundantAttribute': 'expr8',
+ 'selector': '[expr8]',
'expressions': [
{
@@ -592,8 +611,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
return _scope.user.roles && _scope.user.roles.indexOf('admin') >= 0;
},
- 'redundantAttribute': 'expr13',
- 'selector': '[expr13]',
+ 'redundantAttribute': 'expr9',
+ 'selector': '[expr9]',
'template': template(
'\n Admin\n ',
@@ -601,8 +620,42 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
)
},
{
- 'redundantAttribute': 'expr14',
- 'selector': '[expr14]',
+ 'type': bindingTypes.TAG,
+ 'getComponent': getComponent,
+
+ 'evaluate': function(
+ _scope
+ ) {
+ return 'app-sidebar-button';
+ },
+
+ 'slots': [
+ {
+ 'id': 'default',
+ 'html': '',
+ 'bindings': []
+ }
+ ],
+
+ 'attributes': [
+ {
+ 'type': expressionTypes.ATTRIBUTE,
+ 'name': 'data',
+
+ 'evaluate': function(
+ _scope
+ ) {
+ return _scope.user;
+ }
+ }
+ ],
+
+ 'redundantAttribute': 'expr10',
+ 'selector': '[expr10]'
+ },
+ {
+ 'redundantAttribute': 'expr11',
+ 'selector': '[expr11]',
'expressions': [
{
@@ -620,8 +673,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
]
),
- 'redundantAttribute': 'expr10',
- 'selector': '[expr10]',
+ 'redundantAttribute': 'expr6',
+ 'selector': '[expr6]',
'itemName': 'user',
'indexName': null,
@@ -650,8 +703,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
],
'attributes': [],
- 'redundantAttribute': 'expr15',
- 'selector': '[expr15]'
+ 'redundantAttribute': 'expr12',
+ 'selector': '[expr12]'
},
{
'type': bindingTypes.IF,
@@ -662,15 +715,15 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('app-modal')
return _scope.state.maxLength > _scope.state.users.length;
},
- 'redundantAttribute': 'expr16',
- 'selector': '[expr16]',
+ 'redundantAttribute': 'expr13',
+ 'selector': '[expr13]',
'template': template(
- '',
+ '',
[
{
- 'redundantAttribute': 'expr17',
- 'selector': '[expr17]',
+ 'redundantAttribute': 'expr14',
+ 'selector': '[expr14]',
'expressions': [
{
@@ -727,7 +780,9 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
'exports': {
state: {
- user: { }
+ user: {
+
+ }
},
/**
@@ -738,6 +793,12 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
this.root.addEventListener('app-users-form-open', (event) => {
this.$('.sidebar').classList.add('sidebar--open')
+
+ // check for data, and if user is send add to state
+ if (event.detail.data) {
+ this.state.user = event.detail.data
+ this.update()
+ }
})
// create form validation
@@ -761,10 +822,19 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
},
+ /**
+ * close current form
+ *
+ *
+ * @param {object} event
+ *
+ */
handleClose(event)
{
event.preventDefault()
this.$('.sidebar').classList.remove('sidebar--open')
+
+ this.reset()
},
/**
@@ -785,8 +855,19 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
data: data
}).then((response) => {
this.state.user = response.data.data
+ this.$('#sidebar-user-form-close').click()
+
this.update()
})
+ },
+
+ /**
+ *
+ *
+ */
+ reset() {
+ this.state.user = { }
+ this.update()
}
},
@@ -797,11 +878,45 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
getComponent
) {
return template(
- '',
+ '',
[
{
- 'redundantAttribute': 'expr20',
- 'selector': '[expr20]',
+ 'type': bindingTypes.IF,
+
+ 'evaluate': function(
+ _scope
+ ) {
+ return !_scope.state.user._id;
+ },
+
+ 'redundantAttribute': 'expr22',
+ 'selector': '[expr22]',
+
+ 'template': template(
+ '\n Create User\n ',
+ []
+ )
+ },
+ {
+ 'type': bindingTypes.IF,
+
+ 'evaluate': function(
+ _scope
+ ) {
+ return _scope.state.user._id;
+ },
+
+ 'redundantAttribute': 'expr23',
+ 'selector': '[expr23]',
+
+ 'template': template(
+ '\n Update User\n ',
+ []
+ )
+ },
+ {
+ 'redundantAttribute': 'expr24',
+ 'selector': '[expr24]',
'expressions': [
{
@@ -816,6 +931,22 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
}
]
},
+ {
+ 'redundantAttribute': 'expr25',
+ 'selector': '[expr25]',
+
+ 'expressions': [
+ {
+ 'type': expressionTypes.VALUE,
+
+ 'evaluate': function(
+ _scope
+ ) {
+ return _scope.state.user.email;
+ }
+ }
+ ]
+ },
{
'type': bindingTypes.TAG,
'getComponent': getComponent,
@@ -828,8 +959,24 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
'slots': [],
'attributes': [],
- 'redundantAttribute': 'expr21',
- 'selector': '[expr21]'
+ 'redundantAttribute': 'expr26',
+ 'selector': '[expr26]'
+ },
+ {
+ 'redundantAttribute': 'expr27',
+ 'selector': '[expr27]',
+
+ 'expressions': [
+ {
+ 'type': expressionTypes.VALUE,
+
+ 'evaluate': function(
+ _scope
+ ) {
+ return _scope.state.user.display_name;
+ }
+ }
+ ]
},
{
'type': bindingTypes.TAG,
@@ -843,8 +990,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
'slots': [],
'attributes': [],
- 'redundantAttribute': 'expr22',
- 'selector': '[expr22]'
+ 'redundantAttribute': 'expr28',
+ 'selector': '[expr28]'
},
{
'type': bindingTypes.TAG,
@@ -858,8 +1005,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
'slots': [],
'attributes': [],
- 'redundantAttribute': 'expr23',
- 'selector': '[expr23]'
+ 'redundantAttribute': 'expr29',
+ 'selector': '[expr29]'
},
{
'type': bindingTypes.TAG,
@@ -873,8 +1020,8 @@ riot__WEBPACK_IMPORTED_MODULE_3__.mount('field-error')
'slots': [],
'attributes': [],
- 'redundantAttribute': 'expr24',
- 'selector': '[expr24]'
+ 'redundantAttribute': 'expr30',
+ 'selector': '[expr30]'
}
]
);
diff --git a/resources/js/components/sidebar-button.riot b/resources/js/components/sidebar-button.riot
index c448057..5eb3373 100644
--- a/resources/js/components/sidebar-button.riot
+++ b/resources/js/components/sidebar-button.riot
@@ -1,5 +1,7 @@
-
+