Commit ed6680c8 authored by Nicolas Widart's avatar Nicolas Widart

Refactor for cleaner views and repository

parent 57ecb8a4
......@@ -17,8 +17,7 @@ class EloquentFileRepository extends EloquentBaseRepository implements FileRepos
*/
public function update($file, $data)
{
$translatableData = Helper::separateLanguages($data);
Helper::updateTranslated($file, $translatableData);
$file->update($data);
return $file;
}
......
......@@ -16,26 +16,13 @@
<div class="row">
<div class="col-md-8">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<?php $i = 0; ?>
<?php foreach(LaravelLocalization::getSupportedLocales() as $locale => $language): ?>
<?php $i++; ?>
<li class="{{ App::getLocale() == $locale ? 'active' : '' }}">
<a href="#tab_{{ $i }}" data-toggle="tab">{{ trans('core::core.tab.'. strtolower($language['name'])) }}</a>
</li>
<?php endforeach; ?>
</ul>
@include('core::partials.form-tab-headers')
<div class="tab-content">
<div class="row">
@include('flash::message')
</div>
<?php $i = 0; ?>
<?php foreach(LaravelLocalization::getSupportedLocales() as $locale => $language): ?>
<?php $i++; ?>
<div class="tab-pane {{ App::getLocale() == $locale ? 'active' : '' }}" id="tab_{{ $i }}">
@include('media::admin.partials.edit-fields', [
'lang' => $locale
])
@include('media::admin.partials.edit-fields', ['lang' => $locale])
</div>
<?php endforeach; ?>
<div class="box-footer">
......@@ -46,7 +33,7 @@
</div> {{-- end nav-tabs-custom --}}
</div>
<div class="col-md-4">
<img src="{{ $file->path }}" alt="{{ $file->translate()->alt_attribute }}" style="width: 100%;"/>
<img src="{{ $file->path }}" alt="" style="width: 100%;"/>
</div>
</div>
......
<div class='form-group{{ $errors->has("alt_attribute[{$lang}]") ? ' has-error' : '' }}'>
{!! Form::label("alt_attribute[{$lang}]", trans('media::media.form.alt_attribute')) !!}
{!! Form::text("alt_attribute[{$lang}]", Input::old("alt_attribute[{$lang}]", $file->translate($lang)->alt_attribute), ['class' => 'form-control', 'placeholder' => trans('media::media.form.alt_attribute')]) !!}
{!! $errors->first("alt_attribute[{$lang}]", '<span class="help-block">:message</span>') !!}
<?php $altAttribute = isset($file->translate($lang)->alt_attribute) ? $file->translate($lang)->alt_attribute : '' ?>
<div class='form-group{{ $errors->has("{$lang}[alt_attribute]") ? ' has-error' : '' }}'>
{!! Form::label("{$lang}[alt_attribute]", trans('media::media.form.alt_attribute')) !!}
{!! Form::text("{$lang}[alt_attribute]", Input::old("{$lang}[alt_attribute]", $altAttribute), ['class' => 'form-control', 'placeholder' => trans('media::media.form.alt_attribute')]) !!}
{!! $errors->first("{$lang}[alt_attribute]", '<span class="help-block">:message</span>') !!}
</div>
<div class='form-group{{ $errors->has("description[{$lang}]") ? ' has-error' : '' }}'>
{!! Form::label("description[{$lang}]", trans('media::media.form.description')) !!}
{!! Form::textarea("description[{$lang}]", Input::old("description[{$lang}]", $file->translate($lang)->description), ['class' => 'form-control', 'placeholder' => trans('media::media.form.description')]) !!}
{!! $errors->first("description[{$lang}]", '<span class="help-block">:message</span>') !!}
<?php $description = isset($file->translate($lang)->description) ? $file->translate($lang)->alt_attribute : '' ?>
<div class='form-group{{ $errors->has("{$lang}[description]") ? ' has-error' : '' }}'>
{!! Form::label("{$lang}[description]", trans('media::media.form.description')) !!}
{!! Form::textarea("{$lang}[description]", Input::old("{$lang}[description]", $description), ['class' => 'form-control', 'placeholder' => trans('media::media.form.description')]) !!}
{!! $errors->first("{$lang}[description]", '<span class="help-block">:message</span>') !!}
</div>
<div class='form-group{{ $errors->has("keywords[{$lang}]") ? ' has-error' : '' }}'>
{!! Form::label("keywords[{$lang}]", trans('media::media.form.keywords')) !!}
{!! Form::text("keywords[{$lang}]", Input::old("keywords[{$lang}]", $file->translate($lang)->keywords), ['class' => 'form-control', 'placeholder' => trans('media::media.form.keywords')]) !!}
{!! $errors->first("keywords[{$lang}]", '<span class="help-block">:message</span>') !!}
<?php $keywords = isset($file->translate($lang)->keywords) ? $file->translate($lang)->alt_attribute : '' ?>
<div class='form-group{{ $errors->has("{$lang}[keywords]") ? ' has-error' : '' }}'>
{!! Form::label("{$lang}[keywords]", trans('media::media.form.keywords')) !!}
{!! Form::text("{$lang}[keywords]", Input::old("{$lang}[keywords]", $keywords), ['class' => 'form-control', 'placeholder' => trans('media::media.form.keywords')]) !!}
{!! $errors->first("{$lang}[keywords]", '<span class="help-block">:message</span>') !!}
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment