CSS tweaks, fix WYSIWYG centering

This commit is contained in:
Timothy Warren 2012-09-13 23:16:51 +00:00
parent 932de6853f
commit 6318917d59
14 changed files with 193 additions and 157 deletions

View File

@ -280,27 +280,6 @@ class data_model extends \miniMVC\Model {
// ! Data Retrieval // ! Data Retrieval
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Get the id of the last item of the type
*
* @param string $type
* @return int
*/
public function get_last_id($type)
{
$query = $this->db->select('id')
->from($type)
->order_by('id', 'DESC')
->limit(1)
->get();
$r = $query->fetch(\PDO::FETCH_ASSOC);
return $r['id'];
}
// --------------------------------------------------------------------------
/** /**
* Get breadcrumb data for section * Get breadcrumb data for section
* *
@ -364,26 +343,6 @@ class data_model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Gets the name of the category from its id
*
* @param int
* @return string
*/
public function get_category_by_id($id)
{
$query = $this->db->select('category')
->from('category')
->where('id', (int) $id)
->get();
$row = $query->fetch(\PDO::FETCH_ASSOC);
return $row['category'];
}
// --------------------------------------------------------------------------
/** /**
* Get the genre name by category id * Get the genre name by category id
* *
@ -405,46 +364,6 @@ class data_model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Gets the name of the section from its id
*
* @param int
* @return string
*/
public function get_section_by_id($id)
{
$query = $this->db->select('section')
->from('section')
->where('id', (int) $id)
->get();
$row = $query->fetch(\PDO::FETCH_ASSOC);
return $row['section'];
}
// --------------------------------------------------------------------------
/**
* Gets the data for the specified id
*
* @param int $id
* @return array
*/
public function get_data_by_id($id)
{
$query = $this->db->select('key, value')
->from('data')
->where('id', (int) $id)
->get();
$row = $query->fetch(\PDO::FETCH_ASSOC);
return $row;
}
// --------------------------------------------------------------------------
/** /**
* Get the categories for the specified genre * Get the categories for the specified genre
* *
@ -470,6 +389,26 @@ class data_model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Gets the name of the category from its id
*
* @param int
* @return string
*/
public function get_category_by_id($id)
{
$query = $this->db->select('category')
->from('category')
->where('id', (int) $id)
->get();
$row = $query->fetch(\PDO::FETCH_ASSOC);
return $row['category'];
}
// --------------------------------------------------------------------------
/** /**
* Get the sections for the specified category id * Get the sections for the specified category id
* *
@ -496,7 +435,27 @@ class data_model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Get the data fro the section * Gets the name of the section from its id
*
* @param int
* @return string
*/
public function get_section_by_id($id)
{
$query = $this->db->select('section')
->from('section')
->where('id', (int) $id)
->get();
$row = $query->fetch(\PDO::FETCH_ASSOC);
return $row['section'];
}
// --------------------------------------------------------------------------
/**
* Get the data from the section
* *
* @param int * @param int
* @return array * @return array
@ -520,6 +479,26 @@ class data_model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Gets the data for the specified id
*
* @param int $id
* @return array
*/
public function get_data_by_id($id)
{
$query = $this->db->select('key, value')
->from('data')
->where('id', (int) $id)
->get();
$row = $query->fetch(\PDO::FETCH_ASSOC);
return $row;
}
// --------------------------------------------------------------------------
/** /**
* Get sections and data for a general data outline * Get sections and data for a general data outline
* *
@ -551,7 +530,7 @@ class data_model extends \miniMVC\Model {
while($row = $d_query->fetch(\PDO::FETCH_ASSOC)) while($row = $d_query->fetch(\PDO::FETCH_ASSOC))
{ {
$d_array[$row['section_id']][$row['key']] = $row['value']; $d_array[$row['section_id']][$row['id']] = array($row['key'] => $row['value']);
} }
} }
@ -658,6 +637,29 @@ class data_model extends \miniMVC\Model {
return in_array(strtolower($str), $valid); return in_array(strtolower($str), $valid);
} }
// --------------------------------------------------------------------------
/**
* Get the id of the last item of the type
*
* @param string $type
* @return int
*/
public function get_last_id($type)
{
$query = $this->db->select('id')
->from($type)
->order_by('id', 'DESC')
->limit(1)
->get();
$r = $query->fetch(\PDO::FETCH_ASSOC);
return $r['id'];
}
// --------------------------------------------------------------------------
} }
// End of data_model.php // End of data_model.php

View File

