mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-05 15:31:47 +01:00
Changed code to support basic i18n.
Added RubyMine configuration and rvm setup to .gitignore.
This commit is contained in:
parent
04faa5d408
commit
fd3f69d927
99 changed files with 1157 additions and 601 deletions
|
|
@ -6,16 +6,6 @@ class Preference < ActiveRecord::Base
|
|||
{ :due_in_n_days => 0, :due_on => 1}
|
||||
end
|
||||
|
||||
def self.day_number_to_name_map
|
||||
{ 0 => "Sunday",
|
||||
1 => "Monday",
|
||||
2 => "Tuesday",
|
||||
3 => "Wednesday",
|
||||
4 => "Thursday",
|
||||
5 => "Friday",
|
||||
6 => "Saturday"}
|
||||
end
|
||||
|
||||
def hide_completed_actions?
|
||||
return show_number_completed == 0
|
||||
end
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ class Project < ActiveRecord::Base
|
|||
named_scope :hidden, :conditions => { :state => 'hidden' }
|
||||
named_scope :completed, :conditions => { :state => 'completed'}
|
||||
|
||||
validates_presence_of :name, :message => "project must have a name"
|
||||
validates_length_of :name, :maximum => 255, :message => "project name must be less than 256 characters"
|
||||
validates_uniqueness_of :name, :message => "already exists", :scope =>"user_id"
|
||||
validates_does_not_contain :name, :string => ',', :message => "cannot contain the comma (',') character"
|
||||
validates_presence_of :name
|
||||
validates_length_of :name, :maximum => 255
|
||||
validates_uniqueness_of :name, :scope =>"user_id"
|
||||
validates_does_not_contain :name, :string => ','
|
||||
|
||||
acts_as_list :scope => 'user_id = #{user_id} AND state = \'#{state}\''
|
||||
acts_as_state_machine :initial => :active, :column => 'state'
|
||||
|
|
@ -71,8 +71,8 @@ class Project < ActiveRecord::Base
|
|||
|
||||
def self.feed_options(user)
|
||||
{
|
||||
:title => 'Tracks Projects',
|
||||
:description => "Lists all the projects for #{user.display_name}"
|
||||
:title => t('models.project.feed_title'),
|
||||
:description => t('models.project.feed_description', :username => user.display_name)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class Todo < ActiveRecord::Base
|
|||
|
||||
def validate
|
||||
if !show_from.blank? && show_from < user.date
|
||||
errors.add("show_from", "must be a date in the future")
|
||||
errors.add("show_from", t('models.todo.error_date_must_be_future'))
|
||||
end
|
||||
errors.add(:description, "may not contain \" characters") if /\"/.match(description)
|
||||
unless @predecessor_array.nil? # Only validate predecessors if they changed
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class User < ActiveRecord::Base
|
|||
def update_positions(context_ids)
|
||||
context_ids.each_with_index do |id, position|
|
||||
context = self.detect { |c| c.id == id.to_i }
|
||||
raise "Context id #{id} not associated with user id #{@user.id}." if context.nil?
|
||||
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
|
||||
|
|
@ -27,7 +27,7 @@ class User < ActiveRecord::Base
|
|||
def update_positions(project_ids)
|
||||
project_ids.each_with_index do |id, position|
|
||||
project = self.detect { |p| p.id == id.to_i }
|
||||
raise "Project id #{id} not associated with user id #{@user.id}." if project.nil?
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue