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
207f4853
Commit
207f4853
authored
Apr 01, 2020
by
ZeMKI
Browse files
Layout + admin tag
* optimization of the layout * using admin instead of "superadmin"
parent
c4364647
Changes
33
Hide whitespace changes
Inline
Side-by-side
.idea/sonarlint/issuestore/index.pb
View file @
207f4853
...
...
@@ -91,4 +91,6 @@ V
^
.resources/views/layouts/checksorting.blade.php,1/6/165f0182804d36ad1e3abb3416a14252c9b40123
X
(resources/views/layouts/footer.blade.php,7/a/7aca1ab0495aeaddb9e00c05a972f06c6ffaa618
\ No newline at end of file
(resources/views/layouts/footer.blade.php,7/a/7aca1ab0495aeaddb9e00c05a972f06c6ffaa618
7
.php_cs,e/4/e4a2b85c3025fbd0d06aca90525574bd273d5780
\ No newline at end of file
...
...
app/AllInterviewTokenExport.php
View file @
207f4853
...
...
@@ -60,7 +60,6 @@ class AllInterviewTokenExport implements FromCollection, WithMapping, WithHeadin
$this
->
formatTokenValuesForExport
(
$interview
,
$toprint
);
array_push
(
$printArray
,
$toprint
);
}
}
return
$printArray
;
}
...
...
app/Answer.php
View file @
207f4853
...
...
@@ -40,7 +40,6 @@ class Answer extends Model
$interview
->
answers
()
->
attach
(
$answer
[
'id'
],
[
'question_id'
=>
$question
->
id
]);
}
}
}
}
...
...
@@ -54,7 +53,6 @@ class Answer extends Model
$question
[
'available_answers'
]
=
$question
->
availableAnswers
();
$question
[
'answers'
]
=
$question
->
answers
()
->
having
(
'pivot_interview_id'
,
'='
,
$interview
->
id
)
->
get
();
}
}
public
function
question
()
...
...
app/Http/Controllers/StudyController.php
View file @
207f4853
...
...
@@ -295,7 +295,7 @@ class StudyController extends Controller
public
function
destroy
(
Study
$study
,
Request
$request
)
{
if
(
!
auth
()
->
user
()
->
hasRole
([
'
superadministrator
'
,
'supervisor'
]))
{
if
(
!
auth
()
->
user
()
->
hasRole
([
'
admin
'
,
'supervisor'
]))
{
abort
(
403
,
'You are not allowed to edit this study'
);
}
if
(
!
auth
()
->
user
()
->
can
(
'delete-studies'
,
$study
->
id
))
return
response
(
'You are not authorized to delete this study.'
,
403
);
...
...
app/InterviewTokenExport.php
View file @
207f4853
...
...
@@ -4,6 +4,7 @@ namespace App\Exports;
use
App\InterviewTokens
;
use
App\Token
;
use
Illuminate\Support\Collection
;
use
Image
;
use
Maatwebsite\Excel\Concerns\Exportable
;
use
Maatwebsite\Excel\Concerns\FromCollection
;
...
...
@@ -86,7 +87,7 @@ class InterviewTokenExport implements FromCollection, WithMapping, WithHeadings
}
/**
* @return
\Illuminate\Support\
Collection
* @return Collection
*/
public
function
collection
()
{
...
...
app/Policies/InterviewPolicy.php
View file @
207f4853
...
...
@@ -20,7 +20,7 @@ class InterviewPolicy
*/
public
function
before
(
$user
,
$ability
)
{
if
(
$user
->
hasRole
(
'
superadministrator
'
))
{
if
(
$user
->
hasRole
(
'
admin
'
))
{
return
true
;
}
}
...
...
app/Policies/SortingPolicy.php
View file @
207f4853
...
...
@@ -20,7 +20,7 @@ class SortingPolicy
*/
public
function
before
(
$user
,
$ability
)
{
if
(
$user
->
hasRole
(
'
superadministrator
'
))
{
if
(
$user
->
hasRole
(
'
admin
'
))
{
return
true
;
}
}
...
...
app/Policies/StudyPolicy.php
View file @
207f4853
...
...
@@ -18,7 +18,7 @@ class StudyPolicy
*/
public
function
before
(
$user
,
$ability
)
{
if
(
$user
->
hasRole
(
'
superadministrator
'
))
{
if
(
$user
->
hasRole
(
'
admin
'
))
{
return
true
;
}
}
...
...
app/Sorting.php
View file @
207f4853
...
...
@@ -22,7 +22,6 @@ class Sorting extends Model
$study
->
sortings
()
->
attach
(
$request
->
get
(
'sorting'
)[
'id'
],
[
'details'
=>
$circles
.
$description
.
$classifiers
]);
}
else
{
$study
->
sortings
()
->
attach
(
$request
->
get
(
'sortingid'
),
[
'details'
=>
$request
->
get
(
'details'
)]);
}
}
...
...
app/Study.php
View file @
207f4853
...
...
@@ -51,7 +51,6 @@ class Study extends LaratrustTeam
foreach
(
$study
->
users
as
$user
)
{
$user
->
detachPermissions
(
$editPermissions
,
$study
);
}
}
// we keep a third table to ensure we save data about the specific sorting in another table
...
...
app/Token.php
View file @
207f4853
...
...
@@ -3,11 +3,11 @@
namespace
App
;
use
File
;
use
Helper
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\Auth
;
use
Image
;
use
Storage
;
use
Helper
;
class
Token
extends
Model
{
...
...
@@ -33,7 +33,6 @@ class Token extends Model
File
::
delete
(
$token
->
image_path
);
$token
->
studies
()
->
detach
();
}
else
return
false
;
});
}
...
...
@@ -59,11 +58,15 @@ class Token extends Model
$token
->
studies
()
->
sync
(
$study
->
id
);
}
else
{
self
::
SaveNewToken
(
$tokenToSave
,
$study
,
$isInterview
,
$token
);
}
$token
->
save
();
}
public
function
studies
()
{
return
$this
->
belongsToMany
(
Study
::
class
,
'study_tokens'
)
->
withTimestamps
();
}
/**
* @param $tokenToSave
* @param $study
...
...
@@ -103,11 +106,9 @@ class Token extends Model
if
(
file_exists
(
$studyPath
.
$name
.
'.mtoken'
))
{
$name
=
now
()
->
timestamp
.
$name
;
}
$extension
=
Helper
::
extension
(
$image
);
// open file a image resource
$path
=
$studyPath
.
$name
.
"."
.
$extension
;
$path
=
$studyPath
.
$name
.
"."
.
$extension
;
Image
::
make
(
$image
)
->
fit
(
100
,
100
)
->
save
(
$path
);
$encryptedContent
=
encrypt
(
$base64FirstPart
.
','
.
base64_encode
(
file_get_contents
(
$path
)));
$encryptedName
=
'study'
.
$newStudy
->
id
.
'/tokens/'
.
$name
.
'.mtoken'
;
...
...
@@ -133,11 +134,6 @@ class Token extends Model
$token
->
studies
()
->
sync
(
$newStudy
->
id
);
}
public
function
studies
()
{
return
$this
->
belongsToMany
(
Study
::
class
,
'study_tokens'
)
->
withTimestamps
();
}
/**
* @param $tokens
* @return mixed
...
...
@@ -156,7 +152,6 @@ class Token extends Model
}
}
return
$tokens
;
}
public
function
interview
()
...
...
@@ -174,6 +169,10 @@ class Token extends Model
return
$this
->
belongsTo
(
User
::
class
)
->
withTimestamps
();
}
/**
* Tokens created during the interview
* @return mixed
*/
public
function
createdtokens
()
{
return
$this
->
where
(
'author'
,
'=='
,
0
);
...
...
app/User.php
View file @
207f4853
...
...
@@ -29,11 +29,11 @@ class User extends Authenticatable implements MustVerifyEmail
protected
$hidden
=
[
'password'
,
'remember_token'
,
];
/**
* The attributes that should be mutated to dates.
* @var array
*/
public
function
listRoles
()
{
return
$this
->
roles
()
->
distinct
()
->
pluck
(
'name'
)
->
toArray
();
...
...
@@ -76,8 +76,6 @@ class User extends Authenticatable implements MustVerifyEmail
$action
->
time
=
date
(
"Y-m-d H:i:s"
);
$action
->
save
();
return
$action
;
}
public
function
interviews
()
...
...
config/laratrust_seeder.php
View file @
207f4853
...
...
@@ -2,7 +2,7 @@
return
[
'role_structure'
=>
[
'
superadministrator
'
=>
[
'
admin
'
=>
[
'users'
=>
'c,r,u,d'
,
'acl'
=>
'c,r,u,d'
,
'profile'
=>
'c,r,u,d'
,
...
...
resources/views/admin/dashboard.blade.php
View file @
207f4853
...
...
@@ -4,7 +4,7 @@
<
section
class
=
"hero is-info welcome is-small w-full"
>
<
div
class
=
"hero-body"
>
<
div
class
=
"container"
>
<
div
class
=
"container
mx-auto
"
>
<
h1
class
=
"title"
>
Hello
,
{{
$user
->
email
}}
.
</
h1
>
...
...
resources/views/admin/layout.blade.php
View file @
207f4853
@
include
(
'layouts.header'
)
<
body
>
<
div
class
=
"container"
id
=
"app"
>
<
div
class
=
"container
mx-auto
"
id
=
"app"
>
<!--
START
NAV
-->
@
include
(
'layouts.nav'
)
<!--
END
NAV
-->
...
...
resources/views/admin/sidebar.blade.php
View file @
207f4853
...
...
@@ -17,12 +17,6 @@
Backup
</a></li>
<li><a
href=
"{{url('admin/users')}}"
>
Users
</a></li>
<li><a
href=
"{{url('admin/notifications')}}"
>
Notifications
</a></li>
<li>
<a>
@todo Studies
</a>
<ul>
<li><a>
@todo Interviews
</a></li>
</ul>
</li>
</ul>
</aside>
</div>
resources/views/auth/layouts/app.blade.php
View file @
207f4853
...
...
@@ -20,6 +20,14 @@
<!-- Styles -->
<link
href=
"{{ asset('css/app.css') }}"
rel=
"stylesheet"
>
<script>
window
.
trans
=
[];
window
.
trans
=
<?php
$json_file
=
File
::
get
(
resource_path
()
.
"/lang/"
.
App
::
getLocale
()
.
'.json'
);
echo
json_decode
(
json_encode
(
$json_file
,
true
));;
?>
;
</script>
</head>
<body>
...
...
resources/views/auth/login.blade.php
View file @
207f4853
...
...
@@ -2,7 +2,7 @@
@
section
(
'content'
)
<
div
class
=
"bg-img"
></
div
>
<
div
class
=
"container "
>
<
div
class
=
"container
mx-auto
"
>
<
div
class
=
"columns is-centered"
>
<
div
class
=
"column is-6"
style
=
"margin-top: 10%"
>
...
...
@@ -18,7 +18,7 @@
<
div
class
=
"column has-text-centered "
>
<
h1
class
=
"title"
style
=
"margin: 0 auto; max-width: 100%;"
>
Mesort
</
h1
>
</
div
>
<
div
class
=
"py-4 w-
100
text-center "
>
<
div
class
=
"py-4 w-
full
text-center "
>
<
a
class
=
"text-blue-500 hover:text-red-600"
href
=
"
{
{url('register')}
}
"
>
Register
to
use
Mesort
</
a
>
</
div
>
...
...
@@ -28,7 +28,7 @@
<
label
for
=
"email"
class
=
"label"
>
{{
__
(
'E-Mail Address'
)
}}
</
label
>
<
div
class
=
"control"
>
<
input
id
=
"email"
type
=
"text"
class
=
"input {{
$errors->has
('email') ? '
is-invalid
' : '' }}"
name
=
"email"
class
=
"input {{
$errors->has
('email') ? '
bg-red-dark
' : '' }}"
name
=
"email"
value
=
"{{ old('email') }}"
required
autofocus
>
</
div
>
</
div
>
...
...
@@ -43,7 +43,7 @@
<
label
for
=
"password"
class
=
"label"
>
{{
__
(
'Password'
)
}}
</
label
>
<
p
class
=
"control has-icon-left"
>
<
input
id
=
"password"
type
=
"password"
class
=
"input {{
$errors->has
('password') ? '
is-invalid
' : '' }}"
name
=
"password"
class
=
"input {{
$errors->has
('password') ? '
bg-red-dark
' : '' }}"
name
=
"password"
required
>
<
span
class
=
"icon is-small is-left"
>
<
i
class
=
"fas fa-lock"
></
i
>
...
...
resources/views/auth/passwords/email.blade.php
View file @
207f4853
@
extends
(
'layouts.app'
)
@
section
(
'content'
)
<
div
class
=
"container"
>
<
div
class
=
"
row justify-content
-center"
>
<
div
class
=
"
col-md-8
"
>
<
div
class
=
"
card
"
>
<
div
class
=
"
card-header
"
>
{{
__
(
'Reset Password'
)
}}
</
div
>
<
div
class
=
"container
mx-auto
"
>
<
div
class
=
"
flex flex-wrap justify
-center"
>
<
div
class
=
"
md:w-2/3 pr-4 pl-4
"
>
<
div
class
=
"
relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-grey-light
"
>
<
div
class
=
"
py-3 px-6 mb-0 bg-grey-lighter border-b-1 border-grey-light text-grey-darkest
"
>
{{
__
(
'Reset Password'
)
}}
</
div
>
<
div
class
=
"
card-body
"
>
<
div
class
=
"
flex-auto p-6
"
>
@
if
(
session
(
'status'
))
<
div
class
=
"
alert alert-success
"
role
=
"alert"
>
<
div
class
=
"
relative px-3 py-3 mb-4 border rounded text-green-darker border-green-dark bg-green-lighter
"
role
=
"alert"
>
{{
session
(
'status'
)
}}
</
div
>
@
endif
...
...
@@ -17,26 +17,26 @@
<
form
method
=
"POST"
action
=
"{{ route('password.email') }}"
>
@
csrf
<
div
class
=
"
form-group row
"
>
<
div
class
=
"
mb-4 flex flex-wrap
"
>
<
label
for
=
"email"
class
=
"
col-md-4 col-form-labe
l text-md-right"
>
{{
__
(
'E-Mail Address'
)
}}
</
label
>
class
=
"
md:w-1/3 pr-4 pl-4 pt-2 pb-2 mb-0 leading-norma
l text-md-right"
>
{{
__
(
'E-Mail Address'
)
}}
</
label
>
<
div
class
=
"
col-md-6
"
>
<
div
class
=
"
md:w-1/2 pr-4 pl-4
"
>
<
input
id
=
"email"
type
=
"email"
class
=
"
form-control
{{
$errors->has
('email') ? '
is-invalid
' : '' }}"
class
=
"
block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal bg-white text-grey-darker border border-grey rounded
{{
$errors->has
('email') ? '
bg-red-dark
' : '' }}"
name
=
"email"
value
=
"{{ old('email') }}"
required
>
@
if
(
$errors
->
has
(
'email'
))
<
span
class
=
"
invalid-feedback"
role
=
"alert
"
>
<
span
class
=
"
hidden mt-1 text-sm text-red"
role
=
"relative px-3 py-3 mb-4 border rounded
"
>
<
strong
>
{{
$errors
->
first
(
'email'
)
}}
</
strong
>
</
span
>
@
endif
</
div
>
</
div
>
<
div
class
=
"
form-group row
mb-0"
>
<
div
class
=
"
col-md-6 offset-md-4
"
>
<
button
type
=
"submit"
class
=
"
btn btn-primary
"
>
<
div
class
=
"
mb-4 flex flex-wrap
mb-0"
>
<
div
class
=
"
md:w-1/2 pr-4 pl-4 md:mx-1/3
"
>
<
button
type
=
"submit"
class
=
"
inline-block align-middle text-center select-none border font-normal whitespace-no-wrap py-2 px-4 rounded text-base leading-normal no-underline text-blue-lightest bg-blue hover:bg-blue-light
"
>
{{
__
(
'Send Password Reset Link'
)
}}
</
button
>
</
div
>
...
...
resources/views/auth/passwords/reset.blade.php
View file @
207f4853
...
...
@@ -2,7 +2,7 @@
@
section
(
'content'
)
<
div
class
=
"bg-img"
></
div
>
<
div
class
=
"container "
>
<
div
class
=
"container
mx-auto
"
>
<
div
class
=
"columns is-centered"
>
<
div
class
=
"column is-half"
>
...
...
@@ -14,7 +14,7 @@
<
label
for
=
"email"
class
=
"label"
>
{{
__
(
'E-Mail Address'
)
}}
</
label
>
<
div
class
=
"control"
>
<
input
id
=
"email"
disabled
type
=
"email"
value
=
"
{
{$user->email}
}
"
class
=
"input {{
$errors->has
('email') ? '
is-invalid
' : '' }}"
name
=
"email"
class
=
"input {{
$errors->has
('email') ? '
bg-red-dark
' : '' }}"
name
=
"email"
value
=
"{{ old('email') }}"
required
autofocus
>
</
div
>
</
div
>
...
...
@@ -23,7 +23,7 @@
<
label
for
=
"password"
class
=
"label"
>
{{
__
(
'New Password'
)
}}
</
label
>
<
p
class
=
"control has-icon-left"
>
<
input
id
=
"password"
type
=
"password"
class
=
"input {{
$errors->has
('password') ? '
is-invalid
' : '' }}"
name
=
"password"
class
=
"input {{
$errors->has
('password') ? '
bg-red-dark
' : '' }}"
name
=
"password"
minlength
=
"6"
required
>
<
span
class
=
"icon is-small is-left"
>
...
...
Prev
1
2
Next
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