slices 1.0.4 → 1.0.5

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
  SHA1:
3
- metadata.gz: f7f84f08cfcea6705c4e9eb9cf65a7b1c2bd5335
4
- data.tar.gz: 6aae0d719917c901b85cfc564b2a3abfaa23b16e
3
+ metadata.gz: 0b50a602b55d804ce6e82fd30ff4caeeae4e218f
4
+ data.tar.gz: 4a4788c7dcbe27ae76972168c36bcf74672b23d0
5
5
  SHA512:
6
- metadata.gz: e9f168301ebfcf8f5aa7e411b44017b7e48c7141c01b0d428f3195157e5a2aeee7f1386bf54cc13881393bebf62098f9e556dfeb2c6c72e4c0df763a82e789ca
7
- data.tar.gz: 92ed514b8243831cb27b8386a793b479687b4577354b712b9d3f3580d54cc0713d9786cc2b7b9c25c6eb5aa86a07d67b34b87531402ac3ced856e080c376f346
6
+ metadata.gz: bcc62dbc628c164bb9e5939f1d7852014c91579b31fa590d013d3c80d149aa95ddc7e2f6ce0622932fbaee05d8645e13980c7fd899499d6b396b1850c3812f28
7
+ data.tar.gz: f48be52b0e4b7732ae5d809985aaf4994dd06f3b9e1de30cc737148e40dc6e0cb83fc19ee2232e8183b20260df002067b46252faef44374eb1f122615f4b84e5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 1.0.5 / 2014-08-21
2
+
3
+ * Add confirmation when deleting set entries
4
+ * Fix admin last-login date
5
+ * Fix token field in page meta
6
+
1
7
  # 1.0.4 / 2014-06-06
2
8
 
3
9
  * Remove omniauth
