"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20170421000001_pretty_date_options_added.rb" (25 Mar 2021, 1222 Bytes) of package /linux/www/zammad-4.0.0.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "20170421000001_pretty_date_options_added.rb": 3.5.1_vs_4.0.0.

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