##// END OF EJS Templates
remove trailing white space from test/fixtures/workflows.yml...
remove trailing white space from test/fixtures/workflows.yml git-svn-id: http://svn.redmine.org/redmine/trunk@16339 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15561:3ba70a76164b
r15957:7816a4025a03 master
Show More
my_helper.rb
125 lines | 4.4 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Added encoding comment to helpers (#9792)....
r8090 # encoding: utf-8
#
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/my_helper.rb....
r6743 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
- new controller "myController"...
r60 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/my_helper.rb....
r6743 #
Jean-Philippe Lang
- new controller "myController"...
r60 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/my_helper.rb....
r6743 #
Jean-Philippe Lang
- new controller "myController"...
r60 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module MyHelper
Jean-Philippe Lang
Adds helpers for rendering my page blocks....
r15545 # Renders the blocks
def render_blocks(blocks, user, options={})
s = ''.html_safe
if blocks.present?
blocks.each do |block|
content = render_block_content(block, user)
if content.present?
if options[:edit]
Jean-Philippe Lang
Use regular icon-* class....
r15546 close = link_to(l(:button_delete), {:action => "remove_block", :block => block}, :method => 'post', :class => "icon-only icon-close")
Jean-Philippe Lang
Adds helpers for rendering my page blocks....
r15545 content = close + content_tag('div', content, :class => 'handle')
end
s << content_tag('div', content, :class => "mypage-box", :id => "block-#{block}")
end
end
end
s
end
# Renders a single block content
def render_block_content(block, user)
Jean-Philippe Lang
Moves blocks definition to Redmine::MyPage....
r15548 unless Redmine::MyPage.blocks.key?(block)
Jean-Philippe Lang
Adds helpers for rendering my page blocks....
r15545 Rails.logger.warn("Unknown block \"#{block}\" found in #{user.login} (id=#{user.id}) preferences")
return
end
Jean-Philippe Lang
My page - Spent time: configurable number of days to display (#8761)....
r15560 settings = user.pref.my_page_settings(block)
Jean-Philippe Lang
Adds helpers for rendering my page blocks....
r15545 begin
Jean-Philippe Lang
My page - Spent time: configurable number of days to display (#8761)....
r15560 render(:partial => "my/blocks/#{block}", :locals => {:user => user, :settings => settings})
Jean-Philippe Lang
Adds helpers for rendering my page blocks....
r15545 rescue ActionView::MissingTemplate
Rails.logger.warn("Template missing for block \"#{block}\" found in #{user.login} (id=#{user.id}) preferences")
return nil
end
end
Jean-Philippe Lang
Moves blocks definition to Redmine::MyPage....
r15548 def block_select_tag(user)
disabled = user.pref.my_page_layout.values.flatten
options = content_tag('option')
Redmine::MyPage.block_options.each do |label, block|
options << content_tag('option', label, :value => block, :disabled => disabled.include?(block))
end
Jean-Philippe Lang
Missing select name....
r15549 select_tag('block', options, :id => "block-select")
Jean-Philippe Lang
Moves blocks definition to Redmine::MyPage....
r15548 end
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 def calendar_items(startdt, enddt)
Issue.visible.
where(:project_id => User.current.projects.map(&:id)).
where("(start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)", startdt, enddt, startdt, enddt).
includes(:project, :tracker, :priority, :assigned_to).
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 references(:project, :tracker, :priority, :assigned_to).
to_a
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 end
def documents_items
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 Document.visible.order("#{Document.table_name}.created_on DESC").limit(10).to_a
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 end
def issuesassignedtome_items
Issue.visible.open.
Jean-Philippe Lang
Adds a scope to get issues assigned to a user....
r14338 assigned_to(User.current).
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 limit(10).
includes(:status, :project, :tracker, :priority).
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 references(:status, :project, :tracker, :priority).
Jean-Philippe Lang
Use the same scope for counting....
r14337 order("#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC")
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 end
def issuesreportedbyme_items
Jean-Philippe Lang
Show open issues only in "Reported Issues" on My page (#23472)....
r15390 Issue.visible.open.
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 where(:author_id => User.current.id).
limit(10).
includes(:status, :project, :tracker).
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 references(:status, :project, :tracker).
Jean-Philippe Lang
Use the same scope for counting....
r14337 order("#{Issue.table_name}.updated_on DESC")
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 end
def issueswatched_items
Jean-Philippe Lang
Watched issues count on "My page" is shown for all issues instead of only open ones (#15777)....
r14933 Issue.visible.open.on_active_project.watched_by(User.current.id).recently_updated.limit(10)
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 end
def news_items
News.visible.
where(:project_id => User.current.projects.map(&:id)).
limit(10).
includes(:project, :author).
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 references(:project, :author).
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 order("#{News.table_name}.created_on DESC").
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 to_a
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 end
Jean-Philippe Lang
Tests broken by r15942 (#8761)....
r15561 def timelog_items(settings={})
Jean-Philippe Lang
My page - Spent time: configurable number of days to display (#8761)....
r15560 days = settings[:days].to_i
days = 7 if days < 1 || days > 365
entries = TimeEntry.
where("#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", User.current.id, User.current.today - (days - 1), User.current.today).
Jean-Philippe Lang
Fixed that spent time on my page does not include entries without issue (#19320)....
r13689 joins(:activity, :project).
references(:issue => [:tracker, :status]).
includes(:issue => [:tracker, :status]).
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 order("#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC").
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 to_a
Jean-Philippe Lang
My page - Spent time: configurable number of days to display (#8761)....
r15560
return entries, days
Jean-Philippe Lang
Adds helpers for retrieving my page data....
r10695 end
Jean-Philippe Lang
- new controller "myController"...
r60 end