Project

General

Profile

« Previous | Next » 

Revision 81e2d3f3

Added by Ohad Levy almost 14 years ago

  • ID 81e2d3f3f6059d9d4807e57011769ad016d6c2d5

fixes #302 and all references to_label and to_s
removed references to all per_page settings as they are common now

View differences:

app/controllers/audits_controller.rb
class AuditsController < ApplicationController
def index
@search = Audit.search params[:search]
@audits = @search.paginate :page => params[:page], :per_page => 15
@audits = @search.paginate :page => params[:page]
end
def show
app/controllers/operatingsystems_controller.rb
class OperatingsystemsController < ApplicationController
def index
@search = Operatingsystem.search(params[:search])
@operatingsystems = @search.all.paginate(:page => params[:page], :per_page => 10, :include => [:architectures], :order => :name)
@operatingsystems = @search.all.paginate(:page => params[:page], :include => [:architectures], :order => :name)
end
def new
app/controllers/users_controller.rb
params[:search][:order] ||= "descend_by_firstname"
@search = User.search(params[:search])
@users = @search.paginate(:page => params[:page], :include => [:auth_source], :per_page => 15)
@users = @search.paginate(:page => params[:page], :include => [:auth_source])
end
def new
app/models/architecture.rb
validates_format_of :name, :with => /\A(\S+)\Z/, :message => "can't be blank or contain white spaces."
acts_as_audited
alias_attribute :to_s, :name
alias_attribute :to_label, :name
def self.per_page
25
end
end
app/models/domain.rb
before_destroy Ensure_not_used_by.new(:hosts, :subnets)
def to_label
name
end
def to_s
to_label
end
# counts how many times a certian fact value exists in this domain
# used mostly for statistics
def countFact fact, value
app/models/environment.rb
validates_format_of :name, :with => /^[\w\d]+$/, :message => "is alphanumeric and cannot contain spaces"
default_scope :order => 'name'
def to_label
name
end
def to_s
name
end
def self.per_page
10
end
# returns an hash of all puppet environments and their relative paths
def self.puppetEnvs
env = Hash.new
app/models/fact_value.rb
end
hash
end
def self.per_page
15
end
end
app/models/host.rb
alias_attribute :os, :operatingsystem
alias_attribute :arch, :architecture
alias_attribute :hostname, :name
alias_attribute :to_s, :name
alias_attribute :to_label, :name
validates_uniqueness_of :name
validates_presence_of :name, :environment_id
......
domain.nil? ? name : name.chomp("." + domain.name)
end
# defines how many hosts will be shown in the hostlist
def self.per_page
20
end
# method to return the correct owner list for host edit owner select dropbox
def is_owned_by
owner.id_and_type if owner
app/models/hostgroup.rb
#TODO: add a method that returns the valid os for a hostgroup
def to_s
name
end
def all_puppetclasses
puppetclasses
end
app/models/media.rb
:message => "Only URLs with schema http://, https://, ftp:// or nfs:// are allowed (e.g. nfs://server/vol/dir)"
alias_attribute :os, :operatingsystem
alias_attribute :to_s, :name
alias_attribute :to_label, :name
before_destroy Ensure_not_used_by.new(:hosts)
end
app/models/model.rb
validates_uniqueness_of :name
validates_presence_of :name
default_scope :order => 'name'
alias_attribute :to_s, :name
alias_attribute :to_label, :name
end
app/models/parameter.rb
validates_format_of :name, :value, :with => /\A(\S+\s?)+\Z/, :message => "can't be blank or contain trailing white space"
attr_accessor :nested
def to_s
name
end
end
app/models/ptable.rb
validates_presence_of :layout
validates_format_of :name, :with => /\A(\S+\s?)+\Z/, :message => "can't be blank or contain trailing white spaces."
alias_attribute :to_s, :name
alias_attribute :to_label, :name
end
app/models/puppetclass.rb
return klasses
end
def to_s
name
end
# returns a hash containing modules and associated classes
def self.classes2hash classes
hash = {}
......
klass <=> other.klass
end
def self.per_page
20
end
# Retrieve the manifestdir from the puppet configuration
# Returns: String
def self.manifestdir
app/models/report.rb
# with_changes
named_scope :with_changes, {:conditions => "status != 0"}
def self.per_page
20
end
# a method that save the report values (e.g. values from METRIC)
# it is not supported to edit status values after it has been written once.
def status=(st)
app/models/usergroup.rb
has_many :hosts, :as => :owner
validates_uniqueness_of :name
before_destroy Ensure_not_used_by.new(:hosts, :usergroups)
alias_attribute :to_s, :name
alias_attribute :to_label, :name
# The text item to see in a select dropdown menu
alias_method :select_title, :to_s
alias_attribute :select_title, :to_s
# Support for sorting the groups by name
def <=>(other)
config/initializers/foreman.rb
def id_and_type
"#{id}-#{self.class.table_name.humanize}"
end
alias_attribute :to_label, :name
alias_attribute :to_s, :to_label
def self.per_page
20
end
end

Also available in: Unified diff