结合 Rails 3 和 sproutcore 的良好示例应用程序

发布于 2024-12-06 17:07:13 字数 651 浏览 2 评论 0 原文

我正在尝试为我正在制作的 Rails 3.1 应用程序编写一个 sproutcore 前端。我已经看过 sproutcore 指南,但我有兴趣查看如何将 sproutcore 与 Rails 3(.1) 一起使用的真实示例。

我找到了两个示例,但每个示例都完全不同:

  1. 使用 todo-app “https://github.com/drogus/bulk_api">bulk_api:一种有趣的方法,使用特定的 REST 风格来最小化流量。但它建议将 sproutcore 应用程序放置在 app/sproutcore 中,但我仍然有点不清楚它实际上是如何完全挂钩的。
  2. Travis-ci 这似乎是一个非常干净的示例,rails 3.1,使用 sproutcore。我还不完全清楚,但所有 sproutcore js 都干净地存储在 app/assets/javascript/apps 中,据我所知,application.html只需加载 js 并提供加载所有内容的框架。

你还知道其他例子吗?如何在 Rails 应用程序中使用 sproutcore?

I am trying to write a sproutcore frontend for a rails 3.1 application I am making. I have had a look at the sproutcore guides, but I am interested in seeing real examples how to use sproutcore together with rails 3(.1).

I have found two examples, but each is totally different:

  1. A todo-app created using bulk_api: an interesting approach using a specific REST-style to minimise the traffic. But it proposes to place the sproutcore app in app/sproutcore, and is still a bit unclear to me how that actually hooks in completely.
  2. Travis-ci which seems to be a very clean example, rails 3.1, to use sproutcore. It is not yet completely clear to me, but all sproutcore js is cleanly stored inside app/assets/javascript/apps and as far as i can tell, the application.html just loads the js and provides the frame where everything is loaded into.

Do you know any other examples? How do you use sproutcore in your rails app?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深海里的那抹蓝 2024-12-13 17:07:13

您描述的方法与将backbone.js集成到rails应用程序中的方法相同,并且它似乎工作得很好

https://github.com/codebrew/backbone-rails

这将主干存储在

app/assets/javascripts/backbone/
应用程序/资产/javascripts/backbone/应用程序/模型
app/assets/javascripts/backbone/app/controllers

然后视图中有一个脚本标签,它只是初始化主干

<script type="text/javascript">
  $(function() {
    // Blog is the app name
    window.router = new Blog.Routers.PostsRouter({posts: <%= @posts.to_json.html_safe -%>});
    Backbone.history.start();
  });
</script>

我想 sproutcore 的类似过程是有意义的

The method you describe is the same way that you integrate backbone.js into a rails app, and it seems to work very well

https://github.com/codebrew/backbone-rails

This stores backbone in

app/assets/javascripts/backbone/
app/assets/javascripts/backbone/app/models
app/assets/javascripts/backbone/app/controllers

And then there is a script tag in the view that just initializes backbone

<script type="text/javascript">
  $(function() {
    // Blog is the app name
    window.router = new Blog.Routers.PostsRouter({posts: <%= @posts.to_json.html_safe -%>});
    Backbone.history.start();
  });
</script>

I imagine a similar process for sproutcore would make sense

痞味浪人 2024-12-13 17:07:13

我确实找到了一个演示项目: sproutcore-on-rails 确实成功了对我来说更清楚。

I did find a demo-project: sproutcore-on-rails that did manage to make things clearer for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文