20170421000001_pretty_date_options_added.rb 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. class PrettyDateOptionsAdded < ActiveRecord::Migration[4.2]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. Setting.create_or_update(
  6. title: 'Pretty Date',
  7. name: 'pretty_date_format',
  8. area: 'System::Branding',
  9. description: 'Defines pretty date format.',
  10. options: {
  11. form: [
  12. {
  13. display: '',
  14. null: false,
  15. name: 'pretty_date_format',
  16. tag: 'select',
  17. options: {
  18. 'relative': 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"',
  19. 'absolute': 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"',
  20. },
  21. },
  22. ],
  23. },
  24. preferences: {
  25. render: true,
  26. prio: 10,
  27. permission: ['admin.branding'],
  28. },
  29. state: 'relative',
  30. frontend: true
  31. )
  32. Scheduler.create_or_update(
  33. name: 'Import Jobs',
  34. method: 'ImportJob.start_registered',
  35. period: 1.hour,
  36. prio: 1,
  37. active: true,
  38. updated_by_id: 1,
  39. created_by_id: 1
  40. )
  41. end
  42. end