Commit 62ea01f6ab710b3acbb11e0c8e04b37079680abd

Authored by Antonio Terceiro
1 parent fa886513

Removing cool-but-useless help feature

I *like* deleting code. :-)
app/views/layouts/application.rhtml
... ... @@ -43,7 +43,7 @@
43 43 " action_"+ @controller.controller_name() +"_"+ @controller.action_name() +
44 44 ' ' + (logged_in? ? 'logged-in' : 'not-logged-in')
45 45 %>' onload='noosfero_init();'
46   - help=<%= _('Pass the mouse over page elements to get help on them. Click the question mark icon on the top-right corner to deactivate this help window.').inspect %> onresize="registerDocumentSize()">
  46 + onresize="registerDocumentSize()">
47 47 <script type="text/javascript">
48 48 /* Adds a class to "msie" to the body element if a Microsoft browser is
49 49 * detected. This is needed to workaround several of their limitations.
... ... @@ -76,12 +76,7 @@
76 76  
77 77 <div id="beta-tag"><span>BETA</span></div>
78 78  
79   - <div id="noosfero_bar" help="#noosfero_bar_help">
80   - <div id="noosfero_bar_help" style="display:none">
81   - <%= _("This is %s's shortcuts bar. Using it you have access to the main features of the environment and you find the information of your interest more quickly.") % @environment.name %>
82   - <p/>
83   - <%= _("This bar helps you find information following two paths or <strong>dimensions</strong>. First dimension is composed of <em>categories</em>, which you'll find in the colored tabs in the top. Second dimension has <em>content types</em>, and you'll find them in the animated bar on your right.") % @environment.name %>
84   - </div>
  79 + <div id="noosfero_bar">
85 80  
86 81 <div id="navigation_bar">
87 82 <%= link_to "<span>"+ @environment.name() +"</span>",
... ... @@ -107,9 +102,8 @@
107 102 <%= render :file => 'shared/user_menu' %>
108 103 </div><!-- id='user_box' -->
109 104  
110   - <a href="#" id="btShowHelp" class="icon-help32on help-on icon-help-on"
111   - title="<%= _('Turn help on/off') %>"
112   - onclick="mouseHelpOnOff(); return false"><span><%= _('Help') %></span></a>
  105 + <a href="/doc" id="btShowHelp" class="icon-help32on help-on icon-help-on"
  106 + title="<%= _('Documentation') %>"><span><%= _('Documentation') %></span></a>
113 107  
114 108 </div><!-- id="noosfero_bar" -->
115 109  
... ... @@ -136,15 +130,6 @@
136 130 <%= theme_footer %>
137 131 </div><!-- id="footer" -->
138 132  
139   - <div id="helpBox" style="display:none">
140   - <div id="helpBoxBody">
141   - <div class="helpAvatar"></div>
142   - <div id="helpBoxContent"></div>
143   - </div>
144   - </div>
145   - <%= javascript_include_tag 'show-mouse-help' %>
146   - <%= javascript_include_tag 'noosfero-show-help' %>
147   -
148 133 <% if environment.enabled?('warn_obsolete_browser') %>
149 134  
150 135 <div id="better-browser-promotion" style="display:none">
... ...
app/views/layouts/wizard.rhtml
... ... @@ -23,20 +23,8 @@
23 23 %>
24 24 </head>
25 25 <body class='noosfero' id='wizard'>
26   - <div id="wizard-content">
27   - <a href="#" id="btShowHelp" class="icon-help32on help-on icon-help-on"
28   - title="<%= _('Turn help on/off') %>"
29   - onclick="mouseHelpOnOff(); return false"><span><%= _('Help') %></span></a>
30   - <%= yield %>
31   - </div><!-- id="wizard-content" -->
32   - <div id="helpBox" style="display:none">
33   - <div id="helpBoxBody">
34   - <div class="helpAvatar"></div>
35   - <div id="helpBoxContent"></div>
36   - </div>
37   - </div>
38   - <%= javascript_include_tag 'show-mouse-help' %>
39   - <%= javascript_include_tag 'noosfero-show-help' %>
40   -
  26 + <div id="wizard-content">
  27 + <%= yield %>
  28 + </div><!-- id="wizard-content" -->
41 29 </body>
42 30 </html>
... ...
public/javascripts/noosfero-show-help.js
... ... @@ -1,41 +0,0 @@
1   -
2   -function mouseHelpOnOff() {
3   - if ( pageHelp.info.updateBox ) {
4   - showMouseHelpOff()
5   - $("btShowHelp").className = "icon-help32on help-on icon-help-on";
6   - } else {
7   - showMouseHelpOn()
8   - $("btShowHelp").className = "icon-help32off help-off icon-help-off";
9   - }
10   - var date = new Date();
11   - // open/close help on help button is remembed by one year:
12   - date.setTime( date.getTime() + ( 365*24*60*60*1000 ) );
13   - var expires = "; expires=" + date.toGMTString();
14   - document.cookie = "mouseHelpTurnOn="+ pageHelp.info.updateBox + expires +"; path=/";
15   -}
16   -
17   -function mouseHelpOn() {
18   - mouseHelpOnOff();
19   - new Effect.Fade( "noticeAboutHelp" );
20   -}
21   -
22   -function mouseHelpOff() {
23   - var date = new Date();
24   - // cancel help on question box is remembed by 5 days:
25   - date.setTime( date.getTime() + ( 5*24*60*60*1000 ) );
26   - var expires = "; expires=" + date.toGMTString();
27   - document.cookie = "mouseHelpTurnOn=false" + expires +"; path=/";
28   - new Effect.Fade( "noticeAboutHelp" );
29   -}
30   -
31   -if ( document.cookie.indexOf("mouseHelpTurnOn=") > -1 ) {
32   - if ( document.cookie.indexOf("mouseHelpTurnOn=true") > -1 ) {
33   - mouseHelpOnOff();
34   - }
35   -}
36   -
37   -/* O Noosfero não deve mais propor o help na entrada
38   -else {
39   - new Effect.Appear( "noticeAboutHelp", {duration:2} );
40   -}
41   -*/
public/javascripts/show-mouse-help.js
... ... @@ -1,249 +0,0 @@
1   -/*
2   -** : : : : : : How to use the Show Help : : : : : :
3   -** For each interesting page element you can put the
4   -** attribute help. The help attribute can be any string
5   -** text (scaped to not distroy the html) or some html id.
6   -** The help for each element will be showed automaticaly
7   -** when the mouse is over that. Yeah... we can turn on
8   -** this help system calling the function showMouseHelpOn()
9   -** and turn off calling the function showMouseHelpOff().
10   -**
11   -** Examples:
12   -**
13   -** <a href="..." help="this is a link">my link</a>
14   -**
15   -** <form help="#myLongHelp"> ... </form>
16   -** <div id="myLongHelp" style="display:none">
17   -** This is a <b>loooong</b> help. <p/>
18   -** You can put <code>HTML</code> here too!
19   -** </div>
20   -**
21   -** You need to put the style="display:none" on the long
22   -** help container to it's text do not noise the web page.
23   -**
24   -** If the mouse pointed element do not have a help,
25   -** each one of this parents will be visited to find
26   -** the help. If no one has a help the help box turn
27   -** to non visible.
28   -*/
29   -
30   -/*
31   -** This script can be loaded by the page and it's iFrames,
32   -** as in the Noofero - community network system. Some of
33   -** this code will enable the iFrame => parent information.
34   -*/
35   -
36   -/*
37   -** pageHelp has informations for this page/frame
38   -** to not conflict with other frames.
39   -*/
40   -var pageHelp = {};
41   -if ( navigator.userAgent.indexOf('MSIE') != -1 ) {
42   - pageHelp.isIE = ( navigator.userAgent.indexOf('Opera') == -1 )
43   -}
44   -// If i'm in a iFrame, get the iFrame reference:
45   -if ( window.parent == window ) {
46   - pageHelp.myFrame = false;
47   -} else {
48   - var randTit = "iframe"+ Math.random();
49   - window.frameHelpId = randTit;
50   - var docFrames = window.parent.document.getElementsByTagName("iframe");
51   - var f;
52   - for ( var i=0; f=docFrames[i]; i++ ) {
53   - if ( f.contentWindow && ( f.contentWindow.frameHelpId == randTit ) ) {
54   - pageHelp.myFrame = f;
55   - }
56   - }
57   -}
58   -
59   -/*
60   -** pageHelp.info is a reference for a cetral help information.
61   -** All frames will update the information here.
62   -*/
63   -if ( !window.parent.pageHelpInfo ) window.parent.pageHelpInfo = {};
64   -pageHelp.info = window.parent.pageHelpInfo;
65   -pageHelp.info.incPos = { x:20, y:20 };
66   -pageHelp.info.myDoc = window.parent.document;
67   -
68   -mouseBli = 0;
69   -function getHelp( ev ) {
70   - var helpInfo = pageHelp.info;
71   - if ( helpInfo.updateBox ) {
72   - if ( window.event ) {
73   - ev = window.event;
74   - var el = ev.srcElement;
75   - } else {
76   - var el = ev.target;
77   - }
78   - var mX = 0;
79   - var mY = 0;
80   - if ( ev.pageX || ev.pageY) {
81   - mX = ev.pageX;
82   - mY = ev.pageY;
83   - }
84   - else if (ev.clientX || ev.clientY) {
85   - mX = ev.clientX;
86   - mY = ev.clientY;
87   - if ( pageHelp.isIE ) {
88   - mX += helpInfo.myDoc.body.scrollLeft;
89   - mY += helpInfo.myDoc.body.scrollTop;
90   - }
91   - }
92   - if ( pageHelp.myFrame ) {
93   - var fPos = pageHelp.getPos( pageHelp.myFrame );
94   - mX += fPos.x;
95   - mY += fPos.y;
96   - }
97   - var box = helpInfo.helpBox;
98   - helpInfo.mX = mX;
99   - helpInfo.mY = mY;
100   - if ( mX > ( helpInfo.myDoc.body.clientWidth / 1.8 ) ) {
101   - movePageHelpToTheLeftMouseSide()
102   - } else {
103   - movePageHelpToTheRightMouseSide()
104   - }
105   - if ( ( mY + box.clientHeight + 40 ) >
106   - ( helpInfo.myDoc.body.clientHeight + helpInfo.myDoc.body.scrollTop )
107   - ) {
108   - mY = helpInfo.myDoc.body.clientHeight + helpInfo.myDoc.body.scrollTop
109   - - box.clientHeight - 40;
110   - }
111   - if ( box ) {
112   - debug = mouseBli++ +" "+ el.nodeName;
113   - while ( el.parentNode.getAttribute && ! el.getAttribute("help") ) { el = el.parentNode }
114   - debug += " :: "+ el.nodeName +" "+ el.getAttribute("help");
115   - debug += "<br>"+ pageHelp.myFrame.src +" x:"+ mX +" y:"+ mY;
116   - var txt = el.getAttribute("help");
117   - if ( txt != box.txt ) {
118   - if ( txt ) {
119   - helpWow(true);
120   - box.style.display = "block";
121   - if ( txt != "FALSE" ) {
122   - var realTxt = txt;
123   - if ( /^#.+/.test( txt ) ) {
124   - var txtEl = el.ownerDocument.getElementById( txt.replace(/#/,"") );
125   - if ( txtEl ) realTxt = txtEl.innerHTML;
126   - }
127   - box.content.innerHTML = '<p>'+ realTxt +'</p>'+
128   - '<br style="clear:both" />'+
129   - '<div class="help-force-clear-ieworkarroundbug"'+
130   - ' style="height:1px; overflow:hidden"></div>';
131   - }
132   - } else {
133   - box.style.display = "none";
134   - }
135   - }
136   - box.txt = txt;
137   - box.style.left = ( mX + helpInfo.incPos.x ) +"px";
138   - box.style.top = ( mY + helpInfo.incPos.y ) +"px";
139   - }
140   - }
141   -}
142   -
143   -pageHelp.getPos = function (obj) {
144   - var x = y = 0;
145   - if (obj.offsetParent) {
146   - do {
147   - x += obj.offsetLeft;
148   - y += obj.offsetTop;
149   - } while (obj = obj.offsetParent);
150   - }
151   - return { x:x, y:y };
152   -}
153   -
154   -function movePageHelpToTheLeftMouseSide() {
155   - clearTimeout( movePageHelpToTheRightMouseSide.timeout )
156   - clearTimeout( movePageHelpToTheLeftMouseSide.timeout )
157   - if ( pageHelp.info.incPos.x > -( pageHelp.info.helpBox.clientWidth + 20 ) ) {
158   - pageHelp.info.incPos.x -= 10;
159   - if ( ( pageHelp.info.mX + pageHelp.info.incPos.x + pageHelp.info.helpBox.clientWidth ) >
160   - pageHelp.info.myDoc.body.clientWidth ) {
161   - pageHelp.info.incPos.x =
162   - pageHelp.info.myDoc.body.clientWidth - pageHelp.info.helpBox.clientWidth - pageHelp.info.mX - 10;
163   - }
164   - pageHelp.info.helpBox.style.left = ( pageHelp.info.mX + pageHelp.info.incPos.x ) +"px";
165   - movePageHelpToTheLeftMouseSide.timeout =
166   - setTimeout( "movePageHelpToTheLeftMouseSide()", 20 );
167   - }
168   -}
169   -
170   -function movePageHelpToTheRightMouseSide() {
171   - clearTimeout( movePageHelpToTheRightMouseSide.timeout )
172   - clearTimeout( movePageHelpToTheLeftMouseSide.timeout )
173   - if ( pageHelp.info.incPos.x < 20 ) {
174   - pageHelp.info.incPos.x += 10;
175   - pageHelp.info.helpBox.style.left = ( pageHelp.info.mX + pageHelp.info.incPos.x ) +"px";
176   - movePageHelpToTheRightMouseSide.timeout =
177   - setTimeout( "movePageHelpToTheRightMouseSide()", 20 );
178   - }
179   -}
180   -
181   -if( window.addEventListener ) { // Standard
182   - document.body.addEventListener( "mousemove", getHelp, false );
183   -}
184   -if( window.attachEvent ) { // IE
185   - document.body.attachEvent( "onmousemove", getHelp );
186   -}
187   -
188   -function helpWow( start ) {
189   - var bg = pageHelp.info.bg;
190   - var box = pageHelp.info.helpBox.style;
191   - var change = false;
192   - if ( start ) {
193   - box.backgroundColor = "rgb("+ bg.r.wow +","+ bg.g.wow +","+ bg.b.wow +")";
194   - bg.r.cur = bg.r.wow;
195   - bg.g.cur = bg.g.wow;
196   - bg.b.cur = bg.b.wow;
197   - change = true;
198   - } else {
199   - for ( c in bg ) {
200   - if ( bg[c].cur != bg[c].orig ) {
201   - bg[c].cur += bg[c].inc;
202   - if ( ( bg[c].inc > 0 ) && ( bg[c].cur > bg[c].orig ) ) bg[c].cur = bg[c].orig
203   - if ( ( bg[c].inc < 0 ) && ( bg[c].cur < bg[c].orig ) ) bg[c].cur = bg[c].orig
204   - change = true;
205   - }
206   - }
207   - }
208   - if ( change ) {
209   - box.backgroundColor = "rgb("+ Math.round(bg.r.cur) +","+
210   - Math.round(bg.g.cur) +","+
211   - Math.round(bg.b.cur) +")";
212   - setTimeout( "helpWow()", 20 )
213   - }
214   -}
215   -
216   -function showMouseHelpOn() {
217   - pageHelp.info.helpBox = document.getElementById("helpBox");
218   - pageHelp.info.helpBox.content = document.getElementById("helpBoxContent");
219   - pageHelp.info.helpBox.setAttribute( "help", "FALSE" );
220   - pageHelp.info.updateBox = true;
221   - pageHelp.info.myDoc.body.style.cursor = "help";
222   - if ( window.getComputedStyle ) {
223   - var bg = window.getComputedStyle( pageHelp.info.helpBox, "" ).backgroundColor;
224   - } else {
225   - var bg = pageHelp.info.helpBox.currentStyle.backgroundColor;
226   - }
227   - if ( /^#/.test(bg) ) {
228   - var r = parseInt( bg.replace(/^#(..)..../,"$1"), 16 );
229   - var g = parseInt( bg.replace(/^#..(..)../,"$1"), 16 );
230   - var b = parseInt( bg.replace(/^#....(..)/,"$1"), 16 );
231   - } else {
232   - bg = bg.replace(/\s/g, "");
233   - var r = parseInt( bg.replace(/^rgb\(([0-9]+),[0-9]+,[0-9]+\)/,"$1") );
234   - var g = parseInt( bg.replace(/^rgb\([0-9]+,([0-9]+),[0-9]+\)/,"$1") );
235   - var b = parseInt( bg.replace(/^rgb\([0-9]+,[0-9]+,([0-9]+)\)/,"$1") );
236   - }
237   - bg = { r:{orig:r,wow:255}, g:{orig:g,wow:250}, b:{orig:b,wow:100} }
238   - for ( c in bg ) {
239   - bg[c].inc = ( bg[c].orig - bg[c].wow ) / 20;
240   - }
241   - pageHelp.info.bg = bg;
242   -}
243   -
244   -function showMouseHelpOff() {
245   - pageHelp.info.helpBox.style.display = "none";
246   - pageHelp.info.updateBox = false;
247   - pageHelp.info.myDoc.body.style.cursor = "default";
248   -}
249   -
public/stylesheets/help.css
... ... @@ -18,59 +18,3 @@
18 18 display: none;
19 19 }
20 20  
21   -#helpBox {
22   - position: absolute;
23   - top: 350px;
24   - border: 2px solid #26A;
25   - background: #A0B8D0;
26   - width: 35%;
27   - z-index: 2000;
28   -}
29   -
30   -#helpBoxBody {
31   - border: 1px solid #E8F0F8;
32   - padding: 0px 5px 0px 10px;
33   -}
34   -
35   -.helpAvatar {
36   - float: left;
37   - margin: 5px 10px 5px -5px;
38   - width: 48px;
39   - height: 48px;
40   - background: url("../images/help-avatar.gif");
41   -}
42   -.msie6 .helpAvatar {
43   - margin: 5px 8px 5px -2px;
44   -}
45   -
46   -#helpBoxBody p {
47   - margin: 0px;
48   - padding: 8px 0px 0px 0px;
49   -}
50   -
51   -.help-force-clear-ieworkarroundbug {
52   - margin-top: -2px;
53   -}
54   -
55   -/* * * Notice About Help Box * * */
56   -
57   -#noticeAboutHelp {
58   - position: absolute;
59   - top: 200px;
60   - left: 50%;
61   - width: 400px;
62   - max-width: 370px;
63   - padding: 10px 15px 0px 15px;
64   - margin-left: -200px;
65   - border: 2px solid #204A87;
66   - background: #729FCF;
67   - text-align: justify;
68   -}
69   -.msie #noticeAboutHelp {
70   - padding: 10px 15px;
71   -}
72   -
73   -#noticeAboutHelp .bts {
74   - text-align: center;
75   -}
76   -
... ...