softwear-lib 2.0.4 → 2.0.5

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.
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require self
3
+ *= require animate/animate
4
+ */
@@ -0,0 +1,11 @@
1
+ .box-info{
2
+ position:relative;
3
+ padding: 15px;
4
+ background: #fff;
5
+ color: #5b5b5b;
6
+ margin-bottom: 20px;
7
+ -webkit-transition:All 0.4s ease;
8
+ -moz-transition:All 0.4s ease;
9
+ -o-transition:All 0.4s ease;
10
+ }
11
+
@@ -1,6 +1,7 @@
1
1
  module Softwear
2
2
  class ErrorReportsController < ApplicationController
3
3
  skip_before_filter :authenticate_user!
4
+ before_action :assign_current_user, only: :email_report
4
5
 
5
6
  helper Softwear::Engine.helpers do
6
7
  def method_missing(name, *args, &block)
@@ -33,5 +34,11 @@ module Softwear
33
34
  render inline: "<%= flash[:success] %>"
34
35
  end
35
36
  end
37
+
38
+ private
39
+
40
+ def assign_current_user
41
+ @current_user = current_user rescue nil
42
+ end
36
43
  end
37
44
  end
@@ -2,36 +2,45 @@ class ErrorReportMailer < ActionMailer::Base
2
2
  default to: 'devteam@annarbortees.com'
3
3
 
4
4
  def send_report(user, params)
5
- @order = Order.find_by(id: params[:order_id])
6
5
  @user = user || User.find_by(id: params[:user_id])
6
+ if ["Softwear CRM", "Softwear Production"].include?(app_name)
7
+ @order = Order.find_by(id: params[:order_id])
7
8
 
8
- if @user.nil?
9
- from_customer = true
9
+ if @user.nil?
10
+ from_customer = true
10
11
 
11
- if @order.nil?
12
+ if @order.nil?
13
+ @user = OpenStruct.new(
14
+ email: 'unknown-user@annarbortees.com',
15
+ full_name: 'Unknown Customer'
16
+ )
17
+ else
18
+ @user = OpenStruct.new(
19
+ email: @order.email,
20
+ full_name: "(Customer) #{@order.full_name}"
21
+ )
22
+ end
23
+ end
24
+
25
+ if @user.nil?
12
26
  @user = OpenStruct.new(
13
27
  email: 'unknown-user@annarbortees.com',
14
28
  full_name: 'Unknown Customer'
15
29
  )
16
- else
17
- @user = OpenStruct.new(
18
- email: @order.email,
19
- full_name: "(Customer) #{@order.full_name}"
20
- )
21
30
  end
22
- end
23
31
 
24
- @error_class = params[:error_class]
25
- @error_message = params[:error_message]
26
- @backtrace = params[:backtrace]
27
- @user_message = params[:user_message]
28
- @additional_info = params[:additional_info]
32
+ @error_class = params[:error_class]
33
+ @error_message = params[:error_message]
34
+ @backtrace = params[:backtrace]
35
+ @user_message = params[:user_message]
36
+ @additional_info = params[:additional_info]
37
+ end
29
38
 
30
39
  mail(
31
40
  from: from_customer ? 'customer-report@softwearcrm.com' : @user.email,
32
41
  reply_to: @user.email,
33
42
  to: 'devteam@annarbortees.com',
34
- subject: "Softwear CRM Error Report From #{@user.full_name}"
43
+ subject: "#{app_name} Error Report from #{@user.full_name}"
35
44
  )
36
45
  end
37
46
 
@@ -50,4 +59,21 @@ class ErrorReportMailer < ActionMailer::Base
50
59
  body: at.strftime("Just got a response at %I:%M%p")
51
60
  )
52
61
  end
62
+
63
+ private
64
+
65
+ def app_name
66
+ case Rails.application.class.parent.to_s
67
+ when "CrmSoftwearcrmCom" then return "Softwear CRM"
68
+ when "RetailPublishing" then return "Softwear Mockbot"
69
+ when "SoftwearProduction" then return "Softwear Production"
70
+ when "SoftwearHub" then return "Softwear Hub"
71
+ when "AnnarborteesFba" then return "Softwear Fba"
72
+ when "AnnarborteesWww" then return "Ann Arbor Tees WWW"
73
+ else
74
+ return "Unknown App"
75
+ end
76
+ end
77
+
53
78
  end
79
+
@@ -1,6 +1,7 @@
1
1
  module Softwear
2
2
  module Auth
3
3
  module EmailsHelper
4
+
4
5
  def backtrace_is_from_app?(line)
5
6
  !(line.include?('/gems/') || /^kernel\// =~ line || line.include?('/vendor_ruby/'))
6
7
  end
@@ -1,5 +1,9 @@
1
1
  module Softwear
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Softwear
4
+
5
+ initializer "softwear_lib.assets.precompile" do |app|
6
+ app.config.assets.precompile += %w(softwear.css application.css softwear.js)
7
+ end
4
8
  end
5
9
  end
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Library
3
- VERSION = "2.0.4"
3
+ VERSION = "2.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softwear-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Baillie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-30 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,6 +81,10 @@ files:
81
81
  - LICENSE.txt
82
82
  - README.md
83
83
  - Rakefile
84
+ - app/assets/javascripts/softwear.js
85
+ - app/assets/stylesheets/animate/animate.css
86
+ - app/assets/stylesheets/application.css
87
+ - app/assets/stylesheets/softwear.css
84
88
  - app/controllers/softwear/application_controller.rb
85
89
  - app/controllers/softwear/error_reports_controller.rb
86
90
  - app/helpers/softwear/application_helper.rb