mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Delete tags
This commit is contained in:
parent
21644ff4dd
commit
e232f2e223
@ -39,6 +39,37 @@ class TagController extends Controller
|
||||
View::share('tagOptions', $tagOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function delete(Tag $tag)
|
||||
{
|
||||
$subTitle = 'Delete "' . e($tag->tag) . '"';
|
||||
|
||||
// put previous url in session
|
||||
Session::put('tags.delete.url', URL::previous());
|
||||
|
||||
return view('tags.delete', compact('tag', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Tag $tag, TagRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
$tagName = $tag->tag;
|
||||
$repository->destroy($tag);
|
||||
|
||||
Session::flash('success', 'Tag "' . e($tagName) . '" was deleted.');
|
||||
|
||||
return Redirect::to(route('tags.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
@ -15,6 +15,18 @@ use Illuminate\Support\Collection;
|
||||
class TagRepository implements TagRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function destroy(Tag $tag)
|
||||
{
|
||||
$tag->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
@ -60,15 +72,17 @@ class TagRepository implements TagRepositoryInterface
|
||||
*
|
||||
* @return Tag
|
||||
*/
|
||||
public function update(Tag $tag, array $data) {
|
||||
$tag->tag = $data['tag'];
|
||||
$tag->date = $data['date'];
|
||||
public function update(Tag $tag, array $data)
|
||||
{
|
||||
$tag->tag = $data['tag'];
|
||||
$tag->date = $data['date'];
|
||||
$tag->description = $data['description'];
|
||||
$tag->latitude = $data['latitude'];
|
||||
$tag->longitude = $data['longitude'];
|
||||
$tag->zoomLevel = $data['zoomLevel'];
|
||||
$tag->tagMode = $data['tagMode'];
|
||||
$tag->latitude = $data['latitude'];
|
||||
$tag->longitude = $data['longitude'];
|
||||
$tag->zoomLevel = $data['zoomLevel'];
|
||||
$tag->tagMode = $data['tagMode'];
|
||||
$tag->save();
|
||||
|
||||
return $tag;
|
||||
}
|
||||
}
|
@ -31,4 +31,11 @@ interface TagRepositoryInterface {
|
||||
* @return Tag
|
||||
*/
|
||||
public function update(Tag $tag, array $data);
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function destroy(Tag $tag);
|
||||
}
|
44
resources/views/tags/delete.blade.php
Normal file
44
resources/views/tags/delete.blade.php
Normal file
@ -0,0 +1,44 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $tag) !!}
|
||||
{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('tags.destroy',$tag->id)]) !!}
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<div class="panel panel-red">
|
||||
<div class="panel-heading">
|
||||
Delete tag "{{{$tag->tag}}}"
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
Are you sure that you want to delete tag "{{{$tag->tag}}}"?
|
||||
</p>
|
||||
|
||||
@if($tag->transactionjournals()->count() > 0)
|
||||
<p class="text-info">
|
||||
Tag "{{{$tag->name}}}" still has {{$tag->transactionjournals()->count()}} transaction(s) connected
|
||||
to it. These will <strong>not</strong> be removed but will lose their connection to this tag.
|
||||
</p>
|
||||
@endif
|
||||
|
||||
<p>
|
||||
<button type="submit" class="btn btn-default btn-danger">Delete permanently</button>
|
||||
<a href="{{URL::previous()}}" class="btn-default btn">Cancel</a >
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-8">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{!! Form::close() !!}
|
||||
@stop
|
Loading…
Reference in New Issue
Block a user