Module: Project::Preferences

Included in:
Project
Defined in:
app/models/project/preferences.rb

Constant Summary

BASE_PREFERENCES =

DEFAULT_WORKBENCH_STARTING_PATH = '/hub'.freeze

DEFAULT_WORKBENCH_SETTINGS = {
  'workbench_starting_path' => DEFAULT_WORKBENCH_STARTING_PATH
}.freeze
YAML.load_file(Rails.root + 'config/preferences/project.yml')

Instance Method Summary (collapse)

Instance Method Details

- (Object) fill_preferences



32
33
34
35
36
37
38
39
40
41
# File 'app/models/project/preferences.rb', line 32

def fill_preferences
  if preferences.empty?
    reset_preferences
  else
    Project::BASE_PREFERENCES.keys.each do |k|
      preferences[k] = Project::BASE_PREFERENCES[k] if send(k).nil?
    end
  end
  true
end

- (Object) layout=(values)



47
48
49
50
# File 'app/models/project/preferences.rb', line 47

def layout=(values)
  l = layout.nil? ? {} : layout
  super(l.merge(values))
end

- (Object) reset_preferences



43
44
45
# File 'app/models/project/preferences.rb', line 43

def reset_preferences
  write_attribute(:preferences, Project::BASE_PREFERENCES)
end