Code Monkey home page Code Monkey logo

netzke-core's Introduction

Netzke is a framework that greatly facilitates creation of complex Sencha Ext JS + Ruby-on-Rails applications by leveraging a modular, object-oriented approach.

Gem Version

Rationale

Sencha Ext JS is a powerful front-end framework, which is used for crafting web-apps that give the end user experience similar to that of a desktop application. It has an extensive set of widgets ('components'), and leverages a modular approach to its fullest: a developer can extend components (using Ext JS's own class system), nest components with the help of many powerful layouts, dynamically create and destroy them, etc. The architecture of Ext JS is well thought out and complete.

However, with Ext JS being server-agnostic, it is not always a trivial task for a developer to bind Ext JS components to the server-side data and application business logic, especially in complex applications. Netzke as the solution that allows you to extend the modular approach to the server side.

Netzke Core takes the burden of implementing the following key aspects of the framework:

  • Client-side (JavaScript) class generation
  • Client-server communication
  • Extendibility of components (with the help of inheritance and mixins)
  • Unlimited nesting (composition)
  • Dynamic component loading
  • Client-side class caching

...and more.

All this extremely facilitates building fast, low-traffic, robust, and highly maintainable applications. As a result, your code scales much better in the sense of complexity, compared to using conventional MVC, where developers are pretty much limited with the programming techniques that they can apply.

HelloWorld component

Here's a mini-tutorial on building a simple Netzke component that illustrates client-server communication in Netzke.

Ext JS files are not distributed with Netzke, so, make sure that they are located in (or sym-linked as) YOUR_APP/public/extjs.

In YOUR_APP/components/hello_world.rb:

class HelloWorld < Netzke::Base
  # Configure client class
  client_class do |c|
    c.title = "Hello World component"
  end

  # Actions are used by Ext JS to share functionality and state b/w buttons and menu items
  # The handler for this action should be called netzkeOnPingServer by default
  action :ping_server

  # Self-configure with a bottom toolbar
  def configure(c)
    super
    c.bbar = [:ping_server] # embed the action into bottom toolbar as a button
  end

  # Endpoint callable from client class
  endpoint :greet_the_world do
    # call client class' method showGreeting
    client.show_greeting("Hello World!")
  end
end

In YOUR_APP/components/hello_world/client/hello_world.js put the client class (JavaScript) methods:

{
  // handler for the ping_server action
  netzkeOnPingServer: function(){
    // calling greet_the_world endpoint
    this.server.greetTheWorld();
  },

  // called by the server as the result of executing the endpoint
  showGreeting: function(greeting){
    this.update("Server says: " + greeting);
  }
}

To embed the component in Rails view:

Use load_netzke in the layout to include Ext JS and Netzke scripts and stylesheets:

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  <%= csrf_meta_tag %>
  <%= load_netzke %>
</head>
<body>
  <%= yield %>
</body>
</html>

Embed the component in the Rails view:

<%= netzke :hello_world %>

To learn about Netzke architecture in detail, refer to the Netzke Core README.

Netzke gems

The netzke Ruby gem is a meta-gem that has the following framework parts as dependencies:

  • Netzke Core - the "bare bones" of the framework. Its README is a must-read for understanding the framework.
  • Netzke Basepack - a few feature-packed pre-built components.
  • Netzke Testing - a set of helpers that simplify development and testing of Netzke components.

Documentation

Netzke components consist of server side (Ruby) and client side (JavaScript) code, each having an API that you will want to use in your app. Documentation for the server-side (Ruby) classes is auto-generated (with YARD) and hosted by RubyDoc.info. Documentation for client-side classes is generated manually with yuidoc using scripts provided in this gem; it is hosted here.

Generating documentation for client-side code

Symlink Netzke gems (such as netzke-basepack and netzke-core) into the doc/client directory, then run

rake client_doc:generate

The combined docs for all symlinked gems will be generated in doc/client/build.

Useful links

  • Project website - place to start
  • Demo - demo showing off components from Basepack (browse through demo components and see their source code)
  • Twitter - bite-sized announcements about Netzke

FAQ

Will I need to write JavaScript while using Netzke?

It depends. For developing new components or extending existing ones (e.g. from Basepack) you'll most probably need to apply your Sencha Ext JS knowledge (and Netzke isn't supposed to limit you here in any way). However, the idea is that you write JavaScript code only once. After the component is created, use it as if it were a part of some Ruby library. A comparison with Ruby gems that use C extensions is also appropriate here: as some Ruby gems incapsulate C code for you, the same way Netzke components incapsulate JavaScript.

