replace path modules to apps

This commit is contained in:
cuneytsenturk 2017-11-01 22:15:25 +03:00
parent cfbd5eba59
commit d7f53b52c1
22 changed files with 82 additions and 89 deletions

View File

@ -14,7 +14,7 @@ class ModuleInstall extends Command
*
* @var string
*/
protected $signature = 'module:install {module} {company_id}';
protected $signature = 'module:install {alias} {company_id}';
/**
* The console command description.
@ -32,7 +32,7 @@ class ModuleInstall extends Command
{
$request = [
'company_id' => $this->argument('company_id'),
'alias' => strtolower($this->argument('module')),
'alias' => strtolower($this->argument('alias')),
'status' => '1',
];

View File

@ -18,7 +18,7 @@ class Home extends Controller
public function __construct(Route $route)
{
if (!setting('general.api_token')) {
return redirect('modules/token/create')->send();
return redirect('apps/token/create')->send();
}
parent::__construct($route);

View File

@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
use App\Models\Module\Module;
use App\Models\Module\ModuleHistory;
use App\Traits\Modules;
use Artisan;
use Illuminate\Routing\Route;
class Item extends Controller
@ -22,7 +23,7 @@ class Item extends Controller
public function __construct(Route $route)
{
if (!setting('general.api_token')) {
return redirect('modules/token/create')->send();
return redirect('apps/token/create')->send();
}
parent::__construct($route);
@ -73,19 +74,19 @@ class Item extends Controller
// Download
$json['step'][] = array(
'text' => trans('modules.installation.download', ['module' => $name]),
'url' => url('modules/item/download')
'url' => url('apps/download')
);
// Unzip
$json['step'][] = array(
'text' => trans('modules.installation.unzip', ['module' => $name]),
'url' => url('modules/item/unzip')
'url' => url('apps/unzip')
);
// Download
$json['step'][] = array(
'text' => trans('modules.installation.install', ['module' => $name]),
'url' => url('modules/item/install')
'url' => url('apps/install')
);
return response()->json($json);
@ -141,9 +142,9 @@ class Item extends Controller
$json = $this->installModule($path);
if ($json['success']) {
Artisan::call('module:install ' . $json['data']['alias'] . ' ' . session('company_id'));
Artisan::call('module:install', ['alias' => $json['data']['alias'], 'company_id' => session('company_id')]);
$message = trans('messages.success.added', ['type' => trans('modules.installed', ['module' => $json['data']['name']])]);
$message = trans('modules.installed', ['module' => $json['data']['name']]);
flash($message)->success();
}
@ -162,18 +163,18 @@ class Item extends Controller
'module_id' => $module->id,
'category' => $json['data']['category'],
'version' => $json['data']['version'],
'description' => trans('modules.history.uninstalled', ['module' => $json['data']['name']]),
'description' => trans('modules.uninstalled', ['module' => $json['data']['name']]),
);
ModuleHistory::create($data);
$module->delete();
$message = trans('messages.success.added', ['type' => trans('modules.uninstalled', ['module' => $json['data']['name']])]);
$message = trans('modules.uninstalled', ['module' => $json['data']['name']]);
flash($message)->success();
return redirect('modules/item/' . $alias)->send();
return redirect('apps/' . $alias)->send();
}
public function update($alias)
@ -187,16 +188,16 @@ class Item extends Controller
'module_id' => $module->id,
'category' => $json['data']['category'],
'version' => $json['data']['version'],
'description' => trans_choice('modules.history.updated', $json['data']['name']),
'description' => trans_choice('modules.updated', $json['data']['name']),
);
ModuleHistory::create($data);
$message = trans('messages.success.added', ['type' => trans('modules.updated', ['module' => $json['data']['name']])]);
$message = trans('modules.updated', ['module' => $json['data']['name']]);
flash($message)->success();
return redirect('modules/' . $alias)->send();
return redirect('apps/' . $alias)->send();
}
public function enable($alias)
@ -210,7 +211,7 @@ class Item extends Controller
'module_id' => $module->id,
'category' => $json['data']['category'],
'version' => $json['data']['version'],
'description' => trans('modules.history.enabled', ['module' => $json['data']['name']]),
'description' => trans('modules.enabled', ['module' => $json['data']['name']]),
);
$module->status = 1;
@ -219,11 +220,11 @@ class Item extends Controller
ModuleHistory::create($data);
$message = trans('messages.success.added', ['type' => trans('modules.enabled', ['module' => $json['data']['name']])]);
$message = trans('modules.enabled', ['module' => $json['data']['name']]);
flash($message)->success();
return redirect('modules/' . $alias)->send();
return redirect('apps/' . $alias)->send();
}
public function disable($alias)
@ -237,7 +238,7 @@ class Item extends Controller
'module_id' => $module->id,
'category' => $json['data']['category'],
'version' => $json['data']['version'],
'description' => trans('modules.history.disabled', ['module' => $json['data']['name']]),
'description' => trans('modules.disabled', ['module' => $json['data']['name']]),
);
$module->status = 0;
@ -246,10 +247,10 @@ class Item extends Controller
ModuleHistory::create($data);
$message = trans('messages.success.added', ['type' => trans('modules.disabled', ['module' => $json['data']['name']])]);
$message = trans('modules.disabled', ['module' => $json['data']['name']]);
flash($message)->success();
return redirect('modules/' . $alias)->send();
return redirect('apps/' . $alias)->send();
}
}

View File

@ -18,7 +18,7 @@ class Tiles extends Controller
public function __construct(Route $route)
{
if (!setting('general.api_token')) {
return redirect('modules/token/create')->send();
return redirect('apps/token/create')->send();
}
parent::__construct($route);

View File

@ -32,6 +32,6 @@ class Token extends Controller
setting()->save();
return redirect('modules/home');
return redirect('apps/home');
}
}

View File

@ -56,7 +56,7 @@ class Modules extends Controller
flash($message)->success();
return redirect('settings/modules/' . $alias);
return redirect('settings/apps/' . $alias);
}
}

View File

@ -157,7 +157,7 @@ class AdminMenu
continue;
}
$sub->url('settings/modules/' . $module->getAlias(), $module->getName(), $position, $attr);
$sub->url('settings/apps/' . $module->getAlias(), $module->getName(), $position, $attr);
$position++;
}
@ -170,7 +170,7 @@ class AdminMenu
// Apps
if ($user->can('read-modules-home')) {
$menu->add([
'url' => 'modules/home',
'url' => 'apps/home',
'title' => trans_choice('general.modules', 2),
'icon' => 'fa fa-rocket',
'order' => 8,

View File

@ -14,7 +14,7 @@ trait Modules
public function getModules()
{
$response = $this->getRemote('modules/items');
$response = $this->getRemote('apps/items');
if ($response->getStatusCode() == 200) {
return json_decode($response->getBody())->data;
@ -25,7 +25,7 @@ trait Modules
public function getModule($alias)
{
$response = $this->getRemote('modules/items/' . $alias);
$response = $this->getRemote('apps/' . $alias);
if ($response->getStatusCode() == 200) {
return json_decode($response->getBody())->data;
@ -36,7 +36,7 @@ trait Modules
public function getCategories()
{
$response = $this->getRemote('modules/categories');
$response = $this->getRemote('apps/categories');
if ($response->getStatusCode() == 200) {
return json_decode($response->getBody())->data;
@ -47,7 +47,7 @@ trait Modules
public function getModulesByCategory($alias)
{
$response = $this->getRemote('modules/categories/' . $alias);
$response = $this->getRemote('apps/categories/' . $alias);
if ($response->getStatusCode() == 200) {
return json_decode($response->getBody())->data;
@ -58,7 +58,7 @@ trait Modules
public function getPaidModules()
{
$response = $this->getRemote('modules/paid');
$response = $this->getRemote('apps/paid');
if ($response->getStatusCode() == 200) {
return json_decode($response->getBody())->data;
@ -69,7 +69,7 @@ trait Modules
public function getNewModules()
{
$response = $this->getRemote('modules/new');
$response = $this->getRemote('apps/new');
if ($response->getStatusCode() == 200) {
return json_decode($response->getBody())->data;
@ -80,7 +80,7 @@ trait Modules
public function getFreeModules()
{
$response = $this->getRemote('modules/free');
$response = $this->getRemote('apps/free');
if ($response->getStatusCode() == 200) {
return json_decode($response->getBody())->data;
@ -204,8 +204,11 @@ trait Modules
// Update database
Artisan::call('migrate', ['--force' => true]);
Artisan::call('cache:clear');
$data = [
'path' => $path,
'name' => $module->name,
'alias' => $module->alias
];

View File

@ -99,7 +99,7 @@ class Updater
if ($alias == 'core') {
$url = 'core/download/' . $version . '/' . $info['php'] . '/' . $info['mysql'];
} else {
$url = 'modules/items/' . $alias . '/download/' . $version . '/' . $info['akaunting'] . '/' . $info['token'];
$url = 'apps/items/' . $alias . '/download/' . $version . '/' . $info['akaunting'] . '/' . $info['token'];
}
$response = static::getRemote($url, ['timeout' => 30, 'track_redirects' => true]);

View File

@ -85,7 +85,7 @@ class Versions
$alias = $module->get('alias');
$version = $module->get('version');
$url = 'modules/items/' . $alias . '/version/' . $version . '/' . $info['akaunting'];
$url = 'apps/items/' . $alias . '/version/' . $version . '/' . $info['akaunting'];
$data[$alias] = static::getLatestVersion($url);
}

View File

@ -17,6 +17,6 @@ class OfflinePaymentAdminMenu
// Add child to existing item
$item = $event->menu->whereTitle(trans_choice('general.settings', 2));
$item->url('modules/offlinepayment/settings', trans('offlinepayment::offlinepayment.offlinepayment'), 4, ['icon' => 'fa fa-angle-double-right']);
$item->url('apps/offlinepayment/settings', trans('offlinepayment::offlinepayment.offlinepayment'), 4, ['icon' => 'fa fa-angle-double-right']);
}
}

View File

@ -60,7 +60,7 @@ class Settings extends Controller
Artisan::call('cache:clear');
return redirect('modules/offlinepayment/settings');
return redirect('apps/offlinepayment/settings');
}
/**

View File

@ -1,6 +1,6 @@
<?php
Route::group(['middleware' => ['web', 'auth', 'language', 'adminmenu', 'permission:read-admin-panel'], 'prefix' => 'modules/offlinepayment', 'namespace' => 'Modules\OfflinePayment\Http\Controllers'], function () {
Route::group(['middleware' => ['web', 'auth', 'language', 'adminmenu', 'permission:read-admin-panel'], 'prefix' => 'apps/offlinepayment', 'namespace' => 'Modules\OfflinePayment\Http\Controllers'], function () {
Route::get('settings', 'Settings@edit');
Route::post('settings', 'Settings@update');
Route::post('settings/get', 'Settings@get');

View File

@ -11,7 +11,7 @@
</div>
<!-- /.box-header -->
{!! Form::open(['url' => 'modules/offlinepayment/settings', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'apps/offlinepayment/settings', 'files' => true, 'role' => 'form']) !!}
<div class="box-body">
<div id="install-loading"></div>
@ -27,7 +27,7 @@
<!-- /.box-body -->
<div class="box-footer">
{{ Form::saveButtons('modules/offlinepayment/settings') }}
{{ Form::saveButtons('apps/offlinepayment/settings') }}
</div>
<!-- /.box-footer -->
@ -114,7 +114,7 @@
var code = $(this).attr('id').replace('edit-', '');
$.ajax({
url: '{{ url("modules/offlinepayment/settings/get") }}',
url: '{{ url("apps/offlinepayment/settings/get") }}',
type: 'post',
dataType: 'json',
data: {code: code},
@ -149,7 +149,7 @@
var code = $(this).attr('id').replace('delete-', '');
$.ajax({
url: '{{ url("modules/offlinepayment/settings/delete") }}',
url: '{{ url("apps/offlinepayment/settings/delete") }}',
type: 'post',
dataType: 'json',
data: {code: code},

View File

@ -12,27 +12,19 @@ return [
'buy_now' => 'Buy Now',
'faq' => 'FAQ',
'changelog' => 'Changelog',
'installed' => 'Installed',
'uninstalled' => 'Uninstalled',
'token_link' => '<a href="https://akaunting.com/tokens" target="_blank">Click here</a> to get your API token.',
'enabled' => ':module app enabled',
'disabled' => ':module app disabled',
'installed' => ':module installed',
'uninstalled' => ':module uninstalled',
'updated' => ':module updated',
'enabled' => ':module enabled',
'disabled' => ':module disabled',
'installation' => [
'header' => 'Module Installation',
'start' => ':module installing.',
'header' => 'App Installation',
'download' => 'Downloading :module file.',
'unzip' => 'Extracting :module files.',
'install' => 'Uploading :module files.',
],
'history' => [
'installed' => ':module installed',
'uninstalled' => ':module uninstall',
'updated' => ':module updated',
'enabled' => ':module enabled',
'disabled' => ':module disabled',
'install' => 'Installing :module files.',
],
'button' => [

View File

@ -61,20 +61,22 @@
<div class="box-footer">
@if ($installed)
<a href="{{ url('modules/item/' . $module->slug . '/uninstall') }}" class="btn btn-block btn-danger">{{ trans('modules.button.uninstall') }}</a>
<a href="{{ url('apps/' . $module->slug . '/uninstall') }}" class="btn btn-block btn-danger">{{ trans('modules.button.uninstall') }}</a>
@if ($enable)
<a href="{{ url('modules/item/' . $module->slug . '/disabled') }}" class="btn btn-block btn-warning">{{ trans('modules.button.disable') }}</a>
<a href="{{ url('apps/' . $module->slug . '/disable') }}" class="btn btn-block btn-warning">{{ trans('modules.button.disable') }}</a>
@else
<a href="{{ url('modules/item/' . $module->slug . '/enabled') }}" class="btn btn-block btn-success">{{ trans('modules.button.enable') }}</a>
<a href="{{ url('apps/' . $module->slug . '/enable') }}" class="btn btn-block btn-success">{{ trans('modules.button.enable') }}</a>
@endif
@else
<a href="{{ $module->action_url }}" class="btn btn-success btn-block" <?php echo ($module->install) ? 'id="install-module"' : 'target="_blank"'; ?>>
@if ($module->install)
{{ trans('modules.install') }}
@else
{{ trans('modules.buy_now') }}
@endif
@if ($module->install)
<a href="{{ $module->action_url }}" class="btn btn-success btn-block" id="install-module">
{{ trans('modules.install') }}
</a>
@else
<a href="{{ $module->action_url }}" class="btn btn-success btn-block" target="_blank">
{{ trans('modules.buy_now') }}
</a>
@endif
@endif
</div>
<!-- /.box-footer -->
@ -91,7 +93,7 @@
<tbody>
<tr>
<th>Vendor</th>
<td class="text-right"><a href="{{ url('modules/vendor/' . $module->vendor->id) }}">{{ $module->vendor_name }}</a></td>
<td class="text-right"><a href="{{ url('apps/vendor/' . $module->vendor->id) }}">{{ $module->vendor_name }}</a></td>
</tr>
<tr>
<th>Version</th>
@ -111,7 +113,7 @@
</tr>
<tr>
<th>Category</th>
<td class="text-right"><a href="{{ url('modules/category/' . $module->category->slug) }}">{{ $module->category->name }}</a></td>
<td class="text-right"><a href="{{ url('apps/category/' . $module->category->slug) }}">{{ $module->category->name }}</a></td>
</tr>
</tbody>
</table>
@ -139,7 +141,7 @@
startInstallation();
$.ajax({
url: '{{ url("modules/item/steps") }}',
url: '{{ url("apps/steps") }}',
type: 'post',
dataType: 'json',
data: {name: '{{ $module->name }}', version: '{{ $module->version }}'},
@ -195,7 +197,7 @@
}
if (json['installed']) {
window.location = '{{ url("modules/item/" . $module->slug) }}';
window.location = '{{ url("apps/" . $module->slug) }}';
}
},
error: function(xhr, ajaxOptions, thrownError) {
@ -213,11 +215,9 @@
modal += ' <div class="modal-dialog">';
modal += ' <div class="modal-content">';
modal += ' <div class="modal-header">';
modal += ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>';
modal += ' <h4 class="modal-title">{{ trans('modules.installation.header') }}</h4>';
modal += ' </div>';
modal += ' <div class="modal-body">';
modal += ' <p><span class="message">{{ trans("modules.installation.start", ['module' => $module->name]) }}</span></p>';
modal += ' <p></p>';
modal += ' <p>';
modal += ' <div class="progress">';
@ -228,9 +228,6 @@
modal += ' <div id="progress-text"></div>';
modal += ' </p>';
modal += ' </div>';
modal += ' <div class="modal-footer">';
modal += ' <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>';
modal += ' </div>';
modal += ' </div>';
modal += ' </div>';
modal += '</div>';

View File

@ -4,7 +4,7 @@
@section('content')
<div class="box box-success">
{!! Form::open(['url' => 'modules/token', 'files' => true, 'role' => 'form']) !!}
{!! Form::open(['url' => 'apps/token', 'files' => true, 'role' => 'form']) !!}
<div class="box-body">
<div class="col-md-12">
@ -24,7 +24,7 @@
<!-- /.box-body -->
<div class="box-footer">
{{ Form::saveButtons('modules/token') }}
{{ Form::saveButtons('apps/token') }}
</div>
{!! Form::close() !!}

View File

@ -4,14 +4,14 @@
<div class="pull-left">
{!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-sm', 'style' => 'display:inline;width:inherit;']) !!}
<a href="{{ url('modules/paid') }}" class="btn btn-sm btn-default btn-flat margin" style="margin-left: 20px;">Top Paid</a>
<a href="{{ url('modules/new') }}" class="btn btn-sm btn-default btn-flat margin">New</a>
<a href="{{ url('modules/free') }}" class="btn btn-sm btn-default btn-flat margin">Top Free</a>
<a href="{{ url('apps/paid') }}" class="btn btn-sm btn-default btn-flat margin" style="margin-left: 20px;">Top Paid</a>
<a href="{{ url('apps/new') }}" class="btn btn-sm btn-default btn-flat margin">New</a>
<a href="{{ url('apps/free') }}" class="btn btn-sm btn-default btn-flat margin">Top Free</a>
</div>
<div class="pull-right">
<div class="has-feedback">
{!! Form::open(['url' => 'modules/search', 'role' => 'form']) !!}
{!! Form::open(['url' => 'apps/search', 'role' => 'form']) !!}
<input type="text" class="form-control input-sm" style="margin-top: 10px;" placeholder="Search Apps">
<span class="glyphicon glyphicon-search form-control-feedback"></span>
{!! Form::close() !!}

View File

@ -64,14 +64,14 @@
<script type="text/javascript">
$(document).ready(function() {
$('select[name=\'category\']').on('change', function() {
url = '{{ url('modules/category') }}';
url = '{{ url('apps/categories') }}';
var value = $(this).val();
if (value) {
url += '/' + encodeURIComponent(value);
} else {
url = '{{ url('modules/home') }}';
url = '{{ url('apps/home') }}';
}
location = url;

View File

@ -1,13 +1,13 @@
<div class="col-md-3 no-padding-left">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ url('modules/' . $module->slug) }}">{{ $module->name }}</a></h3>
<h3 class="box-title"><a href="{{ url('apps/' . $module->slug) }}">{{ $module->name }}</a></h3>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body text-center">
<a href="{{ url('modules/' . $module->slug) }}">
<a href="{{ url('apps/' . $module->slug) }}">
<img src="{{ $module->files[0]->path_string }}" alt="{{ $module->name }}" class="item-image">
</a>
</div>

View File

@ -7,7 +7,7 @@
<div class="box box-success">
{!! Form::model($setting, [
'method' => 'PATCH',
'url' => ['settings/modules/' . $module->getAlias()],
'url' => ['settings/apps/' . $module->getAlias()],
'files' => true,
'role' => 'form'
]) !!}

View File

@ -82,11 +82,11 @@ Route::group(['middleware' => 'language'], function () {
Route::get('settings', 'Settings\Settings@edit');
Route::patch('settings', 'Settings\Settings@update');
Route::resource('taxes', 'Settings\Taxes');
Route::get('modules/{alias}', 'Settings\Modules@edit');
Route::patch('modules/{alias}', 'Settings\Modules@update');
Route::get('apps/{alias}', 'Settings\Modules@edit');
Route::patch('apps/{alias}', 'Settings\Modules@update');
});
Route::group(['prefix' => 'modules'], function () {
Route::group(['prefix' => 'apps'], function () {
Route::resource('token', 'Modules\Token');
Route::resource('home', 'Modules\Home');
Route::get('categories/{alias}', 'Modules\Tiles@category');