Revision b9b272f0 src/sunstone/models/SunstoneViews.rb

View differences:

src/sunstone/models/SunstoneViews.rb
19 19

  
20 20
require 'pp'
21 21

  
22

  
22 23
# This class is used by Sunstone to set and return the views available to a user
23 24
# as well as available tabs.
24 25
class SunstoneViews
......
31 32
    VIEWS_CONFIGURATION_FILE = ETC_LOCATION + "/sunstone-views.yaml"
32 33
    VIEWS_CONFIGURATION_DIR  = ETC_LOCATION + "/sunstone-views/"
33 34

  
34
    def initialize(mode)
35
    def initialize
35 36
        @views_config = YAML.load_file(VIEWS_CONFIGURATION_FILE)
36 37

  
37 38
        base_path = SUNSTONE_ROOT_DIR+'/public/js/'
38 39

  
39 40
        @views = Hash.new
40
        Dir[VIEWS_CONFIGURATION_DIR + mode + '/*.yaml'].each do |p_path|
41
            reg = VIEWS_CONFIGURATION_DIR + mode + '/'
42
            m = p_path.match(/^#{reg}(.*).yaml$/)
41

  
42
        Dir[VIEWS_CONFIGURATION_DIR+'*.yaml'].each do |p_path|
43
            m = p_path.match(/^#{VIEWS_CONFIGURATION_DIR}(.*).yaml$/)
43 44
            if m && m[1]
44 45
                @views[m[1]] = YAML.load_file(p_path)
45 46
            end

Also available in: Unified diff