Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/helpers/issue_meetings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ def week_days
end

end

unless IssuesController.included_modules.include?(IssueMeetingsHelper)
IssuesController.send(:helper, :issue_meetings)
IssuesController.send(:include, IssueMeetingsHelper)
end
4 changes: 4 additions & 0 deletions db/migrate/003_fix_issue_due_date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ def self.up
end

end

unless Issue.included_modules.include?(Patches::ThatMeetingIssuePatch)
Issue.send(:include, Patches::ThatMeetingIssuePatch)
end
52 changes: 3 additions & 49 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,61 +1,15 @@
require 'redmine'

require_dependency 'hooks/that_meeting_hook'
Rails.configuration.to_prepare do
require_dependency 'that_meeting_hook'
end

Rails.logger.info 'Starting That Meeting plugin for Redmine'

IssueQuery.add_available_column(QueryColumn.new(:formatted_start_time, :caption => :field_start_time))
IssueQuery.add_available_column(QueryColumn.new(:formatted_end_time, :caption => :field_end_time))
IssueQuery.add_available_column(QueryColumn.new(:recurrence))

Rails.configuration.to_prepare do
unless IssuesController.included_modules.include?(IssueMeetingsHelper)
IssuesController.send(:helper, :issue_meetings)
IssuesController.send(:include, IssueMeetingsHelper)
end
unless IssuesController.included_modules.include?(Patches::ThatMeetingIssuesControllerPatch)
IssuesController.send(:include, Patches::ThatMeetingIssuesControllerPatch)
end
unless CalendarsController.included_modules.include?(Patches::ThatMeetingCalendarsControllerPatch)
CalendarsController.send(:include, Patches::ThatMeetingCalendarsControllerPatch)
end
unless ActionView::Base.included_modules.include?(I18n::TimeFormatter)
ActionView::Base.send(:include, I18n::TimeFormatter)
end
unless ApplicationHelper.included_modules.include?(Patches::ThatMeetingApplicationHelperPatch)
ApplicationHelper.send(:include, Patches::ThatMeetingApplicationHelperPatch)
end
unless IssuesHelper.included_modules.include?(Patches::ThatMeetingIssuesHelperPatch)
IssuesHelper.send(:include, Patches::ThatMeetingIssuesHelperPatch)
end
unless WatchersHelper.included_modules.include?(Patches::ThatMeetingWatchersHelperPatch)
WatchersHelper.send(:include, Patches::ThatMeetingWatchersHelperPatch)
end
unless MyHelper.included_modules.include?(Patches::ThatMeetingMyHelperPatch)
MyHelper.send(:include, Patches::ThatMeetingMyHelperPatch)
end
unless Redmine::Helpers::Calendar.included_modules.include?(Patches::ThatMeetingCalendarPatch)
Redmine::Helpers::Calendar.send(:include, Patches::ThatMeetingCalendarPatch)
end
unless Issue.included_modules.include?(Patches::ThatMeetingIssuePatch)
Issue.send(:include, Patches::ThatMeetingIssuePatch)
end
unless Journal.included_modules.include?(Patches::ThatMeetingJournalPatch)
Journal.send(:include, Patches::ThatMeetingJournalPatch)
end
unless JournalDetail.included_modules.include?(Patches::ThatMeetingJournalDetailPatch)
JournalDetail.send(:include, Patches::ThatMeetingJournalDetailPatch)
end
unless Watcher.included_modules.include?(Patches::ThatMeetingWatcherPatch)
Watcher.send(:include, Patches::ThatMeetingWatcherPatch)
end
unless Mailer.included_modules.include?(Patches::ThatMeetingMailerPatch)
Mailer.send(:include, Patches::ThatMeetingMailerPatch)
end
unless MailHandler.included_modules.include?(Patches::ThatMeetingMailHandlerPatch)
MailHandler.send(:include, Patches::ThatMeetingMailHandlerPatch)
end
end

Redmine::Plugin.register :that_meeting do
name 'That Meeting'
Expand Down
7 changes: 6 additions & 1 deletion lib/i18n/time_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ def format_time_with_timezone(time, include_date = true, user = User.current)
timezone_format = Setting.plugin_that_meeting['timezone_format'] || '%Z'
time = time.to_time if time.is_a?(String)
local = user && user.time_zone ? time.in_time_zone(user.time_zone) : (time.utc? ? time.localtime : time)
(include_date ? "#{format_date(local)} " : '') + I18n.l(local, options) + I18n.l(local, :format => " #{timezone_format}")
(include_date ? "#{format_date(local)} " : '') + I18n.l(local, **options) + I18n.l(local, :format => " #{timezone_format}")
end

end
end


unless ActionView::Base.included_modules.include?(I18n::TimeFormatter)
ActionView::Base.send(:include, I18n::TimeFormatter)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_application_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ def context_menu_with_meetings

end
end