@ -1,10 +1,8 @@
<h2><?= $category ?></h2>
<p class="breadcrumbs"> <p class="breadcrumbs">
<a href="<?= miniMVC\site_url('') ?>">Genres</a> > <a href="<?= miniMVC\site_url('genres/detail/'.$genre['id']) ?>"><?= $genre['genre'] ?></a> > <?= $category ?> <a href="<?= miniMVC\site_url('') ?>">Genres</a> > <a href="<?= miniMVC\site_url('genres/detail/'.$genre['id']) ?>"><?= $genre['genre'] ?></a> > <?= $category ?>
</p> </p>
<form action="<?= miniMVC\site_url("category/add_section") ?>" method="post"> <form class="add" action="<?= miniMVC\site_url("category/add_section") ?>" method="post">
<fieldset> <fieldset>
<legend>Add Section</legend> <legend>Add Section</legend>
<dl> <dl>
@ -17,7 +15,8 @@
</dl> </dl>
</fieldset> </fieldset>
</form> </form>
<script src="<?= SCRIPT_PATH.'wysiwyg'; ?>"></script>
<h3>Sections</h3>
<ul class="list"> <ul class="list">
<?php foreach($sections as $id => $section): ?> <?php foreach($sections as $id => $section): ?>
<?php if (is_array($section)) list($section, $d) = $section ?> <?php if (is_array($section)) list($section, $d) = $section ?>
@ -30,17 +29,19 @@
<?php if ( ! empty($d)): ?> <?php if ( ! empty($d)): ?>
<?php foreach($d as $k => $v): ?> <?php foreach($d as $did => $dd): ?>
<?php foreach($dd as $k => $v): ?>
<?php $class = (strpos($v, "<br />") !== FALSE) ? 'multiline' : 'pair' ?> <?php $class = (strpos($v, "<br />") !== FALSE) ? 'multiline' : 'pair' ?>
<dl class="<?= $class ?>"> <dl class="<?= $class ?>">
<dt> <dt><?= $k ?></dt>
<?= $k ?> <dd>
</dt> <?= $v ?>
<dd><?= $v ?></dd> </dd>
</dl> </dl>
<?php endforeach ?> <?php endforeach ?>
<?php endforeach ?>
<?php endif ?> <?php endif ?>

View File

@ -1,10 +1,8 @@
<h2><?= $genre ?></h2>
<p class="breadcrumbs"> <p class="breadcrumbs">
<a href="<?= miniMVC\site_url('') ?>">Genres</a> > <?= $genre ?> <a href="<?= miniMVC\site_url('') ?>">Genres</a> > <?= $genre ?>
</p> </p>
<form action="<?= miniMVC\site_url("genre/add_category") ?>" method="post"> <form class="add" action="<?= miniMVC\site_url("genre/add_category") ?>" method="post">
<fieldset> <fieldset>
<legend>Add Category</legend> <legend>Add Category</legend>
<dl> <dl>
@ -17,15 +15,27 @@
</dl> </dl>
</fieldset> </fieldset>
</form> </form>
<h3>Categories</h3>
<ul> <ul class="list">
<?php foreach($categories as $id => $cat): ?> <?php foreach($categories as $id => $cat): ?>
<li> <li>
<a href="<?= miniMVC\site_url("category/detail/{$id}") ?>"><?= $cat ?></a> <a href="<?= miniMVC\site_url("category/{$id}") ?>"><?= $cat ?></a>
<span class="modify" id="category_<?=$id ?>"> <span class="modify" id="category_<?=$id ?>">
<button class="edit">Edit</button> <button class="edit">Edit</button>
<button class="delete">Delete</button> <button class="delete">Delete</button>
</span> </span>
<ul>
<?php /* $sarray = $this->data_model->get_sections($id); ?>
<?php foreach($sarray as $sid => $section): ?>
<li>
<a href="<?= miniMVC\site_url("section/{$sid}") ?>"><?= $section ?></a>
<span class="modify" id="section_<?=$id ?>">
<button class="edit">Edit</button>
<button class="delete">Delete</button>
</span>
</li>
<?php endforeach */ ?>
</ul>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>

View File

@ -1,6 +1,6 @@
<h2>Genres</h2> <p class="breadcrumbs">Genres</p>
<form action="<?= miniMVC\site_url("genre/add") ?>" method="post"> <form class="add" action="<?= miniMVC\site_url("genre/add") ?>" method="post">
<fieldset> <fieldset>
<legend>Add Genre</legend> <legend>Add Genre</legend>
<dl> <dl>
@ -14,7 +14,8 @@
</fieldset> </fieldset>
</form> </form>
<ul> <h3>Genres</h3>
<ul class="list">
<?php foreach($genres as $id => $name): ?> <?php foreach($genres as $id => $name): ?>
<li> <li>
<a href="<?= miniMVC\site_url("genre/{$id}") ?>"> <a href="<?= miniMVC\site_url("genre/{$id}") ?>">

