Browse Source

One more try to disable turbolinks and added pageloader bar

Dmitry Yu Okunev 3 years ago
parent
commit
e79e266b89

+ 1 - 1
Gemfile

@@ -19,7 +19,7 @@ gem 'therubyracer', platforms: :ruby
 # Use jquery as the JavaScript library
 gem 'jquery-rails'
 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
-gem 'turbolinks', '~> 5'
+#gem 'turbolinks', '~> 5'
 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
 gem 'jbuilder', '~> 2.5'
 # Use Redis adapter to run Action Cable in production

+ 0 - 4
Gemfile.lock

@@ -146,9 +146,6 @@ GEM
     thor (0.19.1)
     thread_safe (0.3.5)
     tilt (2.0.5)
-    turbolinks (5.0.1)
-      turbolinks-source (~> 5)
-    turbolinks-source (5.0.0)
     tzinfo (1.2.2)
       thread_safe (~> 0.1)
     uglifier (3.0.2)
@@ -181,7 +178,6 @@ DEPENDENCIES
   spring-watcher-listen (~> 2.0.0)
   sqlite3
   therubyracer
-  turbolinks (~> 5)
   tzinfo-data
   uglifier (>= 1.3.0)
   web-console

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

@@ -249,3 +249,12 @@ ul li {
 	transition:		all 0.15s ease-in-out 0s;
 }
 
+#pageload-bar {
+	display:		none;
+	position:		fixed;
+	z-index:		2;
+	width:			100%;
+	height:			100%;
+	text-align:		center;
+	vertical-align:		middle;
+}

+ 18 - 9
app/views/layouts/application.html.erb

@@ -6,8 +6,8 @@
 		<link rel="icon" type="image/png" href="/imgs/favicon.png" />
 		<%= csrf_meta_tags %>
 
-		<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
-		<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+		<%= stylesheet_link_tag    'application', media: 'all' %>
+		<%= javascript_include_tag 'application' %>
 		<style>
 			table td {
 				border: 1px solid #aaa;
@@ -15,7 +15,7 @@
 		</style>
 	</head>
 
-	<body>
+	<body data-no-turbolink='true'>
 		<div id='header'>
 			<% if @user.nil? %>
 				<%= t :anonymous %> — <a href='https://login.mephi.ru/login?allow_anonymous=true&service=<%= @current_url %>'>авторизоваться</a>
@@ -25,12 +25,6 @@
 			&nbsp;
 		</div>
 
-		<div id='content' class='transition'>
-			<div id='contentPadded'>
-				<%= yield %>
-			</div>
-		</div>
-
 		<div id='navigation' class='transition'>
 			<ul class='transition'>
 					<li><a data-no-turbolink='true' href='/people/index'>Полный список</a></li>
@@ -39,9 +33,19 @@
 			</ul>
 		</div>
 
+		<div id='content' class='transition'>
+			<div id='contentPadded'>
+				<%= yield %>
+			</div>
+		</div>
+
 		<div id='footer'>
 			<a href='mailto:dyokunev@mephi.ru'>Техническая поддержка: dyokunev@mephi.ru</a>
 		</div>
+
+		<div id='pageload-bar'>
+			<img src='/imgs/pageloader.gif'>
+		</div>
 	</body>
 </html>
 <script>
@@ -50,4 +54,9 @@
 	}).mouseleave(function(){
 		$('#content').css('left', '30px');
 	})
+
+	$('#navigation a').click(function(){
+		$('#pageload-bar').css('display', 'block');
+		return true;
+	})
 </script>

BIN
public/imgs/pageloader.gif