Patch #2971

Patch for "My Page" personalization not storing reordered blocks

Added by Thorsten Schaaps over 8 years ago. Updated almost 8 years ago.

Status:ClosedStart date:2009-03-14
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:UI
Target version:0.9.0

Description

I just noticed "My page" personalization does not fully work:
You can add/remove blocks, but after reordering blocks the layout is not stored.
Tested with Safari 3.2.1 and FireFox 3.0.1, this can be reproduced on http://www.redmine.org.

One reason is MyController#order_blocks expects params[:group] to be an array, which simply is not the case, also params["list-#{group}"] may actually be empty if the user just dragged the last item out of a group.

A patch for these issues is attached.

Note that there may still be a race condition because of concurrent AJAX calls when the session is stored within cookies.
(Basically the same session is received twice - once for the removal, once for adding - changed and sent back, one change overwriting the other)

Redmine trunk (r2589)
Ruby 1.8.6
Rails 2.2.2
Postgres 8.3

mypage_order_fix.patch Magnifier (704 Bytes) Thorsten Schaaps, 2009-03-14 23:53

Associated revisions

Revision 2634
Added by Jean-Philippe Lang over 8 years ago

Fixes that "My Page" personalization was not storing reordered blocks (#2971).

Revision 3194
Added by Jean-Philippe Lang almost 8 years ago

Fixes block reordering on my page (#2971).

History

#1 Updated by Curtis Stewart over 8 years ago

+1

I will be interested when this patch gets incorporated also. I have had a few people ask about it.

#2 Updated by Jean-Philippe Lang over 8 years ago

  • Status changed from New to Resolved
  • Target version set to 0.8.3

Patch applied in r2634. Thanks.
Rather than storing the changes in session, we should write them directly in the database.

#3 Updated by Chaoqun Zou over 8 years ago

There are still some problems in changing layout:

  • Add more than one components to both left-bottom and right-bottom areas, save layout.
  • Move components between two bottom areas, save layout.
  • If you do these several times, you will find that some component will be lost sometimes.

#4 Updated by Jean-Philippe Lang over 8 years ago

  • Status changed from Resolved to Reopened
  • Target version changed from 0.8.3 to 0.9.0

I'll do some more testing.

#5 Updated by Anonymous over 8 years ago

I'm having the same problem, even on redmine.org
It seems if it move something to the top block I'll never be able to move it to either of the bottom 2 blocks.

#6 Updated by Jean-Philippe Lang almost 8 years ago

  • Status changed from Reopened to Closed

This should be fixed in r3194.

#7 Updated by Alex Revetchi almost 8 years ago

  • Status changed from Closed to Reopened
  • Assignee set to Jean-Philippe Lang

Jean-Philippe Lang wrote:

This should be fixed in r3194.

Why def page_layout_save has been removed, in 0.9 there is no save link on My page in customization mode.

#8 Updated by Alex Revetchi almost 8 years ago

Alex Revetchi wrote:

Jean-Philippe Lang wrote:

This should be fixed in r3194.

Why def page_layout_save has been removed, in 0.9 there is no save link on My page in customization mode.

I have put back the code removed in a prevous commit and it works fine now:

app/views/my/page_layout.rhtml - after the line 48
+<%= link_to l(:button_save), {:action => 'page_layout_save'}, :class => 'icon icon-save' %>

app/controllers/my_controller.rb - restored page_layout_save routine at the end of the file

+ # Save user's page layout
+ def page_layout_save
+ @user = User.current
+ @user.pref[:my_page_layout] = session[:page_layout] if session[:page_layout]
+ @user.pref.save
+ session[:page_layout] = nil
+ redirect_to :action => 'page'
+ end

#9 Updated by Jean-Philippe Lang almost 8 years ago

  • Status changed from Reopened to Closed

This code was removed because order is saved immediately after moving a block.

#10 Updated by Alex Revetchi almost 8 years ago

Jean-Philippe Lang wrote:

This code was removed because order is saved immediately after moving a block.

There should be at least close button, what user should do in order to exit the customization mode? navigate away from that page?

#11 Updated by Jean-Philippe Lang almost 8 years ago

There is a 'Back' button for that.

#12 Updated by Alex Revetchi almost 8 years ago

Jean-Philippe Lang wrote:

There is a 'Back' button for that.

Thanks, a lot, it was confusing as I was used to the previous interface, where back was canceling the changes i.e. not saving them.

Also available in: Atom PDF