Permalink
Browse files

Style updates to admin theme, updated html table builder to work with…

… new styles.
  • Loading branch information...
1 parent 8b7f5f3 commit bf03ac9bd117a41c61cd1fe17275db54c024c3d1 @geekforbrains committed Feb 24, 2012
Showing with 121 additions and 20 deletions.
  1. +1 −1 core/admin/controllers/admin.php
  2. +80 −11 core/admin/views/css/main.css
  3. +14 −0 core/admin/views/index.php
  4. +13 −6 core/html/html_form.php
  5. +13 −2 core/html/html_table.php
@@ -16,7 +16,7 @@ public static function dashboard()
{
return array(
'title' => 'Dashboard',
- 'content' => '<em>TODO</em>'
+ 'content' => '<p>Dashboard is under development.</p>'
);
}
@@ -101,6 +101,28 @@ a:hover {
display: none;
}
+.messages {
+ margin-top: 18px;
+}
+
+.messages p {
+ font-size: 14px;
+ padding: 10px;
+ margin-top: 2px;
+}
+
+.messages p.ok {
+ background-color: #E7FFCC;
+ color: #294D00;
+ border: 1px solid #C6ECC6;
+}
+
+.messages p.error {
+ background-color: #FFE5E5;
+ border: 1px solid #FFCCCC;
+ color: #660000;
+}
+
.content h1,
.content h2 {
font-weight: bold;
@@ -114,6 +136,12 @@ a:hover {
border-bottom: 4px solid #565656;
}
+.content p {
+ margin-top: 15px;
+ font-size: 14px;
+ line-height: 20px;
+}
+
.spacer {
margin-top: 30px;
}
@@ -160,10 +188,11 @@ table {
}
table tr th {
- background-color: #DBDBDB;
+ background-color: #E8E8E8;
font-weight: bold;
}
+table tr th,
table tr td {
border-bottom: 1px solid #CECECE;
}
@@ -193,7 +222,7 @@ form label {
}
form ul {
- margin-top: 10px;
+ margin-top: 15px;
}
form ul li {
@@ -203,21 +232,14 @@ form ul li {
.text input,
.select select,
-.textarea textarea,
-.topright input,
-.topright select {
+.textarea textarea {
font-size: 12px;
font-family: arial, sans-serif;
padding: 5px;
margin: 0;
border: 1px solid #b3b3b3;
}
-.topright input,
-.topright select {
- width: 150px;
-}
-
form .text input,
form .text.small input {width: 40%}
form .text.mini input {width: 60px}
@@ -250,6 +272,52 @@ form .buttons {
padding-top: 10px;
}
+form div.error {
+ padding: 7px 0 5px 0;
+}
+
+form .textarea div.error {
+ padding-top: 4px;
+}
+
+form div.error span {
+ padding: 5px;
+ background-color: #FFE5E5;
+ border: 1px solid #FFCCCC;
+ color: #660000;
+}
+
+.topright ul,
+.topright ul li {
+ margin: 0;
+ padding: 0;
+}
+
+.topright ul li {
+ margin-right: 5px;
+}
+
+.topright ul li,
+.topright ul li label {
+ float: left;
+}
+
+.topright ul li label {
+ padding-top: 6px;
+ margin-right: 5px;
+}
+
+.topright .text input,
+.topright .select select {
+ width: 150px;
+}
+
+.topright .submit,
+.topright .buttons {
+ margin: 0;
+ padding-top: 6px;
+}
+
.btn,
.btn:link,
.btn:visited {
@@ -258,7 +326,8 @@ form .buttons {
color: #ffffff;
}
-.btn.mini {
+.btn.mini,
+.topright .btn {
padding: 6px 8px;
font-weight: normal;
}
@@ -17,6 +17,13 @@
<?php foreach($adminContent as $content): ?>
<div class="grid_12 spacer">
<h1><?php echo $content['title']; ?></h1>
+
+ <?php if(isset($content['topright'])): ?>
+ <div class="topright">
+ <?php echo $content['topright']; ?>
+ </div>
+ <?php endif; ?>
+
<?php echo $content['content']; ?>
</div>
<?php endforeach; ?>
@@ -25,6 +32,13 @@
<div class="grid_12 spacer">
<h2><?php echo $adminContent['title']; ?></h2>
+
+ <?php if(isset($adminContent['topright'])): ?>
+ <div class="topright">
+ <?php echo $adminContent['topright']; ?>
+ </div>
+ <?php endif; ?>
+
<?php echo $adminContent['content']; ?>
</div>
@@ -87,11 +87,11 @@ public function validate()
public function build($fieldsets, $action = null, $method = 'post', $enctype = false)
{
$formId = md5(uniqid()); // Used to determine form being posted when validating feilds
- $shortFormId = substr($formId, 0, 6); // Used to set the id/name on the form tag
+ $formName = preg_replace('/[0-9]+/', '', $formId); // Used to set the id/name of the form tag
$formData = array();
$html = Html::form()->open($action, $method, $enctype,
- array('id' => $shortFormId, 'name' => $shortFormId));
+ array('id' => $formName, 'name' => $formName));
// Insert form id as hidden field
$html .= '<input type="hidden" name="form_id" value="' . $formId . '" />';
@@ -118,7 +118,7 @@ public function build($fieldsets, $action = null, $method = 'post', $enctype = f
$formData[$fieldName] = $fieldData;
// Add form id for buttons
- $fieldData['form_id'] = $shortFormId;
+ $fieldData['form_name'] = $formName;
/*
$html .= '<p';
@@ -152,7 +152,7 @@ public function build($fieldsets, $action = null, $method = 'post', $enctype = f
}
$html .= '>';
- if(isset($fieldData['title']))
+ if(isset($fieldData['title']) && !is_null($fieldData['title']))
$html .= '<label>' . $fieldData['title'] . '</label>';
$html .= call_user_func(array('self', '_' . $fieldData['type']), $fieldName, $fieldData);
@@ -326,8 +326,15 @@ private static function _file($name, $data)
* - default_value: The default value to give the field
* - attributes: An array of key value pairs for attributes (ex: array('class' => 'my_class'))
*/
- private static function _submit($name, $data) {
- return sprintf('<input%s type="submit" name="%s" value="%s" />', self::_attributes($data), $name, $data['value']);
+ private static function _submit($name, $data)
+ {
+ //return sprintf('<input%s type="submit" name="%s" value="%s" />', self::_attributes($data), $name, $data['value']);
+
+ $html = sprintf('<input type="hidden" name="%s" value="true" />', $name); // So we can track which button was clicked
+ $html .= sprintf('<a class="btn blue" href="javascript:document.%s.submit(); return false;">%s</a>',
+ $data['form_name'], $data['value']);
+
+ return $html;
}
// TODO
@@ -64,6 +64,7 @@ public function addHeader($attributes = array())
{
$this->_pointer =& $this->_headerHtml;
$this->_tag = 'th';
+
$this->_tr($attributes);
return $this;
}
@@ -78,12 +79,22 @@ public function addRow($attributes = array())
public function addCol($content, $attributes = array())
{
- $this->_pointer .= sprintf('<%s', $this->_tag);
+ // Allow different tags to be set in header (ex: td)
+ $tag = $this->_tag;
+ if(isset($attributes['tag']))
+ {
+ $tag = $attributes['tag'];
+ unset($attributes['tag']);
+ }
+
+ $this->_pointer .= sprintf('<%s', $tag);
if($attributes)
$this->_addAttr($attributes);
- $this->_pointer .= sprintf('>%s</%s>', $content, $this->_tag);
+ $this->_pointer .= sprintf('>%s</%s>', $content, $tag);
+
+ return $this;
}
public function render()

0 comments on commit bf03ac9

Please sign in to comment.