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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67ea0c217984b55a62704317801681d551960a2a
4
- data.tar.gz: 195e4cd78e57449eb38b64497b8dd6dd9561413a
3
+ metadata.gz: 66a6b1ec02239ee8de7622241d48ae770be48790
4
+ data.tar.gz: b673f1df8c37f7ab820f307fdc384ad5ff6628ab
5
5
  SHA512:
6
- metadata.gz: 048caf0cbfaf3775d26805bc2ca0c3e00d1e99a8ccdb19de3e480627f4baa279841da2c394d60662c051cf5bb146407ce178f9e8b21340113abe388032c589bd
7
- data.tar.gz: 0fba1cc2d274a16ccfff22040e5b5fcac673c7915bbc0cad5497f91be740951f1ff3665fb196cb96ee64dbb4c0e7703038bd84e2901584a6f10e28c341a76f6b
6
+ metadata.gz: beb48afc8636fedfd1715f6ce8113edf8ed55555d1a009bc5cd4ec7f1819cc35e3150fd02667730cda33012a3132f40d1b5fe46fd150ec62c4c71c6f48ea9c1d
7
+ data.tar.gz: a166230ab9e169fde877e42f07254bd588fe04500ebbc1581b802c63a46022345690b919e680231c76f673ee2fb09d4cd7149ffa78d3ba7d975a174caca0b1cb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ants (0.3.3)
4
+ ants (0.3.4)
5
5
  devise
6
6
  mongoid (>= 4.0)
7
7
  mongoid-slug (>= 4.0.0)
@@ -1,5 +1,5 @@
1
1
  class @AntsAdminUsers
2
- constructor: (title='Admins', apiPath='/admin') ->
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
- name:
16
- type: 'string'
17
- required: true
18
- label: "Name"
19
- placeholder: 'Full name'
20
- onInitialize: (input) ->
21
- if input.object
22
- input.$el.removeClass 'input-required'
23
- input.config.disabled = true
24
- input._add_disabled()
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
- email:
27
- type: 'string'
28
- required: true
29
- placeholder: 'Email'
31
+ email:
32
+ type: 'string'
33
+ required: true
34
+ placeholder: 'Email'
30
35
 
31
- onInitialize: (input) ->
32
- if input.object
33
- input.$el.removeClass 'input-required'
34
- input.config.disabled = true
35
- input._add_disabled()
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
- input.$actions =$ "<span class='input-actions'></span>"
38
- input.$avatarBtn =$ "<a href='https://en.gravatar.com/' target='_blank'>Update avatar</a>"
39
- input.$label.append input.$actions
40
- input.$actions.append input.$avatarBtn
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
- password:
43
- type: 'password'
44
- required: true
45
- placeholder: 'Password'
46
- onInitialize: (input) ->
47
- if input.object
48
- input.$el.removeClass 'input-required'
49
- input.$label.html 'Change Password'
50
- input.config.placeholder = 'Type new password & hit Save'
51
- input._add_placeholder()
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
- path_from: { type: 'string', label: 'From', placeholder: '/redirect-from-path', required: true }
21
- path_to: { type: 'url', label: 'To', placeholder: '/redirect-to-path', required: true }
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
@@ -1,2 +1,4 @@
1
1
  @import "ants/header";
2
- @import "ants/profile";
2
+ @import "ants/profile";
3
+ @import "ants/settings";
4
+ @import "ants/redirects";
@@ -0,0 +1,12 @@
1
+ // .redirects {
2
+ // .item-title {
3
+ // line-height: 1.5em;
4
+ // }
5
+ // .item-subtitle {
6
+ // @include position(relative, -20px null null null);
7
+ // float: right;
8
+ // }
9
+ // .item.has-subtitle {
10
+ // padding: .6em 1em .8em;
11
+ // }
12
+ // }
@@ -0,0 +1,8 @@
1
+ .view-settings {
2
+ .input-hash.input-values {
3
+ padding: 0;
4
+ & > .label {
5
+ display: none;
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,5 @@
1
+ module Admin
2
+ class SettingsObjectsController < Admin::BaseController
3
+ mongosteen
4
+ end
5
+ end
@@ -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
- def downcase_from_path!
59
- self.path_from.downcase!
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
@@ -1,3 +1,3 @@
1
1
  module Ants
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
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.3.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-27 00:00:00.000000000 Z
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