ants 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/ants/admin_users.coffee +44 -34
- data/app/assets/javascripts/ants/redirects.coffee +6 -2
- data/app/assets/javascripts/ants/settings.coffee +20 -0
- data/app/assets/stylesheets/ants.scss +3 -1
- data/app/assets/stylesheets/ants/redirects.scss +12 -0
- data/app/assets/stylesheets/ants/settings.scss +8 -0
- data/app/controllers/admin/settings_objects_controller.rb +5 -0
- data/app/models/redirect.rb +8 -20
- data/app/models/settings_object.rb +22 -0
- data/lib/ants/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66a6b1ec02239ee8de7622241d48ae770be48790
|
4
|
+
data.tar.gz: b673f1df8c37f7ab820f307fdc384ad5ff6628ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: beb48afc8636fedfd1715f6ce8113edf8ed55555d1a009bc5cd4ec7f1819cc35e3150fd02667730cda33012a3132f40d1b5fe46fd150ec62c4c71c6f48ea9c1d
|
7
|
+
data.tar.gz: a166230ab9e169fde877e42f07254bd588fe04500ebbc1581b802c63a46022345690b919e680231c76f673ee2fb09d4cd7149ffa78d3ba7d975a174caca0b1cb
|
data/Gemfile.lock
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class @AntsAdminUsers
|
2
|
-
constructor: (title='
|
2
|
+
constructor: (title='Administrators', apiPath='/admin') ->
|
3
3
|
config =
|
4
4
|
title: title
|
5
5
|
showWithParent: true
|
@@ -12,42 +12,52 @@ class @AntsAdminUsers
|
|
12
12
|
})
|
13
13
|
|
14
14
|
formSchema:
|
15
|
-
|
16
|
-
type: '
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
details_panel:
|
16
|
+
type: 'group'
|
17
|
+
groupClass: 'group-panel'
|
18
|
+
title: 'Profile'
|
19
|
+
inputs:
|
20
|
+
name:
|
21
|
+
type: 'string'
|
22
|
+
required: true
|
23
|
+
label: "Name"
|
24
|
+
placeholder: 'Full name'
|
25
|
+
onInitialize: (input) ->
|
26
|
+
if input.object
|
27
|
+
input.$el.removeClass 'input-required'
|
28
|
+
input.config.disabled = true
|
29
|
+
input._add_disabled()
|
25
30
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
email:
|
32
|
+
type: 'string'
|
33
|
+
required: true
|
34
|
+
placeholder: 'Email'
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
onInitialize: (input) ->
|
37
|
+
if input.object
|
38
|
+
input.$el.removeClass 'input-required'
|
39
|
+
input.config.disabled = true
|
40
|
+
input._add_disabled()
|
36
41
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
42
|
+
input.$actions =$ "<span class='input-actions'></span>"
|
43
|
+
input.$avatarBtn =$ "<a href='https://en.gravatar.com/' target='_blank'>Update avatar</a>"
|
44
|
+
input.$label.append input.$actions
|
45
|
+
input.$actions.append input.$avatarBtn
|
41
46
|
|
42
|
-
|
43
|
-
type: '
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
input
|
47
|
+
password_panel:
|
48
|
+
type: 'group'
|
49
|
+
groupClass: 'group-panel'
|
50
|
+
title: 'Password'
|
51
|
+
inputs:
|
52
|
+
password:
|
53
|
+
type: 'password'
|
54
|
+
required: true
|
55
|
+
placeholder: 'Password'
|
56
|
+
onInitialize: (input) ->
|
57
|
+
if input.object
|
58
|
+
input.$el.removeClass 'input-required'
|
59
|
+
input.$label.html 'Change password'
|
60
|
+
input.config.placeholder = 'Enter new password here, then hit "Save"'
|
61
|
+
input._add_placeholder()
|
52
62
|
|
53
63
|
return config
|
@@ -17,7 +17,11 @@ class @AntsRedirects
|
|
17
17
|
})
|
18
18
|
|
19
19
|
formSchema:
|
20
|
-
|
21
|
-
|
20
|
+
group:
|
21
|
+
type: 'group'
|
22
|
+
groupClass: 'group-panel'
|
23
|
+
inputs:
|
24
|
+
path_from: { type: 'string', label: 'From', placeholder: '/redirect-from-path', required: true }
|
25
|
+
path_to: { type: 'url', label: 'To', placeholder: '/redirect-to-path', required: true }
|
22
26
|
|
23
27
|
return config
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class @AntsSettings
|
2
|
+
constructor: (title, slug, formSchema, apiPath='/admin') ->
|
3
|
+
config =
|
4
|
+
title: title
|
5
|
+
showWithParent: true
|
6
|
+
|
7
|
+
objectStore: new RailsObjectStore({
|
8
|
+
resource: 'settings_object'
|
9
|
+
path: "#{apiPath}/settings_objects/#{slug}"
|
10
|
+
})
|
11
|
+
|
12
|
+
formSchema:
|
13
|
+
values:
|
14
|
+
type: 'hash'
|
15
|
+
formSchema: formSchema
|
16
|
+
|
17
|
+
onViewShow: (view) ->
|
18
|
+
view.$el.addClass 'view-settings'
|
19
|
+
|
20
|
+
return config
|
data/app/models/redirect.rb
CHANGED
@@ -4,7 +4,6 @@ class Redirect
|
|
4
4
|
include Mongoid::Search
|
5
5
|
include Ants::Id
|
6
6
|
|
7
|
-
|
8
7
|
## Attributes
|
9
8
|
field :path_from, type: String
|
10
9
|
field :path_to, type: String
|
@@ -22,21 +21,17 @@ class Redirect
|
|
22
21
|
## Indexes
|
23
22
|
index({ path_from: 1 })
|
24
23
|
|
25
|
-
|
26
24
|
## Callbacks
|
27
25
|
after_validation :downcase_from_path!
|
28
26
|
|
29
|
-
|
30
27
|
## Helpers
|
31
28
|
def _list_item_title
|
32
|
-
path_from
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
def _list_item_subtitle
|
37
|
-
'Created ' + ActionController::Base.helpers.time_ago_in_words(created_at) + ' ago'
|
29
|
+
"#{path_from} → #{path_to}"
|
38
30
|
end
|
39
31
|
|
32
|
+
# def _list_item_subtitle
|
33
|
+
# 'Created ' + ActionController::Base.helpers.time_ago_in_words(created_at) + ' ago'
|
34
|
+
# end
|
40
35
|
|
41
36
|
## Class Methods
|
42
37
|
def self.match(request)
|
@@ -52,18 +47,11 @@ class Redirect
|
|
52
47
|
self.where(:path_from.in => [ fullpath, fullpath_alt1, fullpath_alt2, fullpath_alt3 ]).first
|
53
48
|
end
|
54
49
|
|
55
|
-
|
56
50
|
private
|
57
51
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
return true
|
62
|
-
end
|
63
|
-
|
52
|
+
def downcase_from_path!
|
53
|
+
self.path_from.downcase!
|
64
54
|
|
55
|
+
return true
|
56
|
+
end
|
65
57
|
end
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class SettingsObject
|
2
|
+
include Mongoid::Document
|
3
|
+
include Mongoid::Timestamps
|
4
|
+
include Ants::Id
|
5
|
+
include Ants::Slug
|
6
|
+
|
7
|
+
## Attributes
|
8
|
+
field :title
|
9
|
+
field :values, type: Hash, default: {}
|
10
|
+
|
11
|
+
## Slug
|
12
|
+
slug :title
|
13
|
+
|
14
|
+
def values_attributes= (hash)
|
15
|
+
values = hash
|
16
|
+
end
|
17
|
+
|
18
|
+
## Class
|
19
|
+
def self.hash
|
20
|
+
all.to_a.inject({}) { |h, s| h[s.title.to_sym] = s.values; h }
|
21
|
+
end
|
22
|
+
end
|
data/lib/ants/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.4
|
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-11-
|
11
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -159,13 +159,17 @@ files:
|
|
159
159
|
- app/assets/javascripts/ants/meta.coffee
|
160
160
|
- app/assets/javascripts/ants/profile.coffee
|
161
161
|
- app/assets/javascripts/ants/redirects.coffee
|
162
|
+
- app/assets/javascripts/ants/settings.coffee
|
162
163
|
- app/assets/javascripts/ants/slug.coffee
|
163
164
|
- app/assets/stylesheets/ants.scss
|
164
165
|
- app/assets/stylesheets/ants/header.scss
|
165
166
|
- app/assets/stylesheets/ants/profile.scss
|
167
|
+
- app/assets/stylesheets/ants/redirects.scss
|
168
|
+
- app/assets/stylesheets/ants/settings.scss
|
166
169
|
- app/controllers/admin/admin_users_controller.rb
|
167
170
|
- app/controllers/admin/menus_controller.rb
|
168
171
|
- app/controllers/admin/redirects_controller.rb
|
172
|
+
- app/controllers/admin/settings_objects_controller.rb
|
169
173
|
- app/controllers/redirects_controller.rb
|
170
174
|
- app/helpers/content_helper.rb
|
171
175
|
- app/helpers/menu_helper.rb
|
@@ -174,6 +178,7 @@ files:
|
|
174
178
|
- app/models/menu.rb
|
175
179
|
- app/models/menu_link.rb
|
176
180
|
- app/models/redirect.rb
|
181
|
+
- app/models/settings_object.rb
|
177
182
|
- app/views/ants/_profile.html.erb
|
178
183
|
- lib/ants.rb
|
179
184
|
- lib/ants/engine.rb
|