Merge pull request #598 from experty/L5
Use APC cache for Docker and fix bug with changing component sort order
This commit is contained in:
@@ -46,11 +46,9 @@ class ApiController extends AbstractController
|
||||
public function postUpdateComponentOrder()
|
||||
{
|
||||
$componentData = Binput::all();
|
||||
unset($componentData['component'][0]); // Remove random 0 index.
|
||||
|
||||
foreach ($componentData['component'] as $componentId => $order) {
|
||||
foreach ($componentData['ids'] as $order => $componentId) {
|
||||
$component = Component::find($componentId);
|
||||
$component->update(['order' => $order]);
|
||||
$component->update(['order' => $order + 1]); // Ordering should be 1-based, data comes in 0-based
|
||||
}
|
||||
|
||||
return $componentData;
|
||||
|
||||
@@ -18,6 +18,7 @@ env[DB_HOST] = $DB_HOST
|
||||
env[DB_DATABASE] = $DB_DATABASE
|
||||
env[DB_USERNAME] = $DB_USERNAME
|
||||
env[DB_PASSWORD] = $DB_PASSWORD
|
||||
env[CACHE_DRIVER] = apc
|
||||
|
||||
|
||||
[global]
|
||||
|
||||
14
public/build/dist/js/all-1ee9c181.js
vendored
14
public/build/dist/js/all-1ee9c181.js
vendored
File diff suppressed because one or more lines are too long
21
public/build/dist/js/all-73562b00.js
vendored
Normal file
21
public/build/dist/js/all-73562b00.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"dist/css/all.css": "dist/css/all-9e808a49.css",
|
||||
"dist/js/all.js": "dist/js/all-1ee9c181.js"
|
||||
"dist/js/all.js": "dist/js/all-73562b00.js"
|
||||
}
|
||||
@@ -133,19 +133,17 @@ $(function() {
|
||||
group: "omega",
|
||||
handle: ".drag-handle",
|
||||
onUpdate: function() {
|
||||
// Loop each component, setting the order input to the new order.
|
||||
var $components = $('#component-list .striped-list-item');
|
||||
$.each($components, function(id) {
|
||||
// Order should start from 1 now.
|
||||
$(this).find('input[rel=order]').val(id + 1);
|
||||
});
|
||||
|
||||
// Now POST the form to the internal API.
|
||||
var orderedComponentIds = $.map(
|
||||
$('#component-list .striped-list-item'),
|
||||
function(elem) {
|
||||
return $(elem).data('component-id');
|
||||
}
|
||||
);
|
||||
$.ajax({
|
||||
async: true,
|
||||
url: '/dashboard/api/components/order',
|
||||
type: 'POST',
|
||||
data: $('form[name=componentList]').serializeObject(),
|
||||
data: {ids: orderedComponentIds},
|
||||
success: function() {
|
||||
(new CachetHQ.Notifier()).notify('Components updated.', 'success');
|
||||
}
|
||||
|
||||
@@ -16,35 +16,32 @@
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<form name="componentList">
|
||||
<div class="col-sm-12 striped-list" id="component-list">
|
||||
@forelse($components as $component)
|
||||
<div class="row striped-list-item">
|
||||
<div class="col-xs-6">
|
||||
<h4>
|
||||
@if($components->count() > 1)
|
||||
<span class="drag-handle"><i class="ion-drag"></i></span>
|
||||
@endif
|
||||
{{ $component->name }} <small>{{ $component->humanStatus }}</small>
|
||||
</h4>
|
||||
@if($component->group)
|
||||
<p><small>{{ trans('dashboard.components.listed_group', ['name' => $component->group->name]) }}</small></p>
|
||||
<div class="col-sm-12 striped-list" id="component-list">
|
||||
@forelse($components as $component)
|
||||
<div class="row striped-list-item" data-component-id="{{ $component->id }}">
|
||||
<div class="col-xs-6">
|
||||
<h4>
|
||||
@if($components->count() > 1)
|
||||
<span class="drag-handle"><i class="ion-drag"></i></span>
|
||||
@endif
|
||||
@if($component->description)
|
||||
<p>{{ $component->description }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
<a href="/dashboard/components/{{ $component->id }}/edit" class="btn btn-default">{{ trans('forms.edit') }}</a>
|
||||
<a href="/dashboard/components/{{ $component->id }}/delete" class="btn btn-danger confirm-action" data-method="DELETE">{{ trans('forms.delete') }}</a>
|
||||
</div>
|
||||
<input type="hidden" rel="order" name="component[{{ $component->id }}]" value="{{ $component->order }}">
|
||||
{{ $component->name }} <small>{{ $component->humanStatus }}</small>
|
||||
</h4>
|
||||
@if($component->group)
|
||||
<p><small>{{ trans('dashboard.components.listed_group', ['name' => $component->group->name]) }}</small></p>
|
||||
@endif
|
||||
@if($component->description)
|
||||
<p>{{ $component->description }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
<a href="/dashboard/components/{{ $component->id }}/edit" class="btn btn-default">{{ trans('forms.edit') }}</a>
|
||||
<a href="/dashboard/components/{{ $component->id }}/delete" class="btn btn-danger confirm-action" data-method="DELETE">{{ trans('forms.delete') }}</a>
|
||||
</div>
|
||||
@empty
|
||||
<div class="list-group-item text-danger">{{ trans('dashboard.components.add.message') }}</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</form>
|
||||
@empty
|
||||
<div class="list-group-item text-danger">{{ trans('dashboard.components.add.message') }}</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user