Skip to content

Commit

Permalink
Fixed wikicipher button in toolbar when not in Wiki context
Browse files Browse the repository at this point in the history
Fixed formatting
  • Loading branch information
sleroux-keep committed Apr 13, 2015
1 parent 3b377e4 commit 542f51b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions assets/javascripts/jstoolbar/wikicipher.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ jsToolBar.prototype.elements.wikicipher = {
}

window.onload=function(){
try{
var warn = document.getElementsByClassName('flash warning');
var isWiki = "/Wiki/edit";
if (warn.length>0){
document.getElementsByClassName('jstb_wikicipher')[0].hide();
}
if(window.location.pathname.indexOf(isWiki, window.location.pathname.length - isWiki.length) !== -1){
// nothing to do...
}else{
//hide wikicipher toolbar button
document.getElementsByClassName('jstb_wikicipher')[0].style.visibility='hidden';
var warn = document.getElementsByClassName('flash warning');
var isWiki = "/Wiki/edit";
if (warn.length>0){
document.getElementsByClassName('jstb_wikicipher')[0].hide();
}
if(window.location.pathname.indexOf(isWiki, window.location.pathname.length - isWiki.length) !== -1){
// nothing to do...
}else{
//hide wikicipher toolbar buttons
var elems = document.getElementsByClassName('jstb_wikicipher');
for(var i = 0; i != elems.length; ++i){
elems[i].style.visibility = "hidden";
}
}catch(e){
alert(e);
}

};
2 changes: 1 addition & 1 deletion lib/wiki_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def decodeContent(originalText,params,tags,export)

decoded = ''+decoded+''
else
decoded = "<notextile>"+decoded+"</notextile>"
decoded = "<notextile>"+decoded+"</notextile>"
decoded = '{{decoded_start}} '+decoded+' {{decoded_stop}}'
end
originalText = originalText.gsub(m.strip.force_encoding("UTF-8"), decoded.strip.force_encoding("UTF-8"))
Expand Down

0 comments on commit 542f51b

Please sign in to comment.