@extends('layouts.default')

@section('title')
@parent
Добавление новости для проекта {{ $project->name }}
@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@store', $project->id))) }}
		<h2>Добавление новости для проекта {{ $project->name }}</h2>

    <div class="form-group {{ ($errors->has('type')) ? 'has-error' : '' }}">
			{{ Form::label( 'type', 'Рубрика:', array('class' => 'control-label') ) }}
			{{ Form::select('type', ProjectNewsTypes::getAllTypes(), null, 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', null, array('class' => 'form-control', 'placeholder' => 'Название', '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', null, array('class' => 'form-control tinyEditor', 'placeholder' => 'Текст новости')) }}
			{{ ($errors->has('content') ? $errors->first('content') : '') }}
		</div>

		{{ 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
