Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1299696
records_helper.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 19, 12:15 AM
Size
1 KB
Mime Type
text/x-ruby
Expires
Fri, Nov 21, 12:15 AM (9 h, 49 m)
Engine
blob
Format
Raw Data
Handle
294695
Attached To
rWEBDNS WebDNS (edet4)
records_helper.rb
View Options
module
RecordsHelper
# Smart suffix for records
#
# On forward zones returns the zone name.
# On reverse zones returns the zone name but also tries to infer the subnet.
#
# Returns a smart suffix string.
def
name_field_append
(
record
)
return
".
#{
record
.
domain
.
name
}
"
if
not
record
.
domain
.
reverse?
".
#{
record
.
domain
.
name
}
(
#{
record
.
domain
.
subnet
}
)"
end
# List of record types usually used for that domain type
def
record_types_for_domain
(
domain
)
return
Record
.
reverse_records
if
domain
.
reverse?
return
Record
.
enum_records
if
domain
.
enum?
Record
.
forward_records
end
def
editable_record_attr
(
rec
,
attr
)
return
soa_content
(
rec
)
if
rec
.
type
==
'SOA'
&&
attr
==
:content
return
rec
.
read_attribute
(
attr
)
if
rec
.
type
==
'SOA'
||
!
can_edit?
(
rec
)
link_to
(
rec
.
read_attribute
(
attr
),
"#edit-record-
#{
rec
.
id
}
-
#{
attr
}
"
,
class
:
'editable'
,
data
:
{
pk
:
rec
.
id
,
name
:
attr
,
type
:
'text'
,
url
:
editable_domain_records_path
(
rec
.
domain_id
)
}
)
end
def
soa_content
(
rec
)
SOA
::
SOA_FIELDS
.
map
{
|
attr
|
"<span class='soa-
#{
attr
}
'>
#{
rec
.
send
(
attr
)
}
</span>"
}
.
join
(
' '
)
.
html_safe
end
end
Event Timeline
Log In to Comment