Commit 76be57fcf2d8c5bb9ab4ae0837233e6c7b8a0698

Authored by Dmitriy Zaporozhets
1 parent b95a56c1

Init highlgiht js and render for blob. Improve css for it

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/javascripts/main.js.coffee
... ... @@ -59,6 +59,8 @@ $ -&gt;
59 59 # Click a .one_click_select field, select the contents
60 60 $(".one_click_select").on 'click', -> $(@).select()
61 61  
  62 + hljs.initHighlightingOnLoad()
  63 +
62 64 $('.remove-row').bind 'ajax:success', ->
63 65 $(this).closest('li').fadeOut()
64 66  
... ...
app/assets/stylesheets/generic/files.scss
... ... @@ -144,7 +144,7 @@
144 144 &.code {
145 145 padding: 0;
146 146  
147   - table.lines {
  147 + .highlighted-data {
148 148 border: none;
149 149 box-shadow: none;
150 150 margin: 0px;
... ... @@ -158,47 +158,34 @@
158 158 font-size: 12px !important;
159 159 line-height: 16px !important;
160 160 margin: 0;
161   - padding: 10px 0;
162 161 }
163   - td {
164   - border: none;
165   - margin: 0;
166   - padding: 0;
167   - vertical-align: top;
168 162  
169   - &:first-child {
170   - background: #eee;
171   - width: 50px;
172   - }
173   - &:last-child {
174   - }
175   - }
176   - tr:hover {
177   - background: none;
  163 + .hljs {
  164 + padding: 0;
178 165 }
179 166  
180   - pre.line_numbers {
181   - color: #666;
182   - padding: 10px 6px 10px 0;
  167 + .line-numbers {
  168 + padding: 10px;
183 169 text-align: right;
184   - background: #EEE;
  170 + float: left;
  171 + width: 60px;
185 172  
186 173 a {
187   - color: #666;
  174 + display: block;
  175 + font-size: 12px !important;
  176 + line-height: 16px !important;
188 177  
189 178 i {
190 179 display: none;
191   - font-size: 14px;
192   - line-height: 14px;
193 180 }
  181 +
194 182 &:hover i {
195   - display: inherit;
  183 + display: inline;
196 184 }
197 185 }
198 186 }
199 187  
200 188 .highlight {
201   - border-left: 1px solid #DEE2E3;
202 189 overflow: auto;
203 190 overflow-y: hidden;
204 191  
... ...
app/views/projects/blob/_text.html.haml
... ... @@ -8,7 +8,16 @@
8 8 - else
9 9 .file-content.code
10 10 - unless blob.empty?
11   - %div{class: user_color_scheme_class}
12   - = raw blob.colorize(formatter: :gitlab)
  11 + %div.highlighted-data{class: user_color_scheme_class}
  12 + .line-numbers
  13 + - blob.data.lines.size.times do |index|
  14 + - i = index + 1
  15 + = link_to "#L#{i}", id: "L#{i}", rel: "#L#{i}" do
  16 + %i.icon-link
  17 + = i
  18 + .highlight
  19 + %pre
  20 + %code
  21 + = raw blob.data
13 22 - else
14 23 %p.nothing_here_message Empty file
... ...