2014-02-03 19:23:00 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-09-20 12:08:02 +00:00
|
|
|
class Overview < ApplicationModel
|
2012-04-10 14:06:46 +00:00
|
|
|
store :condition
|
|
|
|
store :order
|
|
|
|
store :view
|
2015-04-27 13:42:53 +00:00
|
|
|
validates :name, presence: true
|
|
|
|
validates :prio, presence: true
|
2015-09-17 18:39:51 +00:00
|
|
|
|
2016-03-12 00:49:51 +00:00
|
|
|
before_create :fill_link
|
|
|
|
before_update :fill_link
|
2015-09-17 18:39:51 +00:00
|
|
|
|
2016-03-12 00:49:51 +00:00
|
|
|
notify_clients_support
|
2016-03-03 01:51:24 +00:00
|
|
|
latest_change_support
|
|
|
|
|
2015-09-17 18:39:51 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
# fill link
|
|
|
|
def fill_link
|
2016-03-12 00:49:51 +00:00
|
|
|
return true if link.empty?
|
|
|
|
return true if !changes['name']
|
2015-09-17 18:39:51 +00:00
|
|
|
self.link = name.downcase
|
|
|
|
link.gsub!(/\s/, '_')
|
|
|
|
link.gsub!(/[^0-9a-z]/i, '_')
|
|
|
|
link.gsub!(/_+/, '_')
|
|
|
|
end
|
|
|
|
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|