Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
timw4mail committed Sep 12, 2012
1 parent bb6d8ce commit ba319c7
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 114 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sys/*.sqlite
docs/*
docs/*
assets/js/cache/*
2 changes: 1 addition & 1 deletion app/classes/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function check_login_status()
*/
public function __destruct()
{
$this->page->set_foot_js_group('js', TRUE);
$this->page->set_foot_js_group('js');
$this->page->build_footer();
}

Expand Down
4 changes: 2 additions & 2 deletions app/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
|--------------------------------------------------------------------------
|
| Whether or not to show a backtrace for php errors
|
|
| Must be defined as TRUE for the backtrace to display.
|
*/
Expand All @@ -142,6 +142,6 @@
| Whether or not use gzip compression on page output
|
*/
define('GZ_COMPRESS', FALSE);
define('GZ_COMPRESS', TRUE);

// End of config.php
2 changes: 1 addition & 1 deletion app/modules/meta/views/outline.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2>Outline</h2>

<dl>
<dl class="outline">
<dt>Genre</dt>
<dd>
<ul>
Expand Down
31 changes: 31 additions & 0 deletions app/modules/meta/views/section_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,37 @@
</dl>
</fieldset>
</form>
<script src="<?= SCRIPT_PATH.'wysiwyg'; ?>"></script>
<script type="text/javascript">
// WYSIWYG
new TINY.editor.edit('editor',
{
id:'input',
width:450,
height:175,
cssclass:'te',
controlclass:'tecontrol',
rowclass:'teheader',
dividerclass:'tedivider',
controls:['bold','italic','underline','strikethrough','|','subscript','superscript','|',
'orderedlist','unorderedlist','|','leftalign',
'centeralign','rightalign','blockjustify','|','unformat','n','undo','redo','|',
'image','hr','link','unlink','|'],
footer:true,
fonts:['Verdana','Arial','Georgia','Trebuchet MS'],
xhtml:true,
cssfile:ASSET_URL+'css.php/g/css',
bodyid:'editor',
footerclass:'tefooter',
toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
resize:{cssclass:'resize'}
});
// Make sure the WYSIWYG submits the text
// This just copies the text from the WYSIWYG into the textbox
document.querySelector('form').onsubmit = function(e) {
window.editor.toggle();
};
</script>

<?php if ( ! empty($sdata)): ?>

Expand Down
3 changes: 0 additions & 3 deletions app/views/footer.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<div id="overlay_bg"></div>
<div id="overlay"></div>
<script type="text/javascript">
var APP_URL = '<?= \miniMVC\site_url(); ?>';
</script>
<?php if ($foot_js != ""): ?>
<?= $foot_js ?>
<?php endif ?>
Expand Down
4 changes: 4 additions & 0 deletions app/views/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
<?= $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 />
4 changes: 3 additions & 1 deletion assets/config/js_groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@

'js' => array(
'kis-lite-dom.js',
'tinyeditor.js',
'meta.js'
),
'wysiwyg' => array(
'tinyeditor.js',
),
);
39 changes: 25 additions & 14 deletions assets/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ button {
vertical-align:middle;
}

a {
a, a:visited {
text-decoration:none;
color:#558BFF;
}

a:hover {
Expand Down Expand Up @@ -61,9 +62,13 @@ dd {
}

/* Hide forms by default */
/*fieldset dl {
fieldset dl {
display:none;
}*/
}

#edit_form dl {
display:block;
}

