Code cleanup.

This commit is contained in:
James Cole
2015-07-26 15:51:07 +02:00
parent 0e2419d61a
commit 17a8c4918c
30 changed files with 176 additions and 172 deletions

View File

@@ -124,7 +124,7 @@ class AttachmentController extends Controller
*/ */
public function preview(Attachment $attachment) public function preview(Attachment $attachment)
{ {
if($attachment->mime == 'application/pdf') { if ($attachment->mime == 'application/pdf') {
$file = public_path('images/page_white_acrobat.png'); $file = public_path('images/page_white_acrobat.png');
} else { } else {
$file = public_path('images/page_green.png'); $file = public_path('images/page_green.png');

View File

@@ -6,7 +6,6 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
use Preferences; use Preferences;
use Session;
use View; use View;
/** /**

View File

@@ -1,5 +1,6 @@
<?php namespace FireflyIII\Http\Controllers; <?php namespace FireflyIII\Http\Controllers;
use Artisan;
use Auth; use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Config; use Config;
@@ -11,7 +12,7 @@ use Preferences;
use Route; use Route;
use Session; use Session;
use Steam; use Steam;
use Artisan;
/** /**
* Class HomeController * Class HomeController
* *

View File

@@ -193,7 +193,6 @@ Route::group(
Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']); Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']);
/** /**
* Attachment Controller * Attachment Controller
*/ */

View File

@@ -12,6 +12,21 @@ use FireflyIII\Models\Attachment;
class AttachmentRepository implements AttachmentRepositoryInterface class AttachmentRepository implements AttachmentRepositoryInterface
{ {
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment)
{
/** @var \FireflyIII\Helpers\Attachments\AttachmentHelperInterface $helper */
$helper = app('FireflyIII\Helpers\Attachments\AttachmentHelperInterface');
$file = $helper->getAttachmentLocation($attachment);
unlink($file);
$attachment->delete();
}
/** /**
* @param Attachment $attachment * @param Attachment $attachment
* @param array $data * @param array $data
@@ -29,19 +44,4 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $attachment; return $attachment;
} }
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment)
{
/** @var \FireflyIII\Helpers\Attachments\AttachmentHelperInterface $helper */
$helper = app('FireflyIII\Helpers\Attachments\AttachmentHelperInterface');
$file = $helper->getAttachmentLocation($attachment);
unlink($file);
$attachment->delete();
}
} }

View File

@@ -12,6 +12,13 @@ use FireflyIII\Models\Attachment;
interface AttachmentRepositoryInterface interface AttachmentRepositoryInterface
{ {
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment);
/** /**
* @param Attachment $attachment * @param Attachment $attachment
* @param array $attachmentData * @param array $attachmentData
@@ -19,12 +26,5 @@ interface AttachmentRepositoryInterface
* @return Attachment * @return Attachment
*/ */
public function update(Attachment $attachment, array $attachmentData); public function update(Attachment $attachment, array $attachmentData);
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment);
} }

View File

@@ -49,7 +49,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* *
* @var array * @var array
*/ */
protected $fillable = ['email', 'password','blocked','blocked_code']; protected $fillable = ['email', 'password', 'blocked', 'blocked_code'];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
* *

View File

@@ -145,12 +145,12 @@ return [
'ExpandedForm' => [ 'ExpandedForm' => [
'is_safe' => [ 'is_safe' => [
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location', 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
'multiRadio','file','multiCheckbox','staticText' 'multiRadio', 'file', 'multiCheckbox', 'staticText'
] ]
], ],
'Form' => [ 'Form' => [
'is_safe' => [ 'is_safe' => [
'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea','file' 'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea', 'file'
] ]
], ],
], ],

View File

