layout 'base'
before_filter :require_login
- BLOCKS = { 'issues_assigned_to_me' => :label_assigned_to_me_issues,
- 'issues_reported_by_me' => :label_reported_issues,
- 'latest_news' => :label_news_latest,
+ BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
+ 'issuesreportedbyme' => :label_reported_issues,
+ 'news' => :label_news_latest,
'calendar' => :label_calendar,
'documents' => :label_document_plural
}.freeze
+ DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'],
+ 'right' => ['issuesreportedbyme']
+ }.freeze
+
verify :xhr => true,
:session => :page_layout,
:only => [:add_block, :remove_block, :order_blocks]
# Show user's page
def page
@user = self.logged_in_user
- @blocks = @user.pref[:my_page_layout] || { 'left' => ['issues_assigned_to_me'], 'right' => ['issues_reported_by_me'] }
+ @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
end
# Edit user's account
# User's page layout configuration
def page_layout
@user = self.logged_in_user
- @blocks = @user.pref[:my_page_layout] || { 'left' => ['issues_assigned_to_me'], 'right' => ['issues_reported_by_me'] }
+ @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
session[:page_layout] = @blocks
%w(top left right).each {|f| session[:page_layout][f] ||= [] }
@block_options = []
+++ /dev/null
-<h3><%=l(:label_assigned_to_me_issues)%></h3>\r
-<% assigned_issues = Issue.find(:all, \r
- :conditions => ["assigned_to_id=?", user.id],\r
- :limit => 10, \r
- :include => [ :status, :project, :tracker ], \r
- :order => 'issues.updated_on DESC') %>\r
-<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>\r
-<% if assigned_issues.length > 0 %>\r
-<p><%=lwr(:label_last_updates, assigned_issues.length)%></p>\r
-<% end %>\r
+++ /dev/null
-<h3><%=l(:label_reported_issues)%></h3>\r
-<% reported_issues = Issue.find(:all, \r
- :conditions => ["author_id=?", user.id],\r
- :limit => 10, \r
- :include => [ :status, :project, :tracker ], \r
- :order => 'issues.updated_on DESC') %>\r
-<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>\r
-<% if reported_issues.length > 0 %>\r
-<p><%=lwr(:label_last_updates, reported_issues.length)%></p>\r
-<% end %>
\ No newline at end of file
--- /dev/null
+<h3><%=l(:label_assigned_to_me_issues)%></h3>\r
+<% assigned_issues = Issue.find(:all, \r
+ :conditions => ["assigned_to_id=?", user.id],\r
+ :limit => 10, \r
+ :include => [ :status, :project, :tracker ], \r
+ :order => 'issues.updated_on DESC') %>\r
+<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>\r
+<% if assigned_issues.length > 0 %>\r
+<p><%=lwr(:label_last_updates, assigned_issues.length)%></p>\r
+<% end %>\r
--- /dev/null
+<h3><%=l(:label_reported_issues)%></h3>\r
+<% reported_issues = Issue.find(:all, \r
+ :conditions => ["author_id=?", user.id],\r
+ :limit => 10, \r
+ :include => [ :status, :project, :tracker ], \r
+ :order => 'issues.updated_on DESC') %>\r
+<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>\r
+<% if reported_issues.length > 0 %>\r
+<p><%=lwr(:label_last_updates, reported_issues.length)%></p>\r
+<% end %>
\ No newline at end of file
+++ /dev/null
-<h3><%=l(:label_news_latest)%></h3>\r
-\r
-<%= render (:partial => 'news/news', \r
- :collection => News.find(:all,\r
- :limit => 10,\r
- :order => 'news.created_on DESC',\r
- :conditions => "news.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",\r
- :include => [:project, :author])) unless @user.projects.empty? %>
\ No newline at end of file
--- /dev/null
+<h3><%=l(:label_news_latest)%></h3>\r
+\r
+<%= render (:partial => 'news/news', \r
+ :collection => News.find(:all,\r
+ :limit => 10,\r
+ :order => 'news.created_on DESC',\r
+ :conditions => "news.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",\r
+ :include => [:project, :author])) unless @user.projects.empty? %>
\ No newline at end of file