Why did you choose for Ext JS as front end?

In the current scene, Ext JS is the only library I know of that has the architecture consistent, flexible, and complete enough to allow for complex "enterprise level" web applications.

When will there be more components available?

I'm creating new components according to my own practical needs. As soon as get something generic, I might add that to netzke-basepack or to a dedicated gem. However, the key idea of Netzke is that it facilitates creating new components which are extremely easy to share, so that anybody could contribute.


Copyright (c) 2009-2017 Good Bit Labs, released under the same license as Ext JS

netzke-core's People

Contributors

0rca avatar allomov avatar avsej avatar delwyn avatar eddietejeda avatar firemind avatar kristianmandrup avatar mindreframer avatar randaalex avatar spieker avatar thepry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netzke-core's Issues

Actions can not be added to menu

http://www.rubydoc.info/github/netzke/netzke-core#Actions__toolbars__and_menus

Actions can also be referred to is submenus:
c.tbar = [{text: 'Menu', menu: {items: [:show_report]}}]

I played with netzke-demo, and change the Applcaction.rb title_html to menu like this:

tbar: [{text:'Menu', menu: {items: [:about]} },'->', :about, current_user ? :sign_out : :sign_in],

The dropdown menu displayed without any text and can not response to the click events.

When viewed source in chrome, I got :