@@ -25,11 +25,14 @@ var EntriesBackbone = $.extend(true, {}, GenericBackbone, {
25
25
 
26
26
  view_prototype: {
27
27
  events: {
28
- "click a.delete": "clear"
28
+ "click a.delete": "clear_with_confirmation"
29
29
  },
30
30
 
31
31
  tagName: 'tr',
32
32
 
33
+ clear_with_confirmation: function() {
34
+ if (confirm('Are you sure?')) this.model.clear();
35
+ }
33
36
  },
34
37
 
35
38
  app_view_prototype: {
@@ -24,7 +24,8 @@ slices.TokenFieldView = Backbone.View.extend({
24
24
  'keydown' : 'onKey',
25
25
  'keypress' : 'onKey',
26
26
  'click .del' : 'onClickDel',
27
- 'click .option' : 'onClickOption'
27
+ 'click .option' : 'onClickOption',
28
+ 'click' : 'onClick'
28
29
  },
29
30
 
30
31
  className: 'token-field',
@@ -101,7 +102,7 @@ slices.TokenFieldView = Backbone.View.extend({
101
102
 
102
103
  delayedCapture: _.debounce(function() {
103
104
  this.capture();
104
- }, 750),
105
+ }, 1500),
105
106
 
106
107
  focusOrRemoveLastToken: function(e) {
107
108
  var focusedToken = this.$el.find('.token.focus');
@@ -198,6 +199,11 @@ slices.TokenFieldView = Backbone.View.extend({
198
199
  }
199
200
  },
200
201
 
202
+ onClick: function(e) {
203
+ this.render();
204
+ this.focus();
205
+ },
206
+
201
207
  onClickDel: function(e) {
202
208
  e.preventDefault();
203
209
 
data/app/models/admin.rb CHANGED
@@ -38,6 +38,8 @@ class Admin
38
38
 
39
39
  def as_json(options)
40
40
  super(options).tap do |json|
41
+ json[:last_sign_in_at] = last_sign_in_at
42
+
41
43
  if current_admin = options[:current_admin]
42
44
  json[:current_admin] = current_admin.id == id
43
45
  end
data/app/models/layout.rb CHANGED
@@ -9,7 +9,6 @@ class Layout
9
9
  def self.files
10
10
  files = []
11
11
  SlicesController.view_paths.each do |resolver|
12
- next if ignore_layout?(resolver.to_path)
13
12
  query = File.join(resolver, 'layouts', "*#{file_extension}")
14
13
  files.concat(Dir.glob(query))
15
14
  end
@@ -22,10 +21,6 @@ class Layout
22
21
  '.html.erb'
23
22
  end
24
23
 
25
- def self.ignore_layout?(layout)
26
- layout.include?(Slices.gem_path) && Rails.root.to_s != Slices.gem_path
27
- end
28
-
29
24
  def initialize(name)
30
25
  @name = name
31
26
  end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Slices</title>
5
+ <%= stylesheet_link_tag "slices/application", :media => "all" %>
6
+ <%= javascript_include_tag "slices/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -1,19 +1,7 @@
1
1
  module Slices
2
- class Engine < Rails::Engine; end
2
+ class Engine < Rails::Engine
3
3
 
4
- def self.autoload_slices(app, root)
5
- slice_dirs = Dir.glob(File.expand_path('app/slices/*', root))
6
- app.config.autoload_paths.push(*slice_dirs.select { |f| File.directory?(f) })
7
- end
8
-
9
- # We need to add the app's own app/slices/* directories to the load
10
- # path so that slices created within the application are automatically
11
- # detected. This means that we need a Railtie as well as an engine, as
12
- # an engine's initializer can't add autoload_paths that aren't scoped
13
- # within the engine itself (for some stupid reason).
14
- class Railtie < Rails::Railtie
15
4
  initializer :autoload_slices, before: :set_autoload_paths do |app|
16
- Slices.autoload_slices(app, Slices.gem_path) if Slices.test_environment?
17
5
  Slices.autoload_slices(app, Rails.root)
18
6
  end
19
7
 
@@ -21,12 +9,6 @@ module Slices
21
9
  config.mongoid.observers.concat [:page_observer, :asset_observer]
22
10
  end
23
11
 
24
- initializer :load_config_initializers, after: :config_initializers do |app|
25
- Dir.glob('config/initializers/*.rb').each do |initializer|
26
- load(initializer)
27
- end
28
- end
29
-
30
12
  initializer :slices_will_paginate_active_view, after: 'will_paginate.action_view' do
31
13
  load Slices.gem_path + '/lib/set_link_renderer.rb'
32
14
  end
@@ -39,13 +21,11 @@ module Slices
39
21
  Slices.load_slice_classes_into_object_space(Rails.root)
40
22
  end
41
23
 
42
- rake_tasks do
43
- root = Slices.gem_path + '/lib/'
44
-
45
- Dir[root + 'slices/tasks/*.rake'].each do |taskfile|
46
- load taskfile.sub root, ''
47
- end
48
- end
24
+ end
49
25
 
26
+ def self.autoload_slices(app, root)
27
+ slice_dirs = Dir.glob(File.expand_path('app/slices/*', root))
28
+ app.config.autoload_paths.push(*slice_dirs.select { |f| File.directory?(f) })
50
29
  end
30
+
51
31
  end
@@ -1,4 +1,4 @@
1
1
  module Slices
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
4
4
 
data/lib/slices.rb CHANGED
@@ -1,7 +1,5 @@
1
- require 'rails'
2
- require 'bson'
3
1
  require 'devise'
4
- require 'mongo'
2
+ require 'devise/orm/mongoid'
5
3
  require 'mongoid'
6
4
  require 'mongoid_paperclip'
7
5
  require 'RedCloth'
@@ -44,13 +42,9 @@ module Slices
44
42
  end
45
43
  end
46
44
 
47
- def self.test_environment?
48
- Rails.env.test? && Rails.root.to_s == Slices.gem_path
49
- end
50
-
51
45
  end
52
46
 
53
- require 'slices/slices_engine' if defined?(Rails)
47
+ require 'slices/engine' if defined?(Rails)
54
48
  require 'slices/i18n'
55
49
  require 'slices/will_paginate_mongoid'
56
50
  require 'slices/will_paginate'
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,4 @@
1
1
  <li>
2
2
  <label for="meta-name">Page Name</label>
3
- <input type="text" id="meta-name" value="{{name}}">
3
+ <input type="text" id="meta-name" name="meta-name" value="{{name}}">
4
4
  </li>
5
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slices
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - With Associates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-06 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson_ext
@@ -362,6 +362,7 @@ files:
362
362
  - app/views/admin/snippets/index.html.erb
363
363
  - app/views/admin/snippets/update.html.erb
364
364
  - app/views/layouts/admin.html.erb
365
+ - app/views/layouts/slices/application.html.erb
365
366
  - lib/ext/file_store_cache.rb
366
367
  - lib/generators/humans/humans_generator.rb
367
368
  - lib/generators/humans/templates/humans.txt
@@ -395,22 +396,17 @@ files:
395
396
  - lib/slices/cms_form_builder.rb
396
397
  - lib/slices/config.rb
397
398
  - lib/slices/container_parser.rb
399
+ - lib/slices/engine.rb
398
400
  - lib/slices/generator_macros.rb
399
401
  - lib/slices/has_attachments.rb
400
402
  - lib/slices/has_slices.rb
401
403
  - lib/slices/i18n/backend.rb
402
404
  - lib/slices/i18n.rb
403
- - lib/slices/i18n_backend.rb
404
405
  - lib/slices/page_as_json.rb
405
406
  - lib/slices/paperclip.rb
406
407
  - lib/slices/position_helper.rb
407
408
  - lib/slices/renderer.rb
408
- - lib/slices/slices_engine.rb
409
409
  - lib/slices/split_date_time_field.rb
410
- - lib/slices/tasks/assets.rake
411
- - lib/slices/tasks/db.rake
412
- - lib/slices/tasks/seeds.rake
413
- - lib/slices/tasks/validate.rake
414
410
  - lib/slices/tree.rb
415
411
  - lib/slices/version.rb
416
412
  - lib/slices/will_paginate.rb
@@ -418,6 +414,10 @@ files:
418
414
  - lib/slices.rb
419
415
  - lib/sRGB.icc
420
416
  - lib/standard_tree.rb
417
+ - lib/tasks/assets.rake
418
+ - lib/tasks/db.rake
419
+ - lib/tasks/seeds.rake
420
+ - lib/tasks/validate.rake
421
421
  - public/slices/templates/page_main.hbs
422
422
  - public/slices/templates/page_main_extra.hbs
423
423
  - public/slices/templates/page_meta.hbs
@@ -426,13 +426,6 @@ files:
426
426
  - public/slices/templates/set_page_entry_content_meta.hbs
427
427
  - public/slices/templates/slice.hbs
428
428
  - config/routes.rb
429
- - config/initializers/backtrace_silencers.rb
430
- - config/initializers/devise.rb
431
- - config/initializers/inflections.rb
432
- - config/initializers/locales.rb
433
- - config/initializers/mime_types.rb
434
- - config/initializers/secret_token.rb
435
- - config/initializers/session_store.rb
436
429
  - CHANGELOG.md
437
430
  - README.md
438
431
  homepage: http://slices.withassociates.com
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,7 +0,0 @@
1
- require 'devise/orm/mongoid'
2
-
3
- ActiveSupport::SecureRandom = SecureRandom
4
-
5
- Devise.setup do |config|
6
- config.mailer_sender = "hello@example.com"
7
- end
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
@@ -1 +0,0 @@
1
- I18n.enforce_available_locales = false
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,9 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- if defined?(Slices::Application)
8
- Slices::Application.config.secret_token = 'b101d69faed18665b8d3b9f7dd321593b6687ddaced0c9b563ad92627ae5d53c835d3977918d8322c2928e5a7cd3b28d909f386d15156a950d7ca8f5669f3693'
9
- end
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- if defined?(Slices::Application)
4
- Slices::Application.config.session_store :cookie_store, key: '_slices_session'
5
- end
6
-
7
- # Use the database for sessions instead of the cookie-based default,
8
- # which shouldn't be used to store highly confidential information
9
- # (create the session table with "rake db:sessions:create")
10
- # Slices::Application.config.session_store :active_record_store
@@ -1,24 +0,0 @@
1
- saise 'aaaaa'
2
- module Slices
3
-
4
- class I18nBackend
5
- include I18n::Backend::Simple::Implementation
6
-
7
- # Translates the given local and key. See the I18n API documentation for details.
8
- #
9
- # @return [Object] the translated key (usually a String)
10
- def translate(locale, key, options = {})
11
- content = super(locale, key, options.merge(fallback: true))
12
- if content.respond_to?(:html_safe)
13
- content.html_safe
14
- else
15
- content
16
- end
17
- end
18
- end
19
- end
20
-
21
- I18n.backend = I18n::Backend::Chain.new(
22
- Slices::I18n::Backend.new,
23
- I18n.backend
24
- )