Module: Redmine::MyPage

Includes:
I18n
Defined in:
lib/redmine/my_page.rb

Constant Summary

CORE_BLOCKS =
{
  'issuesassignedtome' => :label_assigned_to_me_issues,
  'issuesreportedbyme' => :label_reported_issues,
  'issueswatched' => :label_watched_issues,
  'news' => :label_news_latest,
  'calendar' => :label_calendar,
  'documents' => :label_document_plural,
  'timelog' => :label_spent_time
}

Class Method Summary collapse

Methods included from I18n

#current_language, #day_letter, #day_name, #find_language, #format_date, #format_hours, #format_time, included, #l, #l_hours, #l_hours_short, #l_or_humanize, #languages_options, #ll, #lu, #month_name, #set_language_if_valid, #valid_languages

Class Method Details

.additional_blocksObject

Returns the additional blocks that are defined by plugin partials



46
47
48
49
50
51
52
# File 'lib/redmine/my_page.rb', line 46

def self.additional_blocks
  @@additional_blocks ||= Dir.glob("#{Redmine::Plugin.directory}/*/app/views/my/blocks/_*.{rhtml,erb}").inject({}) do |h,file|
    name = File.basename(file).split('.').first.gsub(/^_/, '')
    h[name] = name.to_sym
    h
  end
end

.block_optionsObject



37
38
39
40
41
42
43
# File 'lib/redmine/my_page.rb', line 37

def self.block_options
  options = []
  blocks.each do |k, v|
    options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize]
  end
  options
end

.blocksObject

Returns the available blocks



33
34
35
# File 'lib/redmine/my_page.rb', line 33

def self.blocks
  CORE_BLOCKS.merge(additional_blocks).freeze
end

.default_layoutObject

Returns the default layout for My Page



55
56
57
58
59
60
# File 'lib/redmine/my_page.rb', line 55

def self.default_layout
  {
    'left' => ['issuesassignedtome'],
    'right' => ['issuesreportedbyme']
  }
end