0

netzke+ rails 4+を使用すると奇妙な動作が発生しextjs-4.2.1 ます。最初にページが読み込まれるたびに div が表示されますが、ページを更新するまでグリッドは読み込まれません。rails 3++を使用してエラーを再現できませんnetzke 0.8extjs-4.1これは netzke のバグでしょうか? ブラウザ コンソールを使用していますが、エラーは表示されません。

現在、このバージョンの netzke を使用しています。

gem "netzke-core", "~> 0.10.0.rc2"
gem "netzke-basepack", "~> 0.10.0.rc2"

そしてRails 4.0.2_extjs-4.2.1

私のapplication.html.erb

<!DOCTYPE html>
<html>
<head>
    <title>Railroad</title>
    <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
    <%= load_netzke %>
    <%= csrf_meta_tags %>
</head>
<body>
<div id="wrap">
    <div id="header">
        <div>
            <h1>Demo</h1>
            <hr/>
        </div>
        <div style="float: left;">
            <% if I18n.locale == I18n.default_locale %>
                <%= link_to "Español", :locale=>'es'%>
            <% else %>
                <%= link_to "English", :locale=>'en'%>
            <%end%>
        </div>
        <div style="float: right;">
            <% if user_signed_in? %>
                <%= link_to (t :sign_out), destroy_user_session_path, :method => :delete %>
            <% end %>
        </div>
    </div>
    <div id="main-content">
        <%= render 'layouts/messages' %>
        <%= yield %>
    </div>
    <div id="footer">
        <hr/>
    </div>
</div>
</body>
</html>

ようこそ/index.html.erb

<h2><%= t :post_option %></h2>
<ul>
    <li><%= link_to (t :post_list),  posts_path%></li>
    <li><%= link_to (t :post_new),   new_post_path%></li>
</ul>

私の投稿/index.html.erb

<h2>TEST</h2>
<%= netzke :posts, height: 400 %>

<br/>
<%=  link_to (t :back), root_path %>

私のルート.rb

Railroad::Application.routes.draw do

  devise_for :users, :controllers => {:registrations => "registrations", :omniauth_callbacks => "omniauth_callbacks"}

  resources :posts do
    resources :comments
  end

  netzke
  root "welcome#index"

end

私のモデル post.rb

class Post < ActiveRecord::Base
  has_many :comments, dependent: :destroy
  validates :title, presence: true, length: { minimum: 5 }

  private
  def post_params
    params.require(:post).permit(:title, :text)
  end
end

そして私の components/posts.rb

class Posts < Netzke::Basepack::Grid
  def configure(c)
    super
    c.model = "Post"
    c.columns = [
        :title,
        :text
    ]
    c.prohibit_update = true
    c.prohibit_delete = false
  end
end

ご協力いただきありがとうございます。

アップデート

この問題は、NetzkeControllerクリックするlink_toとグリッドのあるページに移動することに関連しているように見えますが、結果としてNetzkeController実行されない0.10.0.rc2ため、ページを更新するまでグリッドはロードされませんが、0.8 で同じシナリオを実行すると、NetzkeControllerそれが呼び出され、グリッドをロードします。

netzke 0.8ページがレンダリングされた後のログファイルは次のとおりです0.10.0rc2

0.8

Started GET "/test/view" for 127.0.0.1 at 2014-03-19 09:07:48 -0600
Processing by TestController#view as HTML
  Rendered test/view.html.erb within layouts/application (19.2ms)
Completed 200 OK in 42ms (Views: 41.6ms | ActiveRecord: 0.0ms)
[2014-03-19 09:07:48] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/netzke/ext.css" for 127.0.0.1 at 2014-03-19 09:07:48 -0600
Processing by NetzkeController#ext as CSS
  Rendered text template (0.0ms)
Completed 200 OK in 2ms (Views: 0.3ms | ActiveRecord: 0.0ms)
[2014-03-19 09:07:48] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/netzke/ext.js" for 127.0.0.1 at 2014-03-19 09:07:48 -0600
Processing by NetzkeController#ext as JS
  Rendered text template (0.0ms)
Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms)
[2014-03-19 09:07:48] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started POST "/netzke/direct/?authenticity_token=vkC6OERWwyDwHU5Hqnqpu%2BH83PNpqLnikPADBoZvrME%3D" for 127.0.0.1 at 2014-03-19 09:07:48 -0600

0.10.0rc2

Started GET "/posts" for 127.0.0.1 at 2014-03-18 13:02:58 -0600
Processing by PostsController#index as HTML
4

1 に答える 1

0

こんにちは、ページをレンダリングするすべてのリンクでメソッドを指定する問題を最終的に解決しました。netzke 0.8.0 はこれを必要としないため、これは公式リリースで解決される可能性があります。

これが新しい application.html.erb で、ロケールの link_to ではありません。

<!DOCTYPE html>
<html>
<head>
    <title>Railroad</title>
    <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
    <%= load_netzke %>
    <%= csrf_meta_tags %>
</head>
<body>
<div id="wrap">
    <div id="header">
        <div>
            <h1>Demo</h1>
            <hr/>
        </div>
        <div style="float: left;">
            <% if I18n.locale == I18n.default_locale %>
                <%= link_to "Español", {:locale=>'es'}, :method => :get%>
            <% else %>
                <%= link_to "English", {:locale=>'en'}, :method => :get%>
            <%end%>
        </div>
        <div style="float: right;">
            <% if user_signed_in? %>
                <%= link_to (t :sign_out), destroy_user_session_path, :method => :delete %>
            <% end %>
        </div>
    </div>
    <div id="main-content">
        <%= render 'layouts/messages' %>
        <%= yield %>
    </div>
    <div id="footer">
        <hr/>
    </div>
</div>
</body>
</html>

そして、これが私の新しいwelcome/index.html.erbです

<h2><%= t :post_option %></h2>
<ul>
    <li><%= link_to (t :post_list),  posts_path, :method => :get%></li>
    <li><%= link_to (t :post_new),   new_post_path%></li>
</ul>
于 2014-03-25T19:12:32.007 に答える