Skip to content

Commit

Permalink
Merge pull request #88 from Laravel-Backpack/v5
Browse files Browse the repository at this point in the history
provide support for Backpack v6
  • Loading branch information
tabacitu authored Jul 1, 2023
2 parents 3de4adc + f205680 commit 73e62b1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 32 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
[![Style CI](https://styleci.io/repos/53691643/shield)](https://styleci.io/repos/53691643)
[![Total Downloads][ico-downloads]][link-downloads]

A quick interface to edit language files, for Laravel Backpack.
A quick interface to edit language files, for Laravel Backpack.

_**Note:** this interface allows the admin to directly edit the language files stored in ```resources/lang```. Which might not be a great idea in production, if you have those files commited to git and/or use auto-deployment._

> ### Security updates and breaking changes
> Please **[subscribe to the Backpack Newsletter](http://backpackforlaravel.com/newsletter)** so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months.

## Install in Backpack 5.x or 4.1 (Laravel 6, 7, 8 or 9)
## Install in Backpack v6.x

### Step 1. Install via Composer

Expand All @@ -36,18 +36,19 @@ php artisan vendor:publish --provider="Backpack\LangFileManager\LangFileManagerS

### Step 3. Add menu items for it

Add a menu item for it in resources/views/vendor/backpack/base/inc/sidebar.blade.php:
Add a menu item for it in resources/views/vendor/backpack/ui/inc/menu_items.blade.php:

```html
<li class="nav-item nav-dropdown">
<a class="nav-link nav-dropdown-toggle" href="#"><i class="nav-icon la la-globe"></i> Translations</a>
<ul class="nav-dropdown-items">
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('language') }}"><i class="nav-icon la la-flag-checkered"></i> Languages</a></li>
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('language/texts') }}"><i class="nav-icon la la-language"></i> Site texts</a></li>
</ul>
</li>
<x-backpack::menu-dropdown title="Translations" icon="la la-globe">
<x-backpack::menu-dropdown-item title="Languages" icon="la la-flag-checkered" :link="backpack_url('language')" />
<x-backpack::menu-dropdown-item title="Site texts" icon="la la-language" :link="backpack_url('language/texts')" />
</x-backpack::menu-dropdown>
```

## Upgrading from 4.x to 5.x

You should have no problems upgrading, there have been no breaking changes. Just require the new version.

## Upgrading from 3.x to 4.x

- Flags are no longer supported on the Language CRUD, until version 3 admins could browse an image for the language flag, we now recommend developers to setup those images in advance, having them in a public folder like `public\flags\en.svg` `public\flags\ro.svg`.
Expand Down
9 changes: 2 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@
"lang files",
"lang file manager",
"language",
"dick",
"tabacitu",
"updivision",
"dick admin",
"dickadmin",
"laravel",
"admin panel",
"translationmanager",
"dick translationmanager"
"translationmanager"
],
"homepage": "https://github.com/laravel-backpack/langfilemanager",
"license": "MIT",
Expand All @@ -33,7 +28,7 @@
}
],
"require": {
"backpack/crud": "^5.0"
"backpack/crud": "^6.0"
},
"require-dev": {
"phpunit/phpunit" : "^9.0",
Expand Down
1 change: 0 additions & 1 deletion src/app/Http/Requests/LanguageRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Backpack\LangFileManager\app\Http\Requests;

use App\Http\Requests\Request;
use Illuminate\Foundation\Http\FormRequest;

class LanguageRequest extends FormRequest
Expand Down
32 changes: 18 additions & 14 deletions src/resources/views/translations.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends(backpack_view('layouts.top_left'))
@extends(backpack_view('blank'))

@php
$defaultBreadcrumbs = [
Expand All @@ -12,23 +12,27 @@
@endphp

@section('header')
<section class="container-fluid">
<h2>
<span class="text-capitalize">{{ trans('backpack::langfilemanager.translate') }}</span>
<small>{{ trans('backpack::langfilemanager.site_texts') }}.</small>

@if ($crud->hasAccess('list'))
<small><a href="{{ url($crud->route) }}" class="hidden-print font-sm"><i class="fa fa-angle-double-left"></i> {{ trans('backpack::crud.back_to_all') }} <span>{{ $crud->entity_name_plural }}</span></a></small>
@endif
</h2>
<section class="header-operation container-fluid animated fadeIn d-flex mb-2 align-items-end" bp-section="page-header">
<h1 bp-section="page-heading" class="mb-2">
{{ trans('backpack::langfilemanager.translate') }}
</h1>
<p class="ms-2 ml-2 mb-2" bp-section="page-subheading">
{{ trans('backpack::langfilemanager.site_texts') }}.</i>
</p>
@if ($crud->hasAccess('list'))
<p class="ms-2 ml-2 mb-2" bp-section="page-subheading-back-button">
<small><a href="{{ url($crud->route) }}" class="hidden-print font-sm"><i class="fa fa-angle-double-left"></i> {{
trans('backpack::crud.back_to_all') }} <span>{{ $crud->entity_name_plural }}</span></a></small>
</p>
@endif
</section>
@endsection

@section('content')
<!-- Default box -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title float-right pr-1">
<div class="box-title float-right float-end pr-1">
<small>
&nbsp; {{ trans('backpack::langfilemanager.switch_to') }}: &nbsp;
<select name="language_switch" id="language_switch">
Expand All @@ -37,17 +41,17 @@
@endforeach
</select>
</small>
</h3>
</div>
</div>
<div class="box-body">
<ul class="nav nav-tabs">
@foreach ($langFiles as $file)
<li class="nav-item">
<a class="nav-link {{ $file['active'] ? 'active' : '' }}" href="{{ $file['url'] }}">{{ $file['name'] }}</a>
<a class="nav-link {{ $file['active'] ? 'active bg-white' : '' }}" href="{{ $file['url'] }}">{{ $file['name'] }}</a>
</li>
@endforeach
</ul>
<section class="tab-content p-3 lang-inputs">
<section class="tab-content bg-white p-3 lang-inputs mb-2">
@if (!empty($fileArray))
<form
method="post"
Expand Down

0 comments on commit 73e62b1

Please sign in to comment.