Permalink
Browse files

NEW Side by side editing functionality - first cut (os#7412)

Introduces a preview window that appears when the screen is wide enough,
removes old preview button, adds a draft-public switch, adds variety of
preview options which are not hooked up yet.

Relies on sapphire's f95fadc84416835302fe6c8448054960b5e7ec65
  • Loading branch information...
1 parent 1bf67fd commit 639f6e4d951d15b0aab2f88fe3a6d315431e6b5a @adrexia adrexia committed with chillu Nov 15, 2012
View
16 code/controllers/SilverStripeNavigator.php
@@ -122,9 +122,9 @@ public function getHTML() {}
/**
* @return String
- * Text displayed in watermark
+ * Get the Title of an item
*/
- public function getWatermark() {}
+ public function getTitle() {}
/**
* Optional link to a specific view of this record.
@@ -190,6 +190,10 @@ public function getHTML() {
_t('ContentController.CMS', 'CMS')
);
}
+
+ public function getTitle() {
+ return _t('ContentController.CMS', 'CMS');
+ }
public function getLink() {
return $this->record->CMSEditLink();
@@ -221,7 +225,7 @@ public function getHTML() {
}
}
- public function getWatermark() {
+ public function getTitle() {
return _t('ContentController.DRAFTSITE');
}
@@ -269,7 +273,7 @@ public function getHTML() {
}
}
- public function getWatermark() {
+ public function getTitle() {
return _t('ContentController.PUBLISHEDSITE');
}
@@ -310,6 +314,10 @@ public function getHTML() {
$this->recordLink = $this->record->AbsoluteLink();
return "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
}
+
+ public function getTitle() {
+ return _t('ContentController.VERSION', 'Version').': '.$this->record->LastEdited;
+ }
public function getMessage() {
if($date = Versioned::current_archived_date()) {
View
30 javascript/SilverStripeNavigator.js
@@ -4,32 +4,26 @@ function windowName(suffix) {
}
(function($) {
- $('#switchView a.newWindow').live('click',
- function() {
+ $(document).ready(function() {
+ $('#switchView a.newWindow').on('click', function(e) {
var w = window.open(this.href, windowName(this.target));
w.focus();
return false;
- }
- );
+ });
- $('#SilverStripeNavigatorLink').live('click',
- function() {
+ $('#SilverStripeNavigatorLink').on('click', function(e) {
$('#SilverStripeNavigatorLinkPopup').toggle();
return false;
- }
- );
-
- $('#SilverStripeNavigatorLinkPopup a.close').live('click',
- function() {
+ });
+
+ $('#SilverStripeNavigatorLinkPopup a.close').on('click', function(e) {
$('#SilverStripeNavigatorLinkPopup').hide();
return false;
- }
- );
-
- $('#SilverStripeNavigatorLinkPopup input').live('focus',
- function() {
+ });
+
+ $('#SilverStripeNavigatorLinkPopup input').on('focus',function(e) {
this.select();
- }
- );
+ });
+ });
})(jQuery);
View
6 templates/Includes/CMSMain_EditForm.ss
@@ -22,11 +22,7 @@
<% loop Actions %>
$Field
<% end_loop %>
- <% if Controller.LinkPreview %>
- <a href="$Controller.LinkPreview" class="cms-preview-toggle-link ss-ui-button" data-icon="preview">
- <% _t('LeftAndMain.PreviewButton', 'Preview') %> &raquo;
- </a>
- <% end_if %>
+
</div>
<% end_if %>
</div>
View
5 templates/Includes/CMSSettingsController_EditForm.ss
@@ -19,11 +19,6 @@
<% loop Actions %>
$Field
<% end_loop %>
- <% if Controller.LinkPreview %>
- <a href="$Controller.LinkPreview" class="cms-preview-toggle-link ss-ui-button" data-icon="preview">
- <% _t('LeftAndMain.PreviewButton', 'Preview') %> &raquo;
- </a>
- <% end_if %>
</div>
<% end_if %>
</form>

0 comments on commit 639f6e4

Please sign in to comment.