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

Commit

Permalink
Fix tabs and scrolling issues in RepositoryEditor
Browse files Browse the repository at this point in the history
Make sure to disableShortcutsOnForm when replicating rows
  • Loading branch information
cdujeu committed Dec 14, 2013
1 parent 2084d57 commit 85e7c1b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Class.create("RepositoryEditor", AbstractEditor, {
fitHeightToBottom(metaPane, oElement);
};
this.tab = new AjxpSimpleTabs(oFormObject.down("#repositoryTabulator"));
this.tab.observe("switch", this.resize.bind(this));
this.actions.get("saveButton").observe("click", this.save.bind(this) );
if(!modal._editorOpener) {
modal.setCloseValidation(this.validateClose.bind(this));
Expand Down Expand Up @@ -236,7 +237,7 @@ Class.create("RepositoryEditor", AbstractEditor, {
accordionContent.insert(form);
var saveButton = null;
if(insertSave){
accordionContent.insert("<div tabindex='0' name='meta_source_edit' class='largeButton SF_disabled' style='min-width:70px; margin-top: 20px;margin-right: 0;'><span class='icon-save'></span> <span class=\"title\">Save</span></div>");
accordionContent.insert("<div tabindex='0' name='meta_source_edit' class='largeButton SF_disabled' style='min-width:70px; margin-top: 20px;margin-right: 0;float: right;'><span class='icon-save'></span> <span class=\"title\">Save</span></div>");
saveButton = accordionContent.down("div[name='meta_source_edit']");
}
accordionContent.insert("<div tabindex='0' name='meta_source_delete' class='largeButton' style='min-width:70px; margin-top: 20px;margin-right: 0;'><span class='icon-trash'></span> <span class=\"title\">Remove</span></div>");
Expand All @@ -257,7 +258,7 @@ Class.create("RepositoryEditor", AbstractEditor, {
}.bind(this) );
}
}
this.metaTab = new AjxpSimpleTabs(this.metaPane.down("#metaTabulator"));
this.metaTab = new AjxpSimpleTabs(this.metaPane.down("#metaTabulator"), {autoHeight:true});
metaPane.select("div.largeButton").invoke("observe", "click", this.metaActionClick.bind(this));
}
if(!metaPane.down('div.metaPane')){
Expand Down Expand Up @@ -305,14 +306,15 @@ Class.create("RepositoryEditor", AbstractEditor, {
}
modal.refreshDialogAppearance();
modal.refreshDialogPosition();
addFormDetail.insert("<div class='largeButton' style='width:100px;margin-top: 20px;margin-left: 0'><span class='icon-plus-sign'></span> <span>"+MessageHash['ajxp_repository_editor.11']+"</span></div>");
addFormDetail.insert("<div class='largeButton' style='width:100px;margin-top: 20px;margin-left: 0; float: right;'><span class='icon-plus-sign'></span> <span>"+MessageHash['ajxp_repository_editor.11']+"</span></div>");
addFormDetail.down(".largeButton")._form = addForm;
addFormDetail.down(".largeButton").observe("click", this.metaActionClick.bind(this));
this.resize();
}.bind(this));

this.metaPane.setStyle({overflowY:'hidden'});
this.metaPane.setStyle({overflowY:'auto'});
this.metaPane.resizeOnShow = function(tab){
fitHeightToBottom(this.metaPane.down("#metaTabulator"), null, 30);
//fitHeightToBottom(this.metaPane.down("#metaTabulator"), null, 30);
this.metaTab.resize();
}.bind(this);
this.metaTab.resize();
Expand Down Expand Up @@ -378,11 +380,11 @@ Class.create("RepositoryEditor", AbstractEditor, {
if(size){
this.contentMainContainer.setStyle({height:(size - parseInt(this.element.down('.editor_header').getHeight()) - 30) +"px"});
}else{
fitHeightToBottom(this.contentMainContainer, this.element.up(".dialogBox"));
fitHeightToBottom(this.contentMainContainer, this.element.up(".dialogBox"), 30);
}
this.tab.resize();
if(this.metaTab){
fitHeightToBottom(this.metaPane.down("#metaTabulator"), null, 30);
//fitHeightToBottom(this.metaPane.down("#metaTabulator"), null, 30);
this.metaTab.resize();
}
this.element.fire("editor:resize", size);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/editor.ajxp_repository/i18n/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"4" => "Workspace Features",
"5" => "Select feature",
"6" => "Edit parameters",
"7" => "Use the selector below to activate plugins that will add more functionnalities to the workspace.",
"7" => "Use the selector below to activate plugins that will add more functionnalities to the workspace. Don't forget to click on the Add a Source button to apply your changes.",
"8" => "Click on a plugin to edit its parameters, or simply remove the feature",
"9" => "%s Plugins",
"10" => "Meta Sources",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/js/ajaxplorer.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Class.create("AjxpSimpleTabs", AjxpPane, {

panes:null,
tabRow:null,
fitHeight: true,

/**
* Constructor
Expand All @@ -31,11 +32,14 @@ Class.create("AjxpSimpleTabs", AjxpPane, {
*/
initialize : function($super, htmlElement, tabulatorOptions){
$super(htmlElement);
if(tabulatorOptions && tabulatorOptions.autoHeight){
this.fitHeight = false;
}
if(!htmlElement.down("div.tabpanes")){
htmlElement.insert(new Element("div", {className:"tabpanes"}));
}
this.panes = htmlElement.down("div.tabpanes");
fitHeightToBottom(this.panes, this.htmlElement);
if(this.fitHeight) fitHeightToBottom(this.panes, this.htmlElement);
if(htmlElement.down("ul.tabrow")){
this.tabRow = htmlElement.down("ul.tabrow");
htmlElement.down("ul.tabrow").select("li").each(function(tab){
Expand Down Expand Up @@ -66,14 +70,14 @@ Class.create("AjxpSimpleTabs", AjxpPane, {
pane.addClassName("tabPane");
tab.tabPANE = pane;
this.panes.insert(pane);
fitHeightToBottom(pane, this.panes);
if(this.fitHeight) fitHeightToBottom(pane, this.panes);
pane.setStyle({overflowY:"auto"});
tab.setSelected = function(){
this.panes.childElements("div.tabPane").invoke("hide");
tab.tabPANE.show();
this.tabRow.select("li").invoke("removeClassName", "selected");
tab.addClassName("selected");
pane.setStyle({height:parseInt(this.panes.getHeight())+"px"});
if(this.fitHeight) pane.setStyle({height:parseInt(this.panes.getHeight())+"px"});
if(tab.tabPANE.resizeOnShow){
tab.tabPANE.resizeOnShow(tab,tab.tabPANE);
}
Expand All @@ -87,14 +91,15 @@ Class.create("AjxpSimpleTabs", AjxpPane, {
selectTabByIndex : function(index){
try{
this.tabRow.select("li")[index].setSelected();
this.notify("switch");
}catch(e){}
},

/**
* Resizes the widget
*/
resize : function(){
fitHeightToBottom(this.panes, this.htmlElement);
if(this.fitHeight) fitHeightToBottom(this.panes, this.htmlElement);
var tRW = this.tabRow.getWidth();
var padding = 0;
var lis = this.tabRow.select("li");
Expand All @@ -115,7 +120,7 @@ Class.create("AjxpSimpleTabs", AjxpPane, {
tab.setStyle({maxWidth:maxWidth+'px'});
}
if(tab.tabPANE){
fitHeightToBottom(tab.tabPANE, this.panes);
if(this.fitHeight) fitHeightToBottom(tab.tabPANE, this.panes);
if(tab.hasClassName("selected") && tab.tabPANE.resizeOnShow){
tab.tabPANE.resizeOnShow(tab, tab.tabPANE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ Class.create("FormManager", {
form.select("input,textarea,select").invoke("observe", "blur", function(){
ajaxplorer.enableAllKeyBindings();
});
form.select(".SF_replicableGroup").invoke("writeAttribute", "data-disableShortcutsOnForm", "true");
},

confirmExistingImageDelete : function(modalParent, imgSrc, hiddenInput, param){
Expand Down Expand Up @@ -788,6 +789,9 @@ Class.create("FormManager", {
});
tr.insert(removeButton);
}
if(tr.readAttribute('data-disableShortcutsOnForm')){
this.disableShortcutsOnForm(tr);
}
if(form.ajxpPaneObject) form.ajxpPaneObject.notify('after_replicate_row', tr);
/*
templateRow.select('input', 'select', 'textarea').each(function(origInput){
Expand Down

0 comments on commit 85e7c1b

Please sign in to comment.