Class: UzuUzu::Info

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/uzuuzu-cms/model/info.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fixture_loadObject

self.uniq



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/uzuuzu-cms/model/info.rb', line 65

def self.fixture_load
  # fixture load
  ::UzuUzu.logger.debug 'fixture load start'
  Dir.glob('./fixture/**/*.*').each do |path|
    ::UzuUzu.logger.debug "fixture file : #{path}"
    paths = path.split('/')
    model_name = ::File.basename(paths.pop, '.*')
    while !paths.blank? && paths[-1] != 'fixture'
      model_name = "#{paths.pop.camel_case}::#{model_name.camel_case}"
    end
    begin
      ::UzuUzu.logger.debug "fixture model name : #{model_name}"
      model = eval("::#{model_name}")
      ::UzuUzu::DataStore::Fixture.import_file(model, path, true)
    rescue NameError => e
      ::UzuUzu.logger.error(e.to_s)
    end
  end
  ::UzuUzu.logger.debug 'fixture load end'
end

.initialize?Boolean

Returns:

  • (Boolean)


90
91
92
93
# File 'lib/uzuuzu-cms/model/info.rb', line 90

def self.initialize?
  info = self.uniq
  info.initialize?
end

.uniqObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/uzuuzu-cms/model/info.rb', line 46

def self.uniq
  ret = nil
  UzuUzu.transaction do |tr|
    tr.begin
    ary = self.all
    if ary.empty?
      fixture_load
    end
    ary = self.all

    ret = ary.pop
    ary.each do |record|
      record.destroy
    end
    tr.commit
  end
  ret
end

Instance Method Details



95
96
97
# File 'lib/uzuuzu-cms/model/info.rb', line 95

def breadcrumbs
  []
end

#contents_render(options = {}, locals = {}) ⇒ Object



115
116
117
# File 'lib/uzuuzu-cms/model/info.rb', line 115

def contents_render(options={}, locals={})
  ''
end

#css_urlsObject



103
104
105
106
107
# File 'lib/uzuuzu-cms/model/info.rb', line 103

def css_urls
  self.csses.map do |css|
    css.url
  end
end

#initialize?Boolean

fixture_load

Returns:

  • (Boolean)


86
87
88
# File 'lib/uzuuzu-cms/model/info.rb', line 86

def initialize?
  self.step >= 2
end

#js_urlsObject



109
110
111
112
113
# File 'lib/uzuuzu-cms/model/info.rb', line 109

def js_urls
  self.javascripts.map do |js|
    js.url
  end
end

#layout_fixObject



99
100
101
# File 'lib/uzuuzu-cms/model/info.rb', line 99

def layout_fix
  self.layout
end

#page_titleObject



119
120
121
# File 'lib/uzuuzu-cms/model/info.rb', line 119

def page_title
  self.title
end

#render(options = {}, locals = {}) ⇒ Object



123
124
125
# File 'lib/uzuuzu-cms/model/info.rb', line 123

def render(options={}, locals={})
  self.layout.render(options, locals)
end