Skip to content

Commit

Permalink
File picker
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed May 6, 2014
1 parent ff0d975 commit 2be937f
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function index()
$models = Paginator::make($data->items, $data->totalItems, $itemsPerPage);

if ($filepicker) {
return View::make('files.admin.filepicker')
$this->layout->content = View::make('files.admin.filepicker')
->withModels($models);
} else {
$this->layout->content = View::make('files.admin.index')
Expand Down
89 changes: 58 additions & 31 deletions app/TypiCMS/Modules/Files/Views/files/admin/filepicker.blade.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,72 @@
<!doctype html>
<html lang="fr">

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Choose file</title>

{{ HTML::style(asset('css/admin.css')) }}

@section('js')
{{ HTML::script(asset('js/list.js')) }}
<script>
function selectAndClose(image) {
var TinyMCEWindow = top.tinymce.activeEditor.windowManager;
TinyMCEWindow.getParams().oninsert(image);
TinyMCEWindow.close();
}
</script>
@stop

@section('bodyClass')
no-padding-top
@stop

@section('navbar')
@stop

@section('breadcrumbs')
@stop

@section('h1')
<span id="nb_elements">{{ $models->getTotal() }}</span> @choice('files::global.files', $models->getTotal())
@stop

</head>
@section('addButton')
<a id="uploaderAddButtonContainer" href="{{ route('admin.files.create') }}"><i id="uploaderAddButton" class="fa fa-plus-circle"></i><span class="sr-only">{{ ucfirst(trans('files::global.New')) }}</span></a>
@stop

<body style="padding-top:15px">
@section('main')

<div class="col-sm-12">
@if (count($models))
<div class="clearfix">
@foreach ($models as $key => $model)
<div class="thumbnail" onclick="selectAndClose('/{{ $model->path }}/{{ $model->filename }}')">
{{ $model->present()->thumb }}
<div class="caption">
<small>{{ $model->filename }}</small>
<div>{{ $model->alt_attribute }}</div>
</div>
<div class="list-form" lang="{{ Config::get('app.locale') }}">

@section('btn-locales')
@stop

@include('admin._buttons-list')

{{ Form::open(array('route' => 'admin.files.store', 'files' => true, 'class' => 'dropzone', 'id' => 'dropzone')) }}

@foreach (Config::get('app.locales') as $locale)
{{ Form::hidden($locale.'[status]', 1) }}
{{ Form::hidden($locale.'[description]') }}
{{ Form::hidden($locale.'[alt_attribute]', '') }}
{{ Form::hidden($locale.'[keywords]') }}
@endforeach

<div class="dropzone-previews clearfix sortable sortable-thumbnails">
@if (count($models))
@foreach ($models as $key => $model)
<div class="thumbnail" id="item_{{ $model->id }}">
{{ $model->present()->checkbox }}
{{ $model->present()->thumb }}
<div class="caption">
<a href="#" class="btn btn-default btn-xs btn-block btn-insert" onclick="selectAndClose('/{{ $model->path }}{{ $model->filename }}')">@lang('files::global.Insert')</a>
<small>{{ $model->filename }}</small>
</div>
</div>
@endforeach
@else
<p class="text-muted">@lang('global.No file')</p>
@endif
</div>
@endforeach
</div>
{{ $models->appends(Input::except('page'))->links() }}
@else
<p class="text-muted">@lang('global.No file')</p>
@endif
<div class="dz-message">@lang('files::global.Drop files to upload')</div>

{{ Form::close() }}

</div>

</body>
{{ $models->appends(Input::except('page'))->links() }}

</html>
@stop
1 change: 1 addition & 0 deletions app/TypiCMS/Modules/Files/lang/en/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
'Drop files to upload (or click)' => 'Drop files to upload (or click).',
'Drop files to upload' => 'Drop files to upload.',
'files_edit_info' => 'Files are manageable on each module interface',
'Insert' => 'Insert',
);
1 change: 1 addition & 0 deletions app/TypiCMS/Modules/Files/lang/fr/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
'Drop files to upload (or click)' => 'Cliquer ou glisser des fichiers pour les envoyer.',
'Drop files to upload' => 'Glisser des fichiers pour les envoyer.',
'files_edit_info' => 'L’ajout et la modification de fichiers se fait depuis les modules auquels sont rattachés les fichiers',
'Insert' => 'Insérer',
);
2 changes: 1 addition & 1 deletion public/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function initTinymce(selector) {
tinymce.activeEditor.windowManager.open({
title: 'Choose image',
url: '/admin/files?type=i&filepicker=1',
width: 832,
width: 835,
height: 550
}, {
oninsert: function(url) {
Expand Down

0 comments on commit 2be937f

Please sign in to comment.