Commit c1fd25ce6ed28ad19fe4928be018a189c06cc3d7

Authored by Dmitriy Zaporozhets
1 parent 046773d6

Replace turbolink spinner with nprogress

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Gemfile
... ... @@ -167,6 +167,7 @@ gem &#39;bootstrap-sass&#39;, &#39;~&gt; 3.0&#39;
167 167 gem "font-awesome-rails", '~> 3.2'
168 168 gem "gemoji", "~> 1.3.0"
169 169 gem "gon", '~> 5.0.0'
  170 +gem 'nprogress-rails'
170 171  
171 172 group :development do
172 173 gem "annotate", "~> 2.6.0.beta2"
... ...
Gemfile.lock
... ... @@ -297,6 +297,7 @@ GEM
297 297 net-ssh (>= 1.99.1)
298 298 net-ssh (2.7.0)
299 299 nokogiri (1.5.10)
  300 + nprogress-rails (0.1.2.3)
300 301 oauth (0.4.7)
301 302 oauth2 (0.8.1)
302 303 faraday (~> 0.8)
... ... @@ -621,6 +622,7 @@ DEPENDENCIES
621 622 minitest (~> 4.7.0)
622 623 modernizr (= 2.6.2)
623 624 mysql2
  625 + nprogress-rails
624 626 omniauth (~> 1.1.3)
625 627 omniauth-github
626 628 omniauth-google-oauth2
... ...
app/assets/javascripts/application.js
... ... @@ -29,3 +29,5 @@
29 29 //= require_tree .
30 30 //= require d3
31 31 //= require underscore
  32 +//= require nprogress
  33 +//= require nprogress-turbolinks
... ...
app/assets/javascripts/main.js.coffee
... ... @@ -41,19 +41,11 @@ window.linkify = (str) -&gt;
41 41 window.simpleFormat = (str) ->
42 42 linkify(sanitize(str).replace(/\n/g, '<br />'))
43 43  
44   -window.startSpinner = ->
45   - $('.turbolink-spinner').fadeIn()
46   -
47   -window.stopSpinner = ->
48   - $('.turbolink-spinner').fadeOut()
49   -
50 44 window.unbindEvents = ->
51 45 $(document).unbind('scroll')
52 46 $(document).off('scroll')
53 47  
54   -document.addEventListener("page:fetch", startSpinner)
55 48 document.addEventListener("page:fetch", unbindEvents)
56   -document.addEventListener("page:change", stopSpinner)
57 49  
58 50 $ ->
59 51 # Click a .one_click_select field, select the contents
... ...
app/assets/stylesheets/application.scss
... ... @@ -7,6 +7,8 @@
7 7 *= require select2
8 8 *= require highlightjs.min
9 9 *= require_self
  10 + *= require nprogress
  11 + *= require nprogress-bootstrap
10 12 */
11 13  
12 14 @import "main/variables.scss";
... ...
app/views/layouts/_head_panel.html.haml
... ... @@ -15,10 +15,6 @@
15 15 .navbar-collapse.collapse
16 16 %ul.nav.navbar-nav
17 17 %li.hidden-sm.hidden-xs
18   - %a
19   - %div.hide.turbolink-spinner
20   - %i.icon-refresh.icon-spin
21   - %li.hidden-sm.hidden-xs
22 18 = render "layouts/search"
23 19 %li.visible-sm.visible-xs
24 20 = link_to search_path, title: "Search", class: 'has_bottom_tooltip', 'data-original-title' => 'Search area' do
... ...