active scaffold drag-and-drop sortable

瀏覽次數:94 次
跳到第一則未讀訊息

timcharper

未讀,
2007年11月5日 上午10:59:472007/11/5
收件者:ActiveScaffold : Ruby on Rails plugin
Hi All,
I just created an add-on plugin for activescaffold to add support for
the fancy pants drag and drop scriptaculous sortable effect.

In theory, installation should be easy. You'll need the latest
version of AS trunk:

Then, install the active_scaffold_sortable addon:

script/plugin install http://activescaffold.googlecode.com/svn/addons/active_scaffold_sortable

Then, add this line into your active_scaffold config block:

class Admin::QuotesController < Admin::Base
active_scaffold :quotes do |config|
config.actions << :sortable
end
end

Also, add a column to your model called "position" of type integer.
This will be used to store the sort order.

The plugin will automatically disable pagination, and disable custom
sorting for all of the columns, and force sort on "position"

You can change the sort column like this:

config.sortable.column = :position

Tim

timcharper

未讀,
2007年11月5日 上午11:02:352007/11/5
收件者:ActiveScaffold : Ruby on Rails plugin
By the way, I forgot to add, you'll need to include sortable.js in
your javascripts includes, along with prototype.js, of course.

Tim

On Nov 5, 8:59 am, timcharper <timchar...@gmail.com> wrote:
> Hi All,
> I just created an add-on plugin for activescaffold to add support for
> the fancy pants drag and drop scriptaculous sortable effect.
>
> In theory, installation should be easy. You'll need the latest
> version of AS trunk:
>
> Then, install the active_scaffold_sortable addon:
>

> script/plugin installhttp://activescaffold.googlecode.com/svn/addons/active_scaffold_sortable

Rusty Phillips

未讀,
2007年11月28日 晚上8:05:562007/11/28
收件者:ActiveScaffold : Ruby on Rails plugin
Fantastic!

I notice that you didn't actually include a copyright notice, which I
believe legally means that it may not be allowed to be used...or even
looked at.

Is this under the same license as Active Scaffold?

Ben Greene

未讀,
2007年12月7日 上午11:10:522007/12/7
收件者:ActiveScaffold : Ruby on Rails plugin
Thanks for this great idea Tim!

I'm having some trouble getting it working though. Here's the error
I'm getting--any ideas?

ActionView::TemplateError (undefined method `inherited_view_paths' for
#<ActiveScaffold::Config::Core:0x32da1b0>) on line #12 of vendor/
plugins/active_scaffold/frontends/default/views/_nested.rhtml:
9: column = active_scaffold_config.columns[column_name]
10: association = column.association
11: begin
12: controller =
active_scaffold_controller_for(association.klass)
13: rescue ActiveScaffold::ControllerNotFound => error %>
14: <%= "#{error.class} - #{error.message}"%>
15: <% else %>


On Nov 5, 10:59 am, timcharper <timchar...@gmail.com> wrote:
> Hi All,
> I just created an add-on plugin for activescaffold to add support for
> the fancy pants drag and drop scriptaculoussortableeffect.
>
> In theory, installation should be easy. You'll need the latest
> version of AS trunk:
>
> Then, install the active_scaffold_sortable addon:
>
> script/plugin installhttp://activescaffold.googlecode.com/svn/addons/active_scaffold_sortable

Tim Harper

未讀,
2007年12月8日 凌晨2:15:082007/12/8
收件者:actives...@googlegroups.com
Hi Ben,

It looks like it broke over time :)  I just updated it and got it working w/active scaffold 1.1 RC1.

Tim

Rusty Phillips

未讀,
2007年12月9日 清晨7:58:202007/12/9
收件者:ActiveScaffold : Ruby on Rails plugin
Using rails 1.2.5, active scaffold 1.1 RC1, and the recently updated
version of sortable drag-and-drop:
1) If I don't specify the position column, then it's as if the
sortable code doesn't exist. No sortable code is ever run.
2) If I do specify that column (set it to position,which is a column
I've got defined), then I get the following error:

ActionView::TemplateError (undefined method `column=' for
#<ActiveScaffold::Config::Sortable:0xb7105bb4>) on line #28 of vendor/
plugins/active_scaffold/frontends/default/views/_nested.rhtml:
25: end
26:
27: # generate the customized label
28: @label = as_("%s for %s",
active_scaffold_config_for(association.klass).label,
format_column(@record.to_label))
29:
30: begin
31: controller =
active_scaffold_controller_for(association.klass)

Any thoughts?

robd

未讀,
2007年12月31日 下午1:43:572007/12/31
收件者:ActiveScaffold : Ruby on Rails plugin
Hi Tim,

This looks excellent - many thanks.

I'm on AS head / rails 2.0.2 BTW

A couple of things I did:

- add the reorder method to my routes since I'm using AS with
resources :collection => {:reorder => :post}

- actions/sortable.rb lines 28-31 fail if you don't have list, update
and create actions enabled. Replacing with the following worked for
me:

[:list, :update, :create].each do |action_name|
config.send(action_name).columns.exclude(sortable_column) if
config.actions.include?(action_name)
end

- Should acts_as_list position be zero or one based? Looking at the
rails (2.0.2) plugin source, it looks like it's one based. In that
case I think an update is needed line 50: i.to_i needs to be i+1 (also
is to_i needed here?).

Where should we log tickets for this? Normal activescaffold tracker?

Thanks,
Rob

On Nov 5, 3:59 pm, timcharper <timchar...@gmail.com> wrote:
> Hi All,
> I just created an add-on plugin for activescaffold to add support for
> the fancy pants drag and drop scriptaculous sortable effect.
>
> In theory, installation should be easy.  You'll need the latest
> version of AS trunk:
>
> Then, install theactive_scaffold_sortableaddon:
>
> script/plugin installhttp://activescaffold.googlecode.com/svn/addons/active_scaffold_sortable
回覆所有人
回覆作者
轉寄
0 則新訊息