Skip to content

Instantly share code, notes, and snippets.

Created May 31, 2012 16:30
Show Gist options
  • Save anonymous/2844588 to your computer and use it in GitHub Desktop.
Save anonymous/2844588 to your computer and use it in GitHub Desktop.
<?php echo Form::open(array('class' => 'form-horizontal')); ?>
<div class="row">
<div class="span12">
<h1>Apartments</h1>
<hr />
<?php if (Session::get_flash('success')): ?>
<div class="alert-message success">
<p>
<?php echo implode('', (array) Session::get_flash('success')); ?>
</p>
</div>
<?php endif; ?>
<?php if (Session::get_flash('error')): ?>
<div class="alert-message error">
<?php echo implode('', (array) Session::get_flash('error')); ?>
</div>
<?php endif; ?>
</div>
</div>
<div class="row">
<div class="span12">
<ul id="apartment_menu" class="nav nav-tabs">
<li class="active">
<a href="#basic" data-toggle="tab">Basic Information</a>
</li>
<li>
<a href="#photos" data-toggle="tab">Photos</a>
</li>
<li>
<a href="#bedrooms" data-toggle="tab">Bedrooms</a>
</li>
<li>
<a href="#amenities" data-toggle="tab">Amenities</a>
</li>
<li>
<a href="#charges" data-toggle="tab">Charges</a>
</li>
</ul>
</div>
</div>
<div class="row tab-content">
<div id="basic" class="tab-pane active">
<fieldset class="span12">
<legend>Basic Information</legend>
<div class="control-group <?php if(isset($val) and ! isset($val['name'])) echo 'error' ?>">
<?php echo Form::label('Apartment Name', 'name', array('class' => 'control-label')); ?>
<div class="controls">
<?php echo Form::input('name', Input::post('name', isset($apartment) ? $apartment->name : '')); ?>
</div>
</div>
<div class="control-group <?php if(isset($val) and ! isset($val['content'])) echo 'error' ?>">
<?php echo Form::label('Description', 'content', array('class' => 'control-label')); ?>
<div class="controls">
<?php echo Form::textarea('content', Input::post('content', isset($apartment) ? $apartment->content : ''), array('rows' => '10', 'class' => 'span9')); ?>
</div>
</div>
<div class="control-group">
<?php echo Form::label('Active', 'active', array('class' => 'control-label')); ?>
<div class="controls">
<label class="checkbox inline">
<?php
$checked = true;
if(Input::method() == 'POST' and Input::post('active') == null) $checked = false;
if(isset($apartment) and $apartment->active == false) $checked = false;
echo Form::checkbox('active', 'active', ($checked) ? array('checked') : array());;
?>
Un check this if you don't want the apartment to appear on the site yet.
</label>
</div>
</div>
<div class="control-group <?php if(isset($val) and ! isset($val['location'])) echo 'error' ?>">
<?php echo Form::label('Location', null, array('class' => 'control-label')); ?>
<div class="controls">
<?php echo Html::anchor('#location_modal', 'Set location',
array('data-toggle' => 'modal', 'class' => (isset($val) and ! isset($val['location'])) ? 'btn btn-small btn-danger' : 'btn btn-small')); ?>
</div>
<br />
<div id="location" class="controls <?php echo (Input::post('location.code') or isset($apartment)) ? '' : 'hide'; ?>">
<div class="alert alert-info">
<a class="close" data-dismiss="alert" href="#">×</a>
<strong>Incorrect location?</strong> To customise the apartment location drag-and-drop the blue marker in the correct point on the map.
</div>
<div id="location_map">&nbsp;</div>
<div id="location_details" class="well">
<div class="control-group">
<?php echo Form::label('Address', 'location[add1]'); ?>
<span class="add1 input-xlarge uneditable-input">
<?php echo Input::post('location.add1', isset($apartment) ? $apartment->location->add1 : ''); ?>
</span>
<?php echo Form::hidden('location[add1]', Input::post('location.add1', isset($apartment) ? $apartment->location->add1 : null)); ?>
</div>
<div class="control-group <?php echo (Input::post('location.add2') or !isset($apartment->location->add2)) ? '' : 'hide' ?>">
<span class="add2 input-xlarge uneditable-input">
<?php echo Input::post('location.add2', isset($apartment) ? $apartment->location->add2 : ''); ?>
</span>
<?php echo Form::hidden('location[add2]', Input::post('location.add2', isset($apartment) ? $apartment->location->add2 : null)); ?>
</div>
<div class="control-group">
<?php echo Form::label('City / Town', 'location[city]'); ?>
<span class="city input-xlarge uneditable-input">
<?php echo Input::post('location.city', isset($apartment) ? $apartment->location->city : ''); ?>
</span>
<?php echo Form::hidden('location[city]', Input::post('location.city', isset($apartment) ? $apartment->location->city : null)); ?>
</div>
<div class="control-group">
<?php echo Form::label('Postal / Zip Code', 'location[code]'); ?>
<span class="code input-xlarge uneditable-input">
<?php echo Input::post('location.code', isset($apartment) ? $apartment->location->code : ''); ?>
</span>
<?php echo Form::hidden('location[code]', Input::post('location.code', isset($apartment) ? $apartment->location->code : null)); ?>
</div>
<?php echo Form::hidden('location[country]',
Input::post('location.country', isset($apartment) ? $apartment->location->country : $website['country'])); ?>
<?php echo Form::hidden('location[lat]', Input::post('location.lat', isset($apartment) ? $apartment->location->lat : 48.8566)); ?>
<?php echo Form::hidden('location[lng]', Input::post('location.lng', isset($apartment) ? $apartment->location->lng : 2.3522)); ?>
</div>
</div>
</div>
</fieldset>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment