ants 0.1.4 → 0.2.0

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
  SHA1:
3
- metadata.gz: 657a8e90e24c3847912f0ef7fc274c30aab73d5b
4
- data.tar.gz: 856b34fef9723974bee0caae3df40a85b3ac11a0
3
+ metadata.gz: fffa22182df15ae5af9a5ca27f826d94fec46d80
4
+ data.tar.gz: b07f9d32a98b47487a812604db8120d8ee9d3fff
5
5
  SHA512:
6
- metadata.gz: cfa87fcb807e24fcbc2a92312587a8b6ec344efd3800ab3a0daa969747e2cb9f533440b464e4f654935d2589cda2a6359ccb4027b13ca83a378a7aabf35248c4
7
- data.tar.gz: f357f1da041400c5b0444fd13eb481fa59e612d7d39864caacd66ed2d6fc61d6bc9254fd10b217d8db35ce18773633db9bfdf4d544c3e744204493f49edde2f2
6
+ metadata.gz: 048355f393f3b41471c7349df8fff9c1db2f0cb6ae4327166e88d6de8230a5c57afbfd6fc1013e2f2a7e57292068e3bbcfff4403daa54710ddf5f9980b0dfd8a
7
+ data.tar.gz: 3aab8fbaa685e40bbf840008844990ba025fa4328a7900444e8042d60e91da30a6c51929377f12255eeaecfbb75176666ce089d326e294a7bd6d21c7f20ced92
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ants (0.1.4)
4
+ ants (0.2.0)
5
5
  mongoid (>= 4.0)
6
6
  mongoid-slug (>= 4.0.0)
7
7
 
@@ -44,7 +44,7 @@ GEM
44
44
  thread_safe (~> 0.3, >= 0.3.4)
45
45
  tzinfo (~> 1.1)
46
46
  arel (6.0.0)
47
- bson (3.1.2)
47
+ bson (3.2.4)
48
48
  builder (3.2.2)
49
49
  connection_pool (2.2.0)
50
50
  coveralls (0.8.1)
@@ -79,7 +79,7 @@ GEM
79
79
  mongoid-slug (4.0.0)
80
80
  mongoid (>= 3.0)
81
81
  stringex (~> 2.0)
82
- moped (2.0.6)
82
+ moped (2.0.7)
83
83
  bson (~> 3.0)
84
84
  connection_pool (~> 2.0)
85
85
  optionable (~> 0.2.0)
@@ -164,10 +164,10 @@ DEPENDENCIES
164
164
  ants!
165
165
  bundler (~> 1.9)
166
166
  coveralls
167
- rails (>= 4.1)
167
+ rails (>= 4.2)
168
168
  rake (~> 10.0)
169
169
  rspec (>= 2.0)
170
170
  rspec-aspic (>= 0.0.2)
171
171
 
172
172
  BUNDLED WITH
173
- 1.10.4
173
+ 1.10.6
data/ants.gemspec CHANGED
@@ -23,7 +23,7 @@ Collection of concerns and helpers for Rails + Mongoid + Character web developme
23
23
  s.add_dependency('mongoid', '>= 4.0' )
24
24
  s.add_dependency('mongoid-slug', '>= 4.0.0')
25
25
 
26
- s.add_development_dependency('rails', [ '>= 4.1' ])
26
+ s.add_development_dependency('rails', [ '>= 4.2' ])
27
27
  s.add_development_dependency('rspec', [ '>= 2.0' ])
28
28
  s.add_development_dependency('rspec-aspic', [ '>= 0.0.2' ])
29
29
  s.add_development_dependency('coveralls')
@@ -17,7 +17,12 @@ Ants.adminsConfig = ->
17
17
  label: """Name <small>— to update or add avatar, please register on
18
18
  <a href='http://gravatar.com' target='_blank'>Gravatar</a>
19
19
  using same email address</small>"""
20
- placeholder: 'Users full name'
20
+ placeholder: 'Full name'
21
+ onInitialize: (input) ->
22
+ if input.object
23
+ input.$el.removeClass 'input-required'
24
+ input.config.disabled = true
25
+ input._add_disabled()
21
26
 
22
27
  email:
23
28
  type: 'string'
