Module: Project::Preferences

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

Constant Summary collapse

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

#fill_preferencesObject



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

#layout=(values) ⇒ Object



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

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

#reset_preferencesObject



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

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