OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/cells/enumerations/row_cell.rb

51 lines
930 B

module Enumerations
class RowCell < ::RowCell
include ::IconsHelper
include ::ColorsHelper
include ReorderLinksHelper
def enumeration
model
end
def name
link_to h(enumeration.name), edit_enumeration_path(enumeration)
end
def is_default
if enumeration.is_default?
op_icon 'icon icon-checkmark'
end
end
def color
icon_for_color enumeration.color
end
def active
if enumeration.active?
op_icon 'icon icon-checkmark'
end
end
def sort
reorder_links('enumeration', { action: 'update', id: enumeration }, method: :put)
end
def button_links
[
delete_link
]
end
def delete_link
link_to(
op_icon('icon icon-delete'),
enumeration_path(enumeration),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) }
)
end
end
end