shopapp 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7358bcd191eca835a745a359c283c2c021a89578552c09b82fdecfcd44c2ca1
4
- data.tar.gz: 8d1f82dfba08d9da9dd1a19d55db02b121ca65d5d904fe1ab5750d1b47184736
3
+ metadata.gz: 20d46c43bba283b3d2a3abda46048b8b0e55f1c1f73070f84c2af1ec1b84d5c5
4
+ data.tar.gz: 320def0a006db8f0d21388a31c1dcd1df78d51c307d5c639af1a94630ab4d99b
5
5
  SHA512:
6
- metadata.gz: 4767ee96a987c7000aa21f81a1084cb6851d120e19c16d144bd1b477dae3a75853d2126e9ca4f84ecf0b931962f7fe8c47ca478c4889b3d6d69940b16586f901
7
- data.tar.gz: e9f323c0da1970f17c8bfcb27e4e7b5308cb2902fa83c90e1a5d7f9b9d5554b8351d57382282170f737e57f5eefd01192c0e18cd2055854b15b4e07749e939e4
6
+ metadata.gz: 6b1843c4265d331d351da3f35e3d9b10d14cfb8b7400a0519bf8cb6d8986ac8139ec5af3eeba6988b86d8063fee1dee1881ac5594ac7621df3e7c0b559b2fa75
7
+ data.tar.gz: 1694787c6c6b52cded3499723e38883f24181dadbbe3c499851b436718a9e8e30618078a45b59bc5b02bfb82466ba05080048e4a38796d55aa85df5e8fde3f91
@@ -36,6 +36,7 @@ $zcolor_neutral: #7487D0 !default; //928DAE
36
36
  $zcolor_light: #f1f0f6 !default; //CECACF
37
37
  $zcolor_dark: #100C2E !default;
38
38
  $zcolor_secondary: #71678C !default; //8B669D
39
+ $zcolor_main_light:#6D049B !default; //e236ff
39
40
 
40
41
  // Z functional colors
41
42
  // As suggested by http://colormind.io/bootstrap/
@@ -71,9 +71,13 @@ module ShopliftClient
71
71
  [Rails.configuration.settings['authlift_default_scope'], 'public'].compact.join ' '
72
72
  end
73
73
 
74
- def find_company_by_code(code)
74
+ def find_company_by_code(code, parameters = {})
75
75
  begin
76
- @current_company ||= Company.find_or_create_by! code: code
76
+ @current_company ||= Company.find_or_create_by! code: code do |new_company|
77
+ fail if parameters.empty?
78
+ new_company.name = parameters[:name]
79
+ new_company.info = parameters.to_json
80
+ end
77
81
  rescue ActiveRecord::StatementInvalid
78
82
  if $!.cause.is_a? PG::UndefinedTable
79
83
  fail <<-ERROR.strip_heredoc
@@ -92,7 +96,7 @@ module ShopliftClient
92
96
  @token = OAuth2::AccessToken.new client, session_cookie, scope: scope
93
97
  begin
94
98
  x = srv.get '/api/users/profile'
95
- @current_user = JSON.parse x.response.body
99
+ @current_user_json_hash = @current_user = JSON.parse x.response.body
96
100
  user_scopes = JSON.parse @current_user['scopes']
97
101
  unless user_scopes.include? 'admin'
98
102
  (self.class.required_scopes || []).each do |required_scope|
@@ -102,7 +106,9 @@ module ShopliftClient
102
106
  end
103
107
  end
104
108
  end
105
- find_company_by_code current_user['company']['code']
109
+ find_company_by_code current_user['company']['code'],
110
+ name: current_user['company']['name'],
111
+ logo_code: current_user['company']['logo_code']
106
112
  rescue OAuth2::Error
107
113
  return false
108
114
  end
@@ -207,7 +213,7 @@ module ShopliftClient
207
213
  if defined? self.company_logo_path
208
214
  company_logo_path
209
215
  else
210
- "https://media.shoplift.fi/company_logos/#{@current_company.code}_company_logo_24.png"
216
+ "https://media.shoplift.fi/company_logos/#{@current_user_json_hash['company']['logo_code']}_company_logo_24.png"
211
217
  end
212
218
  end
213
219
  end
@@ -23,19 +23,19 @@
23
23
  %a#navbarDropdown.nav-link.dropdown-toggle(href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
24
24
  %i.fa.fa-th(aria-hidden="true")
25
25
  .dropdown-menu.dropdown-menu-right(aria-labelledby="navbarDropdown")
26
- -(@current_user['company']['apps'] || []).each do |app|
26
+ -(@current_user_json_hash['company']['apps'] || []).each do |app|
27
27
  - if app['home'].present?
28
28
  %a.dropdown-item(href="#{app['home']}")=app['name']
29
29
  %li.nav-item.dropdown.ml-md-2.ml-3.mr-3
30
30
  %a#navbarDropdown.nav-link.dropdown-toggle(href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
31
31
  %i.fa.fa-user(aria-hidden="true")
32
32
  .dropdown-menu.dropdown-menu-right(aria-labelledby="navbarDropdown")
33
- .dropdown-header=@current_user['email']
33
+ .dropdown-header=@current_user_json_hash['email']
34
34
  .dropdown-header
35
35
  %strong Company:
36
- =@current_user['company']['name']
36
+ =@current_user_json_hash['company']['name']
37
37
  .dropdown-divider
38
- - (@current_user['memberships'] || []).reject { |c| @current_user['company']['code'] == c['code'] }.each do |c|
38
+ - (@current_user_json_hash['memberships'] || []).reject { |c| @current_user_json_hash['company']['code'] == c['code'] }.each do |c|
39
39
  = link_to(change_company_path(c['code']), method: :post, :class => 'dropdown-item') do
40
40
  Switch company to: #{c['name']}
41
41
  = link_to(logout_path, method: :delete, :class => 'dropdown-item') do
data/shopapp.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'shopapp'
3
- s.version = '0.2.7'
4
- s.date = '2018-09-25'
3
+ s.version = '0.2.8'
4
+ s.date = '2018-09-27'
5
5
  s.summary = 'Do a shoplift.'
6
6
  s.description = 'Ha! Art thou Bedlam? Dost thou thirst base Trojan, to have me fold up Parca\'s fatal web? Hence!\
7
7
  I am qualmish at the smell of leek.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeljko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties