Skip to content

Commit

Permalink
formulario para postagem criado
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiancarlos committed May 10, 2012
1 parent fff9594 commit 7756925
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
6 changes: 3 additions & 3 deletions application/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@
// 'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
// 'database' => MODPATH.'database', // Database access
'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
// 'orm' => MODPATH.'orm', // Object Relationship Mapping
'orm' => MODPATH.'orm', // Object Relationship Mapping
// 'unittest' => MODPATH.'unittest', // Unit testing
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
'userguide' => MODPATH.'userguide', // User guide and API documentation
));

/**
Expand Down
15 changes: 15 additions & 0 deletions application/classes/controller/postagens.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@ class Controller_Postagens extends Controller_ApplicationBlog {

public function action_index(){



$content = View::factory('site/postagens/page');

$this->template->content = $content;
}

public function action_novo(){

$action = $this->request->action();

$post = array();

$content = View::factory('site/postagens/novo')
->bind('action', $action)
->bind('post', $post);

$this->template->content = $content;

}

}
37 changes: 37 additions & 0 deletions application/views/site/postagens/novo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

<div id="postagens">

<h2>CRUD Posts</h2>

<?php $action = ($action == 'novo') ? 'NOVO POST' : 'EDITAR POST'; ?>

<p>=== <b> <?php echo $action; ?> </b> ===</p>

<?php echo Form::open(); ?>

<div class="block">
<?php $titulo = isset($post['titulo']) ? $post['titulo'] : ''; ?>
<?php echo Form::label('titulo', 'Titulo', array('title' => 'Titulo')); ?>:<br />
<?php echo Form::input('titulo', $titulo, array('id' => 'titulo', 'size' => '60')); ?>
</div>

<div class="block">
<?php $chamada = isset($post['chamada']) ? $post['chamada'] : ''; ?>
<?php echo Form::label('chamada', 'Chamada', array('title' => 'Chamada')); ?>:<br />
<?php echo Form::textarea('chamada', $chamada, array('id' => 'chamada' , 'rows' => 5, 'cols' => '60' )); ?>
</div>

<div class="block">
<?php $texto = isset($post['texto']) ? $post['texto'] : ''; ?>
<?php echo Form::label('texto', 'Texto', array('title' => 'Texto')); ?>:<br />
<?php echo Form::textarea('texto', $texto, array('id' => 'texto' , 'rows' => 12, 'cols' => '60' )); ?>
</div>

<br class="clear" />

<?php echo Form::submit('salvar', 'Salvar', array('id' => 'salvar')); ?>
<?php echo Form::submit('cancelar', 'Cancelar', array('id' => 'cancelar')); ?>

<?php echo Form::close(); ?>
</div>

2 changes: 1 addition & 1 deletion application/views/site/postagens/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<h2>CRUD Posts</h2>

<p>=========================== Listar posts ============================</p>
<p>=============================== Listar ================================</p>

<table cellspacing="0" cellpadding="0">
<thead><th>nº</th> <th>titulo</th> <th>cadastro</th> <th>ações</th></thead>
Expand Down
8 changes: 8 additions & 0 deletions media/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ select:focus { outline: none; }

/*==posts==*/

#listar_posts { margin-bottom: 40px; }

#listar_posts dl.post{ display: block; color: #555; border-bottom:1px solid #ccc; margin-bottom: 8px; }

#listar_posts dl.post dt{ font-size: 26px; line-height:28px; }
Expand All @@ -114,6 +116,8 @@ select:focus { outline: none; }

/*==POSTAGENS==*/

#postagens { margin-bottom: 40px; }

#postagens p{ margin: 10px 0px; }

#postagens table{ width:500px; }
Expand All @@ -122,3 +126,7 @@ select:focus { outline: none; }

#postagens .paginacao { font-size: 22px; text-align: center; margin: 20px; }

#postagens input[type="text"]{ font-size: 15px; padding: 4px 2px; }
#postagens textarea{ font-size: 15px; padding: 4px 2px; }
#postagens input[type="submit"]{ font-size: 15px; padding: 6px 6px; }

0 comments on commit 7756925

Please sign in to comment.