official_module/app/models/server_ability_manager.rb

35 lines
1.1 KiB
Ruby

class ServerAbilityManager
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCategory::Categorizable
include OrbitTag::Taggable
field :store_token
field :site_name
field :site_url
field :site_ip
field :site_num, type: Integer, default: 0
field :max_site_ability, type: Integer, default: 0
def site_name_layout(url=nil,site_name=nil)
url = self.site_url if url.nil?
site_name = self.site_name if site_name.nil?
"<a href=\"#{url}\">#{site_name}</a>
<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">
<li>
<a href=\"/#{I18n.locale}/admin/official_module/#{self.store_token}/set_server_ability\">
#{I18n.t('edit')}
</a>
</li>
<li>
<a href=\"/#{I18n.locale}/admin/official_module/#{self.store_token}/delete\">
#{I18n.t('delete_')}
</a>
</li>
</ul>
<div>"
end
def site_name
tmp = super
tmp = tmp.blank? ? self.site_url : tmp
end
end