소스 검색

Toggle code expansion

Andrew Kane 8 년 전
부모
커밋
d46ea179f7
2개의 변경된 파일16개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 0
      app/assets/stylesheets/blazer/application.css
  2. 7 1
      app/views/blazer/queries/show.html.erb

+ 9 - 0
app/assets/stylesheets/blazer/application.css

@@ -165,3 +165,12 @@ input.search:focus {
 #header a.active {
   color: #999;
 }
+
+#code {
+  max-height: 236px;
+  overflow: hidden;
+}
+
+#code.expanded {
+  max-height: none;
+}

+ 7 - 1
app/views/blazer/queries/show.html.erb

@@ -135,7 +135,13 @@
   </form>
 <% end %>
 
-<pre style="max-height: 236px; overflow: hidden;" onclick="this.style.maxHeight = 'none';"><code><%= @statement %></code></pre>
+<pre id="code"><code><%= @statement %></code></pre>
+
+<script>
+  $("#code").click( function () {
+    $(this).toggleClass("expanded");
+  })
+</script>
 
 <% if @success %>
   <div id="results">