netzke-core 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.2.10
2
+ Removed dependency on 'json' gem.
3
+ Rails v2.3.2 compatibility.
4
+
1
5
  v0.2.9
2
6
  Actions, toolbars and tools reworked for easier configuration.
3
7
  Menus introduced (based on actions).
@@ -30,7 +30,7 @@ class NetzkePreference < ActiveRecord::Base
30
30
  when nil then r = norm_value # do not cast
31
31
  when 'Boolean' then r = norm_value == 'false' ? false : (norm_value == 'true' || norm_value)
32
32
  when 'NilClass' then r = nil
33
- when 'Array', 'Hash' then r = JSON.parse(norm_value)
33
+ when 'Array', 'Hash' then r = ActiveSupport::JSON.decode(norm_value)
34
34
  else
35
35
  r = norm_value.send(ELEMENTARY_CONVERTION_METHODS[klass])
36
36
  end
data/lib/netzke/base.rb CHANGED
@@ -2,12 +2,6 @@ require 'netzke/base_extras/js_builder'
2
2
  require 'netzke/base_extras/interface'
3
3
 
4
4
  module Netzke
5
- #
6
- # Configuration:
7
- # * Define NETZKE_BOOT_CONFIG in environment.rb to specify which Netzke functionality should be disabled
8
- # to reduce the size of /netzke/netzke.[js|css]. Those Netzke gems that use additional JS/CSS-code
9
- # should be aware of this constant.
10
- #
11
5
  class Base
12
6
 
13
7
  # Class-level Netzke::Base configuration. The defaults also get specified here.
@@ -1,10 +1,8 @@
1
- require 'json'
2
-
3
1
  module Netzke
4
2
  module BaseExtras
5
3
  module Interface
6
4
  def get_widget(params = {})
7
- components_cache = (JSON.parse(params[:components_cache]) if params[:components_cache]) || []
5
+ components_cache = (ActiveSupport::JSON.decode(params[:components_cache]) if params[:components_cache]) || []
8
6
 
9
7
  js = js_missing_code(components_cache)
10
8
  css = css_missing_code(components_cache)
@@ -3,7 +3,7 @@ module Netzke
3
3
  #
4
4
  # Module which provides JS-class generation functionality for the widgets ("client-side"). This code is executed only once per widget class, and the results are cached at the server (unless widget specifies config[:no_caching] => true).
5
5
  # Included into Netzke::Base class
6
- # Most of the methods below are meant to be overwritten by a concrete widget class.
6
+ # Most of the methods below are meant to be overwritten
7
7
  #
8
8
  module JsBuilder
9
9
  def self.included(base)
@@ -222,14 +222,6 @@ JS
222
222
 
223
223
  # returns all extra js-code (as string) required by this widget's class
224
224
  def js_included
225
- # from extjs - defined in the widget class with ext_js_include
226
- # extjs_dir = "#{RAILS_ROOT}/public/extjs" # TODO: make extjs location configurable
227
- # begin
228
- # res = super
229
- # rescue
230
- # raise self.superclass.to_s
231
- # end
232
-
233
225
  res = ""
234
226
 
235
227
  included_js = read_inheritable_attribute(:included_js) || []
@@ -238,17 +230,6 @@ JS
238
230
  r << f.read
239
231
  end
240
232
 
241
- # res << "\n"
242
- #
243
- # # from <widget_name>_extras/javascripts - all *.js files found there
244
- # js_dir = File.join(File.dirname(widget_file), short_widget_class_name.underscore + "_extras", "javascripts")
245
- # file_list = Dir.glob("#{js_dir}/*.js")
246
- #
247
- # for file_name in file_list
248
- # f = File.new(file_name)
249
- # res << f.read
250
- # end
251
-
252
233
  res
253
234
  end
254
235
 
@@ -267,21 +248,6 @@ JS
267
248
  res
268
249
  end
269
250
 
270
- # returns all css code require by this widget's class
271
- # def css_included
272
- # res = ""
273
- # # from <widget_name>_extras/stylesheets - all *.css files found there
274
- # js_dir = File.join(File.dirname(widget_file), short_widget_class_name.underscore + "_extras", "stylesheets")
275
- # file_list = Dir.glob("#{js_dir}/*.css")
276
- #
277
- # for file_name in file_list
278
- # f = File.new(file_name)
279
- # res << f.read
280
- # end
281
- #
282
- # res
283
- # end
284
-
285
251
  # all JS code needed for this class including the one from the ancestor widget
286
252
  def css_code(cached_dependencies = [])
287
253
  res = ""
@@ -53,7 +53,7 @@ end
53
53
  class String
