添加扩展字段

This commit is contained in:
fen 2013-11-24 20:46:16 +08:00
parent 50f6798324
commit c1f08101b7
7 changed files with 129 additions and 15 deletions

View File

@ -75,10 +75,9 @@ textarea {
input[type="radio"], input[type="checkbox"] {
margin-right: 3px; }
input.text-s {
input.text-s, textarea.text-s {
padding: 5px; }
input.text-l {
input.text-l, textarea.text-l {
padding: 10px;
font-size: 1.14286em; }
@ -876,14 +875,40 @@ a.operate-reply {
resize: none;
font-size: .92857em; }
.typecho-post-area #advance-panel-btn {
#advance-panel-btn {
padding: 0 10px;
height: 26px;
font-size: .92857em; }
.typecho-post-area #advance-panel {
#advance-panel {
display: none; }
#custom-field {
margin: 1em 0;
padding: 10px 15px;
background: #FFF; }
#custom-field.fold table, #custom-field.fold .description {
display: none; }
#custom-field .description {
margin: 0;
padding: 10px 0 5px;
border-top: 1px solid #F0F0EC; }
#custom-field .typecho-label {
margin: 0;
cursor: pointer; }
#custom-field .typecho-label:hover {
color: #467B96; }
#custom-field th, #custom-field td {
padding: 10px 5px;
text-align: left;
font-size: .92857em;
font-weight: normal; }
#custom-field td {
border-top: 1px solid #F0F0EC;
vertical-align: top; }
#custom-field select {
height: 27px; }
.typecho-post-area .is-draft {
background: #FFF1A8; }
@ -1134,7 +1159,7 @@ a.operate-reply {
/* 预览 */
#wmd-preview {
background: #FFF;
padding: 10px 20px;
padding: 5px 15px;
word-wrap: break-word; }
#wmd-preview img {
max-width: 100%; }

View File

@ -6,7 +6,7 @@
$(document).ready(function () {
var textarea = $('#text'),
toolbar = $('<div class="editor" id="wmd-button-bar" />').insertBefore(textarea.parent())
preview = $('<div id="wmd-preview" />').insertAfter('.submit');
preview = $('<div id="wmd-preview" />').insertBefore('.submit');
var options = {};

View File

@ -22,10 +22,12 @@ textarea {
input[type="radio"], input[type="checkbox"] { margin-right: 3px; }
input.text-s { padding: 5px; }
input.text-l {
padding: 10px;
font-size: 1.14286em;
input, textarea {
&.text-s { padding: 5px; }
&.text-l {
padding: 10px;
font-size: 1.14286em;
}
}
.w-10 { width: 10%; }

View File

@ -66,7 +66,7 @@
/* 预览 */
#wmd-preview {
background: #FFF;
padding: 10px 20px;
padding: 5px 15px;
word-wrap: break-word;
img { max-width: 100%; }
code, pre {

View File

@ -656,16 +656,51 @@ a.operate-reply {
font-size: .92857em;
}
.typecho-post-area #advance-panel-btn {
#advance-panel-btn {
padding: 0 10px;
height: 26px;
font-size: .92857em;
}
.typecho-post-area #advance-panel {
#advance-panel {
display: none;
}
#custom-field {
margin: 1em 0;
padding: 10px 15px;
background: #FFF;
&.fold {
table, .description { display: none; }
}
.description {
margin: 0;
padding: 10px 0 5px;
border-top: 1px solid #F0F0EC;
}
.typecho-label {
margin: 0;
cursor: pointer;
&:hover {
color: #467B96;
}
}
th, td {
padding: 10px 5px;
text-align: left;
font-size: .92857em;
font-weight: normal;
}
td {
border-top: 1px solid #F0F0EC;
vertical-align: top;
}
select { height: 27px; }
}
.typecho-post-area .is-draft {
background: #FFF1A8;
}

View File

@ -187,10 +187,16 @@ $(document).ready(function() {
// 高级选项控制
$('#advance-panel-btn').click(function() {
$('#advance-panel').toggle();
$(this).toggleClass('fold');
return false;
});
// 自定义字段
$('#custom-field .typecho-label').click(function() {
$(this).parent().toggleClass('fold');
return false;
});
// 草稿删除确认
$('.edit-draft-notice a').click(function () {
if (confirm('<?php _e('您确认要删除这份草稿吗?'); ?>')) {
window.location.href = $(this).attr('href');

View File

@ -42,8 +42,54 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text" name="text" class="w-100 mono"><?php echo htmlspecialchars($post->text); ?></textarea>
</p>
<div class="">
<a href="###" class="current">撰写</a>
<a href="###">预览</a>
</div>
<?php include 'file-upload.php'; ?>
<section id="custom-field" class="typecho-post-option fold">
<label class="typecho-label"><?php _e('自定义字段'); ?></label>
<table class="mono">
<tr>
<th width="25%"><?php _e('KEY'); ?></th>
<th width="10%"><?php _e('TYPE'); ?></th>
<th><?php _e('VALUE'); ?></th>
<th width="8%"></th>
</tr>
<tr>
<td><input type="text" class="text-s w-100"></td>
<td>
<select name="" id="">
<option value=""><?php _e('varchar'); ?></option>
<option value=""><?php _e('int'); ?></option>
<option value=""><?php _e('float'); ?></option>
</select>
</td>
<td><textarea class="text-s w-100" rows="2"></textarea></td>
<td>
<button type="button" class="btn-s"><?php _e('-'); ?></button>
</td>
</tr>
<tr>
<td><input type="text" class="text-s w-100"></td>
<td>
<select name="" id="">
<option value=""><?php _e('varchar'); ?></option>
<option value=""><?php _e('int'); ?></option>
<option value=""><?php _e('float'); ?></option>
</select>
</td>
<td><textarea class="text-s w-100"></textarea></td>
<td>
<button type="button" class="btn-s"><?php _e('+'); ?></button>
</td>
</tr>
</table>
<p class="description"><?php _e('自定义字段可以扩展你的模板功能, 使用方法参见 <a href="">帮助文档</a>'); ?></p>
</section>
<?php Typecho_Plugin::factory('admin/write-post.php')->content($post); ?>
<p class="submit clearfix">
<span id="auto-save-message" class="left"></span>