Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ZeMKI
Mesort
Commits
7f6011b6
Commit
7f6011b6
authored
Aug 19, 2019
by
ZeMKI
Browse files
small javascript code optimization
parent
b6f441f3
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
public/css/app.css
View file @
7f6011b6
...
...
@@ -110,6 +110,7 @@ table {
color: #046cbe;
display: block;
line-height: 1.5;
font-size: 16px;
}
/* BACKGROUND
...
...
public/css/app_dompdf.css
View file @
7f6011b6
...
...
@@ -110,6 +110,7 @@ table {
color
:
#046cbe
;
display
:
block
;
line-height
:
1.5
;
font-size
:
16px
;
}
/* BACKGROUND
...
...
public/js/app.js
View file @
7f6011b6
This diff is collapsed.
Click to expand it.
public/mix-manifest.json
View file @
7f6011b6
{
"/js/app.js"
:
"/js/app.js?id=8
335407ff7be9f367e83
"
,
"/css/app.css"
:
"/css/app.css?id=
1abf25588c73d17b8451
"
,
"/css/app_dompdf.css"
:
"/css/app_dompdf.css?id=
06023e8a43967827a614
"
,
"/js/app.js"
:
"/js/app.js?id=8
77c470a605478b522ac
"
,
"/css/app.css"
:
"/css/app.css?id=
e850b5c60370c59e1f2d
"
,
"/css/app_dompdf.css"
:
"/css/app_dompdf.css?id=
473a4745658ee6ec7590
"
,
"/js/manifest.js"
:
"/js/manifest.js?id=844cdbfe9e6b6b56ae8f"
,
"/js/vendor.js"
:
"/js/vendor.js?id=e803732b0abd596f50d8"
}
resources/js/app.js
View file @
7f6011b6
...
...
@@ -25,7 +25,7 @@ Vue.component('v-select', vSelect)
*/
Vue
.
component
(
'
new-study
'
,
require
(
'
./components/newstudy.vue
'
).
default
);
Vue
.
component
(
'
new-edit-user
'
,
require
(
'
./components/newedituser.vue
'
).
default
);
Vue
.
component
(
'
new-edit-user
'
,
require
(
'
./components/
modal
newedituser.vue
'
).
default
);
Vue
.
component
(
'
user-overview
'
,
require
(
'
./components/overviewuser.vue
'
).
default
);
Vue
.
component
(
'
new-interview
'
,
require
(
'
./components/newinterview.vue
'
).
default
);
Vue
.
component
(
'
sorting
'
,
require
(
'
./components/sorting.vue
'
).
default
);
...
...
@@ -41,28 +41,6 @@ var bus = new Vue();
// Assign globally functions for getCookies and setCookies in JS
Vue
.
mixin
({
data
()
{
return
{
fromidtoname
:
{
permissionsNames
:
{
1
:
"
Only consult data
"
,
2
:
"
Can edit study
"
,
3
:
"
Can assign users to study
"
,
4
:
"
Can edit and create users
"
,
5
:
"
Can edit and create studies
"
,
6
:
"
Creator of the study
"
},
permissionsVariables
:
{
onlyconsult
:
1
,
caneditstudy
:
2
,
canassignusers
:
3
,
cancreateusers
:
4
,
cancreatestudy
:
5
,
creator
:
6
}
}
}
},
computed
:
{
url
:
function
()
{
return
document
.
URL
.
split
(
'
/
'
).
pop
();
...
...
resources/js/components/ExampleComponent.vue
deleted
100644 → 0
View file @
b6f441f3
<
template
>
<div
class=
"container"
>
<div
class=
"row justify-content-center"
>
<div
class=
"col-md-8"
>
<div
class=
"card card-default"
>
<div
class=
"card-header"
>
Example Component
</div>
<div
class=
"card-body"
>
I'm an example component.
</div>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
export
default
{
mounted
()
{
console
.
log
(
'
Component mounted.
'
)
}
}
</
script
>
resources/js/components/newedituser.vue
→
resources/js/components/
modal
newedituser.vue
View file @
7f6011b6
...
...
@@ -138,11 +138,6 @@
studiesselected
:
[],
supervisorselected
:
[],
allpermissions
:
[],
permissions
:
{
onlyconsult
:
false
,
caneditstudy
:
false
,
canassignusers
:
false
},
globalpermissions
:{
cancreateusers
:
false
,
cancreatestudy
:
false
...
...
@@ -211,7 +206,8 @@
4
:
"
cancreateusers
"
,
5
:
"
cancreatestudy
"
,
6
:
"
creator
"
}
};
for
(
var
permission
in
val
){
self
.
studiesselected
[
self
.
studyradio
][
permission
]
=
val
[
permission
];
}
...
...
@@ -263,7 +259,7 @@
"
onlyconsult
"
,
"
caneditstudy
"
,
"
canassignusers
"
]
]
;
/// if the study doesn't exist, initialize with all false values
/// otherwise assign the values to the 3 permissions checkboxes
...
...
@@ -289,53 +285,7 @@
window
.
axios
.
post
(
'
getinputdata
'
).
then
(
response
=>
{
this
.
inputs
.
userroles
=
response
.
data
.
allroles
;
// this.inputs.studies = response.data.relatedstudies;
// if(!_.isEmpty(response.data.supervisors)) this.inputs.supervisors = response.data.supervisors;
// show the placeholder
this
.
userroleselected
=
3
;
/*
UPDATE FUNCTION FOR USERS
if(this.update){
window.axios.get('user/'+this.edituser,{data: this.edituser}).then(response =>{
this.usertoedit = response.data;
this.email = this.usertoedit.email;
for (var i = 0; i < this.usertoedit.roles.length; i++) {
this.userroleselected = this.usertoedit.roles[i].id;
}
// for (var i = 0; i < this.usertoedit.studies.length; i++) {
// this.studiesselected.push(this.usertoedit.studies[i].id);
// }
let permissions = [];
for (var i = 0; i < this.usertoedit.studies.length; i++) {
let id = this.usertoedit.studies[i].id;
if(_.isUndefined(this.studiesselected[id])){
this.studiesselected[id] = {}
for (var i = 0; i < this.usertoedit.studies[i].pivot.permission_id.length; i++) {
this.studiesselected[id][this.fromidtoname.permissionsNames[this.usertoedit.studies[i].pivot.permission_id[i]]] = true
}
}else{
for (var i = 0; i < this.usertoedit.studies[i].pivot.permission_id.length; i++) {
this.studiesselected[id][this.fromidtoname.permissionsNames[this.usertoedit.studies[i].pivot.permission_id[i]]] = true
}
}
}
this.studiesselected = this.allpermissions;
if(this.inputs.supervisors) this.supervisorselected = this.usertoedit.supervised_by;
}).catch(error =>{
});
}*/
}).
catch
(
error
=>
{
console
.
log
(
"
error
"
+
error
);
...
...
@@ -348,11 +298,6 @@
saveuser
:
function
(){
// let gpermissions = [];
// if(this.globalpermissions.cancreatestudy)gpermissions.push(4);
// if(this.globalpermissions.cancreateusers)gpermissions.push(5);
let
activeStudies
=
this
.
study
;
if
(
this
.
validate
()){
...
...
@@ -413,7 +358,6 @@ emptyform: function() {
this
.
emailexistmessage
=
""
;
this
.
userroleselected
=
[];
this
.
studiesselected
=
[];
this
.
resetspecificpermissions
();
},
sendresetpassworddialog
()
{
...
...
@@ -435,26 +379,11 @@ sendresetopassword() {
});
},
resetallpermissions
:
function
(){
this
.
permissions
.
onlyconsult
=
false
;
this
.
permissions
.
caneditstudy
=
false
;
this
.
permissions
.
canassignusers
=
false
;
resetallpermissions
:
function
(){
this
.
globalpermissions
.
cancreateusers
=
false
;
this
.
globalpermissions
.
cancreatestudy
=
false
;
},
resetspecificpermissions
:
function
(){
this
.
permissions
.
onlyconsult
=
false
;
this
.
permissions
.
caneditstudy
=
false
;
this
.
permissions
.
canassignusers
=
false
;
},
loadpermissions
:
function
(
id
){
this
.
createStudyPermissionArray
(
id
)
this
.
studyradio
=
id
;
}
}
}
}
...
...
resources/js/components/userpart.vue
View file @
7f6011b6
...
...
@@ -4,18 +4,18 @@
<div
class=
"column"
v-for=
"user in usersinstudy"
v-if=
"user['email'] != 'belli@uni-bremen.de' && user['email'] != auth['email'] "
>
<div
class=
"level has-background-light"
style=
"padding: 3px"
>
<div
class=
"level-left"
@
click=
"confirm
d
elete
u
ser(user)"
><b-icon
icon=
"delete-sweep"
class=
"has-text-danger "
></b-icon></div>
<div
class=
"level-left"
@
click=
"confirm
D
elete
U
ser(user)"
><b-icon
icon=
"delete-sweep"
class=
"has-text-danger "
></b-icon></div>
<div
class=
"level-right"
>
{{
user
[
'
email
'
]
}}
</div>
</div>
<div
class=
"level has-background-warning is-size-7"
style=
"padding: 3px"
>
<div
class=
"level-left"
@
click=
"confirm
s
end
c
onfirmation(user)"
><b-icon
icon=
"send"
></b-icon>
Send
</div>
<div
class=
"level-left"
@
click=
"confirm
S
end
C
onfirmation
Email
(user)"
><b-icon
icon=
"send"
></b-icon>
Send
</div>
<div
class=
"level-right"
v-if=
"user['password_token']"
>
This user needs to set a password
</div>
<div
class=
"level-right"
v-if=
"!(user['password_token'])"
>
Reset password for this user
</div>
</div>
<div
class=
"level"
v-for=
"role in user['roles']"
>
<div
class=
"level-left"
><span
class=
"tag is-primary"
>
{{
role
[
'
name
'
]
}}
</span></div>
</div>
<label
class=
"checkbox"
@
change=
"change
e
dit
p
ermission(caneditthisstudy[user['id']],user['id'])"
:disabled=
"studyeditable == false"
>
<label
class=
"checkbox"
@
change=
"change
E
dit
P
ermission(caneditthisstudy[user['id']],user['id'])"
:disabled=
"studyeditable == false"
>
<input
type=
"checkbox"
v-model=
"caneditthisstudy[user['id']]"
:disabled=
"studyeditable == false"
>
Can edit
<strong>
this
</strong>
study
</label>
...
...
@@ -53,44 +53,35 @@
}
},
event
:{
reloadusers
:
function
(){
window
.
axios
.
get
(
'
study
'
+
this
.
study
+
'
users
'
).
then
(
response
=>
{
}).
catch
(
error
=>
{
});
}
},
methods
:{
confirm
d
elete
u
ser
:
function
(
user
)
{
confirm
D
elete
U
ser
:
function
(
user
)
{
window
.
app
.
$dialog
.
confirm
({
title
:
'
Delete User
'
,
message
:
'
Do you want to delete this user?
'
+
user
.
email
,
confirmText
:
'
Delete
'
,
type
:
'
is-danger
'
,
hasIcon
:
true
,
onConfirm
:
()
=>
this
.
delete
u
ser
(
user
)
onConfirm
:
()
=>
this
.
delete
U
ser
(
user
)
})
},
confirm
s
end
c
onfirmation
:
function
(
user
)
{
confirm
S
end
C
onfirmation
Email
:
function
(
user
)
{
window
.
app
.
$dialog
.
confirm
({
title
:
'
Reset User Password
'
,
message
:
'
Do you want to send again the confirmation email to this user?
'
+
user
.
email
,
confirmText
:
'
Resend
'
,
type
:
'
is-warning
'
,
hasIcon
:
true
,
onConfirm
:
()
=>
this
.
confirm
u
ser
(
user
)
onConfirm
:
()
=>
this
.
confirm
U
ser
(
user
)
})
},
confirm
u
ser
:
function
(
user
){
confirm
U
ser
:
function
(
user
){
window
.
axios
.
patch
(
'
usersconfirm/
'
+
user
.
id
).
then
(
response
=>
{
window
.
app
.
$snackbar
.
open
(
"
User needs to create a new password
"
);
}).
catch
(
error
=>
{
})
},
delete
u
ser
:
function
(
user
){
delete
U
ser
:
function
(
user
){
window
.
axios
.
post
(
'
users/
'
+
user
.
id
+
'
/
'
+
this
.
study
).
then
(
response
=>
{
window
.
app
.
$snackbar
.
open
(
"
User deleted
"
);
...
...
@@ -102,7 +93,7 @@
}).
catch
(
error
=>
{
})
},
change
e
dit
p
ermission
:
function
(
value
,
user
){
change
E
dit
P
ermission
:
function
(
value
,
user
){
let
valueToSend
=
{
'
value
'
:
value
}
window
.
axios
.
post
(
'
users/
'
+
user
+
'
/canedit/
'
+
this
.
study
,
valueToSend
).
then
(
response
=>
{
...
...
resources/sass/_typos.scss
View file @
7f6011b6
...
...
@@ -37,4 +37,6 @@
color
:
#046cbe
;
display
:
block
;
line-height
:
1
.5
;
font-size
:
16px
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment