Permalink
Browse files

API CHANGE ModelAdmin uses GridField, DataList and new layout. Remove…

…d ModelAdmin_CollectionController, ModelAdmin_RecordController and related functionality.

API CHANGE Removed ModelAdmin->ResultColumns()/ColumnSelectionField, selection of own fields no longer possible through the UI, to be replaced by a more generic GridField component
  • Loading branch information...
1 parent 64db811 commit e12a3a4ab7bc4e344d2e3aa8ca1408bcffe542a3 @chillu chillu committed Mar 9, 2012
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,180 +0,0 @@
-/**
- * File: ModelAdmin.History.js
- */
-(function($) {
- $.entwine('ss', function($){
- /**
- * Class: .ModelAdmin
- *
- * A simple ajax browser history implementation tailored towards
- * navigating through search results and different forms loaded into
- * the ModelAdmin right panels. The logic listens to search and form loading
- * events, keeps track of the loaded URLs, and will display graphical back/forward
- * buttons where appropriate. A search action will cause the history to be reset.
- *
- * Note: The logic does not replay save operations or hook into any form actions.
- *
- * Available Events:
- * - historyAdd
- * - historyStart
- * - historyGoFoward
- * - historyGoBack
- *
- * Todo:
- * Switch tab state when re-displaying search forms
- * Reload search parameters into forms
- */
- $('.ModelAdmin').entwine({
-
- /**
- * Variable: History
- */
- History: [],
-
- /**
- * Variable: Future
- */
- Future: [],
-
- onmatch: function() {
- var self = this;
-
- this._super();
-
- // generate markup
- this.find('#right').prepend(
- '<div class="historyNav">'
- + '<a href="#" class="back">&lt; ' + ss.i18n._t('ModelAdmin.HISTORYBACK', 'back') + '</a>'
- + '<a href="#" class="forward">' + ss.i18n._t('ModelAdmin.HISTORYFORWARD', 'forward') + ' &gt;</a>'
- + '</div>'
- ).find('.back,.forward').hide();
-
- this.find('.historyNav .back').live('click', function() {
- self.goBack();
- return false;
- });
-
- this.find('.historyNav .forward').live('click', function() {
- self.goForward();
- return false;
- });
- },
-
- /**
- * Function: redraw
- */
- redraw: function() {
- this.find('.historyNav .forward').toggle(Boolean(this.getFuture().length > 0));
- this.find('.historyNav .back').toggle(Boolean(this.getHistory().length > 1));
-
- this._super();
- },
-
- /**
- * Function: startHistory
- *
- * Parameters:
- * (String) url - ...
- * (Object) data - ...
- */
- startHistory: function(url, data) {
- this.trigger('historyStart', {url: url, data: data});
-
- this.setHistory([]);
- this.addHistory(url, data);
- },
-
- /**
- * Add an item to the history, to be accessed by goBack and goForward
- */
- addHistory: function(url, data) {
- this.trigger('historyAdd', {url: url, data: data});
-
- // Combine data into URL
- if(data) {
- if(url.indexOf('?') == -1) url += '?' + $.param(data);
- else url += '&' + $.param(data);
- }
- // Add to history
- this.getHistory().push(url);
- // Reset future
- this.setFuture([]);
-
- this.redraw();
- },
-
- /**
- * Function: goBack
- */
- goBack: function() {
- if(this.getHistory() && this.getHistory().length) {
- if(this.getFuture() == null) this.setFuture([]);
-
- var currentPage = this.getHistory().pop();
- var previousPage = this.getHistory()[this.getHistory().length-1];
-
- this.getFuture().push(currentPage);
-
- this.trigger('historyGoBack', {url:previousPage});
-
- // load new location
- $('.cms-content').loadForm(previousPage);
-
- this.redraw();
- }
- },
-
- /**
- * Function: goForward
- */
- goForward: function() {
- if(this.getFuture() && this.getFuture().length) {
- if(this.getFuture() == null) this.setFuture([]);
-
- var nextPage = this.getFuture().pop();
-
- this.getHistory().push(nextPage);
-
- this.trigger('historyGoForward', {url:nextPage});
-
- // load new location
- $('.cms-content').loadForm(nextPage);
-
- this.redraw();
- }
- }
- });
-
- /**
- * Class: #SearchForm_holder form
- *
- * A search action will cause the history to be reset.
- */
- $('#SearchForm_holder form').entwine({
- onmatch: function() {
- var self = this;
- this.bind('beforeSubmit', function(e) {
- $('.ModelAdmin').startHistory(
- self.attr('action'),
- self.serializeArray()
- );
- });
-
- this._super();
- }
- });
-
- /**
- * Class: form[name=Form_ResultsForm] tbody td a
- *
- * We have to apply this to the result table buttons instead of the
- * more generic form loading.
- */
- $('form[name=Form_ResultsForm] tbody td a').entwine({
- onclick: function(e) {
- $('.ModelAdmin').addHistory(this.attr('href'));
- }
- });
-
- });
-})(jQuery);
@@ -1,78 +0,0 @@
-/** --------------------------------------------
- * ModelAdmin
- * -------------------------------------------- */
-
-.ModelAdmin {
- // Disable by default, will be replaced by more intuitive column selection in new data grid
- .ResultAssemblyBlock {
- display: none;
- }
- .cms-content-tools {
- h3.cms-panel-header {
- display:none;
- }
- #SearchForm_holder {
- ul.ui-tabs-nav {
- overflow:hidden;
- li {
- max-width:99%;
- a {
- white-space: nowrap;
- overflow: hidden;
- text-overflow:ellipsis;
- //above 3 lines can also be achieved with mixin below
- //@include ellipsis;
- max-width:85%;
- }
- }
- }
- #ModelClassSelector {
- margin-bottom:2px;
- select {
- width:96%;
- }
- }
- div.tab {
- border:1px solid #aaa; //following color from the jquery smoothness theme
- margin-top:-1px;
- background:#fff; //backround is kept white to follow tabs
- padding:$grid-x;
-
- h3 {
- margin-top:16px;
- margin-bottom:10px;
- @include doubleborder(bottom, $color-light-separator, lighten($color-light-separator, 10%))
- }
-
- form {
- input {
- margin:0px;
- }
- .field {
- border-bottom:0px;
- margin-bottom:6px;
- }
- .Actions {
- max-width:100%;
- overflow:hidden;
- button.ss-ui-action-minor {
- //removing the "clear search" button
- display:none;
- }
- input.action {
- //experimenting with text-overlow:ellipsis on action buttons
- //currently disabled as this ignores padding-left on the buttons in Firefox
- //and makes the text appear in front of the icon in Firefox 10
- //See a screenshot here: http://db.tt/iBi39rRt
-
- //white-space: nowrap;
- //overflow: hidden;
- //text-overflow:ellipsis;
- //max-width:100%;
- }
- }
- }
- }
- }
- }
-}
View
@@ -179,7 +179,7 @@ body.cms {
/** --------------------------------------------
* Tabs
* -------------------------------------------- */
-.ui-tabs .cms-content-header .ui-tabs-nav, .cms-dialog .ui-tabs-nav {
+.cms-content-header .ui-tabs-nav, .cms-dialog .ui-tabs-nav {
li {
margin:0;
a {
@@ -568,6 +568,7 @@ body.cms {
position: relative;
.cms-panel-header {
+ clear: both;
margin: 0 0 $grid-y - 1;
line-height: $grid-y * 3;
@@ -1240,6 +1241,14 @@ body.cms-dialog {
}
+/** --------------------------------------------
+ * Search forms (used in AssetAdmin, ModelAdmin, etc)
+ * -------------------------------------------- */
+.cms-search-form {
+ overflow: auto;
+ margin-bottom: $grid-y*2;
+}
+
/** --------------------------------------------
* Step labels
* -------------------------------------------- */
@@ -1,18 +1,30 @@
<div class="cms-content center $BaseCSSClasses" data-layout-type="border">
<div class="cms-content-header north">
- <div><h2>
- <% if SectionTitle %>
- $SectionTitle
- <% else %>
- <% _t('ModelAdmin.Title', 'Data Models') %>
- <% end_if %>
- </h2></div>
- </div>
+ <div>
+ <h2>
+ <% if SectionTitle %>
+ $SectionTitle
+ <% else %>
+ <% _t('ModelAdmin.Title', 'Data Models') %>
+ <% end_if %>
+ </h2>
+
+ <div class="cms-content-header-tabs ss-ui-tabs-nav">
+ <ul>
+ <% control ManagedModelTabs %>
+ <li class="tab-$ClassName $LinkOrCurrent">
+ <a href="$Link" class="cms-panel-link">$Title</a>
+ </li>
+ <% end_control %>
+ </ul>
+ </div>
- $Tools
+ </div>
+ </div>
- <div class="cms-content-fields center ui-widget-content">
+ <div class="cms-content-fields center ui-widget-content" data-layout-type="border">
+ $Tools
$EditForm
</div>
@@ -1,5 +0,0 @@
-<% if Results %>
- $Form
-<% else %>
- <p><% sprintf(_t('ModelAdmin.NORESULTS', 'No results'), $ModelPluralName) %></p>
-<% end_if %>
Oops, something went wrong.

0 comments on commit e12a3a4

Please sign in to comment.