@@ -0,0 +1,3 @@
1
+ class AdminMailer < Devise::Mailer
2
+
3
+ end
data/app/models/admin.rb CHANGED
@@ -1,3 +1,11 @@
1
+ # -------------------------------------------------------------------
2
+ # Make sure /config/initializers/device.rb includes :email like:
3
+ #
4
+ # config.case_insensitive_keys = [ :email ]
5
+ #
6
+ # This is required to make it possible for users login with case
7
+ # insensative emails.
8
+ # -------------------------------------------------------------------
1
9
  class Admin
2
10
  include Mongoid::Document
3
11
  include Mongoid::Timestamps
@@ -7,7 +15,8 @@ class Admin
7
15
 
8
16
 
9
17
  ## Attributes
10
- field :name, default: ''
18
+ field :name
19
+ field :permissions, type: Array
11
20
 
12
21
  # Include default devise modules. Others available are:
13
22
  # :confirmable, :lockable, :timeoutable, :registerable, :validatable and :omniauthable
@@ -44,22 +53,23 @@ class Admin
44
53
 
45
54
 
46
55
  ## Validations
47
- validates :name, presence: true
56
+ validates :name, presence: true
57
+ validates :email, presence: true, allow_blank: false, uniqueness: true
48
58
 
49
59
 
50
60
  ## Search
51
61
  search_in :name, :email
52
62
 
53
-
54
63
  ## Scopes
55
64
  default_scope -> { asc(:name) }
56
65
 
57
66
 
58
67
  ## Indexes
59
- index({ name: 1 })
68
+ index({ name: 1 })
69
+ index({ email: 1 }, { unique: true })
60
70
 
61
71
 
62
- # HELPERS
72
+ ## Helpers
63
73
  def devise_mailer
64
74
  AdminMailer
65
75
  end
@@ -67,9 +77,9 @@ class Admin
67
77
 
68
78
  def last_sign_in_ago
69
79
  if last_sign_in_at
70
- 'seen ' + ActionController::Base.helpers.time_ago_in_words(last_sign_in_at) + ' ago'
80
+ 'Seen ' + ActionController::Base.helpers.time_ago_in_words(last_sign_in_at) + ' ago'
71
81
  else
72
- 'never seen'
82
+ 'Never seen'
73
83
  end
74
84
  end
75
85
 
@@ -88,7 +98,6 @@ class Admin
88
98
  "http://www.gravatar.com/avatar/#{ Digest::MD5.hexdigest(email) }?s=80&d=retro&r=g"
89
99
  end
90
100
 
91
-
92
101
  end
93
102
 
94
103
 
@@ -25,7 +25,7 @@ class Redirect
25
25
 
26
26
 
27
27
  ## Callbacks
28
- after_validation :downcase_paths!
28
+ after_validation :downcase_from_path!
29
29
 
30
30
 
31
31
  ## Helpers
@@ -35,7 +35,7 @@ class Redirect
35
35
 
36
36
 
37
37
  def _list_item_subtitle
38
- 'created ' + ActionController::Base.helpers.time_ago_in_words(created_at) + ' ago'
38
+ 'Created ' + ActionController::Base.helpers.time_ago_in_words(created_at) + ' ago'
39
39
  end
40
40
 
41
41
 
@@ -43,7 +43,7 @@ class Redirect
43
43
  def self.match(request)
44
44
  # request.fullpath includes parameters and leading / so
45
45
  # add ending slash (Rails skips it) as alternative option
46
- fullpath = request.fullpath
46
+ fullpath = request.fullpath.downcase
47
47
  fullpath_alt1 = fullpath.gsub('?', '/?')
48
48
 
49
49
  # decode URL to UTF string, e.g. %C3%A9 => é
@@ -56,9 +56,8 @@ class Redirect
56
56
 
57
57
  private
58
58
 
59
- def downcase_paths!
59
+ def downcase_from_path!
60
60
  self.path_from.downcase!
61
- self.path_to.downcase!
62
61
 
63
62
  return true
64
63
  end
data/lib/ants/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ants
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ants
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-15 00:00:00.000000000 Z
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '4.1'
47
+ version: '4.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '4.1'
54
+ version: '4.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -145,6 +145,7 @@ files:
145
145
  - app/assets/stylesheets/ants.scss
146
146
  - app/assets/stylesheets/chr/header.scss
147
147
  - app/controllers/redirects_controller.rb
148
+ - app/mailers/admin_mailer.rb
148
149
  - app/models/admin.rb
149
150
  - app/models/redirect.rb
150
151
  - lib/ants.rb