View File

@ -1,4 +1,4 @@
<h2>Outline</h2> <p class="breadcrumbs">Outline</p>
<dl class="outline"> <dl class="outline">
<dt>Genre</dt> <dt>Genre</dt>

View File

@ -1,5 +1,3 @@
<h2><?= $section ?></h2>
<p class="breadcrumbs"> <p class="breadcrumbs">
<a href="<?= miniMVC\site_url('') ?>">Genres</a> > <a href="<?= miniMVC\site_url('') ?>">Genres</a> >
<a href="<?= miniMVC\site_url('genres/detail/'.$p['genre_id']) ?>"><?= $p['genre'] ?></a> > <a href="<?= miniMVC\site_url('genres/detail/'.$p['genre_id']) ?>"><?= $p['genre'] ?></a> >
@ -7,7 +5,7 @@
<?= $section ?> <?= $section ?>
</p> </p>
<form action="<?= miniMVC\site_url("section/add_data") ?>" method="post"> <form class="add" action="<?= miniMVC\site_url("section/add_data") ?>" method="post">
<fieldset> <fieldset>
<legend>Add Data</legend> <legend>Add Data</legend>
<dl> <dl>
@ -54,7 +52,7 @@ document.querySelector('form').onsubmit = function(e) {
window.editor.toggle(); window.editor.toggle();
}; };
</script> </script>
<h3>Data</h3>
<?php if ( ! empty($sdata)): ?> <?php if ( ! empty($sdata)): ?>
<?php foreach($sdata as $d_id => $d): ?> <?php foreach($sdata as $d_id => $d): ?>

View File

@ -1,5 +1,4 @@
<div id="overlay_bg"></div> <?php $this->load_view('theme_footer'); ?>
<div id="overlay"></div>
<?php if ($foot_js != ""): ?> <?php if ($foot_js != ""): ?>
<?= $foot_js ?> <?= $foot_js ?>
<?php endif ?> <?php endif ?>

View File

@ -9,9 +9,4 @@
<?= $head_js ?> <?= $head_js ?>
</head> </head>
<body<?= (!empty($body_class)) ? "class=\"" . $body_class . "\"" : ""; ?><?= (!empty($body_id)) ? " id=\"" . $body_id . "\"" : ""; ?>> <body<?= (!empty($body_class)) ? "class=\"" . $body_class . "\"" : ""; ?><?= (!empty($body_id)) ? " id=\"" . $body_id . "\"" : ""; ?>>
<script type="text/javascript"> <?php $this->load_view('theme_header'); ?>
var APP_URL = '<?= \miniMVC\site_url(); ?>';
var ASSET_URL = APP_URL.replace('index.php/', '') + 'assets/';
</script>
<h1><a href="<?= miniMVC\site_url('') ?>">Meta</a></h1>
[<a href="<?= miniMVC\site_url('outline')?>">Data Outline</a>]<br />

View File

@ -0,0 +1,2 @@
<div id="overlay_bg"></div>
<div id="overlay"></div>

View File

@ -0,0 +1,6 @@
<script type="text/javascript">
var APP_URL = '<?= \miniMVC\site_url(); ?>';
var ASSET_URL = APP_URL.replace('index.php/', '') + 'assets/';
</script>
<h1><a href="<?= miniMVC\site_url('') ?>">Meta</a></h1>
<span id="outline">[<a href="<?= miniMVC\site_url('outline')?>">Data Outline</a>]</span>

View File

