Skip to content

Commit 331bdc1

Browse files
committed
Moved current_user to the application layout. Fixes #158
1 parent a8aece6 commit 331bdc1

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

app/views/layouts/application.html.erb

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
<%= yield :javascript_includes %>
1212

1313
<%= csrf_meta_tags %>
14+
15+
<%- if user_signed_in? %>
16+
<%= javascript_tag do %>
17+
$.data(document, "current-user", <%= current_user_data.to_json.html_safe %>);
18+
<% end %>
19+
<%- end %>
1420
</head>
1521
<body>
1622
<div id="kandan">

app/views/main/index.html.erb

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
<%- end %>
1010

1111
<%= javascript_tag do %>
12-
<%- if user_signed_in? %>
13-
$.data(document, "current-user", <%= current_user_data.to_json.html_safe %>);
14-
<%- end %>
1512
$(document).data("active-users", [])
1613
<%- end %>
1714

app/views/main/search.html.erb

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<%= javascript_tag do %>
2-
$.data(document, "current-user", <%= current_user_data.to_json.html_safe %>);
3-
42
$(document).ready(function(){
53
Kandan.Plugins.initAll()
64
activities = <%= @activities.to_json(:include => :user).html_safe %>;

0 commit comments

Comments
 (0)