Module: Timebox

Extended by:
ActiveSupport::Concern
Includes:
CacheMarkdownField, Gitlab::SQL::Pattern, Referable, StripAttribute
Included in:
Milestone
Defined in:
app/models/concerns/timebox.rb

Defined Under Namespace

Classes: TimeboxStruct

Constant Summary collapse

None =

Represents a “No Timebox” state used for filtering Issues and Merge Requests that have no timeboxes assigned.

TimeboxStruct.new('No Timebox', 'No Timebox', 0)
Any =
TimeboxStruct.new('Any Timebox', '', -1)
Upcoming =
TimeboxStruct.new('Upcoming', '#upcoming', -2)
Started =
TimeboxStruct.new('Started', '#started', -3)

Constants included from Gitlab::SQL::Pattern

Gitlab::SQL::Pattern::MIN_CHARS_FOR_PARTIAL_MATCHING, Gitlab::SQL::Pattern::REGEX_QUOTED_TERM

Constants included from CacheMarkdownField

CacheMarkdownField::INVALIDATED_BY

Instance Attribute Summary

Attributes included from CacheMarkdownField

#skip_markdown_cache_validation

Instance Method Summary collapse

Methods included from StripAttribute

#strip_attributes!

Methods included from Referable

#referable_inspect, #to_reference_base

Methods included from Gitlab::SQL::Pattern

split_query_to_search_terms

Methods included from CacheMarkdownField

#attribute_invalidated?, #banzai_render_context, #cached_html_for, #cached_html_up_to_date?, #can_cache_field?, #invalidated_markdown_cache?, #latest_cached_markdown_version, #local_version, #mentionable_attributes_changed?, #mentioned_filtered_user_ids_for, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #skip_project_check?, #store_mentions!, #updated_cached_html_for

Instance Method Details

#merge_requests_enabled?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


149
150
151
# File 'app/models/concerns/timebox.rb', line 149

def merge_requests_enabled?
  raise NotImplementedError
end


125
126
127
# File 'app/models/concerns/timebox.rb', line 125

def reference_link_text(from = nil)
  self.class.reference_prefix + self.title
end

#resource_parentObject

Raises:

  • (NotImplementedError)


141
142
143
# File 'app/models/concerns/timebox.rb', line 141

def resource_parent
  raise NotImplementedError
end

#safe_titleObject



137
138
139
# File 'app/models/concerns/timebox.rb', line 137

def safe_title
  title.to_slug.normalize.to_s
end

#timebox_nameObject



133
134
135
# File 'app/models/concerns/timebox.rb', line 133

def timebox_name
  model_name.singular
end

#title=(value) ⇒ Object



129
130
131
# File 'app/models/concerns/timebox.rb', line 129

def title=(value)
  write_attribute(:title, sanitize_title(value)) if value.present?
end

#to_ability_nameObject



145
146
147
# File 'app/models/concerns/timebox.rb', line 145

def to_ability_name
  model_name.singular
end

#to_referenceObject

Raises:

  • (NotImplementedError)


121
122
123
# File 'app/models/concerns/timebox.rb', line 121

def to_reference
  raise NotImplementedError
end

#weight_available?Boolean

Returns:

  • (Boolean)


153
154
155
# File 'app/models/concerns/timebox.rb', line 153

def weight_available?
  resource_parent&.feature_available?(:issue_weights)
end