analytics bug fix and invite page

James Peret лет %!s(int64=10): %!d(string=назад)
Родитель
Сommit
f043671ae3

+ 7 - 1
app/controllers/application_controller.rb

@@ -43,8 +43,14 @@ class ApplicationController < ActionController::Base
43 43
   def analytics
44 44
     if current_user != nil
45 45
       @id_analytics = current_user.full_name
46
+      cookies[:avalanche_user_id] = @id_analytics
46 47
     else
47
-      @id_analytics = 'Guest_'+ Time.now.to_i.to_s
48
+      if cookies[:avalanche_user_id]
49
+        @id_analytics = cookies[:avalanche_user_id].to_sym
50
+      else
51
+        @id_analytics = 'Guest_'+ Time.now.to_i.to_s
52
+        cookies[:avalanche_user_id] = @id_analytics
53
+      end
48 54
     end
49 55
     @analytics ||= Analytics.new(@id_analytics)
50 56
   end

+ 1 - 2
app/models/analytics.rb

@@ -2,8 +2,7 @@ class Analytics
2 2
 
3 3
   require 'mixpanel-ruby'
4 4
   
5
-  
6
-  def initialize(id)
5
+  def initialize(id = "")
7 6
     @tracker = Mixpanel::Tracker.new(ENV["MIXPANEL_PROJECT_TOKEN"])
8 7
     @id = id
9 8
   end 

+ 18 - 0
app/views/agents/invite.html.erb

@@ -0,0 +1,18 @@
1
+<%= content_tag(:div, class: 'container top-container') do %>
2
+	<%= content_tag(:div, class: 'row') do %>
3
+		<%= content_tag(:div, class: 'span12') do %>
4
+			<% # Page Content %>
5
+			<%= bootstrap_flash %>
6
+			<%= content_tag(:div, class: 'page-header') do %>
7
+				<%= content_tag(:h1) do %>
8
+					<%= t 'agent.invite' %>
9
+				<% end %>
10
+			<% end %>
11
+		<% end %>
12
+	<% end %>
13
+	<%= content_tag(:div, class: 'row') do %>
14
+		<%= content_tag(:div, class: 'span12') do %>
15
+		
16
+		<% end %>
17
+	<% end %>
18
+<% end %>

+ 0 - 5
app/views/devise/invitations/edit.html.erb

@@ -1,9 +1,4 @@
1 1
 <h2><%= t 'devise.invitations.edit.header' %></h2>
2
-<h2><%= t 'devise.invitations.edit.header' %></h2>
3
-<h2><%= t 'devise.invitations.edit.header' %></h2>
4
-<h2><%= t 'devise.invitations.edit.header' %></h2>
5
-<h2><%= t 'devise.invitations.edit.header' %></h2>
6
-<h2><%= t 'devise.invitations.edit.header' %></h2>
7 2
 
8 3
 <%= simple_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :put } do |f| %>
9 4
   <%= devise_error_messages! %>

+ 1 - 0
app/views/layouts/_navigation_links.html.erb

@@ -19,6 +19,7 @@
19 19
 				<% end %>
20 20
 				<li><%= link_to (t "nav.profile"), show_agent_path(current_user) %></li>
21 21
 	  			<li><%= link_to (t "nav.account"), edit_user_registration_path, id: 'nav-btn-account' %></li>
22
+				<li><%= link_to (t "nav.invite"), invite_path %></li>
22 23
 	  			<li><%= link_to (t "nav.logout"), destroy_user_session_path, method: :delete, id: 'nav-btn-logout' %></li>
23 24
 			</ul>
24 25
 		</li>

+ 1 - 0
config/routes.rb

@@ -58,6 +58,7 @@ Avalanche2::Application.routes.draw do
58 58
   get 'dashboard/directing' => 'agents#directing_missions', as: :directing_missions
59 59
   get 'agents' => 'agents#list', as: :agent_list
60 60
   get 'agent/:id' => 'agents#show', as: :show_agent
61
+  get 'invite' => 'agents#invite', as: :invite
61 62
   
62 63
   # Rewards
63 64
   get 'dashboard/rewards' => 'agents#rewards', as: :user_rewards