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
// --------------------------------------------------------------------------
/**
* 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
*
@ -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
*
@ -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
*
@ -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
*
@ -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
* @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
*
@ -551,7 +530,7 @@ class data_model extends \miniMVC\Model {
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);
}
// --------------------------------------------------------------------------
/**
* 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

View File

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

View File

@ -1,10 +1,8 @@
<h2><?= $genre ?></h2>
<p class="breadcrumbs">
<a href="<?= miniMVC\site_url('') ?>">Genres</a> > <?= $genre ?>
</p>
<form action="<?= miniMVC\site_url("genre/add_category") ?>" method="post">
<form class="add" action="<?= miniMVC\site_url("genre/add_category") ?>" method="post">
<fieldset>
<legend>Add Category</legend>
<dl>
@ -17,15 +15,27 @@
</dl>
</fieldset>
</form>
<ul>
<h3>Categories</h3>
<ul class="list">
<?php foreach($categories as $id => $cat): ?>
<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 ?>">
<button class="edit">Edit</button>
<button class="delete">Delete</button>
</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>
<?php endforeach ?>
</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>
<legend>Add Genre</legend>
<dl>
@ -14,7 +14,8 @@
</fieldset>
</form>
<ul>
<h3>Genres</h3>
<ul class="list">
<?php foreach($genres as $id => $name): ?>
<li>
<a href="<?= miniMVC\site_url("genre/{$id}") ?>">

View File

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

View File

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

View File

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

View File

@ -9,9 +9,4 @@
<?= $head_js ?>
</head>
<body<?= (!empty($body_class)) ? "class=\"" . $body_class . "\"" : ""; ?><?= (!empty($body_id)) ? " id=\"" . $body_id . "\"" : ""; ?>>
<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>
[<a href="<?= miniMVC\site_url('outline')?>">Data Outline</a>]<br />
<?php $this->load_view('theme_header'); ?>

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

View File

@ -8,45 +8,22 @@ $_.ext('center', function (sel){
var contHeight,
contWidth,
xOffset,
inH,
inW,
top,
left;
contHeight = (typeof sel.outerHeight !== "undefined")
? sel.outerHeight
: sel.offsetHeight;
contHeight = sel.offsetHeight;
contWidth = sel.offsetWidth;
contWidth = (typeof sel.outerWidth !== "undefined")
? sel.outerWidth
: 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;
inH = window.innerHeight;
inW = window.innerWidth;
sel.style.position = "fixed";
top = (inH - contHeight) / 2;
left = (inW - contWidth) / 2 + xOffset;
if (sel.style.posTop)
{
sel.style.posTop = top + "px";
}
else
{
sel.style.top = top + "px";
}
left = (inW - contWidth) / 2;
sel.style.top = top + "px";
sel.style.left = left + "px";
});
@ -172,6 +149,9 @@ $_.ext('center', function (sel){
toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
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