jinda 0.1.8 → 0.1.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60bc5ed0b6030f8892be7c287ccd80e4268b196a2034a0c76ac8d430b81081de
4
- data.tar.gz: 96e6ce7f167c3dbfd75fa98c57d4e7753b2b5d269af8aa0550df37b5c97c976e
3
+ metadata.gz: f3ce5c17fcecc4aec0dd04876f2f49d0eb09652708eac9940830cbd421feb472
4
+ data.tar.gz: 78a7b9a7cbb4bf0d24b87156a66c40d56b024a55cc2cba4244f287ce44ce2286
5
5
  SHA512:
6
- metadata.gz: fe341989317ee7b6f833de1ab7e00420b220baf4dc975efa080950f7cead25593bc8bf1f71c31497f1d6ab93a833ac37de206af7d6b1f0712892f0c95051251b
7
- data.tar.gz: fa23f95aca47b63b38c3c6fed6ff49572f138d14ffb8fb76b9504802042da36d519dd7ec390bb6bb22ef8ec2f4e8929a2b7b8169ead5741da084f7881c119662
6
+ metadata.gz: 8be7403c5159d253c77b86aa9a8c4012e6ae92555d9dd0c83907e585f17a252fe6b4f0ec2009a0504ff3cdf4377021c8704285930332f4b36f14dfe1ab705ce8
7
+ data.tar.gz: e192a43b60a0588f8b64e8d60f5a029596e5063700c9f105e8087de2ef2416a4c45addb5f2be48b0594690092b60d5f74a2559af618a45f9a67e3519f71d4234
@@ -7,6 +7,8 @@ class Identity
7
7
  field :email, :type => String
8
8
  field :password_digest, :type => String
9
9
  field :auth_token, :type => String
10
+ field :image, :type => String
11
+
10
12
 
11
13
 
12
14
  validates_presence_of :code
@@ -10,6 +10,7 @@ class User
10
10
  field :auth_token, :type => String
11
11
  field :password_reset_token, :type => String
12
12
  field :password_reset_sent_at,:type => DateTime
13
+ field :image, :type => String
13
14
 
14
15
 
15
16
  belongs_to :identity, :polymorphic => true, :optional => true
@@ -42,6 +43,7 @@ class User
42
43
  user.provider = auth.provider
43
44
  user.code = auth.info.name
44
45
  user.role = "M"
46
+ user.image = auth.info.image
45
47
  end
46
48
  end
47
49
  end
data/lib/jinda/helpers.rb CHANGED
@@ -81,6 +81,33 @@ module Jinda
81
81
  default_role= Jinda::Role.where(:code =>'default').first
82
82
  return default_role ? default_role.name.to_s : ''
83
83
  end
84
+
85
+ def sign_in?
86
+ if current_ma_user.present?
87
+ return true
88
+ else
89
+ return false
90
+ end
91
+ end
92
+
93
+ # ############################### Themes ###################################
94
+ #
95
+ # Check login user information from User model: name(code), image for Themes
96
+ #
97
+ # ##########################################################################
98
+ def get_login_user_info
99
+ if current_ma_user.present?
100
+ $user_image = current_ma_user.image
101
+ $user_name = current_ma_user.code
102
+ $user_email = current_ma_user.email
103
+ else
104
+ $user_image = asset_url("user.png", :width => "48")
105
+ $user_name = 'Guest User'
106
+ $user_email = 'guest@sample.com'
107
+ end
108
+ return $user_image, $user_name, $user_email
109
+ end
110
+
84
111
  def name2code(s)
85
112
  # rather not ignore # symbol cause it could be comment
86
113
  code, name = s.split(':')
@@ -205,7 +232,6 @@ module Jinda
205
232
  # end
206
233
  #@user ||= User.find_by_auth_token!(cookies[:auth_token]) if cookies[:auth_token]
207
234
  @user ||= User.where(:auth_token => cookies[:auth_token]).first if cookies[:auth_token]
208
-
209
235
  end
210
236
 
211
237
  def ui_action?(s)
data/lib/jinda/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jinda
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
data/lib/tasks/jinda.rake CHANGED
@@ -18,9 +18,9 @@ namespace :jinda do
18
18
  task :seed=> :environment do
19
19
  unless Identity.where(code:"admin").exists?
20
20
  identity= Identity.create :code => "admin", :email => "admin@test.com", :password => "secret",
21
- :password_confirmation => "secret"
21
+ :password_confirmation => "secret", :image => "https://user-images.githubusercontent.com/3953832/42472827-50ed8cbc-8388-11e8-8982-fa523c25288f.png"
22
22
  User.create :provider => "identity", :uid => identity.id.to_s, :code => identity.code,
23
- :email => identity.email, :role => "M,A,D", :auth_token => "71JxMH5fxi23zinBoq1uKA"
23
+ :email => identity.email, :role => "M,A,D", :auth_token => "71JxMH5fxi23zinBoq1uKA", :image => identity.image
24
24
  end
25
25
  end
26
26
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jinda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prateep Kul
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-07-01 00:00:00.000000000 Z
12
+ date: 2018-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -240,6 +240,7 @@ files:
240
240
  - lib/generators/jinda/templates/app/assets/images/tick.png
241
241
  - lib/generators/jinda/templates/app/assets/images/twittersmall.png
242
242
  - lib/generators/jinda/templates/app/assets/images/user.png
243
+ - lib/generators/jinda/templates/app/assets/images/user_admin_gear.png
243
244
  - lib/generators/jinda/templates/app/assets/images/view_code.png
244
245
  - lib/generators/jinda/templates/app/assets/javascripts/application.js
245
246
  - lib/generators/jinda/templates/app/assets/javascripts/cable.js