Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Make tabulator string shorter (max 25 chars)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jul 16, 2014
1 parent 607f212 commit 523ff39
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 23 deletions.
4 changes: 2 additions & 2 deletions core/src/plugins/access.fs/fsTemplatePart.xml
Expand Up @@ -30,12 +30,12 @@
<div id="cpane_tabs" ajxpClass="AjxpTabulator" ajxpOptions='{"fit":"height", "fitParent":"browser", "refireResize":0.5, "registerAsEditorOpener":true, "saveState":true,"events":{"ajaxplorer:context_changed":"this.switchTabulator(this.tabulatorData.first().id);"}, "defaultTabId": "files","tabInfos" : [{"id":"files","label":"","iconClass":"icon-folder-open", "element":"files_list_pane"}]}'>
<div id="files_list_pane" ajxpClass="AjxpPane">
<div id="files_list_header" ajxpClass="AjxpPane">
<div id="display_toolbar" class="text_only" ajxpClass="ActionsToolbar" ajxpOptions='{"flexTo":"files_list_header", "submenuClassName":"panelHeaderMenu","submenuPosition":"bottom right","submenuOffsetTop":12,"toolbarsList":["default"],"skipBubbling":true, "skipCarousel":true,"submenuOffsetTop":2}'></div>
<div id="display_toolbar" class="text_only" ajxpClass="ActionsToolbar" ajxpOptions='{"flexTo":"files_list_header", "submenuClassName":"panelHeaderMenu","submenuPosition":"bottom right","submenuOffsetTop":12,"toolbarsList":["default"],"skipBubbling":true, "skipCarousel":true,"submenuOffsetTop":5}'></div>
<div style="float:left;" ajxpClass="AjxpPane" id="buttons_bar_cont">
<div id="buttons_bar" class="action_bar" ajxpClass="ActionsToolbar" ajxpOptions='{"toolbarsList":["navigation", "change_main"],"groupOtherToolbars":["more", "change", "remote"], "groupOtherLabel":"More","skipBubbling":true, "skipCarousel":true,"submenuOffsetTop":2}'></div>
</div>
</div>
<div id="vertical_splitter" ajxpClass="Splitter" ajxpOptions='{"direction": "vertical", "initA":"70%", "minB":290,"fit":"height","fitParent":"browser", "minSize":0, "foldingButton":"B", "invisibleBar": true}'>
<div id="vertical_splitter" ajxpClass="Splitter" ajxpOptions='{"direction": "vertical", "initB":"290", "minB":290,"fit":"height","fitParent":"browser", "minSize":0, "invisibleBar": true}'>
<div id="content_pane" ajxpClass="FilesList" ajxpOptions='{"displayMode":"detail","replaceScroller":true, "messageBoxReference":true, "fit":"height", "fitParent":"files_lit_pane", "cellPaddingCorrection":6, "iconBgPosition" : "5px 4px"}'></div>
<div id="info_panel" ajxpClass="InfoPanel" style="top:0;" ajxpOptions='{"replaceScroller":"true", "skipActions":true,"headerToolbarOptions":{"submenuClassName":"panelHeaderMenu","submenuPosition":"bottom right","submenuOffsetTop":12,"toolbarsList":["filter","vertical_splitter-actions"],"skipBubbling":true, "skipCarousel":true,"submenuOffsetTop":2}}'></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/editor.diaporama/class.Diaporama.js
Expand Up @@ -164,7 +164,7 @@ Class.create("Diaporama", AbstractEditor, {
this.jsImageLoading = false;
this.imgTag.src = this.jsImage.src;
this.resizeImage(true);
var text = getBaseName(this.currentFile) + ' ('+this.sizes.get(this.currentFile).width+' X '+this.sizes.get(this.currentFile).height+')';
var text = getBaseName(this.currentFile);// + ' ('+this.sizes.get(this.currentFile).width+' X '+this.sizes.get(this.currentFile).height+')';
this.updateTitle(text);
}.bind(this);
Event.observe(this.zoomInput, "keypress", function(e){
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/js/ajaxplorer.js

Large diffs are not rendered by default.

Expand Up @@ -75,7 +75,7 @@ Class.create("AjxpPane", {
this.buildImageBackgroundFromConfigs(this.options.imageBackgroundFromConfigs);
}

if(options.replaceScroller){
if(this.options.replaceScroller){
this.scroller = new Element('div', {
id:'scroller_'+this.htmlElement.id,
className:'scroller_track'
Expand Down
37 changes: 30 additions & 7 deletions core/src/plugins/gui.ajax/res/js/ajaxplorer/class.AjxpTabulator.js
Expand Up @@ -52,22 +52,24 @@ Class.create("AjxpTabulator", AjxpPane, {
// Add drop shadow here, otherwise the negative value gets stuck in the CSS compilation...
var div = new Element('div', {className:'tabulatorContainer panelHeader'});
$(this.htmlElement).insert({top:div});
this.tabulatorData.each(function(tabInfo){
var shortener = this.shortenLabel;

this.tabulatorData.each(function(tabInfo){
var tab = this._renderTab(tabInfo);
div.insert(tab);
this.selectedTabInfo = tabInfo; // select last one by default
var paneObject = this.getAndSetAjxpObject(tabInfo);
if(!tabInfo.label && paneObject){
paneObject.getDomNode().observe("editor:updateTitle", function(event){
tabInfo.headerElement.down(".tab_label").update(event.memo);
tabInfo.headerElement.down(".tab_label").update(shortener(event.memo));
});
paneObject.getDomNode().observe("editor:updateIconClass", function(event){
tabInfo.headerElement.down("span").replace(new Element('span',{className:event.memo}));
});
}
if($(tabInfo.element)){
$(tabInfo.element).observe("widget:updateTitle", function(event){
tabInfo.headerElement.down(".tab_label").update(event.memo);
tabInfo.headerElement.down(".tab_label").update(shortener(event.memo));
});
}
if(this.options.saveState){
Expand Down Expand Up @@ -113,11 +115,13 @@ Class.create("AjxpTabulator", AjxpPane, {
if(tabInfo.label){
label = MessageHash[tabInfo.label] || tabInfo.label;
}
var forceTabsTips = false;
var title = MessageHash[tabInfo.title] || label.stripTags();
var options = {className:'toggleHeader toggleInactive'};
if(!this.options.tabsTips){ options.title = title; }
var td = new Element('span', options);
if(this.options.tabsTips){
var short = this.shortenLabel(label);
if(this.options.tabsTips || short!=label){
var horizontal = this.htmlElement.hasClassName('left_tabulator');
modal.simpleTooltip(
td,
Expand All @@ -132,7 +136,7 @@ Class.create("AjxpTabulator", AjxpPane, {
if(tabInfo.iconClass){
td.insert(new Element('span', {className:tabInfo.iconClass}));
}
td.insert('<span class="tab_label" ajxp_message_id="'+tabInfo.label+'">'+label+'</span>');
td.insert('<span class="tab_label" ajxp_message_id="'+tabInfo.label+'">'+short+'</span>');
td.observe('click', function(){
this.switchTabulator(tabInfo.id);
}.bind(this) );
Expand All @@ -149,6 +153,24 @@ Class.create("AjxpTabulator", AjxpPane, {

},

shortenLabel: function(label){
if(label && label.innerHTML){
if(label.down('.filenameSpan')){
var cont = label.down('.filenameSpan').innerText;
if(cont.length > 25){
cont = cont.substr(0,7)+"[...]"+cont.substr(-13);
label.down('.filenameSpan').update(cont);
}
}
return label;
}
if(!label || !label.length) return '';
if(label.length > 25){
return label.substr(0,7)+"[...]"+label.substr(-13);
}
return label;
},

openEditorForNode:function(ajxpNode, editorData){
if(this.options.uniqueTab){
// Unique Tab: close anyway
Expand Down Expand Up @@ -242,6 +264,7 @@ Class.create("AjxpTabulator", AjxpPane, {

$(this.htmlElement).insert(new Element("div", {id:tabInfo.element}));
fitHeightToBottom($(this.htmlElement).down("#"+tabInfo.element), null, this.options.fitMarginBottom);
var shortener = this.shortenLabel;

if(paneInfo.type == 'editor' && paneInfo.node && paneInfo.node.getPath){
var editorData;
Expand All @@ -267,7 +290,7 @@ Class.create("AjxpTabulator", AjxpPane, {
};
var editor = eval ( 'new '+editorData.editorClass+'(oForm, editorOptions)' );
editor.getDomNode().observe("editor:updateTitle", function(event){
tabInfo.headerElement.down(".tab_label").update(event.memo);
tabInfo.headerElement.down(".tab_label").update(shortener(event.memo));
});
editor.getDomNode().observe("editor:updateIconClass", function(event){
tabInfo.headerElement.down("span").replace(new Element('span',{className:event.memo}));
Expand All @@ -293,7 +316,7 @@ Class.create("AjxpTabulator", AjxpPane, {
if(paneInfo.widgetClass && paneInfo.widgetOptions){
var widgetInstance = new paneInfo.widgetClass($(tabInfo.element), paneInfo.widgetOptions);
$(tabInfo.element).observe("widget:updateTitle", function(event){
tabInfo.headerElement.down(".tab_label").update(event.memo);
tabInfo.headerElement.down(".tab_label").update(shortener(event.memo));
});
// SERIALIZE CONFIG
if(confPaneInfo){
Expand Down
Expand Up @@ -1233,6 +1233,8 @@ Class.create("FilesList", SelectableElements, {
item.insert({before: newItem});
item.remove();
newItem.ajxpNode = ajxpNode;
newItem.addClassName("ajxpNodeProvider");
if(ajxpNode.isLeaf()) newItem.addClassName("ajxpNodeLeaf");
this.initRows();
item.ajxpNode = null;
delete item;
Expand Down
16 changes: 6 additions & 10 deletions core/src/plugins/gui.ajax/res/themes/orbit/css/ajaxplorer.css
Expand Up @@ -2249,22 +2249,18 @@ div.header_resizer div.ascending {

.paginator
{
background-color:#fff8d1;
border-bottom-color:#dddddd;
border-bottom-style:solid;
border-bottom-width:1px;
font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif ;
font-size:11px;
height:20px;
padding-top:2px;
text-align:center;
background-color: #FFFCE8;
border: 0;
font-size: 12px;
padding: 5px;
text-align: center;
}

.paginatorInput
{
width:21px;
padding: 0 2px;
height: 14px;
height: 17px;
text-align: right;
border: 1px solid #CCCCCC;
margin-right: 2px;
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/themes/orbit/css/allz.css

Large diffs are not rendered by default.

0 comments on commit 523ff39

Please sign in to comment.