netzke-core 0.12.3 → 1.0.0.0.pre

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.
Files changed (41) hide show
  1. data/CHANGELOG.md +65 -607
  2. data/Gemfile +1 -1
  3. data/LICENSE +2 -6
  4. data/README.md +77 -145
  5. data/javascripts/base.js +582 -96
  6. data/javascripts/core.js +62 -0
  7. data/javascripts/notifications.js +43 -0
  8. data/javascripts/remoting_provider.js +29 -0
  9. data/javascripts/routing.js +63 -0
  10. data/lib/netzke/base.rb +16 -83
  11. data/lib/netzke/core/action_config.rb +1 -5
  12. data/lib/netzke/core/actions.rb +59 -21
  13. data/lib/netzke/core/{client_class.rb → client_class_config.rb} +81 -73
  14. data/lib/netzke/core/client_code.rb +157 -0
  15. data/lib/netzke/core/component_config.rb +2 -2
  16. data/lib/netzke/core/composition.rb +85 -65
  17. data/lib/netzke/core/configuration.rb +26 -14
  18. data/lib/netzke/core/core_i18n.rb +17 -0
  19. data/lib/netzke/core/css_config.rb +6 -6
  20. data/lib/netzke/core/dynamic_assets.rb +17 -24
  21. data/lib/netzke/core/embedding.rb +2 -2
  22. data/lib/netzke/core/endpoint_response.rb +8 -2
  23. data/lib/netzke/core/inheritance.rb +33 -0
  24. data/lib/netzke/core/plugins.rb +1 -4
  25. data/lib/netzke/core/railz/action_view_ext.rb +1 -1
  26. data/lib/netzke/core/railz/controller_extensions.rb +21 -15
  27. data/lib/netzke/core/services.rb +61 -48
  28. data/lib/netzke/core/session.rb +0 -2
  29. data/lib/netzke/core/state.rb +11 -9
  30. data/lib/netzke/core/stylesheets.rb +3 -3
  31. data/lib/netzke/core/version.rb +1 -1
  32. data/lib/netzke/core.rb +3 -3
  33. data/lib/netzke/plugin.rb +2 -6
  34. data/stylesheets/core.css +2 -2
  35. metadata +11 -10
  36. data/TODO.md +0 -9
  37. data/javascripts/ext.js +0 -518
  38. data/lib/netzke/core/config_to_dsl_delegator.rb +0 -62
  39. data/lib/netzke/core/dsl_support.rb +0 -70
  40. data/lib/netzke/core/html.rb +0 -29
  41. data/lib/netzke/core/javascript.rb +0 -123
@@ -14,33 +14,37 @@ module Netzke::Core
14
14
  # Note that the provided persistence_key has effect on _application_ level, _not_ only within the view.
15
15
  # By default +persistence_key+ is set to component's +js_id+. Thus, _two components named equally will share the state even being used in different Rails views_.
16
16
  module State
17
- class StateProxy < Object
17
+ class StateProxy
18
18
  def initialize(key)
19
19
  @key = key.to_s
20
20
  Netzke::Base.session ||= {}
21
21
  Netzke::Base.session[:netzke_states] ||= {}
22
- # @session = Netzke::Base.session[:netzke_sessions][@component_id] ||= {}
23
- # @session = {}
24
22
  end
25
23
 
26
24
  # Delegate everything to session
27
25
  def method_missing(method, *args)
28
26
  session_data = to_hash
29
27
  session_data.send(method, *args).tap do |d|
30
- Netzke::Base.session[:netzke_states] = {@key => session_data}
28
+ Netzke::Base.session[:netzke_states] = state_session.merge(@key => session_data)
31
29
  end
32
30
  end
33
31
 
34
32
  def to_hash
35
- ActiveSupport::HashWithIndifferentAccess.new(Netzke::Base.session[:netzke_states][@key] || {})
33
+ ActiveSupport::HashWithIndifferentAccess.new(state_session[@key] || {})
36
34
  end
37
35
 
38
36
  def clear
39
- Netzke::Base.session[:netzke_states].delete(@key)
37
+ state_session.delete(@key)
38
+ end
39
+
40
+ private
41
+
42
+ def state_session
43
+ Netzke::Base.session[:netzke_states]
40
44
  end
41
45
  end
42
46
  # A string which identifies the component. Can be passed as +persistence_key+ config option. Two components with the same +persistence_key+ will be sharing the state.
43
- # If +persistence_key+ is passed, use it. Otherwise use js_id.
47
+ # If +persistence_key+ is passed in the config, use it. Otherwise use js_id.
44
48
  def persistence_key
45
49
  (config.persistence_key || js_id).to_sym
46
50
  end
@@ -59,8 +63,6 @@ module Netzke::Core
59
63
  # * clear
60
64
  def state
61
65
  @state_proxy ||= StateProxy.new(persistence_key)
62
- # session[:netzke_states] ||= {}
63
- # session[:netzke_states][persistence_key] ||= {}
64
66
  end
65
67
  end
66
68
  end
@@ -9,7 +9,7 @@ module Netzke::Core
9
9
 
10
10
  module ClassMethods
11
11
  # Configures JS class
12
- def css_configure &block
12
+ def client_styles &block
13
13
  block.call(css_config)
14
14
  end
15
15
 
@@ -29,7 +29,7 @@ module Netzke::Core
29
29
  res = ""
30
30
 
31
31
  # include the base-class javascript if doing JS inheritance
32
- res << superclass.css_code << "\n" if !js_config.extending_extjs_component? && !cached.include?(superclass.name)
32
+ res << superclass.css_code << "\n" if !client_class_config.extending_extjs_component? && !cached.include?(superclass.name)
33
33
 