/* form styles */
form dt, form dd {
Expand All @@ -78,7 +83,7 @@ form dt {
}

form dd {
width:59%;
width:58%;
text-align:left;
margin-left:0;
padding-left:.25em;
Expand Down Expand Up @@ -131,20 +136,20 @@ button.edit:hover {
}

button.delete {
background:#977;
background:-o-linear-gradient(#977, #955);
background:-moz-linear-gradient(#977, #955);
background:-webkit-linear-gradient(#977, #955);
background:linear-gradient(#977, #955);
background:#f55;
background:-o-linear-gradient(#f55, #955);
background:-moz-linear-gradient(#f55, #955);
background:-webkit-linear-gradient(#f55, #955);
background:linear-gradient(#f55, #955);
color:#fff;
}

button.delete:hover {
background:#955;
background:-o-linear-gradient(#955, #977);
background:-moz-linear-gradient(#955, #977);
background:-webkit-linear-gradient(#955, #977);
background:linear-gradient(#955, #977);
background:-o-linear-gradient(#955, #f55);
background:-moz-linear-gradient(#955, #f55);
background:-webkit-linear-gradient(#955, #f55);
background:linear-gradient(#955, #f55);
}

/* ! Outline styles */
Expand All @@ -157,9 +162,15 @@ button.delete:hover {
margin-left:0.5em;
}

dl.outline {
dl.outline dd {
border-bottom:1px dotted #555;
margin-bottom:0.5em;
}

dl.outline dd:last-child {
border:0;
}

dl.outline dt {
display:list-item;
list-style:square inside;
Expand Down
41 changes: 0 additions & 41 deletions assets/js/cache/js

This file was deleted.

86 changes: 36 additions & 50 deletions assets/js/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ $_.ext('center', function (sel){

var TINY = window.TINY || {};
var $_ = window.$_ || {};
var ASSET_URL = APP_URL.replace('index.php/', '') + 'assets/';

// ! Show/hide forms based on use
$_("fieldset dl").dom.hide();
Expand All @@ -77,12 +76,8 @@ $_.ext('center', function (sel){
meta._delete = function(res){
if (res == 1)
{
$_.get(APP_URL+'message', {
type: 'success',
message: 'Item successfully deleted'
}, function(h) {
$_('body').dom.prepend(h);
});
// Reload the page
window.location = window.location;
}
else
{
Expand Down Expand Up @@ -156,6 +151,33 @@ $_.ext('center', function (sel){

// Center the form
$_('#overlay').center();

if (type == 'data')
{
// WYSIWYG
new TINY.editor.edit('edit_wysiwyg',
{
id:'val',
width:450,
height:175,
cssclass:'te',
controlclass:'tecontrol',
rowclass:'teheader',
dividerclass:'tedivider',
controls:['bold','italic','underline','strikethrough','|','subscript','superscript','|',
'orderedlist','unorderedlist','|','leftalign',
'centeralign','rightalign','blockjustify','|','unformat','n','undo','redo','|',
'image','hr','link','unlink','|'],
footer:true,
fonts:['Verdana','Arial','Georgia','Trebuchet MS'],
xhtml:true,
cssfile:ASSET_URL+'css.php/g/css',
bodyid:'editor',
footerclass:'tefooter',
toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
resize:{cssclass:'resize'}
});
}
});
};

Expand All @@ -165,7 +187,11 @@ $_.ext('center', function (sel){
meta.update_item = function(e) {
var id, type, name, val, txt, data={};

console.log(arguments);
// Update textarea from WYSIWYG
if (window.edit_wysiwyg)
{
window.edit_wysiwyg.toggle();
}

// Get the form values
data.id = $_.$('#id').value;
Expand All @@ -188,12 +214,8 @@ $_.ext('center', function (sel){
// Show the appropriate status message
if (res == 1)
{
$_.get(APP_URL+'message', {
type: 'success',
message: 'Item successfully updated.'
}, function(h) {
$_('body').dom.prepend(h);
});
// Reload the page
window.location = window.location;
}
else
{
Expand All @@ -212,7 +234,6 @@ $_.ext('center', function (sel){
// ! Event binding
// -------------------------------------------------


// Delete Button functionality
$_("button.delete").event.add('click', meta.delete_item);

Expand All @@ -229,39 +250,4 @@ $_.ext('center', function (sel){
// Edit form submission
$_.event.live('#edit_form', 'submit', meta.update_item);

// WYSIWYG
if ($_.$('textarea').length > 0)
{
TINY.init({
id:'input',
width:450,
height:175,
cssclass:'te',
controlclass:'tecontrol',
rowclass:'teheader',
dividerclass:'tedivider',
controls:['bold','italic','underline','strikethrough','|','subscript','superscript','|',
'orderedlist','unorderedlist','|','leftalign',
'centeralign','rightalign','blockjustify','|','unformat','n','undo','redo','|',
'image','hr','link','unlink','|'],
footer:true,
fonts:['Verdana','Arial','Georgia','Trebuchet MS'],
xhtml:true,
cssfile:ASSET_URL+'css.php/g/css',
bodyid:'editor',
footerclass:'tefooter',
toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
resize:{cssclass:'resize'}
});
}

// Make sure the WYSIWYG submits the text
// This just copies the text from the WYSIWYG into the textbox
if (window.editor)
{
document.querySelector('form').onsubmit = function(e) {
window.editor.toggle();
};
}

}());

0 comments on commit ba319c7

Please sign in to comment.