Skip to content

Commit 3dade77

Browse files
committed
move toggle source, remove link to top
1 parent a392e29 commit 3dade77

File tree

4 files changed

+23
-25
lines changed

4 files changed

+23
-25
lines changed

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@
8282
gsub( /^\w+\./m, '')).
8383
gsub(/(.*)[-=]>/, '\1→') %>
8484
</span>
85-
<%- if i == 0 and method.token_stream then -%>
86-
<span class="method-click-advice">toggle source</span>
87-
<%- end -%>
8885
</div>
8986
<%- end -%>
9087
<%- elsif method.has_call_seq? then -%>
@@ -93,11 +90,8 @@
9390
</div>
9491
<%- else -%>
9592
<div class="method-heading">
96-
<span class="method-name"><%= h method.name %></span><span
97-
class="method-args"><%= h method.param_seq %></span>
98-
<%- if method.token_stream then -%>
99-
<span class="method-click-advice">toggle source</span>
100-
<%- end -%>
93+
<span class="method-name"><%= h method.name %></span>
94+
<span class="method-args"><%= h method.param_seq %></span>
10195
</div>
10296
<%- end -%>
10397
</div>
@@ -115,6 +109,7 @@
115109
</div>
116110
<%- end -%>
117111
<%- if method.token_stream then -%>
112+
<button class="toggle-source">toggle source</button>
118113
<div class="method-source-code" id="<%= method.html_name %>-source">
119114
<pre><%= method.markup_code %></pre>
120115
</div>

lib/rdoc/generator/template/rorvswild/css/rdoc.css

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,15 @@ details > summary::after {
208208
content: '+';
209209
font-size: 0.833em;
210210
font-weight: bold;
211-
width: 22px;
212-
height: 22px;
213-
line-height: 20px;
211+
width: 2em;
212+
height: 2em;
213+
line-height: 2em;
214214
border-radius: 50%;
215215
text-align: center;
216216
box-shadow: 0 0 0 1px var(--color-border) inset;
217217
transition: transform 0.2s ease;
218218
display: inline-block;
219+
flex-shrink: 0;
219220
cursor: pointer;
220221
position: relative;
221222
top: 2px;
@@ -707,26 +708,29 @@ em {
707708
font-size: 1rem;
708709
font-weight: bold;
709710
color: var(--color-text);
710-
cursor: pointer;
711711
}
712712

713713
.method-heading span { background-color: var(--color-code-background); }
714714

715715
.method-heading :any-link { color: inherit; }
716716

717-
.method-heading .method-click-advice {
718-
background-color: transparent;
719-
position: absolute;
720-
color: var(--color-text-light);
721-
right: 0;
722-
font-size: 0.694rem;
717+
.toggle-source {
718+
margin-top: 0.5rem;
719+
font-size: 0.833rem;
723720
font-weight: 400;
724-
visibility: hidden;
725-
padding-right: 0;
726-
line-height: 1.5rem;
721+
line-height: 1rem;
722+
background: var(--color-code-background);
723+
box-shadow: 0 0 0 1px var(--color-border);
724+
color: var(--color-text);
725+
border-radius: 2px;
726+
border: none;
727+
cursor: pointer;
727728
}
728729

729-
.method-header:hover .method-click-advice { visibility: visible; }
730+
.toggle-source:hover {
731+
box-shadow: 0 0 0 1px var(--color-text-light);
732+
color: var(--color-title);
733+
}
730734

731735
.method-description,
732736
.aliases {

lib/rdoc/generator/template/rorvswild/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('.toggle-source').forEach(function (codeObject) {
3838
codeObject.addEventListener('click', showSource);
3939
});
4040
};

lib/rdoc/markup/to_html.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ def accept_heading heading
308308
end
309309
@res << to_html(heading.text)
310310
unless @options.pipe then
311-
@res << "<span><a href=\"##{label}\">&para;</a>"
312-
@res << " <a href=\"#top\">&uarr;</a></span>"
311+
@res << "<span><a href=\"##{label}\">&para;</a></span>"
313312
end
314313
@res << "</h#{level}>\n"
315314
end

0 commit comments

Comments
 (0)