mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-11 23:22:36 +01:00
Added locale selection to preferences
Mostly completed transition to full i18n Incorporated german translations by Ulf Klose <ulf.klose@gmail.com>
This commit is contained in:
parent
d57bd479f9
commit
338d4bb5a6
44 changed files with 1071 additions and 209 deletions
|
|
@ -3,6 +3,7 @@ require 'digest/sha1'
|
|||
class User < ActiveRecord::Base
|
||||
# Virtual attribute for the unencrypted password
|
||||
attr_accessor :password
|
||||
attr_protected :is_admin # don't allow mass-assignment for this
|
||||
|
||||
has_many :contexts,
|
||||
:order => 'position ASC',
|
||||
|
|
@ -11,11 +12,11 @@ class User < ActiveRecord::Base
|
|||
find(params['id'] || params['context_id']) || nil
|
||||
end
|
||||
def update_positions(context_ids)
|
||||
context_ids.each_with_index do |id, position|
|
||||
context_ids.each_with_index {|id, position|
|
||||
context = self.detect { |c| c.id == id.to_i }
|
||||
raise I18n.t('models.user.error_context_not_associated', :context => id, :user => @user.id) if context.nil?
|
||||
context.update_attribute(:position, position + 1)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
has_many :projects,
|
||||
|
|
@ -25,11 +26,11 @@ class User < ActiveRecord::Base
|
|||
find(params['id'] || params['project_id'])
|
||||
end
|
||||
def update_positions(project_ids)
|
||||
project_ids.each_with_index do |id, position|
|
||||
project_ids.each_with_index {|id, position|
|
||||
project = self.detect { |p| p.id == id.to_i }
|
||||
raise I18n.t('models.user.error_project_not_associated', :project => id, :user => @user.id) if project.nil?
|
||||
project.update_attribute(:position, position + 1)
|
||||
end
|
||||
}
|
||||
end
|
||||
def projects_in_state_by_position(state)
|
||||
self.sort{ |a,b| a.position <=> b.position }.select{ |p| p.state == state }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue