Commit 207f4853 authored by ZeMKI's avatar ZeMKI

Layout + admin tag

* optimization of the layout
* using admin instead of "superadmin"
parent c4364647
......@@ -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
......
......@@ -60,7 +60,6 @@ class AllInterviewTokenExport implements FromCollection, WithMapping, WithHeadin
$this->formatTokenValuesForExport($interview, $toprint);
array_push($printArray, $toprint);
}
}
return $printArray;
}
......
......@@ -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()
......
......@@ -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);
......
......@@ -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()
{
......
......@@ -20,7 +20,7 @@ class InterviewPolicy
*/
public function before($user, $ability)
{
if ($user->hasRole('superadministrator')) {
if ($user->hasRole('admin')) {
return true;
}
}
......
......@@ -20,7 +20,7 @@ class SortingPolicy
*/
public function before($user, $ability)
{
if ($user->hasRole('superadministrator')) {
if ($user->hasRole('admin')) {
return true;
}
}
......
......@@ -18,7 +18,7 @@ class StudyPolicy
*/
public function before($user, $ability)
{
if ($user->hasRole('superadministrator')) {
if ($user->hasRole('admin')) {
return true;
}
}
......
......@@ -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')]);
}
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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()
......
......@@ -2,7 +2,7 @@
return [
'role_structure' => [
'superadministrator' => [
'admin' => [
'users' => 'c,r,u,d',
'acl' => 'c,r,u,d',
'profile' => 'c,r,u,d',
......
......@@ -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>
......
@include('layouts.header')
<body>
<div class="container" id="app">
<div class="container mx-auto" id="app">
<!-- START NAV -->
@include('layouts.nav')
<!-- END NAV -->
......
......@@ -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>
......@@ -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>
......
......@@ -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>
......
@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-label text-md-right">{{ __('E-Mail Address') }}</label>
class="md:w-1/3 pr-4 pl-4 pt-2 pb-2 mb-0 leading-normal 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>
......
......@@ -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">
......
......@@ -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%">
......@@ -23,7 +23,7 @@
</div>
</div>
@if ($errors->has('email'))
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded" role="alert">
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded" role="relative px-3 py-3 mb-4 border rounded">
<strong>{{ $errors->first('email') }}</strong>
</div>
@endif
......@@ -31,7 +31,7 @@
<label for="email" class="label">{{ __('E-Mail Address') }}</label>
<div class="control">
<input id="email" type="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>
......@@ -54,7 +54,7 @@
<p class="control has-icon-left">
<input id="password" type="password" v-model="registration.password"
@input="checkPassword()"
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>
......@@ -63,7 +63,7 @@
</div>
<div class="field">
<label for="password-confirm"
class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>
class="md:w-1/3 pr-4 pl-4 pt-2 pb-2 mb-0 leading-normal text-md-right">{{ __('Confirm Password') }}</label>
<p class="control has-icon-left">
<input id="password-confirm" type="password" class="input"
name="password_confirmation" required>
......@@ -80,7 +80,7 @@
<div class="field">
<p class="control">
<button class="button is-dark"
:class="{'opacity-50 cursor-not-allowed disabled' : !this.registration.valid_password}"
:class="{'opacity-50 cursor-not-allowed opacity-75' : !this.registration.valid_password}"
:disabled="!this.registration.valid_password"
>
Register
......
......@@ -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%">
......@@ -16,7 +16,7 @@
@if (session('resent'))
<div class="flex items-center bg-blue-500 text-white text-sm font-bold px-4 py-3"
role="alert">
<svg class="fill-current w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg"
<svg class="fill-current w-4 mb-2 font-medium leading-tight text-xl mr-2" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20">
<path
d="M12.432 0c1.34 0 2.01.912 2.01 1.957 0 1.305-1.164 2.512-2.679 2.512-1.269 0-2.009-.75-1.974-1.99C9.789 1.436 10.67 0 12.432 0zM8.309 20c-1.058 0-1.833-.652-1.093-3.524l1.214-5.092c.211-.814.246-1.141 0-1.141-.317 0-1.689.562-2.502 1.117l-.528-.88c2.572-2.186 5.531-3.467 6.801-3.467 1.057 0 1.233 1.273.705 3.23l-1.391 5.352c-.246.945-.141 1.271.106 1.271.317 0 1.357-.392 2.379-1.207l.6.814C12.098 19.02 9.365 20 8.309 20z"/>
......
......@@ -464,7 +464,7 @@
@yield('code', __('Oh no'))
</div>
<div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div>
<div class="w-16 mb-2 font-medium leading-tight text-4xl bg-purple-light my-3 md:my-6"></div>
<p class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal">
@yield('message')
......
......@@ -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">
......
@extends('layouts.app')
@section('content')
<new-edit-user :showmodal="newuser.showmodal" @showmodalparent="showmodal" @reloadusers="reloadusers"
:edituser="newuser.edituser" :study="newuser.study"></new-edit-user>
@if(count($studies) > 0)
<div class="container" style="overflow-x: scroll;overflow-y: auto;margin: 0;height: 90vh;min-width: 100vw"
<div class="container mx-auto"
style="overflow-x: scroll;overflow-y: auto;margin: 0;height: 90vh;min-width: 100vw"
id="style-1">
<div class="level">
......@@ -84,7 +86,7 @@
</div>
</article>
@if(Auth::user()->hasRole(['superadministrator','supervisor']))
@if(Auth::user()->hasRole(['admin','supervisor']))
<div class="is-danger w-full rounded-t-lg " style="margin-top: -25px;">
<p class="control w-full">
<a class="rounded-b-lg button w-full hover:text-gray-300 bg-red-600"
......@@ -108,7 +110,7 @@
</div>
</b-tab-item>
@if(Auth::user()->hasRole(['superadministrator','supervisor']))
@if(Auth::user()->hasRole(['admin','supervisor']))
<b-tab-item>
<template slot="header">
<span data-toggle="tab" id="adduser{{$study->id}}"> Users <b-tag
......@@ -138,10 +140,10 @@
@else
<section class="hero is-bold" style="width: 100vw;height: 100vh;overflow: hidden;">
<div class="hero-body">
<div class="container">
<div class="container mx-auto">
<div class="flex">
@if(Auth::user()->hasRole(['superadministrator','supervisor']) || Auth::user()->can('create-studies'))
@if(Auth::user()->hasRole(['admin','supervisor']) || Auth::user()->can('create-studies'))
<p class="control">
<a class="button is-danger rounded-full h-24 w-24 flex items-center justify-center p-2 ml-4"
......
......@@ -10,7 +10,7 @@
<a href="{{url('export/'.$study->id."/study")}}"
class="bg-red-300 hover:bg-red-400 text-black-800 font-bold py-2 px-4 rounded inline-flex items-center">
<b-icon
class="fill-current w-4 h-4 mr-2"
class="fill-current w-4 mb-2 font-medium leading-tight text-xl mr-2"
icon="export"
>
</b-icon>
......
......@@ -4,7 +4,7 @@
<div class="content contrastbackground p-10">
<div class="container">
<div class="container mx-auto">
<div class="columns">
<div class="column">
<h1 class="title is-size-1">{{$study->name}}</h1>
......
......@@ -4,8 +4,7 @@
<div id="app">
@include('layouts.nav')
<main>
<new-edit-user :showmodal="newuser.showmodal" @showmodalparent="showmodal" @reloadusers="reloadusers"
:edituser="newuser.edituser" :study="newuser.study"></new-edit-user>
@yield('content')
</main>
......
......@@ -16,7 +16,7 @@
>
{{ __('Home') }}
</a>
@if(Auth::user()->hasRole('superadministrator'))
@if(Auth::user()->hasRole('admin'))
<a target="_blank" class="block mt-4 lg:inline-block lg:mt-0 mr-4 menu-item"
href="{{url('translations')}}"
>
......@@ -56,7 +56,7 @@
<div
class="w-auto relative border-t border-b border-blue-500 text-blue-700 pb-2 z-10 border-b-4 border-solid"
:class="notification.read_at == null ? 'bg-blue-200' : 'bg-blue-100'" role="alert"
:class="notification.read_at == null ? 'bg-blue-200' : 'bg-blue-100'" role="relative px-3 py-3 mb-4 border rounded"
v-for="notification in usernotifications">
<div class="w-full flex bg-blue-300 p-2">
......@@ -78,7 +78,7 @@
</div>
@endif
@if((Auth::user()->hasRole(['superadministrator','supervisor']) || Auth::user()->can('create-studies')) && !Auth::user()->hasReachMaxNumberOfStudies())
@if((Auth::user()->hasRole(['admin','supervisor']) || Auth::user()->can('create-studies')) && !Auth::user()->hasReachMaxNumberOfStudies())
<a class="block mt-4 lg:inline-block lg:mt-0 mr-4 menu-item text-red-400"
href="{{url('studies/new')}}"
>
......@@ -92,7 +92,7 @@
@if(Auth::user()->hasRole(['superadministrator']))
@if(Auth::user()->hasRole(['admin']))
<div
class="block mt-4 lg:inline-block lg:mt-0 mr-4 menu-item languagedropbtn relative inline-block hover:cursor-pointer"
href="#" @click="showdropdown('dropdownLanguage')" @mouseover="showdropdown('dropdownLanguage')"
......
<div class="table">
<div class="w-full max-w-full mb-4 bg-transparent">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</div>
......@@ -2,7 +2,7 @@
@section('content')
<div class="container">
<div class="container mx-auto">
<p class="block text-gray-500 font-bold md:text-left mb-2 pr-4">Warning, translations are not visible until they
are exported back to the app/lang file, using <code>php
artisan translation:export</code> command or publish button.</p>
......@@ -10,7 +10,7 @@
style="display:none;">
<div class="flex">
<div class="py-1">
<svg class="fill-current h-6 w-6 text-teal-500 mr-4" xmlns="http://www.w3.org/2000/svg"
<svg class="fill-current mb-2 font-medium leading-tight text-base w-6 text-teal-500 mr-4" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20">
<path
d="M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 11V9h2v6H9v-4zm0-6h2v2H9V5z"/>
......@@ -62,16 +62,16 @@
action="<?php echo action('\Barryvdh\TranslationManager\Controller@postImport') ?>" data-remote="true"
role="form">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<div class="form-group">
<div class="row">
<div class="col-sm-3">
<div class="mb-4">
<div class="flex flex-wrap">
<div class="sm:w-1/4 pr-4 pl-4">
<select name="replace"
class="block appearance-none w-1/3 bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500 my-2">
<option value="0">Append new translations</option>
<option value="1">Replace existing translations</option>
</select>
</div>
<div class="col-sm-2">
<div class="sm:w-1/5 pr-4 pl-4">
<button type="submit"