-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
6,152 additions
and
4,017 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"/js/field.js": "/js/field.js", | ||
"/css/field.css": "/css/field.css" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"/dist/js/field.js": "/dist/js/field.js", | ||
"/C:/dist/js/field.js": "/C:/dist/js/field.js", | ||
"/dist/css/field.css": "/dist/css/field.css" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<template> | ||
<div class="p-3"> | ||
<select v-model="currentLocal" class="w-full form-control form-select" | ||
v-on:change="changeLocal"> | ||
<option v-for="(value, key) in locals" :value="key"> | ||
{{ value }} | ||
</option> | ||
</select> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { | ||
Minimum | ||
} from 'laravel-nova' | ||
export default { | ||
data: function () { | ||
return { | ||
currentLocal: window.config.currentLocal, | ||
locals: window.config.locals | ||
} | ||
}, | ||
methods: { | ||
changeLocal() { | ||
window.location = this.replaceUrlParam(window.location.href, 'lang', this.currentLocal); | ||
}, | ||
async initializeComponent() { | ||
await this.getCurrentLocal() | ||
}, | ||
getLocals() { | ||
return Minimum( | ||
Nova.request().get('/nova-vendor/multilingual-nova/locals') | ||
) | ||
.then(({ data }) => { | ||
this.locals = data | ||
}) | ||
.catch(error => { | ||
}) | ||
}, | ||
getCurrentLocal() { | ||
return Minimum( | ||
Nova.request().get('/nova-vendor/multilingual-nova/current-local') | ||
) | ||
.then(({ data }) => { | ||
this.currentLocal = data | ||
this.loading = false | ||
}) | ||
.catch(error => { | ||
}) | ||
}, | ||
replaceUrlParam(url, paramName, paramValue) | ||
{ | ||
if (paramValue == null) { | ||
paramValue = ''; | ||
} | ||
var pattern = new RegExp('\\b('+paramName+'=).*?(&|#|$)'); | ||
if (url.search(pattern)>=0) { | ||
return url.replace(pattern,'$1' + paramValue + '$2'); | ||
} | ||
url = url.replace(/[?#]$/,''); | ||
return url + (url.indexOf('?')>0 ? '&' : '?') + paramName + '=' + paramValue; | ||
} | ||
}, | ||
created() { | ||
}, | ||
mounted() { | ||
// this.initializeComponent() | ||
}, | ||
} | ||
</script> | ||
|
||
<style> | ||
/* Scoped Styles */ | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<div> | ||
<heading class="mb-6">Nova Language Tool</heading> | ||
|
||
<card class="flex p-3"> | ||
<div class="flex border-b border-40 w-full" > | ||
<div class="w-1/4 py-6 px-8"> | ||
<label class="inline-block text-80 pt-2 leading-tight" for="language">Select Language</label> | ||
</div> | ||
<div class="py-6 px-8 w-1/2"> | ||
<select v-model="currentLocal" id="language" dusk="language" placeholder="Select Language" class="w-full form-control form-select"> | ||
<option v-for="(value, key) in locals" :value="key"> | ||
{{ value }} | ||
</option> | ||
</select> | ||
<div class="help-text help-text mt-2"> </div> | ||
</div> | ||
<div class="py-6 px-2 w-1/4"> | ||
<button type="button" class="btn btn-default btn-primary inline-flex items-center relative ml-auto mr-3" dusk="change-language-button" @click="changeLocal"> | ||
<span class="">Change Language</span> | ||
</button> | ||
</div> | ||
</div> | ||
</card> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { | ||
Minimum | ||
} from 'laravel-nova' | ||
export default { | ||
data: function () { | ||
return { | ||
initialLoading: true, | ||
currentLocal: window.config.currentLocal, | ||
locals: window.config.locals | ||
} | ||
}, | ||
methods: { | ||
changeLocal() { | ||
window.location = Nova.config.base + "/nova-language-tool?lang=" + this.currentLocal; | ||
}, | ||
async initializeComponent() { | ||
await this.getCurrentLocal() | ||
this.initialLoading = false | ||
}, | ||
getCurrentLocal() { | ||
return Minimum( | ||
Nova.request().get('/nova-vendor/multilingual-nova/current-local') | ||
) | ||
.then(({ data }) => { | ||
this.currentLocal = data | ||
this.loading = false | ||
}) | ||
.catch(error => { | ||
}) | ||
}, | ||
}, | ||
created() { | ||
}, | ||
mounted() { | ||
// this.initializeComponent() | ||
}, | ||
} | ||
</script> | ||
|
||
<style> | ||
/* Scoped Styles */ | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<router-link tag="h3" :to="{name: 'nova-language-tool'}" class="cursor-pointer flex items-center font-normal dim text-white mb-6 text-base no-underline"> | ||
<svg class="sidebar-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="var(--sidebar-icon)" d="M3 1h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2H3c-1.1045695 0-2-.8954305-2-2V3c0-1.1045695.8954305-2 2-2zm0 2v4h4V3H3zm10-2h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2h-4c-1.1045695 0-2-.8954305-2-2V3c0-1.1045695.8954305-2 2-2zm0 2v4h4V3h-4zM3 11h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2H3c-1.1045695 0-2-.8954305-2-2v-4c0-1.1045695.8954305-2 2-2zm0 2v4h4v-4H3zm10-2h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2h-4c-1.1045695 0-2-.8954305-2-2v-4c0-1.1045695.8954305-2 2-2zm0 2v4h4v-4h-4z"/></svg> | ||
<span class="sidebar-label"> | ||
Language | ||
</span> | ||
</router-link> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Tool API Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you may register API routes for your tool. These routes | ||
| are loaded by the ServiceProvider of your tool. They are protected | ||
| by your tool's "Authorize" middleware by default. Now, go build! | ||
| | ||
*/ | ||
|
||
Route::get('/current-local', 'Digitalcloud\MultilingualNova\Http\Controllers\LanguageController@currentLocal'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Digitalcloud\MultilingualNova\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Bus\DispatchesJobs; | ||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | ||
|
||
class Controller extends BaseController | ||
{ | ||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Digitalcloud\MultilingualNova\Http\Controllers; | ||
|
||
use Illuminate\Support\Facades\App; | ||
|
||
class LanguageController extends Controller { | ||
|
||
public function index() { | ||
|
||
} | ||
public function currentLocal() { | ||
return App::getLocale(); | ||
} | ||
|
||
public function locals() { | ||
return App::getLocale(); | ||
} | ||
} |
Oops, something went wrong.