@@ -8,6 +8,16 @@ use Illuminate\Database\Schema\Blueprint;
*/ */
class ChangesForV349 extends Migration class ChangesForV349 extends Migration
{ {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
/** /**
* Run the migrations. * Run the migrations.
* *
@@ -22,14 +32,4 @@ class ChangesForV349 extends Migration
} }
); );
} }
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
} }

View File

@@ -8,6 +8,17 @@ use Illuminate\Database\Schema\Blueprint;
*/ */
class ChangesForV3410 extends Migration class ChangesForV3410 extends Migration
{ {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('attachments');
}
/** /**
* Run the migrations. * Run the migrations.
* *
@@ -42,16 +53,4 @@ class ChangesForV3410 extends Migration
} }
); );
} }
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('attachments');
}
} }

View File

@@ -30,9 +30,11 @@
{{ Lang.choice('form.also_delete_piggyBanks', account.piggyBanks|length, {count: account.piggyBanks|length}) }} {{ Lang.choice('form.also_delete_piggyBanks', account.piggyBanks|length, {count: account.piggyBanks|length}) }}
{% endif %} {% endif %}
</p> </p>
<p class="text-success"> <p class="text-success">
{{ 'save_transactions_by_moving'|_ }} {{ 'save_transactions_by_moving'|_ }}
</p> </p>
<p> <p>
{{ Form.select('move_account_before_delete', accountList, null, {class: 'form-control'}) }} {{ Form.select('move_account_before_delete', accountList, null, {class: 'form-control'}) }}
</p> </p>

View File

@@ -55,6 +55,5 @@
</div> </div>
</form> </form>
{% endblock %} {% endblock %}

View File

@@ -54,6 +54,7 @@
} }
} }
</script> </script>
</body> </body>

View File

@@ -1,12 +1,14 @@
<div class="popover" role="tooltip"> <div class="popover" role="tooltip">
<div class="arrow"></div> <div class="arrow"></div>
<h3 class="popover-title"></h3> <h3 class="popover-title"></h3>
<div class="popover-content"></div> <div class="popover-content"></div>
<div class="popover-navigation"> <div class="popover-navigation">
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-sm btn-default" data-role="prev">&laquo; {{ 'prev'|_ }}</button> <button class="btn btn-sm btn-default" data-role="prev">&laquo; {{ 'prev'|_ }}</button>
<button class="btn btn-sm btn-default" data-role="next">{{ 'prev'|_ }} &raquo;</button> <button class="btn btn-sm btn-default" data-role="next">{{ 'prev'|_ }} &raquo;</button>
<button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="{{ 'pause'|_ }}" data-resume-text="Resume"> {{ 'pause'|_ }}</button> <button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="{{ 'pause'|_ }}"
data-resume-text="Resume"> {{ 'pause'|_ }}</button>
</div> </div>
<button class="btn btn-sm btn-default" data-role="end">{{ 'end-tour'|_ }}</button> <button class="btn btn-sm btn-default" data-role="end">{{ 'end-tour'|_ }}</button>
</div> </div>

View File

@@ -53,7 +53,8 @@
<td> <td>
<a href="{{ route('transactions.show',journal.id) }}" title="{{ journal.description }}">{{ journal.description }}</a> <a href="{{ route('transactions.show',journal.id) }}" title="{{ journal.description }}">{{ journal.description }}</a>
{% if journal.attachments|length > 0 %} {% if journal.attachments|length > 0 %}
<i class="fa fa-paperclip pull-right" title="{{ Lang.choice('firefly.nr_of_attachments', journal.attachments|length, {count: journal.attachments|length}) }}"></i> <i class="fa fa-paperclip pull-right"
title="{{ Lang.choice('firefly.nr_of_attachments', journal.attachments|length, {count: journal.attachments|length}) }}"></i>
{% endif %} {% endif %}
</td> </td>

View File

@@ -16,6 +16,7 @@
<p class="text-danger"> <p class="text-danger">
{{ trans('form.permDeleteWarning') }} {{ trans('form.permDeleteWarning') }}
</p> </p>
<p> <p>
{{ trans('form.tag_areYouSure', {'tag': tag.tag}) }} {{ trans('form.tag_areYouSure', {'tag': tag.tag}) }}
</p> </p>

View File

@@ -21,7 +21,7 @@
</p> </p>
<p> <p>
{{'tags_group'|_ }} {{ 'tags_group'|_ }}
</p> </p>
<p> <p>