Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a content manager / admin I can view the new design of the sidebar menu in order to navigate to my options #122

Merged
merged 21 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/laravel-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Create storage directories
run: |
mkdir -p storage/app
mkdir -p storage/app/public/uploads/user_profile_img

- name: Create Database
run: |
mkdir -p database
Expand Down
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Run Pint to beautify the code
vendor/bin/pint
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use App\BusinessLogicLayer\CrowdSourcingProject\Problem\CrowdSourcingProjectProblemManager;
use App\Http\Controllers\Controller;
use App\Models\CrowdSourcingProject\Problem\CrowdSourcingProjectProblem;
use App\Models\CrowdSourcingProject\Problem\CrowdSourcingProjectProblemTranslation;
use App\ViewModels\CrowdSourcingProject\Problem\CreateEditProblem;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
Expand Down Expand Up @@ -33,4 +36,76 @@ public function showProblemsPage(Request $request) {
abort(ResponseAlias::HTTP_NOT_FOUND);
}
}

/**
* Display a listing of the resource.
*/
public function index() {
$viewModel = [];
$viewModel['problems'] = CrowdSourcingProjectProblem::with('translations')->latest()->get();

return view('loggedin-environment.management.problem.index', ['viewModel' => $viewModel]);
}

/**
* Show the form for creating a new resource.
*/
public function create() {
$newProblem = new CrowdSourcingProjectProblem;
$newProblem->default_language_id = 6; // @todo change with lookuptable value - bookmark2
$newProblem->setRelation('defaultTranslation', new CrowdSourcingProjectProblemTranslation); // bookmark2 - is this an "empty" relationship?
$viewModel = new CreateEditProblem($newProblem);

return view('loggedin-environment.management.problem.create-edit.form-page');
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request) {
$validated = $request->validate([ // bookmark2
'problem-title' => ['required'],
'problem-description' => ['required'],
'problem-status' => ['required'], // bookmark2
'problem-default-language' => ['required'], // bookmark2
'problem-slug' => ['required', 'unique:crowd_sourcing_project_problems,slug'],
]);

$crowdSourcingProjectProblem = CrowdSourcingProjectProblem::create([
'project_id' => '3', // bookmark2
'user_creator_id' => '2', // bookmark2
'slug' => $request->input('problem-slug'),
'status_id' => $request->input('problem-status'),
'img_url' => 'zxcv', // bookmark2
'default_language_id' => $request->input('problem-default-language'), // bookmark2 - default or generally another translation language?
]);

$crowdSourcingProjectProblemTranslation = $crowdSourcingProjectProblem->defaultTranslation()->create([ // bookmark2 - default or regular translation?
'title' => $request->input('problem-title'),
'description' => $request->input('problem-description'),
]);

return redirect()->route('problems.index');
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id) {
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id) {
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id) {
//
}
}
1 change: 1 addition & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function patch(Request $request) {
$validationArray['password'] = 'required_with:password_confirmation|string|min:8|confirmed';
$validationArray['current_password'] = 'required|string|min:8';
}
// here we need to add custom messages for the validation, since the field is called 'avatar' and not 'profile image'.
$customMessages = [
'avatar.image' => __('validation.image', ['attribute' => __('my-account.profile_image')]),
'avatar.mimes' => __('validation.mimes', ['attribute' => __('my-account.profile_image'), 'values' => 'jpeg, png, jpg']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CrowdSourcingProjectProblem extends Model {
use SoftDeletes;

protected $table = 'crowd_sourcing_project_problems';
protected $fillable = ['id', 'project_id', 'slug', 'status_id', 'img_url', 'default_language_id'];
protected $fillable = ['id', 'project_id', 'user_creator_id', 'slug', 'status_id', 'img_url', 'default_language_id'];

public function defaultTranslation(): HasOne {
return $this->hasOne(CrowdSourcingProjectProblemTranslation::class,
Expand Down
2 changes: 0 additions & 2 deletions app/Providers/ComposerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class ComposerServiceProvider extends ServiceProvider {
* @return void
*/
public function boot() {
View::composer('loggedin-environment.partials.menu', 'App\ViewComposers\MenuComposer');

View::composer('errors::layout', 'App\ViewComposers\ErrorPagesComposer');

View::composer('partials.language-selector', 'App\ViewComposers\LanguageSelectorComposer');
Expand Down
19 changes: 0 additions & 19 deletions app/ViewComposers/MenuComposer.php

This file was deleted.

13 changes: 13 additions & 0 deletions app/ViewModels/CrowdSourcingProject/Problem/CreateEditProblem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\ViewModels\CrowdSourcingProject\Problem;

use App\Models\CrowdSourcingProject\Problem\CrowdSourcingProjectProblem;

class CreateEditProblem {
public CrowdSourcingProjectProblem $crowdSourcingProjectProblem;

public function __construct(CrowdSourcingProjectProblem $crowdSourcingProjectProblem) {
$this->crowdSourcingProjectProblem = $crowdSourcingProjectProblem;
}
}
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"format": "prettier --write \"resources/assets/\"",
"dev": "vite",
"build": "vite build",
"prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=7680 vite build"
"prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=7680 vite build",
"prepare": "husky install && chmod +x .husky/*"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.4",
Expand All @@ -26,6 +27,7 @@
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-vue": "^9.28.0",
"goodparts": "^1.3.0",
"husky": "^9.1.6",
"laravel-vite-plugin": "^1.0.5",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
Expand Down
Binary file added public/images/test/image_temp_big.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added public/images/test/test.txt
Empty file.
28 changes: 28 additions & 0 deletions resources/assets/js/common-backoffice.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import Clipboard from "clipboard/dist/clipboard";
import $ from "jquery";
import { showToast } from "./common-utils";

const MOBILE_WIDTH = 768;

(function () {
const initializeIcheck = function () {
$(".icheck-input").iCheck({
Expand Down Expand Up @@ -72,12 +74,38 @@ import { showToast } from "./common-utils";
window.$('[data-toggle="tooltip"]').tooltip();
};

const toggleIconOnSidebarMenuToggle = function () {

// if on mobile, set the icon to "fa-chevron-right" by default
if (window.innerWidth < MOBILE_WIDTH) {
$("#sidebar-menu-toggler").find("i").removeClass("fa-chevron-left").addClass("fa-chevron-right");
}

const toggler = $("#sidebar-menu-toggler");
// on click, check if the button has an <i> element with a "fa-chevron-left" class.
// If it does, then change it to "fa-chevron-right". Otherwise, change it to "fa-chevron-left".
toggler.on("click", function () {
// check if we are not in a mobile device
if (window.innerWidth < MOBILE_WIDTH) {
return;
}

const icon = toggler.find("i");
if (icon.hasClass("fa-chevron-left")) {
icon.removeClass("fa-chevron-left").addClass("fa-chevron-right");
} else {
icon.removeClass("fa-chevron-right").addClass("fa-chevron-left");
}
});
}

$(document).ready(function () {
initializeIcheck();
closeDismissibleAlerts();
initClipboardElements();
listenToReadMoreClicks();
initializeTooltips();
toggleIconOnSidebarMenuToggle();
});
})();

Expand Down
2 changes: 1 addition & 1 deletion resources/assets/sass/common-backoffice.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}

.logged-in-env .main-header {
padding-left: 35px;
padding-left: 25px;
}

.no-sidebar {
Expand Down
37 changes: 37 additions & 0 deletions resources/assets/sass/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,40 @@
}
}
}

.sidebar-menu-toggler-container {
background-color: var(--clr-secondary-grey);
border-radius: 100%;
width: 55px;
height: 55px;
padding: 10px;

#sidebar-menu-toggler {
text-align: center;
width: 100%;
height: 100%;

i {
color: var(--clr-secondary-light-grey);
font-size: 33px;
width: 100%;
height: 100%;
}
}
}

.main-sidebar {
.nav-sidebar {
.nav-header {
text-transform: uppercase;
text-decoration: underline;
font-size: medium;
padding: 0 0.5rem;
margin-bottom: 0.5rem;
}

.nav-link {
padding: 0 0.5rem;
}
}
}
20 changes: 16 additions & 4 deletions resources/lang/bg/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@

*/

'login' => 'Вход', //??
'register' => 'Регистрация', //??
'dashboard' => 'Табло за управление', //??
'login' => 'Вход',
'register' => 'Регистрация',
'dashboard' => 'Табло за управление',
'my_dashboard' => 'Табло за управление',
'my_account' => 'Моят акаунт',
'my_history' => 'История на ползването',
'sign_out' => 'Изключете се',

'projects' => 'Проекти',
'see_all_projects' => 'Вижте всички проекти',
'create_new_project' => 'Създайте нов проект',
'questionnaires' => 'Анкети',
'see_all_questionnaires' => 'Вижте анкети',
'responses' => 'Отговори',
'problems' => 'Проблеми',
'see_all_problems' => 'Вижте всички проблеми',
'solutions' => 'Решения',
'see_all_solutions' => 'Вижте всички решения',
'moderate_solutions' => 'Умерени решения',
'platform_management' => 'Управление на платформата',
'manage_users' => 'Управление на потребители',

];
20 changes: 16 additions & 4 deletions resources/lang/de/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@

*/

'login' => 'Anmelden', //??
'register' => 'Registrieren', //??
'dashboard' => 'Dashboard', //??
'login' => 'Anmelden',
'register' => 'Registrieren',
'dashboard' => 'Dashboard',
'my_dashboard' => 'Mein Dashboard',
'my_account' => 'Mein Konto',
'my_history' => 'Meine Historie',
'sign_out' => 'Abmelden',

'projects' => 'Projekte',
'see_all_projects' => 'Alle Projekte anzeigen',
'create_new_project' => 'Neues Projekt erstellen',
'questionnaires' => 'Fragebögen',
'see_all_questionnaires' => 'Alle Fragebögen anzeigen',
'responses' => 'Antworten',
'problems' => 'Probleme',
'see_all_problems' => 'Alle Probleme anzeigen',
'solutions' => 'Lösungen',
'see_all_solutions' => 'Alle Lösungen anzeigen',
'moderate_solutions' => 'Moderiere Lösungen',
'platform_management' => 'Plattform-Management',
'manage_users' => 'Benutzer verwalten',

];
20 changes: 16 additions & 4 deletions resources/lang/el/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@

*/

'login' => 'ΣΥΝΔΕΣΗ', //??
'register' => 'ΕΓΓΡΑΦΗ', //??
'dashboard' => 'Η ΠΛΑΤΦΟΡΜΑ ΜΟΥ', //??
'login' => 'ΣΥΝΔΕΣΗ',
'register' => 'ΕΓΓΡΑΦΗ',
'dashboard' => 'Η ΠΛΑΤΦΟΡΜΑ ΜΟΥ',
'my_dashboard' => 'Η ΠΛΑΤΦΟΡΜΑ ΜΟΥ',
'my_account' => 'Ο ΛΟΓΑΡΙΑΣΜΟΣ ΜΟΥ',
'my_history' => 'ΤΟ ΙΣΤΟΡΙΚΟ ΜΟΥ',
'sign_out' => 'Αποσυνδεθείτε',

'projects' => 'Έργα',
'see_all_projects' => 'Δείτε όλα τα έργα',
'create_new_project' => 'Δημιουργία έργου',
'questionnaires' => 'Ερωτηματολόγια',
'see_all_questionnaires' => 'Δείτε ερωτηματολόγια',
'responses' => 'Απαντήσεις',
'problems' => 'Προβλήματα',
'see_all_problems' => 'Δείτε τα προβλήματα',
'solutions' => 'Λύσεις',
'see_all_solutions' => 'Δείτε τις λύσεις',
'moderate_solutions' => 'Μετριάστε τις λύσεις',
'platform_management' => 'Διαχείριση πλατφόρμας',
'manage_users' => 'Διαχείριση χρηστών',

];
Loading
Loading