@ -2,15 +2,19 @@
/* ! General Styles */ /* ! General Styles */
/* ---------------- */ /* ---------------- */
* { * {
vertical-align:middle; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
} }
html, body { html, body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight:200; font-weight:200;
color:#312;
}
body {
position:relative;
max-width:800px; max-width:800px;
margin: 0 auto; margin: 0 auto;
color:#312;
} }
button { button {
@ -43,8 +47,9 @@ legend:hover {
h1,h2 { h1,h2 {
display:inline-block; display:inline-block;
margin-right:0.5em;
vertical-align:middle; vertical-align:middle;
width:25%; /*width:25%;*/
} }
ul { ul {
@ -52,17 +57,19 @@ ul {
margin:0; margin:0;
} }
li { ul > li {
padding:0.5em 0; padding:0.5em 0;
} }
dt, dd {
padding:0.25em 0;
}
dd { dd {
margin-left:0.5em; margin-left:0.5em;
} }
fieldset {
border-radius:5px;
}
/* Hide forms by default */ /* Hide forms by default */
fieldset dl { fieldset dl {
@ -74,6 +81,14 @@ fieldset dl {
} }
/* form styles */ /* form styles */
fieldset {
border-radius:5px;
}
form.add {
margin-bottom:0.75em;
}
form dt, form dd { form dt, form dd {
display:inline-block; display:inline-block;
vertical-align:top; vertical-align:top;
@ -100,11 +115,17 @@ form dd {
vertical-align:middle; vertical-align:middle;
} }
li:hover > .modify, dt:hover > .modify { li li, li dt {
display:inline-block; position:relative;
vertical-align:middle; z-index:3;
} }
li:hover > .modify, dt:hover > .modify, dd:hover > .modify {
display:inline-block;
vertical-align:top;
}
button.save { button.save {
background:#7c7; background:#7c7;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#77cc77', EndColorStr='#559955')"; /* IE9 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#77cc77', EndColorStr='#559955')"; /* IE9 */
@ -176,6 +197,12 @@ button.delete:hover {
margin-left:0.5em; margin-left:0.5em;
} }
#outline {
position:absolute;
margin:21px 0;
right:0;
}
dl.outline dd { dl.outline dd {
border-bottom:1px dotted #555; border-bottom:1px dotted #555;
margin-bottom:0.5em; margin-bottom:0.5em;
@ -192,6 +219,7 @@ dl.outline dd:last-child {
.list li { .list li {
list-style:none; list-style:none;
} }
li h4 { li h4 {
@ -217,6 +245,7 @@ dl.multiline dd {
dl.pair dt, dl.pair dd { dl.pair dt, dl.pair dd {
display:inline-block; display:inline-block;
vertical-align:middle;
padding:0.25em 0; padding:0.25em 0;
} }
@ -246,12 +275,25 @@ dl.pair dd {
#overlay { #overlay {
position:absolute; position:absolute;
background:#ddd; background:#ddd;
min-width:700px; width:650px;
padding:0.5em; padding:0.5em;
border-radius:5px; border-radius:5px;
display:none; display:none;
z-index:25; z-index:25;
} }
#edit_form {
position:relative;
overflow:hidden;
}
#edit_form dt {
width:20%;
}
#edit_form dd {
width:78%;
}

View File

@ -30,9 +30,9 @@
background-position: 30px 0; background-position: 30px 0;
} }
.tefooter { .tefooter {
height: 32px;
border-top: 1px solid #bbb; border-top: 1px solid #bbb;
background: #f5f5f5; background: #f5f5f5;
overflow:hidden;
} }
.toggle { .toggle {
float: left; float: left;

View File

@ -8,45 +8,22 @@ $_.ext('center', function (sel){
var contHeight, var contHeight,
contWidth, contWidth,
xOffset,
inH, inH,
inW, inW,
top, top,
left; left;
contHeight = (typeof sel.outerHeight !== "undefined") contHeight = sel.offsetHeight;
? sel.outerHeight contWidth = sel.offsetWidth;
: sel.offsetHeight;
contWidth = (typeof sel.outerWidth !== "undefined") inH = window.innerHeight;
? sel.outerWidth inW = window.innerWidth;
: sel.offsetWidth;
xOffset = (typeof window.pageXOffset !== "undefined")
? window.pageXOffset
: document.documentElement.scrollLeft;
inH = (window.innerHeight)
? window.innerHeight
: document.documentElement.offsetHeight;
inW = (window.innerWidth)
? window.innerWidth
: document.documentElement.offsetWidth;
sel.style.position = "fixed"; sel.style.position = "fixed";
top = (inH - contHeight) / 2; top = (inH - contHeight) / 2;
left = (inW - contWidth) / 2 + xOffset; left = (inW - contWidth) / 2;
if (sel.style.posTop)
{
sel.style.posTop = top + "px";
}
else
{
sel.style.top = top + "px";
}
sel.style.top = top + "px";
sel.style.left = left + "px"; sel.style.left = left + "px";
}); });
@ -172,6 +149,9 @@ $_.ext('center', function (sel){
toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'}, toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
resize:{cssclass:'resize'} resize:{cssclass:'resize'}
}); });
//Do it again, so it's correct this time!
$_('#overlay').center();
} }
}); });
}; };

2
sys/db

@ -1 +1 @@
Subproject commit 92c989e6f87cbba1c51c55dd42bb44c2176b0ba2 Subproject commit c963dc29f252d2d237ceacf8300e6e3030abd584