MINOR CMS Preview fixes

This commit is contained in:
Ingo Schommer 2011-05-02 11:43:51 +12:00
parent f94647197b
commit ff1c961ead
4 changed files with 27 additions and 6 deletions

View File

@ -159,7 +159,7 @@ form.nostyle .middleColumn { margin-left: 0; }
input, textarea { -moz-border-radius: 5px; -webkit-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px; background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #ebeff1), color-stop(50%, #ffffff), color-stop(100%, #ebeff1)); background-image: -moz-linear-gradient(top, #ebeff1 0%, #ffffff 50%, #ebeff1 100%); background-image: linear-gradient(top, #ebeff1 0%, #ffffff 50%, #ebeff1 100%); border: 1px solid #aaaaaa; padding: 3px; }
input.loading { padding-left: 16px; background: #ebeff1 url(../../images/network-save.gif) no-repeat center left; }
input.loading, input.ui-state-default.loading, .ui-widget-content input.ui-state-default.loading, .ui-widget-header input.ui-state-default.loading { padding-left: 16px; background: #ebeff1 url(../../images/network-save.gif) no-repeat center left; }
.ss-ui-button.ss-ui-action-constructive, .ui-widget-content .ss-ui-button.ss-ui-action-constructive, .ui-widget-header .ss-ui-button.ss-ui-action-constructive { background: none; background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #77b53f), color-stop(100%, #456925)); background-image: -moz-linear-gradient(top, #77b53f 0%, #456925 100%); background-image: linear-gradient(top, #77b53f 0%, #456925 100%); color: white; }
@ -261,3 +261,5 @@ form.member-profile-form .formattingHelpText li { font-size: 11px; color: #333;
.cms-preview { background-color: #b0bfc6; }
.cms-preview .cms-preview-toggle { cursor: pointer; }
.cms-preview .cms-preview-toggle a { color: white; font-weight: bold; text-decoration: none; }
.cms-switch-view a { padding-right: 1em; }

View File

@ -2,6 +2,8 @@
$.entwine('ss', function($){
$('.LeftAndMain .cms-preview').entwine({
SharedWidth: null,
onmatch: function() {
var self = this, layoutContainer = this.parent();
// this.resizable({
@ -11,6 +13,9 @@
// }
// });
// TODO Compute dynamically
this.setSharedWidth(500);
// Create layout and controls
this.prepend('<div class="cms-preview-toggle west"><a href="#">&lt;</a></div>');
this.find('iframe').addClass('center');
@ -50,14 +55,13 @@
if(id && form.find(':input[name=ID]').val() != id) form.loadForm('admin/page/edit/show/' + id);
},
toggle: function() {
toggle: function(bool) {
var self = this,
width = this.width(),
relayout = function() {$('.cms-container').layout({resize: false});},
minWidth = this.find('.cms-preview-toggle').width(),
wasCollapsed = (width <= minWidth),
sharedWidth = $('.cms-content').width() / 2, // half of content area by default
newWidth = wasCollapsed ? sharedWidth : minWidth,
wasCollapsed = (bool === true || bool === false) ? bool : (width <= minWidth),
newWidth = wasCollapsed ? this.getSharedWidth() : minWidth,
newOverflow = wasCollapsed ? 'auto' : 'hidden';
this.css('overflow', newOverflow).width(newWidth);
@ -98,5 +102,14 @@
this.parents('.cms-preview').toggle();
}
});
$('.LeftAndMain .cms-switch-view a').entwine({
onclick: function(e) {
e.preventDefault();
var preview = $('.cms-preview');
preview.toggle(true);
preview.loadUrl($(e.target).attr('href'));
}
});
});
}(jQuery));

View File

@ -341,4 +341,10 @@ form.member-profile-form {
text-decoration: none;
}
}
}
.cms-switch-view {
a {
padding-right: 1em;
}
}

View File

@ -27,7 +27,7 @@
<% if currentPage %>
<div class="cms-preview east">
<iframe src="$currentPage.Link"></iframe>
<iframe src="$currentPage.Link/?stage=Stage"></iframe>
</div>
<% end_if %>