@extends('layouts.default')

@section('title')
@parent
Редактирование новости
@stop

@section('js')
	<script src="{{ asset('js/tinymce/tinymce.min.js') }}"></script>
@stop

@section('content')
<div class="row">
	<div>
		{{ Form::open(array('action' => array('ProjectNewsController@update', $project->id, $projectNews->id), 'method' => 'put')) }}
		<h2>Редактирование новости №{{ $projectNews->id }}</h2>

		<div class="form-group {{ ($errors->has('type')) ? 'has-error' : '' }}">
			{{ Form::label( 'type', 'Рубрика:', array('class' => 'control-label') ) }}
			{{ Form::select('type', ProjectNewsTypes::getAllTypes(), $projectNews->type_id, array('class' => 'form-control')) }}
			{{ ($errors->has('type') ? $errors->first('type') : '') }}
		</div>
		<div class="form-group {{ ($errors->has('name')) ? 'has-error' : '' }}">
			{{ Form::label( 'name', 'Название:', array('class' => 'control-label') ) }}
			{{ Form::text('name', $projectNews->name, array('class' => 'form-control', 'autofocus')) }}
			{{ ($errors->has('name') ? $errors->first('name') : '') }}
		</div>
		<div class="form-group {{ ($errors->has('content')) ? 'has-error' : '' }}">
			{{ Form::label( 'content', 'Содержание:', array('class' => 'control-label') ) }}
			{{ Form::textarea('content', htmlspecialchars_decode($projectNews->content), array('class' => 'form-control tinyEditor')) }}
			{{ ($errors->has('content') ? $errors->first('content') : '') }}
		</div>

		{{ Form::hidden('id', $projectNews->id) }}
		{{ Form::submit('Сохранить изменения', array('class' => 'btn btn-primary')) }}
		{{ Form::button('Отмена', array('class' => 'btn btn-default', 'onclick'=>'location="'.URL::to('projects').'/'.$project->id.'/project_news"')) }}

    {{ Form::close() }}
	</div>
</div>
@stop