unless ApplicationHelper.included_modules.include?(Patches::ThatMeetingApplicationHelperPatch)
ApplicationHelper.send(:include, Patches::ThatMeetingApplicationHelperPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_calendar_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ def events_on_with_meetings(day)

end
end

unless Redmine::Helpers::Calendar.included_modules.include?(Patches::ThatMeetingCalendarPatch)
Redmine::Helpers::Calendar.send(:include, Patches::ThatMeetingCalendarPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_calendars_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ def show_with_meetings

end
end

unless CalendarsController.included_modules.include?(Patches::ThatMeetingCalendarsControllerPatch)
CalendarsController.send(:include, Patches::ThatMeetingCalendarsControllerPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_issue_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,7 @@ def update_meeting_due_date

end
end

unless Issue.included_modules.include?(Patches::ThatMeetingIssuePatch)
Issue.send(:include, Patches::ThatMeetingIssuePatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_issues_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ def show_with_ics

end
end

unless IssuesController.included_modules.include?(Patches::ThatMeetingIssuesControllerPatch)
IssuesController.send(:include, Patches::ThatMeetingIssuesControllerPatch)
end
30 changes: 11 additions & 19 deletions lib/patches/that_meeting_issues_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,13 @@ module Patches
module ThatMeetingIssuesHelperPatch

def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable

alias_method :render_issue_tooltip_without_meeting, :render_issue_tooltip
alias_method :render_issue_tooltip, :render_issue_tooltip_with_meeting

alias_method :email_issue_attributes_without_meeting, :email_issue_attributes
alias_method :email_issue_attributes, :email_issue_attributes_with_meeting

alias_method :show_detail_without_meeting, :show_detail
alias_method :show_detail, :show_detail_with_meeting
end
base.prepend(InstanceMethods)
end

module InstanceMethods

def render_issue_tooltip_with_meeting(issue)
tooltip = render_issue_tooltip_without_meeting(issue)
def render_issue_tooltip(issue)
tooltip = super(issue)
if issue.meeting?
@cached_label_occurrence ||= l(:label_occurrence)
@cached_label_date ||= l(:label_date)
Expand All @@ -46,8 +34,8 @@ def render_issue_tooltip_with_meeting(issue)
tooltip.html_safe
end

def email_issue_attributes_with_meeting(issue, user, html)
items = email_issue_attributes_without_meeting(issue, user, html)
def email_issue_attributes(issue, user, html)
items = super(issue, user, html)
%w(start_date start_time end_time recurrence).reverse.each do |attribute|
if value = issue.send(attribute)
case value
Expand All @@ -69,19 +57,23 @@ def email_issue_attributes_with_meeting(issue, user, html)
items
end

def show_detail_with_meeting(detail, no_html = false, options = {})
def show_detail(detail, no_html = false, options = {})
if detail.property == 'attendee'
if detail.value
l("label_meeting_status_#{detail.value.downcase}")
else
l(detail.prop_key.empty? ? :label_meeting_status_all_reset : :label_meeting_status_none)
end
else
show_detail_without_meeting(controller.is_a?(Mailer) ? detail.dup : detail, no_html, options)
super(controller.is_a?(Mailer) ? detail.dup : detail, no_html, options)
end
end

end

end
end

unless IssuesHelper.included_modules.include?(Patches::ThatMeetingIssuesHelperPatch)
IssuesHelper.send(:include, Patches::ThatMeetingIssuesHelperPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_journal_detail_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ def normalize_with_meeting(arg)

end
end

unless JournalDetail.included_modules.include?(Patches::ThatMeetingJournalDetailPatch)
JournalDetail.send(:include, Patches::ThatMeetingJournalDetailPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_journal_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ def send_notification_with_reply

end
end

unless Journal.included_modules.include?(Patches::ThatMeetingJournalPatch)
Journal.send(:include, Patches::ThatMeetingJournalPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_mail_handler_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ def target_meeting(event)

end
end

unless MailHandler.included_modules.include?(Patches::ThatMeetingMailHandlerPatch)
MailHandler.send(:include, Patches::ThatMeetingMailHandlerPatch)
end
5 changes: 5 additions & 0 deletions lib/patches/that_meeting_mailer_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,8 @@ def meeting_attribute_changed?(journal)

end
end


unless Mailer.included_modules.include?(Patches::ThatMeetingMailerPatch)
Mailer.send(:include, Patches::ThatMeetingMailerPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_my_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ def render_calendar_block_with_meetings(block, settings)

end
end

unless MyHelper.included_modules.include?(Patches::ThatMeetingMyHelperPatch)
MyHelper.send(:include, Patches::ThatMeetingMyHelperPatch)
end
4 changes: 4 additions & 0 deletions lib/patches/that_meeting_watcher_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ def send_meeting_invitation

end
end

unless Watcher.included_modules.include?(Patches::ThatMeetingWatcherPatch)
Watcher.send(:include, Patches::ThatMeetingWatcherPatch)
end
16 changes: 7 additions & 9 deletions lib/patches/that_meeting_watchers_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ module Patches
module ThatMeetingWatchersHelperPatch

def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable

alias_method :watchers_list_without_meeting, :watchers_list
alias_method :watchers_list, :watchers_list_with_meeting
end
base.prepend(InstanceMethods)
end

module InstanceMethods

def watchers_list_with_meeting(object)
content = watchers_list_without_meeting(object)
def watchers_list(object)
content = super(object)
if object.is_a?(Issue) && object.meeting?
js = "$('#watchers h3').text('#{j l(:label_attendees)} (#{object.watcher_users.size})');"
js << "$('#watchers ul.watchers').addClass('attendees');"
Expand All @@ -34,3 +28,7 @@ def watchers_list_with_meeting(object)

end
end

unless WatchersHelper.included_modules.include?(Patches::ThatMeetingWatchersHelperPatch)
WatchersHelper.send(:include, Patches::ThatMeetingWatchersHelperPatch)
end