34
34
  res << css_included << "\n"
35
35
 
@@ -39,7 +39,7 @@ module Netzke::Core
39
39
 
40
40
  def css_missing_code(cached = [])
41
41
  code = dependency_classes.inject("") do |r,k|
42
- cached.include?(k.js_config.xtype) ? r : r + k.css_code(cached)
42
+ cached.include?(k.client_class_config.xtype) ? r : r + k.css_code(cached)
43
43
  end
44
44
  code.blank? ? nil : code
45
45
  end
@@ -1,5 +1,5 @@
1
1
  module Netzke
2
2
  module Core
3
- VERSION = "0.12.3"
3
+ VERSION = "1.0.0.0.pre"
4
4
  end
5
5
  end
data/lib/netzke/core.rb CHANGED
@@ -23,7 +23,7 @@ module Netzke
23
23
  autoload :EndpointResponse, 'netzke/core/endpoint_response'
24
24
  autoload :Version, 'netzke/core/version'
25
25
  autoload :DynamicAssets, 'netzke/core/dynamic_assets'
26
- autoload :ClientClass, 'netzke/core/client_class'
26
+ autoload :ClientClassConfig, 'netzke/core/client_class_config'
27
27
  autoload :CssConfig, 'netzke/core/css_config'
28
28
  autoload :ConfigToDslDelegator, 'netzke/core/config_to_dsl_delegator'
29
29
  autoload :JsonLiteral, 'netzke/core/json_literal'
@@ -55,8 +55,8 @@ module Netzke
55
55
  @@js_direct_max_retries = 0
56
56
 
57
57
  # Amount of time feedback delay is being shown
58
- mattr_accessor :js_feedback_delay
59
- @@js_feedback_delay = 2000
58
+ mattr_accessor :client_notification_delay
59
+ @@client_notification_delay = 2000
60
60
 
61
61
  mattr_accessor :with_icons
62
62
 
data/lib/netzke/plugin.rb CHANGED
@@ -1,12 +1,8 @@
1
1
  module Netzke
2
2
  class Plugin < Base
3
- js_configure do |c|
3
+ client_class do |c|
4
+ # We need to inherit from Ext.Component so that we recieve goodies like event handling
4
5
  c.extend = "Ext.Component"
5
- c.init = <<-JS
6
- function(cmp){
7
- this.cmp = cmp;
8
- }
9
- JS
10
6
  end
11
7
  end
12
8
  end
data/stylesheets/core.css CHANGED
@@ -2,7 +2,7 @@
2
2
  This file gets loaded along with the rest of Ext library at the initial load
3
3
  */
4
4
 
5
- /* FeedbackGhost */
5
+ /* NetzkeNotifier */
6
6
  .msg .x-box-mc {
7
7
  font-size:14px;
8
8
  }
@@ -29,4 +29,4 @@ This file gets loaded along with the rest of Ext library at the initial load
29
29
  }
30
30
  #msg-div .msg p {
31
31
  margin: 0;
32
- }
32
+ }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.3
5
- prerelease:
4
+ version: 1.0.0.0.pre
5
+ prerelease: 8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Max Gorin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-09 00:00:00.000000000 Z
12
+ date: 2015-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uglifier
@@ -51,24 +51,26 @@ extra_rdoc_files: []
51
51
  files:
52
52
  - app/controllers/netzke_controller.rb
53
53
  - javascripts/base.js
54
- - javascripts/ext.js
54
+ - javascripts/core.js
55
55
  - javascripts/js_extensions.js
56
+ - javascripts/notifications.js
57
+ - javascripts/remoting_provider.js
58
+ - javascripts/routing.js
56
59
  - lib/netzke/base.rb
57
60
  - lib/netzke/core/action_config.rb
58
61
  - lib/netzke/core/actions.rb
59
- - lib/netzke/core/client_class.rb
62
+ - lib/netzke/core/client_class_config.rb
63
+ - lib/netzke/core/client_code.rb
60
64
  - lib/netzke/core/component_config.rb
61
65
  - lib/netzke/core/composition.rb
62
- - lib/netzke/core/config_to_dsl_delegator.rb
63
66
  - lib/netzke/core/configuration.rb
67
+ - lib/netzke/core/core_i18n.rb
64
68
  - lib/netzke/core/css_config.rb
65
69
  - lib/netzke/core/dsl_config_base.rb
66
- - lib/netzke/core/dsl_support.rb
67
70
  - lib/netzke/core/dynamic_assets.rb
68
71
  - lib/netzke/core/embedding.rb
69
72
  - lib/netzke/core/endpoint_response.rb
70
- - lib/netzke/core/html.rb
71
- - lib/netzke/core/javascript.rb
73
+ - lib/netzke/core/inheritance.rb
72
74
  - lib/netzke/core/json_literal.rb
73
75
  - lib/netzke/core/panel.rb
74
76
  - lib/netzke/core/plugins.rb
@@ -98,7 +100,6 @@ files:
98
100
  - LICENSE
99
101
  - Rakefile
100
102
  - README.md
101
- - TODO.md
102
103
  - init.rb
103
104
  homepage: http://netzke.org
104
105
  licenses: []
data/TODO.md DELETED
@@ -1,9 +0,0 @@
1
- ## Roadmap
2
-
3
- ### v1.0
4
-
5
- * `js_configure`: c.mixin and c.include without params pickup "mixins/*.js" and "includes/*.js" respectively
6
- * new convention for endpoint naming: an endpoint declared with `endpoint :do_something` will be callable from
7
- the client as `this.serverDoSomething`
8
- * netzkeFeedback removed in favor of netzkeInfo and netzkeError
9
- * Grid config options like `enable_advanced_search` loose their `enable_` prefix