54
54
  # Converts self to "literal JSON"-string - one that doesn't get quotes appended when being sent "to_json" method
55
55
  def l
56
- def self.to_json
56
+ def self.to_json(options={})
57
57
  self
58
58
  end
59
59
  self
@@ -82,7 +82,7 @@ end
82
82
 
83
83
  module ActiveSupport
84
84
  class TimeWithZone
85
- def to_json
85
+ def to_json(options = {})
86
86
  self.to_s(:db).to_json
87
87
  end
88
88
  end
data/netzke-core.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{netzke-core}
5
- s.version = "0.2.9"
5
+ s.version = "0.2.10"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sergei Kozlov"]
9
- s.date = %q{2009-03-19}
9
+ s.date = %q{2009-03-24}
10
10
  s.description = %q{Build ExtJS/Rails widgets with minimum effort}
11
11
  s.email = %q{sergei@writelesscode.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/app/controllers/netzke_controller.rb", "lib/app/models/netzke_layout.rb", "lib/app/models/netzke_preference.rb", "lib/netzke/action_view_ext.rb", "lib/netzke/base.rb", "lib/netzke/base_extras/interface.rb", "lib/netzke/base_extras/js_builder.rb", "lib/netzke/controller_extensions.rb", "lib/netzke/core_ext.rb", "lib/netzke/feedback_ghost.rb", "lib/netzke/routing.rb", "lib/netzke-core.rb", "lib/vendor/facets/hash/recursive_merge.rb", "LICENSE", "README.mdown", "tasks/netzke_core_tasks.rake", "TODO"]
@@ -3,6 +3,7 @@ require File.join(File.dirname(__FILE__), 'boot')
3
3
  Rails::Initializer.run do |config|
4
4
  config.cache_classes = false
5
5
  config.whiny_nils = true
6
+ config.action_controller.session = { :key => "_myapp_session", :secret => "some very long secret phrase required by action pack" }
6
7
  config.plugin_locators.unshift(
7
8
  Class.new(Rails::Plugin::Locator) do
8
9
  def plugins
@@ -1,14 +1,12 @@
1
1
  require 'test_helper'
2
2
  require 'netzke/core_ext'
3
3
 
4
- require 'json'
5
-
6
4
  class CoreExtTest < ActiveSupport::TestCase
7
5
  test "to_js" do
8
- assert_equal({"aProperty" => true}, JSON.parse({:a_property => true}.to_js))
9
- assert_equal({"aProperty" => true}, JSON.parse({:a_property => true, :nil_property => nil}.to_js))
10
- assert_equal([{"aProperty" => true}, {"anotherProperty" => false}], JSON.parse([{:a_property => true}, {:another_property => false}].to_js))
11
- assert_equal([{"aProperty" => true}, {"anotherProperty" =>false}], JSON.parse([{:a_property => true, :nil_property => nil}, {:another_property => false}].to_js))
6
+ assert_equal({"aProperty" => true}, ActiveSupport::JSON.decode({:a_property => true}.to_js))
7
+ assert_equal({"aProperty" => true}, ActiveSupport::JSON.decode({:a_property => true, :nil_property => nil}.to_js))
8
+ assert_equal([{"aProperty" => true}, {"anotherProperty" => false}], ActiveSupport::JSON.decode([{:a_property => true}, {:another_property => false}].to_js))
9
+ assert_equal([{"aProperty" => true}, {"anotherProperty" =>false}], ActiveSupport::JSON.decode([{:a_property => true, :nil_property => nil}, {:another_property => false}].to_js))
12
10
  end
13
11
 
14
12
  test "recursive delete if nil" do
data/test/test_helper.rb CHANGED
@@ -4,17 +4,9 @@ ENV['RAILS_ENV'] ||= 'in_memory'
4
4
  # Load the Rails environment and testing framework
5
5
  require "#{File.dirname(__FILE__)}/app_root/config/environment"
6
6
  require 'test_help'
7
- require 'action_view/test_case' # Load additional test classes not done automatically by < Rails 2.2.2
8
7
 
9
8
  # Undo changes to RAILS_ENV
10
9
  silence_warnings {RAILS_ENV = ENV['RAILS_ENV']}
11
10
 
12
11
  # Run the migrations
13
- ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
14
-
15
- # Set default fixture loading properties
16
- Test::Unit::TestCase.class_eval do
17
- self.use_transactional_fixtures = true
18
- self.use_instantiated_fixtures = false
19
- self.fixture_path = "#{File.dirname(__FILE__)}/fixtures"
20
- end
12
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Kozlov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-19 00:00:00 +01:00
12
+ date: 2009-03-24 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15