Class: Web::LayoutSet

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/web/layout_set.rb

Overview

LayoutSets contain individual Layout s. They are either private or public.

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ LayoutSet

Returns a new instance of LayoutSet.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/web/layout_set.rb', line 12

def initialize(params)
  super(params)
  self.             ||= false
  self.logoid           ||= 0
  self.pagecount        ||= 0
  self.themeid          ||= ''
  self.colorschemeid    ||= '01'
  self.wapthemeid       ||= 'mobile'
  self.wapcolorschemeid ||= '01'
  self.css              ||= ''
  self.virtualhost      ||= ''

  self.save
end

Instance Method Details

#has_logo?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/web/layout_set.rb', line 43

def has_logo?
  self.
end

#is_private?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/web/layout_set.rb', line 39

def is_private?
  self.privatelayout
end

#is_public?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/web/layout_set.rb', line 35

def is_public?
  !self.privatelayout
end

#layoutsObject



47
48
49
50
# File 'lib/web/layout_set.rb', line 47

def layouts
  return 0 unless self.group
  Web::Layout.find(:all, :conditions => "groupid=#{self.groupid} AND privatelayout=#{self.privatelayout}" )
end

#liferay_classObject

com.liferay.portal.model.LayoutSet



8
9
10
# File 'lib/web/layout_set.rb', line 8

def liferay_class
  'com.liferay.portal.model.LayoutSet'
end

#url_prefixObject

lookup the path prefix for this LayoutSet



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/web/layout_set.rb', line 53

def url_prefix
  return '' unless self.group
  return '/web' if self.is_public?
  _class = (
    self.group.classnameid==0 ?
    Group : Classname.model(Classname.find(self.group.classnameid).value)
  )
  if _class == User
    return '/user' #if self.is_private?
    #return '/web'

  elsif _class == Group
    return '/group' #if self.is_private?
    #return '/web'

  else
    logger.debug 'FIXME: %s' % _class
    return ''
  end
end