mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
commit
bde4f7e011
@ -0,0 +1,32 @@
|
||||
function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (getUrlParameter('view') === "advanced") {
|
||||
$('.fast-update').on('change', function () {
|
||||
var advanced_value = $(this).val(), advanced_entry_id = $(this).data('entry_id'),
|
||||
advanced_column = $(this).data('column'), advanced_type = $(this).attr('type');
|
||||
|
||||
if (advanced_type === "checkbox") {
|
||||
advanced_value = ($(this).prop('checked')) ? 1 : 0;
|
||||
}
|
||||
|
||||
crudAjax({
|
||||
'advanced_column': advanced_column,
|
||||
'advanced_entry_id': advanced_entry_id,
|
||||
'advanced_value': advanced_value
|
||||
}, advanced_update_url, 'POST')
|
||||
})
|
||||
}
|
||||
@ -2,4 +2,5 @@
|
||||
|
||||
return [
|
||||
'unfinished' => 'Unfinished',
|
||||
'advanced' => 'Advanced',
|
||||
];
|
||||
|
||||
@ -2,4 +2,5 @@
|
||||
|
||||
return [
|
||||
'unfinished' => 'Bitmemiş',
|
||||
'advanced' => 'Gelişmiş',
|
||||
];
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
{{ asset_add("scripts.js", "streams::js/table/table.js") }}
|
||||
|
||||
{% if not actions.empty() %}
|
||||
{{ asset_add("scripts.js", "streams::js/table/actions.js") }}
|
||||
{% endif %}
|
||||
|
||||
{% if table.options.sortable %}
|
||||
{{ asset_add("scripts.js", "streams::js/table/sortable.js") }}
|
||||
{% endif %}
|
||||
|
||||
<div class="{{ table.options.container_class ?: 'container-fluid' }}">
|
||||
|
||||
{{ view("streams::table/partials/filters", {'table': table}) }}
|
||||
{{ view("streams::table/partials/views", {'table': table}) }}
|
||||
|
||||
{{ view(table.options.heading ?: "streams::table/partials/heading", {'table': table}) }}
|
||||
|
||||
{% if not table.rows.empty() %}
|
||||
{% block card %}
|
||||
<div class="card">
|
||||
|
||||
{{ form_open({ 'url': url_full() }) }}
|
||||
<div class="table-stack">
|
||||
<table
|
||||
class="
|
||||
{{ table.options.class ?: 'table' }}
|
||||
{{ table.options.sortable ? 'table--sortable' }}
|
||||
"
|
||||
{{ table.options.sortable ? 'data-sortable' }}
|
||||
{{ html_attributes(table.options.attributes) }}>
|
||||
|
||||
{{ view("streams::table/partials/header", {'table': table}) }}
|
||||
|
||||
{% block body %}
|
||||
<tbody>
|
||||
{% for row in table.rows %}
|
||||
<tr id="{{ loop.index }}" class="{{ row.class }}">
|
||||
|
||||
{% if table.options.sortable %}
|
||||
<td>
|
||||
{{ icon('fa fa-arrows handle') }}
|
||||
<input type="hidden" name="{{ row.table.options.prefix }}order[]" value="{{ row.key }}"/>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{% if not table.actions.empty() %}
|
||||
<td>
|
||||
<input type="checkbox" data-toggle="action" name="{{ row.table.options.prefix }}id[]" value="{{ row.key }}"/>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{% for column in row.columns %}
|
||||
<td data-title="{{ trans(column.heading) }}"
|
||||
class="{{ column.class }}" {{ html_attributes(column.attributes) }}>
|
||||
{{ (column.attributes.html) ? column.attributes.html|raw : column.value|raw }}
|
||||
</td>
|
||||
{% endfor %}
|
||||
|
||||
<td class="text-lg-right">
|
||||
<nobr>{{ buttons(row.buttons)|raw }}</nobr>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{{ view("streams::table/partials/footer", {'table': table}) }}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
{{ form_close() }}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
|
||||
{% block no_results %}
|
||||
<div class="card">
|
||||
<div class="card-block card-body">
|
||||
{{ trans(table.options.get('no_results_message', 'streams::message.no_results')) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<script>
|
||||
var advanced_update_url = "{{ url_route('visiosoft.module.advs::ajax_advanced_update') }}";
|
||||
</script>
|
||||
@ -19,6 +19,11 @@ class AdvTableBuilder extends TableBuilder
|
||||
'slug' => 'all',
|
||||
'text' => 'streams::view.all',
|
||||
],
|
||||
'advanced' => [
|
||||
'view' => All::class,
|
||||
'slug' => 'advanced',
|
||||
'text' => 'module::view.advanced',
|
||||
],
|
||||
'trash',
|
||||
'unfinished' => [
|
||||
'view' => unfinished::class
|
||||
@ -74,6 +79,7 @@ class AdvTableBuilder extends TableBuilder
|
||||
'order_by' => [
|
||||
'id' => 'DESC',
|
||||
],
|
||||
'table_view' => 'visiosoft.module.advs::admin/table/table'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -81,6 +87,10 @@ class AdvTableBuilder extends TableBuilder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $assets = [];
|
||||
protected $assets = [
|
||||
'scripts.js' => [
|
||||
'visiosoft.module.advs::js/admin/advanced.js'
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Table;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||
use Anomaly\Streams\Platform\Entry\EntryModel;
|
||||
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||
|
||||
class AdvTableColumns
|
||||
@ -8,11 +9,11 @@ class AdvTableColumns
|
||||
|
||||
public function handle(AdvTableBuilder $builder)
|
||||
{
|
||||
$builder->setColumns([
|
||||
$columns = [
|
||||
'cover_photo' => [
|
||||
'value' => function (EntryInterface $entry) {
|
||||
return "<img width='80px' src='" . $entry->AddAdsDefaultCoverImage($entry)->cover_photo . "' >";
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
'name' => [
|
||||
@ -59,7 +60,36 @@ class AdvTableColumns
|
||||
'created_by' => [
|
||||
'value' => 'entry.created_by.name',
|
||||
],
|
||||
]);
|
||||
];
|
||||
|
||||
if ($builder->isActiveView('advanced')) {
|
||||
|
||||
unset($columns['created_by'], $columns['country']);
|
||||
$columns['is_get_adv'] = [
|
||||
'attributes' => [
|
||||
'html' => function (EntryModel $entry) {
|
||||
$checked = ($entry->is_get_adv) ? 'checked' : '';
|
||||
return '<input style="min-width:120px" type="checkbox" class="form-control fast-update" ' . $checked . ' data-column="is_get_adv" data-entry_id="' . $entry->getId() . '">';
|
||||
}
|
||||
],
|
||||
'class' => 'advs-price',
|
||||
];
|
||||
$columns['standard_price'] = [
|
||||
'attributes' => [
|
||||
'html' => function (EntryModel $entry) {
|
||||
return '<input style="min-width:120px" type="number" min="0" class="form-control fast-update" value="' . $entry->standard_price . '" data-column="standard_price" data-entry_id="' . $entry->getId() . '">';
|
||||
}
|
||||
],
|
||||
'class' => 'advs-price',
|
||||
];
|
||||
$columns['price']['attributes'] = [
|
||||
'html' => function (EntryModel $entry) {
|
||||
return '<input style="min-width:120px" type="number" min="0" class="form-control fast-update" value="' . $entry->price . '" data-column="price" data-entry_id="' . $entry->getId() . '">';
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
$builder->setColumns($columns);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Table\Views;
|
||||
|
||||
use Anomaly\Streams\Platform\Ui\Table\Component\View\Query\AllQuery;
|
||||
use Anomaly\Streams\Platform\Ui\Table\Component\View\View;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class Advanced extends View
|
||||
{
|
||||
|
||||
protected $slug = 'advanced';
|
||||
|
||||
protected $text = 'visiosoft.module.advs::view.advanced';
|
||||
|
||||
protected $query = AllQuery::class;
|
||||
|
||||
public function onQuerying(Builder $query)
|
||||
{
|
||||
$query->where('slug', "");
|
||||
}
|
||||
|
||||
}
|
||||
@ -46,6 +46,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@assetsClear',
|
||||
],
|
||||
'admin/advs-users/choose/{advId}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@choose',
|
||||
'admin/advs/ajax/advanced/advanced-update' => [
|
||||
'as' => 'visiosoft.module.advs::ajax_advanced_update',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@advancedUpdate',
|
||||
],
|
||||
'admin/class/actions/{id}/{type}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@actions',
|
||||
|
||||
|
||||
|
||||
@ -204,4 +204,17 @@ class AdvsController extends AdminController
|
||||
{
|
||||
return Excel::download(new AdvsExport(), 'advs-' . time() . '.xlsx');
|
||||
}
|
||||
|
||||
public function advancedUpdate()
|
||||
{
|
||||
if ($this->request->has('advanced_column') and $this->request->has('advanced_entry_id') and $this->request->has('advanced_value')) {
|
||||
$entry_id = $this->request->get('advanced_entry_id');
|
||||
$column = $this->request->get('advanced_column');
|
||||
$value = $this->request->get('advanced_value');
|
||||
if ($entry = $this->advRepository->find($entry_id)) {
|
||||
$entry->setAttribute($column, $value);
|
||||
$entry->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,8 +11,12 @@ class EnableMaintenanceMode
|
||||
{
|
||||
$builder = $event->getBuilder();
|
||||
if (get_class($builder->getRepository()) === SettingFormRepository::class) {
|
||||
if ($builder->getFormValues()->has('maintenance') and $builder->getFormValues()->get('maintenance')) {
|
||||
Artisan::call('down');
|
||||
if ($builder->getFormValues()->has('maintenance')) {
|
||||
if ($builder->getFormValues()->get('maintenance')) {
|
||||
Artisan::call('down');
|
||||
} elseif (config('streams::maintenance.enabled')) {
|
||||
Artisan::call('up');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user