insight_rails 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/controllers/help/sessions_controller.rb +1 -23
- data/app/controllers/insight_controller.rb +28 -28
- data/app/models/issue.rb +8 -0
- data/app/views/help/categories/index.html.erb +1 -1
- data/app/views/knowledge/article_categories/index.html.erb +12 -10
- data/app/views/layouts/_insight_footer.html.erb +1 -1
- data/generators/insight/insight_generator.rb +3 -0
- data/generators/insight/templates/_insight_footer.html.erb +25 -0
- data/generators/insight/templates/insight.html.erb +56 -0
- data/generators/insight/templates/migrations/link_users_to_crm_contacts.rb +1 -3
- data/lib/insight/crm/callbacks/account.rb +5 -5
- data/lib/insight/crm/callbacks/user.rb +15 -13
- metadata +6 -5
- data/lib/insight/multi_pass_attributes.rb +0 -32
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -3,29 +3,7 @@ class Help::SessionsController < ApplicationController
|
|
3
3
|
layout Insight.configuration.layout
|
4
4
|
|
5
5
|
skip_before_filter :login_required
|
6
|
-
|
7
|
-
before_filter :check_existing_login, :only => [ :new ]
|
8
|
-
|
9
|
-
# def new
|
10
|
-
# end
|
11
|
-
#
|
12
|
-
# def create
|
13
|
-
# json = { :username => params[:username], :password => params[:password] }.to_json
|
14
|
-
# auth_details = MultiPass.encode64(json)
|
15
|
-
#
|
16
|
-
# session = InsightSession.new(:auth => auth_details)
|
17
|
-
# if session.save
|
18
|
-
# self.current_user = session.multipass
|
19
|
-
# else
|
20
|
-
# render :action => "new"
|
21
|
-
# end
|
22
|
-
# end
|
23
|
-
|
24
|
-
def destroy
|
25
|
-
session[:multipass] = nil
|
26
|
-
redirect_to("/help")
|
27
|
-
end
|
28
|
-
|
6
|
+
|
29
7
|
protected
|
30
8
|
|
31
9
|
def check_existing_login
|
@@ -1,32 +1,32 @@
|
|
1
1
|
class InsightController < ApplicationController
|
2
2
|
|
3
|
-
before_filter :login_required
|
4
|
-
|
5
|
-
def current_user
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def current_user=(multipass)
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
def authorized?
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
def logged_in?
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
3
|
+
# before_filter :login_required
|
4
|
+
#
|
5
|
+
# def current_user
|
6
|
+
# @insight_user ||= login_from_multipass
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# def current_user=(multipass)
|
10
|
+
# session[:multipass] = multipass
|
11
|
+
# @insight_user = login_from_multipass
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# def authorized?
|
15
|
+
# logged_in?
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# def logged_in?
|
19
|
+
# !!current_user
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# protected
|
23
|
+
#
|
24
|
+
# def login_required
|
25
|
+
# authorized?
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# def login_from_multipass
|
29
|
+
# session[:multipass].nil? ? nil : InsightUser.new(session[:multipass])
|
30
|
+
# end
|
31
31
|
|
32
32
|
end
|
data/app/models/issue.rb
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
<% if !category.issues.empty? -%>
|
21
21
|
<%= link_to(category.issues.first.updated_at.strftime("%b %d, %Y %H:%M"),
|
22
22
|
help_category_issue_path(category, category.issues.first)) %>
|
23
|
-
by <%= category.issues.first.user_name %>
|
23
|
+
by <%= category.issues.first.contact.nil? ? category.issues.first.user_name : category.issues.first.contact.username %>
|
24
24
|
<% end -%>
|
25
25
|
</td>
|
26
26
|
</tr>
|
@@ -2,15 +2,17 @@
|
|
2
2
|
|
3
3
|
<div class="articles">
|
4
4
|
<% @categories.each do |category| %>
|
5
|
-
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
<% if !category.articles.empty? -%>
|
6
|
+
<div class="category">
|
7
|
+
<h2><%= category.name %></h2>
|
8
|
+
<ul>
|
9
|
+
<% category.articles[0..5].each do |article| %>
|
10
|
+
<li>
|
11
|
+
<%= link_to(article.title, knowledge_article_path(article)) %>
|
12
|
+
</li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
15
17
|
<% end %>
|
16
18
|
</div>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<ul>
|
6
6
|
<% Issue.find(:all, :from => :latest).each do |issue| %>
|
7
7
|
<li>
|
8
|
-
<span><%= issue.created_at.strftime("%d %b %H:%
|
8
|
+
<span><%= issue.created_at.strftime("%d %b %H:%M") %></span> <%= link_to(issue.subject, help_issue_path(issue)) %>
|
9
9
|
</li>
|
10
10
|
<% end %>
|
11
11
|
</ul>
|
@@ -11,6 +11,9 @@ class InsightGenerator < Rails::Generator::Base
|
|
11
11
|
"db/migrate",
|
12
12
|
:migration_file_name => "link_users_to_crm_contacts"
|
13
13
|
|
14
|
+
m.file "insight.html.erb", "app/views/layouts/insight.html.erb"
|
15
|
+
m.file "_insight_footer.html.erb", "app/views/layouts/_insight_footer.html.erb"
|
16
|
+
|
14
17
|
m.insert_into "app/models/user.rb", "include Insight::CRM::Callbacks::User"
|
15
18
|
m.insert_into "app/models/account.rb", "include Insight::CRM::Callbacks::Account"
|
16
19
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div id="footer">
|
2
|
+
<div class="latest-discussions">
|
3
|
+
<div class="latest discussions">
|
4
|
+
<h3>Latest Discussions</h3>
|
5
|
+
<ul>
|
6
|
+
<% Issue.find(:all, :from => :latest).each do |issue| %>
|
7
|
+
<li>
|
8
|
+
<span><%= issue.created_at.strftime("%d %b %H:%M") %></span> <%= link_to(issue.subject, help_issue_path(issue)) %>
|
9
|
+
</li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="latest articles">
|
15
|
+
<h3>Latest Knowledge Base Articles</h3>
|
16
|
+
<ul>
|
17
|
+
<% Article.find(:all, :from => :latest).each do |article| %>
|
18
|
+
<li>
|
19
|
+
<%= link_to(article.title, knowledge_article_path(article)) %>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
</ul>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Help & Support</title>
|
5
|
+
|
6
|
+
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.0/build/reset-fonts-grids/reset-fonts-grids.css">
|
7
|
+
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.0/build/base/base-min.css">
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag 'insight' %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div id="header">
|
13
|
+
<div class="section">
|
14
|
+
<div class="top-nav">
|
15
|
+
<ul class="nav">
|
16
|
+
<li>
|
17
|
+
<%= link_to("Support Home", help_path) %>
|
18
|
+
</li>
|
19
|
+
<li>
|
20
|
+
<%= link_to("Return to App", "/") %>
|
21
|
+
</li>
|
22
|
+
<% if logged_in? %>
|
23
|
+
<li>
|
24
|
+
<%= link_to("Logout", help_logout_path) %>
|
25
|
+
</li>
|
26
|
+
<% else %>
|
27
|
+
<li>
|
28
|
+
<%= link_to("Login", help_login_path) %>
|
29
|
+
</li>
|
30
|
+
<% end %>
|
31
|
+
</ul>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<h1>Help & Support</h1>
|
35
|
+
<div class="nav-bar">
|
36
|
+
<ul class="nav">
|
37
|
+
<li>
|
38
|
+
<%= link_to("Start a Discussion", new_help_issue_path) %>
|
39
|
+
</li>
|
40
|
+
<li>
|
41
|
+
<%= link_to("Browse Discussions", help_browse_path) %>
|
42
|
+
</li>
|
43
|
+
<li>
|
44
|
+
<%= link_to("Knowledge Base", knowledge_path) %>
|
45
|
+
</li>
|
46
|
+
</ul>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
<div id="wrapper">
|
50
|
+
<div id="content">
|
51
|
+
<%= yield %>
|
52
|
+
</div>
|
53
|
+
<%= render :partial => "layouts/insight_footer" %>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
@@ -1,13 +1,11 @@
|
|
1
|
-
class
|
1
|
+
class LinkUsersToCrmContacts < ActiveRecord::Migration
|
2
2
|
|
3
3
|
def self.up
|
4
4
|
add_column :users, :crm_id, :integer
|
5
|
-
add_column :accounts, :crm_id, :integer
|
6
5
|
end
|
7
6
|
|
8
7
|
def self.down
|
9
8
|
remove_column :users, :crm_id
|
10
|
-
remove_column :accounts, :crm_id
|
11
9
|
end
|
12
10
|
|
13
11
|
end
|
@@ -22,11 +22,11 @@ module Insight
|
|
22
22
|
self.update_attribute(:crm_id, account.id)
|
23
23
|
end
|
24
24
|
|
25
|
-
def update_crm_account
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
25
|
+
# def update_crm_account
|
26
|
+
# account = CRM::Models::Account.find(crm_id)
|
27
|
+
# account.name = name
|
28
|
+
# account.save
|
29
|
+
# end
|
30
30
|
|
31
31
|
end
|
32
32
|
|
@@ -22,25 +22,27 @@ module Insight
|
|
22
22
|
self.update_attribute(:crm_id, contact.id)
|
23
23
|
end
|
24
24
|
|
25
|
-
def update_crm_contact
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
25
|
+
# def update_crm_contact
|
26
|
+
# contact = CRM::Models::Contact.find(crm_id)
|
27
|
+
# contact.attributes = crm_attributes
|
28
|
+
# contact.save
|
29
|
+
# end
|
30
30
|
|
31
31
|
def crm_attributes
|
32
32
|
a = {}
|
33
|
-
a[:title] = title
|
34
|
-
a[:first_name] = firstname
|
35
|
-
a[:
|
36
|
-
a[:
|
37
|
-
a[:
|
33
|
+
a[:title] = title if respond_to?(:title)
|
34
|
+
a[:first_name] = firstname if respond_to?(:firstname)
|
35
|
+
a[:first_name] = first_name if respond_to?(:first_name)
|
36
|
+
a[:last_name] = lastname if respond_to?(:lastname)
|
37
|
+
a[:last_name] = last_name if respond_to?(:last_name)
|
38
|
+
a[:email] = email if respond_to?(:email)
|
39
|
+
a[:username] = username if respond_to?(:username)
|
38
40
|
a
|
39
41
|
end
|
40
42
|
|
41
|
-
def recording_last_activity?
|
42
|
-
|
43
|
-
end
|
43
|
+
# def recording_last_activity?
|
44
|
+
# respond_to?(:last_activity) && last_activity_changed?
|
45
|
+
# end
|
44
46
|
|
45
47
|
end
|
46
48
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insight_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kieran Johnson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-15 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -91,6 +91,8 @@ files:
|
|
91
91
|
- generators/insight/insight_generator.rb
|
92
92
|
- generators/insight/lib/insert_commands.rb
|
93
93
|
- generators/insight/templates/README
|
94
|
+
- generators/insight/templates/_insight_footer.html.erb
|
95
|
+
- generators/insight/templates/insight.html.erb
|
94
96
|
- generators/insight/templates/insight.rake
|
95
97
|
- generators/insight/templates/insight.rb
|
96
98
|
- generators/insight/templates/insight.sass
|
@@ -101,7 +103,6 @@ files:
|
|
101
103
|
- lib/insight/crm/callbacks/user.rb
|
102
104
|
- lib/insight/crm/models/account.rb
|
103
105
|
- lib/insight/crm/models/contact.rb
|
104
|
-
- lib/insight/multi_pass_attributes.rb
|
105
106
|
has_rdoc: true
|
106
107
|
homepage: http://github.com/kieranj/insight
|
107
108
|
licenses: []
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Insight
|
2
|
-
|
3
|
-
module MultiPassAttributes
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.extend(ClassMethods)
|
7
|
-
end
|
8
|
-
|
9
|
-
def multipass
|
10
|
-
@multipass ||= self.class.multipass.encode({
|
11
|
-
:id => id,
|
12
|
-
:email => email,
|
13
|
-
:title => title,
|
14
|
-
:first_name => firstname,
|
15
|
-
:last_name => lastname,
|
16
|
-
:crm_id => crm_id,
|
17
|
-
:expires => 30.minutes.from_now
|
18
|
-
})
|
19
|
-
end
|
20
|
-
|
21
|
-
module ClassMethods
|
22
|
-
|
23
|
-
def multipass
|
24
|
-
# @multipass ||= MultiPass.new(FatFreeAuth.configuration.site_name, FatFreeAuth.configuration.secret)
|
25
|
-
@multipass ||= MultiPass.new('fatfree', 'abc')
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|