chr 0.4.12 → 0.4.13

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: f731549e404ffdd9f1623583ddfe872e08b38aea
4
- data.tar.gz: 490af2234f3464422866fdcdc1dc9026672752f9
3
+ metadata.gz: 78fff44ae30cacabc5c9ad629bd9524c59f6aa43
4
+ data.tar.gz: 1a2c7b4f80cf9014d7bec93a353e34afc6dac650
5
5
  SHA512:
6
- metadata.gz: 9edd09db6f3f410be71d8aecefca3b31170ee6521785fa1cd1deee18f11b3121efbecba25f7b05fb41a4afbc2c0859935642448759a1d56a4102e5c465263f1b
7
- data.tar.gz: a256d972fadde06a5836df52db3d274400a528e92053cef9455a10d7b683e18c07ed11ee83a638c17ca091fb13fae5d780641578d7301fe724d574df173a62d6
6
+ metadata.gz: 09513cd3c2b323fbffdc1f1c21b136b0f10aa6ddff4824871e7d81acc47c967bbf22adab2853ebf446d0e4adae63b87e9c277df98b8cece601f82f61274bd4a8
7
+ data.tar.gz: 21c87d145c886ff97d9215c7dc6fdb70b7617fd2fd83c9f513c0783c5b17e52a65c6649b028c0ef0678f151be26c3523efec99586e250b72b709d0d1e9153e6d
@@ -73,13 +73,22 @@ class @Chr
73
73
  return $(this).trigger('hashchange')
74
74
 
75
75
  if ! @isMobile()
76
- return @updateHash('#/' + Object.keys(@modules)[0])
76
+ firstMenuItemPath = @$mainMenu.find(".menu-#{ Object.keys(@modules)[0] }").attr('href')
77
+ return @updateHash(firstMenuItemPath)
77
78
 
78
79
 
79
80
  # PUBLIC ================================================
80
81
 
81
82
  isMobile: ->
82
- $(window).width() < 760
83
+ $(window).width() < 768
84
+
85
+
86
+ isTablet: ->
87
+ ! @isMobile() && ! @isDesktop()
88
+
89
+
90
+ isDesktop: ->
91
+ $(window).width() >= 1024
83
92
 
84
93
 
85
94
  updateHash: (path, @skipRoute=false) ->
@@ -97,8 +106,10 @@ class @Chr
97
106
  @$el.append(@$navBar)
98
107
 
99
108
  for name, config of @config.modules
100
- @modules[name] = new Module(this, name, config)
101
- @_add_menu_item(name, @modules[name].menuTitle)
109
+ m = new Module(this, name, config)
110
+ @_add_menu_item(name, m.menuTitle)
111
+ m.onModuleInit()
112
+ @modules[name] = m
102
113
 
103
114
  @_bind_hashchange()
104
115
  @_on_start()
@@ -10,7 +10,11 @@
10
10
  # PRIVATE ===============================================
11
11
 
12
12
  _add_item: (path, object, position, config, type) ->
13
- item = new @itemClass(@module, path, object, config, type)
13
+ if type == 'folder'
14
+ item = new Item(@module, path, object, config, type)
15
+ else
16
+ item = new @itemClass(@module, path, object, config, type)
17
+
14
18
  @items[object._id] = item
15
19
  @_update_item_position(item, position)
16
20
 
@@ -14,6 +14,7 @@
14
14
  # menuTitle - title used for the menu link
15
15
  # showNestedListsAside - show module root list on the left and all nested
16
16
  # lists on the right side for desktop
17
+ # onModuleInit - after module is initialized callback
17
18
  #
18
19
  # Public methods:
19
20
  # addNestedList (listName, config, parentList)
@@ -39,11 +40,13 @@ class @Module
39
40
  @menuTitle = @config.menuTitle ? @config.title
40
41
  @menuTitle ?= @name.titleize()
41
42
 
42
- @config.onModuleInit?(this)
43
-
44
43
 
45
44
  # PUBLIC ================================================
46
45
 
46
+ onModuleInit: ->
47
+ @config.onModuleInit?(this)
48
+
49
+
47
50
  addNestedList: (name, config, parentList) ->
48
51
  path = [ parentList.path, name ].join('/')
49
52
  @nestedLists[name] = new List(this, path, name, config, parentList)
@@ -29,7 +29,7 @@
29
29
  # special case for LIST inputs, values separated with comma
30
30
  if attr_name.indexOf('[__LIST__') > -1
31
31
  attr_name = attr_name.replace('__LIST__', '')
32
- values = attr_value.split(',')
32
+ values = attr_value.split('|||')
33
33
 
34
34
  for value in values
35
35
  formDataObject.append("#{ @config.resource }#{ attr_name }[]", value)
@@ -23,7 +23,7 @@ a { text-decoration: none; }
23
23
 
24
24
  /* Header ------------------------------------------------------------------ */
25
25
  .header {
26
- height : 40px;
26
+ height : 41px;
27
27
  text-align : center;
28
28
  }
29
29
 
@@ -102,8 +102,7 @@ a { text-decoration: none; }
102
102
 