Ext.onReady(function(){
Netzke.page.application = Ext.create("widget.application", {"className":"Application","name":"application","introHtml":"Click on a demo component in the navigation tree",
"items":[{"layout":"border","tbar":[{"text":"Menu","menu":{"items":[{"action":"about"}]}},"-\u003e",{"action":"about"},{"action":"signIn"}],"items":[{"region":"west","itemId":"navigation","width":300,"split":true,"xtype":"treepanel",

Upgrading to sencha 5?

Hi there, as stated on the sencha website, upgrading to sencha 5 should be pretty straightforward, however when I tried just replacing the ext folder with the new release it completely bombed, I tried looking into it, I am guessing because netzke is linking to example code that is no longer there, the folder structure of the package seems to have changed. I tried to look at it, but quickly got swamped, to be honest I do not quite understand or "get" sencha yet, since using netzke I don't really need to 😄

The new sencha promises to be able to work on tablets, looks really cool imho, so switching would be really awesome. Any ideas or suggestions to take this forward?

Redundant inclusion of JS/CSS

If I have a simple component that extends GridPanel, e.g.,

class ExpandableGridPanel < Netzke::Basepack::GridPanel
js_include Netzke::Core.ext_location.join("examples/ux/
RowExpander.js"),
css_include "#{File.dirname(FILE)}/ajaxrowexpander/
RowExpander.css"

[other stuff here...]
end

and then i create a tab panel, e.g,

<%= netzke :tabs,
:class_name => "Basepack::TabPanel",
:items => [
{:class_name => 'ExpandableGridPanel', :model => 'User'},
{:class_name => 'ExpandableGridPanel', :model =>
'Membership'},
{:class_name => 'ExpandableGridPanel', :model => 'Asset'},
[several more like the above...]
],
%>

Then I get the js and css files included numerous times, once for each
time the class is used.

netzke 0.8.4 can not work on rails 4.0.2

when I add "netzke" to route

$ rake routes

rake aborted!
You should not use the `match` method in your router without specifying an HTTP method.
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
  Instead of: match "controller#action"
  Do: get "controller#action"
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:191:in `normalize_conditions!'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:67:in `initialize'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `new'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `add_route'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1422:in `decomposed_match'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1403:in `block in match'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `each'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `match'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/netzke-core-0.8.4/lib/netzke/core/railz/routes.rb:18:in `netzke'
/Users/tangmonk/MyGit/VideoDeviceManagement/config/routes.rb:2:in `block in <top (required)>'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in `draw'
/Users/tangmonk/MyGit/VideoDeviceManagement/config/routes.rb:1:in `<top (required)>'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `each'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `call'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `execute'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:in `updater'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/tangmonk/MyGit/VideoDeviceManagement/config/environment.rb:5:in `<top (required)>'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
/Users/tangmonk/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.2/lib/rails/application.rb:250:in `block in run_tasks_blocks'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)

Well, since not supported rails 4, but why readme says support rails ~> 4 ?

Loading of nested components fails

Hi,

I have the following setup:

class App < Netzke::Basepack::SimpleApp
  [...]
  js_method :init_component, <<-JS
    function(){
      [...]
      // Load the main component
      this.appLoadComponent('main');
    }
  JS

  component :main, :class_name => "Main"
end
class Main < Netzke::Basepack::TabPanel
  def configuration
    res = super
    res.merge(items => [:sub_component.component])
  end

  component :sub_component, :class_name => "SubComponent"
end
class SubComponent < Netzke::Basepack::TabPanel
  def configuration
    res = super
    res.merge(items => [:sub_sub_component.component])
  end

  component :sub_sub_component, :class_name => "SubSubComponent"
end

What happens, after this.appLoadComponent('main'); is executed, is that netzke complains that it can't find sub_sub_component:
Netzke: unknown component reference sub_sub_subcomponent

I guess, the reason for that is the fact that

detectComponents

just checks this.netzkeComponents and doesn't go any deeper.
But that's just a guess.

The following patch in base.js fixed it for me:

detectComponents: function(o, netzkeComponents){
  if(netzkeComponents == null){
     netzkeComponents = this.netzkeComponents;
  }
  if (Ext.isObject(o)) {
    if (o.items) this.detectComponents(o.items);
  } else if (Ext.isArray(o)) {
    var a = o;
    Ext.each(a, function(c, i){
      if (c.netzkeComponent) {
        var cmpName = c.netzkeComponent,
            cmpCfg = netzkeComponents[cmpName.camelize(true)];
        if (!cmpCfg) throw "Netzke: unknown component reference " + cmpName;
        a[i] = Ext.apply(cmpCfg, c);
        delete a[i].netzkeComponent; // not needed any longer
      } else if (c.items) {this.detectComponents(c.items, c.netzkeComponents);}
    }, this);
  }
}

Overriding scope in component declaration has no effect

When a scope is set in component configuration:

class FooGrid < Grid
  def configure c
    super c
    c.scope = :foo_scope
  end
end

I am not able to override it via the component declaration:

component :foo_grid do |c|
  c.klass = FooGrid
  c.scope = :other_scope
end

As soon as I remove the scope from the configure method the scope supplied in the
declaration will be honored.

Not entirely sure if basepack or core is at fault but I assume it has something to do with the merging mechanism of the different config layers so I reported it here.

String#jsonify for '_meta'

There have been some changes in the ActiveSupport::Inflector class since Rails 3.2.0:

#  rails 3.1.x:
'_meta'.camelize(:lower) # => '_meta'
# rails 3.2.x:
'_meta'.camelize(:lower) # => 'Meta'

So this breaks String#jsonify as well as Symbol#jsonify.

Couldn't load component cmp1 error when dynamically loading tab in workspace

Environment: Ruby 2.0 Rails 4.0 netzke-core 0.90 netzke-base 0.9.0 netzke-communitypack 0.80
When trying to load a component into a tab using the netzke Workspace, I get the error "Couldn't load component cmp1" error. I tracked the error to the Netzke::Core::Composition module, specifically the deliver_component endpoint. In this method, the line of code;

'''cmp_instance = components[component_name] &&
!components[component_name][:excluded] &&
component_instance(component_name, {item_id: item_id, client_config: params[:client_config]})'''

cmp_instance should be returning a component line "UserGrid" which would be inserted into the tab, it is returning nil instead when it shouldn't.
I traced the problem further to the function call 'component_instance' that is called in that expression. I'm by no means completely familiar with Netzke code, but this where my understanding of the code is sparse. I noted that Max had made significant changes to the code for the component_instance method, as a matter of fact the code was completely replaced from the older working version. The new code seems to expect that any child components should have a method 'child component name'_component present in the parent component's code. I looked every where and cannot find where this method is dynamically inserted prior to this component_instance method being called, as a result 'component_instance' will always return nil. Just verify my theory, I monkey patched in the old code that was there before the code change, and low and behold components correctly get inserted into Workspace tabs. Can you please look into this Max? Thanks for creating Netzke btw, big fan!

Default has_many does not update association

I created two models without explicitly specifying associations in Netzke.

class User < ActiveRecord::Base
  attr_accessible :email, :name
  has_many :pages
end

class Page < ActiveRecord::Base
  belongs_to :user
  attr_accessible :name, :url
end

class Pages < Netzke::Basepack::Grid
  def configure(c)
    super
    c.model = "Page"
  end
end

When I'm editing Page, it does update all the attributes except User. I selected User from drop-down list, but its parameter passed to netzke controller looks incorrect: \"user__name\":1 and in result user_id after updating is nil.

I've put code into repository: https://github.com/denispeplin/extjs_tut/tree/ne (uses netzke from gem in this tag, but I also tried with current netzke, same issue).

Post parameters:

Started POST "/netzke/direct/?authenticity_token=BaQAb8Gnadh6G3SkUZyY1nyA3S6fJACWEdwZN4FQZDI%3D" for 127.0.0.1 at 2013-01-22 10:08:18 +0400
Processing by NetzkeController#direct as HTML
  Parameters: {"act"=>"pages__edit_window__edit_form", "method"=>"netzkeSubmit", "data"=>[{"data"=>"{\"id\":\"2\",\"name\":\"testpage\",\"url\":\"www.example.com\",\"user__name\":1,\"created_at\":\"2013-01-21 12:19:56\",\"updated_at\":\"2013-01-22 05:01:39\"}"}], "type"=>"rpc", "tid"=>5, "authenticity_token"=>"BaQAb8Gnadh6G3SkUZyY1nyA3S6fJACWEdwZN4FQZDI=", "netzke"=>{"act"=>"pages__edit_window__edit_form", "method"=>"netzkeSubmit", "data"=>[{"data"=>"{\"id\":\"2\",\"name\":\"testpage\",\"url\":\"www.example.com\",\"user__name\":1,\"created_at\":\"2013-01-21 12:19:56\",\"updated_at\":\"2013-01-22 05:01:39\"}"}], "type"=>"rpc", "tid"=>5}}

Not sure it is netzke-core issue, maybe it is just component does not work properly.

Calling for a endpoint causes the entire config tree branch to be parsed.

There should be ability to make some components cachable, so endpoints calls on them should not parse entire application config.

For example consider such components: main -> sub -> c. So when calling endpoin defined on c, we get both main, sub and c configs parsed. It will be good to have opportunity to make c accessible directly.

Netzke with Mongoid (ActiveModel)

Hi,
I am looking at using Netzke with Mongoid however it relies on ActiveRecord. Is there any work / thoughts on removing netzke's dependance on ActiveRecord and replacing it with ActiveModel?

Cheers

NameError (uninitialized constant Netzke::Basepack::GridPanel::Services::JSON):

Hi Sergey.

I am encountering this very same issue although it had been previously closed. I have tried a very basic app and this error is encountered when trying to filter via the column header. The error persists until any filtering is removed.

I am running on mac os x so the Ruby version is 1.8.7. I have tried this with both EXT version 3.3.1 and 4 ( using your master and extjs4 branches).

Any ideas?

Richard

undefined method `javascripts'

Running Ruby 1.9.2p0 with Gems 1.3.7 I downloaded netzke-demo ran bundle install and then started server. I get this traceback:
/home/vagrant/.bundler/ruby/1.9.1/netzke-basepack-48e8566cf7cc/lib/netzke/basepack.rb:13:in init': undefined methodjavascripts' for Netzke::Core:Module (NoMethodError)
from /home/vagrant/.bundler/ruby/1.9.1/netzke-basepack-48e8566cf7cc/lib/netzke-basepack.rb:26:in <top (required)>' from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:inrequire'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in block (2 levels) in require' from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:ineach'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in block in require' from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:ineach'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in require' from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler.rb:112:inrequire'
from /shared/netzke_demo/config/application.rb:7:in <top (required)>' from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:inrequire'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in block in <top (required)>' from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:intap'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'
Please advise. Thanks

Netzke can not work

I follow this tutorial step by step. My ruby version is 1.9.3, and rails version is 3.2.16.

But still can not work. throw me an error:

NameError

undefined local variable or method `netzke' for #<ActionDispatch::Routing::Mapper:0x007ffcb24eb590>

Rails.root: /Users/USER/MyGit/a

It seems the root error, so I change the root file

before:

 netzke
  root to: "welcome#index"

after:

  root to: "welcome#index"

But when run again, It throw me another error:

NoMethodError in Welcome#index

Showing /Users/tangmonk/MyGit/a/app/views/welcome/index.html.erb where line #1 raised:

undefined method `netzke' for #<#<Class:0x007ffcb29cad40>:0x007ffcb29c8248>
Extracted source (around line #1):

1: <%= netzke :tasks, height: 400 %>
Rails.root: /Users/tangmonk/MyGit/a

I change the rails version to 4.0, But problem still exist.

@nomadCoder , I notice you are the most important contributor of this project, So I hope you can help me. Thanks

undefined method `current_user' for Netzke::Core:Module

Hi folks,
I tried to upgrade our existing netzke app from 0.7.7 to 0.8.1 today. And somehow netzke got rid of the very handy Netzke::Core.current_user helper. Did it get lost with the 0.8 upgrade or is this intentional?

Also netzke-cancan assumes, that this method ist present.

If people should use Netzke::Base.controller.current_user, then this issue can be closed.

{widget}_widget_instance is cached and never expired

i updated the columns of a netzke action, and the changes never get into my views. Only when i rename the action the columns are updated, so i am at sellers_12 now and it really looks silly :(
restarting the server/apache/ruby-process did not help...

Wiki tutorial

I start learn netzke gem from its wiki and got issue in the "hello world" app. The problem is in bottom bar configuration:

js_property :bbar, [:bug_server.action]
action :bug_server, :text=>"foo message"

In chrome js console I got 'undefined method bug_server'. When I remove '.action' part error gone, but it render only text label in bottom bar. Its a new API or issue in version 0.74?

Compatibility with Rails asset pipeline or a CDN

Right now I am only able to load javascripts from /public. I am unable to load from vendor/assets or from the CDN at : http://cdn.sencha.io/ext-4.1.0-gpl/

I used an initializer as follows:

Netzke::Core.setup do |config|
  config.ext_uri = 'assets'
end
Netzke::Core.setup do |config|
  config.ext_uri = 'http://cdn.sencha.io/ext-4.1.0-gpl'
end

using 'assets' as a prefix causes a linktag of:
http://localhost:3000/assets/assets/ext-all-debug.js

expecting it to be:
http://localhost:3000/assets/ext-all-debug.js

Using the CDN gives the following, no .js because it does not find the JS file:
http://cdn.sencha.io/ext-4.1.0-gpl/ext-all-debug

(should be http://cdn.sencha.io/ext-4.1.0-gpl/ext-all-debug.js)

I think the best way is to support
config.action_controller.asset_host

_uri if present would override using the asset_host based link tags.

Otherwise we should specify a prefix (with a default of 'assets') so that files can be put in /vendor/assets as Rails guides recommends. Using public is deprecated with the Rails asset pipeline.

Configuration for netzke default routes

I need a possibility to change the netzke default route (incl. controller) to another path.
Is there a config who I can configure the default netzke route and controller?

Example:

#From
/netzke/(:action)

#To
/some/path/netzke/(:action)

Netzke::Basepack::GridPanel::RecordFormWindow have unoverridable config

Its preferable to use

def default_instance_config
{
:modal => true,
:width => "50%",
:auto_height => true,
:fbar => [:ok.action, :cancel.action]
}
end

instead of @config@ class method to define config because the config defines weak_final_config that merges the all others. So, for example there no easy way to set edit window to maximize or allow to change height.

NameError (uninitialized constant Netzke::Basepack::GridPanel::Services::JSON):

Creating test application as descibed at
http://blog.writelesscode.com/blog/2010/06/14/extjs-rails-crud-application-in-7-minutes/

Started POST "/netzke/direct/?authenticity_token=i2HM%2BROEprbZtxRyZfcWxXHXfZYo13MEzvg1%2BDPTtbw%3D" for 127.0.0.1 at Fri Mar 04 14:01:06 +0300 2011
Processing by NetzkeController#direct as HTML
Parameters: {"data"=>[{"filter"=>"[{"type":"date","comparison":"gt","value":"03/18/2011","field":"due"}]", "start"=>0, "limit"=>30}], "method"=>"getData", "tid"=>3, "authenticity_token"=>"i2HM+ROEprbZtxRyZfcWxXHXfZYo13MEzvg1+DPTtbw=", "type"=>"rpc", "act"=>"tasks"}
Completed in 56ms

NameError (uninitialized constant Netzke::Basepack::GridPanel::Services::JSON):

Ruby 1.8.7-p334
Extjs 3.3.1

$ bundle
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.3)
Using arel (2.0.9)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using acts_as_list (0.1.2)
Using bundler (1.0.10)
Using cgi_multipart_eof_fix (2.5.0)
Using daemons (1.1.0)
Using fastthread (1.0.7)
Using gem_plugin (0.2.3)
Using meta_where (1.0.4)
Using mongrel (1.1.5)
Using mysql2 (0.2.6)
Using netzke-core (0.6.6)
Using will_paginate (3.0.pre2)
Using netzke-basepack (0.6.4)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)

bundle install error with 0.7.5

When running bundle install getting the following error:

Using netzke-core (0.7.5) from git://github.com/skozlov/netzke-core.git (at master) 
netzke-core at /Users/dmytro/.bundler/ruby/1.9.1/netzke-core-2d7e9380b1f7 did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  [".travisrc", "lib/netzke/core_ext/class.rb"] are not files

The theme support is not working

I've just tried to change the theme for my application but it didn't work. In the ActionViewExt I was looking for some references to 'theme' or 'ext_theme' but none of these options is really used.

Help please, Hello_World tutorial not working with Rails 3.0.9/Ruby 1.9.3/Ext 4.0.7/Windows 7

Well I followed the Hello_World tutorial in the Wiki to the letter.
When I start up my server, I get the error:
uninitialized constant HelloWorldComponent
I created the folder components as a subfolder of the app folder
I created the file hello_world_component.rb as described in the Wiki tutorial
I cut and paste the code for the component into the file and saved it
I did everything else as described in the Wiki

Anyone else starting out like me? I have got Netzke working before but with extjs 3.0 and Rails 2.3 please help!

Thanks

Status 4.2 integration?

Hi, not entirely sure if this is the correct place, but I am curious what the status is of the migration to Extjs 4.2? I see there is a branch, is it useable?

I am starting a new project, a website to show geographical data, and I want to use extjs 4.2 and rails (and openlayers). At the moment geoext is too much for me I guess.

I am at the moment choosing between two possible alternatives: your gem/approach or the more manual approach and using the extjs4-rails gem.

What are your thoughts?

Dependent model saving

Two classes were created

class Supplier < ActiveRecord::Base  

  has_one :account, foreign_key: "acc_sup_id", :autosave => true  

  self.primary_key = 'sup_id'  

  attr_accessible :name, :remark

end  

class Account < ActiveRecord::Base 

  belongs_to :supplier, foreign_key: "acc_sup_id"  

  self.primary_key = 'acc_id'  

  self.table_name = 'accounts'  

  attr_accessible :dep, :rev

end

and netzke form is given as

class SupplierForm < Netzke::Basepack::Form

    def configure(c)

    c.model = 'Supplier'

    super

    c.items = [

      {field_label: "Name", name: :name},

      {field_label: "Remark", name: :remark},

      {field_label: "Dep", name: :account__dep, xtype: :checkbox, nested_attribute: true},

      {field_label: "Rev", name: :account__rev, xtype: :checkbox, nested_attribute: true}      
    ]

  end

end

Here I am getting two issues while saving

  1. while inserting only name and remark is saved but not the nested attributes.
  2. If the nested attribute fields set to checked the value is updated to DB but if unchecked update is not working

Components in tbar, dockedItems etc.

Hi,

I tried to add a component to a tbar the following way:

def configuration
  super.merge({:tbar =>  [:my_combobox.component], ... })
end

component :my_combobox, ...

But it seems like that tbar, dockedItems, etc are not checked for NetzkeComponents, just the items property.

quest about netzke_init

<script src="/extjs/adapter/ext/ext-base-debug.js?1293439905" type="text/javascript"></script> <script src="/extjs/ext-all-debug.js?1293440262" type="text/javascript"></script> <script src="/netzke/ext.js?1293618927" type="text/javascript"></script>

the helper can generate above code ,but no rake task can help to generate /netzke/ext.js and /netzke/ext.js . In my view , the core.js must need, but also no task to generate it in the /netzke folder and the netzke_init doesn't include it.

I follow below document but not work:
https://github.com/skozlov/netzke-core/wiki/Installation
https://github.com/skozlov/netzke-core/wiki/Hello-world-extjs
my

Dynamic component loading broken

Hei Denis,

I've started to migrate an existing netzke app from 0.7.7 to the latest master, but I can't get it to work. Dynamic component loading always fails. I use Netzke::Basepack::SimpleApp, which has another component, that should be loaded.

I get the following error:

V8::JSError (Cannot call method 'ns' of null):
  at <eval>:2:5
  /home/meyer/.rvm/gems/ruby-1.9.3-p194-perf@blackbeard/bundler/gems/netzke-core-d02cb9f3aa2e/lib/netzke/composition.rb:86:in `block (2 levels) in <module:Composition>'
[...]

So the serverside JS evaluation complains when executing this piece of code:

Ext.ns("Netzke.classes.Home");

So it seems to me, as the server can't properly load ExtJS, right?

If you need more information, let me know.

Thanks for looking into this.

cheers,
Georg

Error running server

Ruby 1.9.3
Rails 3.2.1

Running rails server:

/Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke/services.rb:60:in register_endpoint': undefined methodread_inheritable_attribute' for Netzke::Base:Class (NoMethodError)
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke/services.rb:37:in endpoint' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke/composition.rb:33:inblock in module:Composition'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.1/lib/active_support/concern.rb:117:in class_eval' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.1/lib/active_support/concern.rb:117:inappend_features'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke/base.rb:40:in include' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke/base.rb:40:inclass:Base'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke/base.rb:33:in <module:Netzke>' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke/base.rb:17:in<top (required)>'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke-core.rb:4:in require' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/bundler/gems/netzke-core-1c1ccc31355b/lib/netzke-core.rb:4:in<top (required)>'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in require' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:inblock (2 levels) in require'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in each' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:inblock in require'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in each' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:inrequire'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/lib/bundler.rb:122:in require' from /Users/beb4ch/SoftwareDevelopment/Workspaces/rails/money/config/application.rb:7:in<top (required)>'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/lib/rails/commands.rb:53:in require' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/lib/rails/commands.rb:53:inblock in <top (required)>'
from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/lib/rails/commands.rb:50:in tap' from /Users/beb4ch/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/lib/rails/commands.rb:50:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

Rails 3.2 support

Netzke is not working in rails 3.2. App cannot start because of read/write_inheritable_attribute call. instead of setter and getter methods, rails 3.2 uses class_attribute[:attr] for read/write (I think).

Also there is a deprecation warning for ActiveConcern.

Ext location configure

config/initializers/netzke.rb:2:in block in <top (required)>': undefined methodext_location=' for Netzke::Core:Module (NoMethodError).

can't use Ext.form.panel with directSubmit type to directly communicate with endpoint

when i use Ext.form.panel set config:

Ext.create('Ext.form.Panel', {
        //some configure
        api: {
          submit: Netzke.providers[_this.id].search
        },
        buttons: [{
          {
          text: 'Search',
          handler: function() {
            var form = this.up('form').getForm();
            if (form.isValid()) {
              form.submit({
                params: {name: 'aaa'},
              });
            }
          }
        }],
       //some configure

i hope it send request with params: "name" => "aaa", but i get this:{"path":"application__tp_panel__requirements_management__requirements_tree","endpoint":"search","data":[undefined],"tid":3}
so i review code,i found in (extjs api)[http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.Basic] config options api say: The formHandler configuration (see Ext.direct.RemotingProvider#action) must be set on the associated server-side method which has been imported by Ext.direct.Manager.
but netzke doesn't provide support to set endpoint formHandler true, in https://github.com/netzke/netzke-core/blob/ext42/javascripts/ext.js#L82-L91

  addEndpointsForComponent: function(componentPath, componentId, endpoints) {
    var cls = this.namespace[componentId] || (this.namespace[componentId] = {});

    Ext.Array.each(endpoints, function(ep) {
      var methodName = ep.camelize(true),
           //some endpoint should have config["formHandler"] = true
          method = Ext.create('Ext.direct.RemotingMethod', {name: methodName, len: 1});

        cls[methodName] = this.createHandler(componentPath, method);
    }, this);
  },

undefined method `new' for nil:NilClass after bundle update

Hi skozlov

I updated both basepack and core today then I get these error, the stack trace doesn't very helpful for me to debug, might you have some idea or I've miss something?

netzke-basepack-c2f2fda10dca
netzke-core-bc9cd6007b94

Once I revert to netzke-basepack-f4c263cb257f and netzke-core-12a68583a395 then the problem gone.

Started GET "/welcome/index" for 127.0.0.1 at 2010-12-24 17:19:25 +0800
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.erb within layouts/application (87.9ms)
Completed in 99ms

ActionView::Template::Error (undefined method new' for nil:NilClass): 1: <%= netzke :simple_basic_app %> app/views/welcome/index.html.erb:1:in_app_views_welcome_index_html_erb__617632484852304534_16927740__2037854811478141187'

Rendered /home/idler/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
Rendered /home/idler/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.6ms)
Rendered /home/idler/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (12.5ms)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.