Skip to content

Commit afa4a07

Browse files
committed
Show spinner on network graph while it loading
Signed-off-by: Dmitriy Zaporozhets <[email protected]>
1 parent e740a00 commit afa4a07

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/helpers/application_helper.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ def render_markup(file_name, file_content)
226226
GitHub::Markup.render(file_name, file_content).html_safe
227227
end
228228

229-
def spinner(text = nil)
230-
content_tag :div, class: 'loading hide' do
229+
def spinner(text = nil, visible = false)
230+
css_class = "loading"
231+
css_class << " hide" unless visible
232+
233+
content_tag :div, class: css_class do
231234
content_tag(:i, nil, class: 'icon-spinner icon-spin') + text
232235
end
233236
end

app/views/projects/network/show.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.tip
44
You can move around the graph by using the arrow keys.
55
.network-graph
6-
= spinner
6+
= spinner nil, true
77

88
:javascript
99
new Network({

0 commit comments

Comments
 (0)