Browse Source

no jQuery fallback

add no jQuery fallback
pull/146/head
irgaabd 10 years ago
parent
commit
63fd2563ea
3 changed files with 115 additions and 130 deletions
  1. +54
    -84
      system/admin/admin.css
  2. +33
    -19
      system/admin/views/add-post.html.php
  3. +28
    -27
      system/admin/views/edit-post.html.php

+ 54
- 84
system/admin/admin.css View File

@ -1,21 +1,21 @@
/* ungrid the simplest responsive css grid (http://badge.fury.io/bo/ungrid)
*/@media(min-width:60em){
.row{
width:100%;
display:table;
table-layout:fixed
}
.col{
display:table-cell
}
*/@media(min-width:60em){.row{width:100%;display:table;table-layout:fixed}.col{display:table-cell}}
.hidden{
display: none;
}
.tema_abu{
background: #F3F3F3;
color: #666;
}
body.admin{
input.text{
margin: 0.5em 0;
border: 1px solid #CFDAE5;
}
.hidden{
display: none;
input:required{
}
.add_post{
@ -24,33 +24,20 @@ body.admin{
.post_editor {
padding: 1em 2em;
}
.post_editor .help{
font-style: italic;
margin: 0 0 2em 0;
}
input.text{
margin: 0.5em 0;
min-width: 25em;
//background-color: #F6F7F9;
border: 1px solid #CFDAE5;
}
input:required{
}
.post_editor input.text {
font-size: 1em;
}
.post_editor textarea{
resize: none;
}
.post_editor input#title,
.post_editor input#tag{
width:100%
}
.post_editor input#title{
font-size: 1.8em;
}
@ -58,36 +45,51 @@ input:required{
margin: 0;
margin-bottom: 1em;
}
.post_editor fieldset legend{
margin-left: 90%;
font-size: 1em;
font-weight: 700;
}
.toggle_field_label{
cursor: pointer;
}
.toggle_field div.col{
vertical-align: top;
padding:0 10px;
}
.wmd-panel textarea{
resize: none;
.post_editor .wmd-panel {
float:none;
}
.post_editor .wmd-preview {
vertical-align: top;
}
.post_editor .wmd-input {
min-height: 500px;
padding: 1em 1em;
width: 100%;
.post_editor .pbutton{
margin: 20px 0;
text-align: right;
}
.pbutton input.submit{
font-weight: 700;
padding: 0.5em 5em;
}
.main_footer{
padding: 3em 0;
}
.post_editor #wmd-preview {
width: 50%;
float: right;
min-height: 530px;
padding: 0em 1em;
.main_footer p{
text-align: center;
font-weight:400;
font-size: 0.65em;
line-height: 0.2em;
letter-spacing: 0.1em;
}
/* Dropzone
*/
.dropzone{
border: 4px dashed gray;
border-radius: 5px;
@ -96,59 +98,27 @@ input:required{
box-sizing: border-box;
cursor: pointer;
}
.dropzone.dz-started {
border: none;
}
.post_editor .dropzone{
margin: 0 30px;
}
.dropzone .dz-default.dz-message{
margin: 1.3em;
text-align: center;
font-size: 40px;
color: gray;
}
.dropzone.dz-started {
border: none;
}
.dropzone.dz-started .dz-message {
display: none;
}
.post_editor .dz-preview div.dz-details,
.post_editor .dz-preview div.dz-error-mark,
.post_editor .dz-preview div.dz-error-message,
.post_editor .dz-preview div.dz-progress,
.post_editor .dz-preview div.dz-success-mark{
.dz-preview .dz-details,
.dz-preview .dz-error-mark,
.dz-preview .dz-error-message,
.dz-preview .dz-progress,
.dz-preview .dz-success-mark{
display: none;
}
.post_editor div.dz-preview div.dz-image img{
.dz-preview .dz-image img{
width: 100%;
height: auto;
cursor: default;
}
.post_editor .pbutton{
text-align: right;
}
.pbutton input.submit{
font-weight: 700;
padding: 0.5em 5em;
}
.main_footer{
padding: 3em 0;
}
.main_footer p{
text-align: center;
font-weight:400;
font-size: 0.65em;
line-height: 0.2em;
letter-spacing: 0.1em;
}
.tema_abu{
background: #F3F3F3;
color: #666;
}

+ 33
- 19
system/admin/views/add-post.html.php View File

@ -7,30 +7,42 @@
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<?php
$nojQueryCSS = "";
if(config('jquery')== 'enable'){
$nojQueryCSS="hidden";
}
?>
<section class="row add_post">
<form method="POST" class="col post_editor">
<input type="text" class="text row" required id="title" name="title" placeholder="Title*" value="<?php if (isset($postTitle)) { echo $postTitle;} ?>"/>
<input type="text" class="text row" required id='tag' name="tag" placeholder="Tag*" value="<?php if (isset($postTag)) { echo $postTag;} ?>"/>
<input type="text" class="text row <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" required id="title" name="title" placeholder="Title*" value="<?=(isset($postTitle)) ? $postTitle : "" ?>"/>
<input type="text" class="text row <?php if (isset($postTag)) { if (empty($postTag)) { echo 'error';}} ?>" required id="tag" name="tag" placeholder="Tag*" value="<?=(isset($postTag)) ? $postTag : "" ?>"/>
<fieldset>
<legend class='toggle_field_label'> Advance <i class="fa fa-chevron-down"></i></legend>
<div class="row toggle_field">
<div class="col"><div type="text" class="dropzone" id="featuredDropzone"></div></div>
<div class="col">
<input type="text" class="text row <?=$nojQueryCSS?>" id="fi" name="fi" placeholder="Featured Image (optional)" value="" data-site-url="<?php echo site_url() ?>" data-image-url=""/>
<input type="text" class="text row <?=$nojQueryCSS?>" id="vid" name="vid" placeholder="Embed Youtube Video (optional)" value="<?php if (isset($postVid)) { echo $postVid;} ?>"/>
<div class="row dropzone hidden" id="featuredDropzone"></div>
</div>
<div class="col">
<input type="text" class="text row" name="url" placeholder="Url (optional)" value="<?php if (isset($postUrl)) { echo $postUrl;} ?>"/>
<p class="help ">If the url leave empty we will use the post title.</p>
<textarea name="description" class="row" placeholder="Meta Description (optional)" maxlength="200"><?php if (isset($p->description)) { echo $p->description;} ?></textarea>
<textarea name="description" class="row" placeholder="Meta Description (optional)" maxlength="200" rows="6"><?php if (isset($p->description)) { echo $p->description;} ?></textarea>
</div>
</div>
</fieldset>
<input type="hidden" id="fi" name="fi" value="" data-site-url="<?php echo site_url() ?>" data-image-url=""/>
<div id="wmd-button-bar" class="wmd-button-bar row"></div>
<div class="wmd-panel">
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content"><?php if (isset($postContent)) { echo $postContent;} ?></textarea><br/>
<div id="mdEditor" class="row">
<div class="wmd-panel col">
<div id="wmd-button-bar" class="wmd-button-bar row"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content"><?php if (isset($postContent)) { echo $postContent;} ?></textarea><br/>
</div>
<div id="wmd-preview" class="col wmd-panel wmd-preview"></div>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf()?>">
<div class="row pbutton">
<input type="submit" name="submit" class="submit" value="Publish"/>
@ -50,9 +62,9 @@
})();
</script>
<?php if(config('jquery')== 'enable'){ ?>
<script type="text/javascript">
(function ($) {
$(document).ready(function() {
$('.toggle_field').hide();
@ -60,21 +72,24 @@ $(document).ready(function() {
$(this).siblings().toggle();
$(this).children('i').toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
});
$('.dropzone').show();
Dropzone.options.featuredDropzone = {
url: "/upload.php",
url: "../upload.php",
acceptedFiles: 'image/*',
uploadMultiple: false,
addRemoveLinks: true,
thumbnailWidth: 300,
thumbnailHeight: null,
dictRemoveFile: "Cancel",
dictCancelUpload: "Hapus/Ganti Gambar",
dictRemoveFile: "Remove",
dictCancelUpload: "Remove/Change Picture",
dictDefaultMessage: '<i class="fa fa-picture-o"></i><p>Drop image to upload</p>',
init: function() {
this.on("success", function(file,ret) {
$('#fi').val($('#fi').data('site-url')+ret);
$('#fi').val($('#fi').data('site-url')+ret);
});
this.on("removedfile", function(file) {
$('#fi').val('');
});
this.on("error", function (file,errmsg){alert(errmsg)});
}
@ -84,10 +99,9 @@ $(document).ready(function() {
})(jQuery);
</script>
<!--
<input type="text" class="text row" id="vid" name="vid" placeholder="Embed Youtube Video (optional)" value="<?php if (isset($postVid)) { echo $postVid;} ?>"/>
<?php } ?>
-->

+ 28
- 27
system/admin/views/edit-post.html.php View File

@ -36,7 +36,10 @@
// The post URL
$delete= site_url().date('Y/m', $postdate).'/'.$oldmd . '/delete?destination=' . $destination;
$nojQueryCSS = "";
if(config('jquery')== 'enable'){
$nojQueryCSS="hidden";
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css" />
@ -50,35 +53,39 @@
<section class="row">
<form method="POST" class="col post_editor">
<input type="text" class="text row" required id="title" name="title" placeholder="Title*" value="<?php echo $oldtitle ?>"/>
<input type="text" class="text row" required id='tag' name="tag" placeholder="Tag*" value="<?php echo $oldtag ?>"/>
<input type="text" class="text row <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" required id="title" name="title" placeholder="Title*" value="<?php echo $oldtitle ?>"/>
<input type="text" class="text row <?php if (isset($postTag)) { if (empty($postTag)) { echo 'error';}} ?>" required id='tag' name="tag" placeholder="Tag*" value="<?php echo $oldtag ?>"/>
<fieldset>
<legend class='toggle_field_label'> Advance <i class="fa fa-chevron-down"></i></legend>
<div class="row toggle_field">
<div class="col"><div type="text" class="dropzone" id="featuredDropzone"></div></div>
<div class="col">
<input type="text" class="text row <?=$nojQueryCSS?>" id="fi" name="fi" placeholder="Featured Image (optional)" value="<?php echo $oldfi?>" data-site-url="<?php echo site_url() ?>" data-image-url=""/>
<input type="text" class="text row <?=$nojQueryCSS?>" id="vid" name="vid" placeholder="Embed Youtube Video (optional)" value="<?php echo $oldvid ?>"/>
<div class="row dropzone hidden" id="featuredDropzone"></div>
</div>
<div class="col">
<input type="text" class="text row" name="url" placeholder="Url (optional)" value="<?php echo $oldmd ?>"/>
<p class="help ">If the url leave empty we will use the post title.</p>
<textarea name="description" class="row" placeholder="Meta Description (optional)" maxlength="200"><?php if (isset($p->description)) { echo $p->description;} ?></textarea>
<textarea name="description" class="row" placeholder="Meta Description (optional)" maxlength="200" rows="6"><?php if (isset($p->description)) { echo $p->description;} ?></textarea>
</div>
</div>
</fieldset>
<input type="hidden" id="fi" name="fi" value="<?php echo $oldfi?>" data-site-url="<?php echo site_url() ?>" data-image-url="<?php echo $oldfi?>"/>
<div id="wmd-button-bar" class="wmd-button-bar row"></div>
<div class="wmd-panel">
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content"><?php echo $oldcontent ?></textarea><br/>
<div id="mdEditor" class="row">
<div class="wmd-panel col">
<div id="wmd-button-bar" class="wmd-button-bar row"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content"><?php echo $oldcontent ?></textarea><br/>
</div>
<div id="wmd-preview" class="col wmd-panel wmd-preview"></div>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf()?>">
<div class="row pbutton">
<input type="submit" name="submit" class="submit" value="Save"/>
<a href="<?php echo $delete?>">Delete</a>
<div class="row">
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf()?>">
</form>
</section>
@ -94,9 +101,8 @@
})();
</script>
<?php if(config('jquery')== 'enable'){?>
<script type="text/javascript">
(function ($) {
$(document).ready(function() {
$('.toggle_field').hide();
@ -104,9 +110,9 @@ $(document).ready(function() {
$(this).siblings().toggle();
$(this).children('i').toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
});
$('.dropzone').show();
Dropzone.options.featuredDropzone = {
url: "/upload.php",
url: "../upload.php",
acceptedFiles: 'image/*',
uploadMultiple: false,
addRemoveLinks: true,
@ -121,24 +127,19 @@ $(document).ready(function() {
$('#fi').val($('#fi').data('site-url')+ret);
});
this.on("error", function (file,errmsg){alert(errmsg)});
var oldfi = $('#fi').data('image-url');
var oldfi = $('#fi').val();
// Create the mock file:
var mockFile = { name: "Filename", size: 12345 };
// Call the default addedfile event handler
this.emit("addedfile", mockFile);
// And optionally show the thumbnail of the file:
this.emit("thumbnail", mockFile, oldfi);
// Make sure that there is no progress bar, etc...
this.emit("complete", mockFile);
}
}
//$("div#featuredDropzone").dropzone({ url: "/edd/upload.php" });
})
})(jQuery);
</script>
</script>
<?php } ?>

Loading…
Cancel
Save