Skip to content

Commit 86039f9

Browse files
committed
Update method toggle's interface
1. Display the method toggle button by default instead of displaying on hover 2. Only toggle the source code when clicking the method toggle button, not when clicking the entire method title section. This will allow us to display an anchor link next to the method title 3. Simplify the toggle source button's appearance
1 parent 6ea31eb commit 86039f9

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

lib/rdoc/generator/template/darkfish/class.rhtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
gsub(/(.*)[-=]>/, '\1→') %>
110110
</span>
111111
<%- if i == 0 and method.token_stream then -%>
112-
<span class="method-click-advice">click to toggle source</span>
112+
<span class="method-click-advice">Toggle source</span>
113113
<%- end -%>
114114
</div>
115115
<%- end -%>
@@ -122,7 +122,7 @@
122122
<span class="method-name"><%= h method.name %></span><span
123123
class="method-args"><%= h method.param_seq %></span>
124124
<%- if method.token_stream then -%>
125-
<span class="method-click-advice">click to toggle source</span>
125+
<span class="method-click-advice">Toggle source</span>
126126
<%- end -%>
127127
</div>
128128
<%- end -%>

lib/rdoc/generator/template/darkfish/css/rdoc.css

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,6 @@ main .method-description .method-calls-super {
608608

609609
main .method-detail {
610610
margin-bottom: 2.5em;
611-
cursor: pointer;
612611
}
613612

614613
main .method-detail:target {
@@ -630,16 +629,12 @@ main .method-heading :visited {
630629
main .method-click-advice {
631630
position: absolute;
632631
top: 2px;
633-
right: 5px;
632+
right: 0px;
634633
font-size: 12px;
635-
color: #9b9877;
636-
visibility: hidden;
637634
padding-right: 20px;
638635
line-height: 20px;
639-
background: url(../images/zoom.png) no-repeat right top;
640-
}
641-
main .method-header:hover .method-click-advice {
642-
visibility: visible;
636+
color: var(--secondary-color);
637+
cursor: pointer;
643638
}
644639

645640
main .method-alias .method-heading {

lib/rdoc/generator/template/darkfish/js/darkfish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function showSource( e ) {
3434
};
3535

3636
function hookSourceViews() {
37-
document.querySelectorAll('.method-heading').forEach(function (codeObject) {
37+
document.querySelectorAll('.method-click-advice').forEach(function (codeObject) {
3838
codeObject.addEventListener('click', showSource);
3939
});
4040
};

0 commit comments

Comments
 (0)