103
103
  .search {
104
104
  @include position(absolute, 0 null null null);
105
- width : 100%;
106
- background : white;
105
+ width : 100%;
107
106
 
108
107
  input { display: block; }
109
108
  .cancel { display: inline-block; }
@@ -120,8 +119,8 @@ a { text-decoration: none; }
120
119
  /* Mobile ------------------------------------------------------------------ */
121
120
  .header {
122
121
  @include position(fixed, 0 null null null);
123
- width : 100%;
124
122
  z-index : 10;
123
+ width : 100%;
125
124
  }
126
125
 
127
126
  .view, .list {
@@ -153,8 +152,7 @@ a { text-decoration: none; }
153
152
 
154
153
  .sidebar {
155
154
  @include position(absolute, 0 null 0 0);
156
- width : 9em;
157
- border-right : 1px solid;
155
+ width : 9em;
158
156
  }
159
157
 
160
158
  .module {
@@ -163,9 +161,9 @@ a { text-decoration: none; }
163
161
  }
164
162
 
165
163
  .view, .list {
166
- bottom : 0;
167
164
  padding-top : 0px;
168
165
  overflow : hidden;
166
+ bottom : 0;
169
167
  }
170
168
 
171
169
  .header { @include position(relative); }
@@ -2,16 +2,26 @@
2
2
 
3
3
  $base-font-family : 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif !default;
4
4
 
5
- $light : 300 !default;
6
- $regular : 400 !default;
7
- $medium : 500 !default;
8
- $bold : 600 !default;
9
- $black : 800 !default;
10
-
11
- $base-font-color : rgb( 89, 89, 89) !default;
12
- $positive-color : rgb( 74,135,238) !default;
13
- $assertive-color : rgb(239, 78, 58) !default;
14
- $border-color : rgb(246,246,246) !default;
5
+ $thin : 100 !default;
6
+ $light : 300 !default;
7
+ $regular : 400 !default;
8
+ $medium : 500 !default;
9
+ $semibold : 600 !default;
10
+ $bold : 700 !default;
11
+ $extrabold : 800 !default;
12
+ $black : 900 !default;
13
+
14
+ $base-font-color : #2e2e2e !default;
15
+ $positive-color : #4a87ee !default;
16
+ $assertive-color : #ee5f4a !default;
17
+ $border-color : #f6f6f6 !default;
18
+
19
+ $sidebar-color : #aaa !default;
20
+ $sidebar-bg-color : #222 !default;
21
+ $sidebar-active-color : white !default;
22
+ $sidebar-active-bg-color : #1a1a1a !default;
23
+
24
+ $list-bg-color : #fafafa !default;
15
25
 
16
26
  $formagic-base-color : $base-font-color;
17
27
  $formagic-positive-color : $positive-color;
@@ -32,19 +42,12 @@ a {
32
42
  .menu a {
33
43
  color : $base-font-color;
34
44
  padding : .75em 1em;
35
- &.active { background-color: $border-color; }
36
- }
37
-
38
- .header a {
39
- &:hover {
40
- opacity : .5;
41
- }
42
45
  }
43
46
 
44
47
  .menu-title,
45
48
  .header .title,
46
49
  .header .save {
47
- font-weight : $medium;
50
+ font-weight : $semibold;
48
51
  }
49
52
 
50
53
  .header {
@@ -141,8 +144,8 @@ a {
141
144
 
142
145
  .header .new { @include icon-plus($positive-color); }
143
146
 
144
- .item .icon-reorder { @include icon-reorder(lighten($base-font-color, 50%)); }
145
- .item .icon-folder { @include icon-folder(lighten($base-font-color, 50%)); }
147
+ .icon-reorder { @include icon-reorder(lighten($base-font-color, 50%)); }
148
+ .icon-folder { @include icon-folder(lighten($base-font-color, 50%)); }
146
149
 
147
150
  .slip-reordering > .icon-reorder:before,
148
151
  .slip-reordering > .icon-reorder:after { background-color: $positive-color; }
@@ -153,24 +156,59 @@ a {
153
156
 
154
157
  @media #{$tablet} {
155
158
  .sidebar {
156
- border-color : $border-color;
159
+ background-color : $sidebar-bg-color;
160
+ }
161
+
162
+ .menu a {
163
+ border-left : 2px solid $sidebar-bg-color;
164
+ color : $sidebar-color;
165
+ &:hover {
166
+ background-color : $sidebar-active-bg-color;
167
+ border-color : $sidebar-active-bg-color;
168
+ color : $sidebar-active-color;
169
+ }
170
+ &.active {
171
+ background-color : $sidebar-active-bg-color;
172
+ border-color : $positive-color;
173
+ color : $sidebar-active-color;
174
+ }
175
+ }
176
+
177
+ .menu-title {
178
+ font-weight : $regular;
179
+ color : white;
157
180
  }
181
+
182
+ .admin-devise_overrides-sessions {
183
+ background-color : $list-bg-color;
184
+ }
185
+
158
186
  .signin-modal {
159
- max-width : 26em;
160
- border : 1px solid $border-color;
161
- margin : 5em auto 1em;
187
+ background : white;
188
+ max-width : 26em;
189
+ border : 1px solid $border-color;
190
+ margin : 5em auto 1em;
162
191
 
163
192
  form {
164
193
  margin-left: .5em;
165
194
  }
166
195
  }
196
+
197
+ .list {
198
+ background-color : $list-bg-color;
199
+ .header {
200
+ background-color : $list-bg-color;
201
+ }
202
+ &.list-aside {
203
+ background-color : white;
204
+ .header {
205
+ background-color : white;
206
+ }
207
+ }
208
+ }
167
209
  }
168
210
 
169
211
  @media #{$desktop} {
170
212
  .list .header { border-color: $border-color; }
171
- .input-text textarea, .content, .items { @include custom-scrollbar(rgba($base-font-color, .5), $border-color, 3px); }
213
+ .input-text textarea, .content, .items { @include custom-scrollbar(rgba($base-font-color, .25), $border-color, 3px); }
172
214
  }
173
-
174
-
175
-
176
-
@@ -323,7 +323,7 @@ module Chr
323
323
  def initialize_mongoid
324
324
  generate 'mongoid:config'
325
325
  append_file "config/mongoid.yml", """\nproduction:
326
- sessions:
326
+ clients:
327
327
  default:
328
328
  uri: <%= ENV['MONGODB_URI'] %>"""
329
329
  end
data/lib/chr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Chr
2
2
  RAILS_VERSION = "~> 4.2.4"
3
3
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
4
- VERSION = "0.4.12"
4
+ VERSION = "0.4.13"
5
5
  end
@@ -12,11 +12,15 @@ gem 'rack-canonical-host'
12
12
  gem 'meta-tags'
13
13
  gem 'asset_sync'
14
14
  gem 'awesome_print'
15
- gem 'mongoid'
15
+ gem 'bson_ext'
16
+ gem 'mongoid', '~> 5.0.0'
17
+ # This `autoinc` branch supports mongoid 5.0, required by Loft
18
+ gem 'mongoid-autoinc', github: 'suweller/mongoid-autoinc'
16
19
  gem 'mongosteen'
17
20
  gem 'chr'
18
21
  gem 'ants'
19
22
  gem 'loft'
23
+ gem 'carrierwave-mongoid'
20
24
 
21
25
  group :development do
22
26
  gem 'spring'
@@ -10,5 +10,6 @@
10
10
  /log/*
11
11
  /public/system
12
12
  /public/assets
13
+ /public/loft
13
14
  /tags
14
15
  /tmp/*
@@ -5,24 +5,21 @@
5
5
  #= require loft
6
6
  #= require ants
7
7
 
8
- @settingsConfig = ->
9
- items:
10
- admins: Ants.adminsConfig()
11
- redirects: Ants.redirectsConfig()
8
+ @getConfig = (data) ->
9
+ modules =
10
+ loft: new Loft()
11
+ settings:
12
+ items:
13
+ admins: new AntsAdmins()
14
+ redirects: new AntsRedirects()
12
15
 
13
- @getChrConfig = (data) ->
14
- modules = {}
15
- all_modules =
16
- loft: new Loft('Files', 'asset', '/admin/assets')
17
- settings: settingsConfig()
18
-
19
- return { modules: all_modules }
16
+ return { modules: modules }
20
17
 
21
18
  $ ->
22
19
  $.get '/admin/bootstrap.json', (response) ->
23
- chrConfig = getChrConfig(response)
20
+ config = getConfig(response)
24
21
 
25
- chr.start('<%= app_name %>', chrConfig)
22
+ chr.start('<%= app_name %>', config)
26
23
 
27
24
  # append signout button to the end of sidebar menu
28
25
  $('a[data-method=delete]').appendTo(".sidebar .menu").show()
@@ -8,14 +8,14 @@
8
8
  <meta name="apple-mobile-web-app-capable" content="yes">
9
9
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
10
10
 
11
- <%= display_meta_tags site: 'hello-world', title: 'CMS' %>
11
+ <%%= display_meta_tags site: '<%= app_name %>', title: 'CMS' %>
12
12
 
13
- <%= csrf_meta_tags %>
14
- <%= stylesheet_link_tag :admin, media: 'all' %>
13
+ <%%= csrf_meta_tags %>
14
+ <%%= stylesheet_link_tag :admin, media: 'all' %>
15
15
  </head>
16
16
 
17
17
  <body class='<%= body_class %>'>
18
- <%= yield %>
18
+ <%%= yield %>
19
19
  </body>
20
20
 
21
21
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.12
4
+ version: 0.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-09-12 00:00:00.000000000 Z
13
+ date: 2015-10-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -343,7 +343,7 @@ files:
343
343
  - templates/character_admin.coffee.erb
344
344
  - templates/character_admin.scss
345
345
  - templates/character_admin_index.html.erb
346
- - templates/character_admin_layout.html.erb
346
+ - templates/character_admin_layout.html.erb.erb
347
347
  - templates/character_base_controller.rb
348
348
  - templates/development_seeds.rb
349
349
  - templates/devise_overrides_passwords_controller.rb