diff --git a/assets/javascripts/hot_buttons.js b/assets/javascripts/hot_buttons.js index 03b4f86..e439bba 100755 --- a/assets/javascripts/hot_buttons.js +++ b/assets/javascripts/hot_buttons.js @@ -580,7 +580,7 @@ jQuery(document).ready(function() { var include_comment = button.config.get('include_comment').evalJSON(); if (include_comment) { //Fix to make this plugin compatible with CKEditor plugin - if (CKEDITOR && CKEDITOR.instances["issue_notes"]) { + if (typeof CKEDITOR != "undefined" && CKEDITOR && CKEDITOR.instances["issue_notes"]) { //destroy CKEDITOR so it won't replace notes text with his empty value on submit try { CKEDITOR.instances["issue_notes"].destroy() diff --git a/init.rb b/init.rb index 3142c4c..5cd5767 100644 --- a/init.rb +++ b/init.rb @@ -7,11 +7,6 @@ object_to_prepare = Rails.configuration end -object_to_prepare.to_prepare do - require File.dirname(__FILE__) + '/lib/issues_controller_patch.rb' - IssuesController.send(:include, IssueHotButtons::IssuesControllerPatch) -end - class Hooks < Redmine::Hook::ViewListener render_on :view_issues_show_details_bottom, :partial => 'hot_buttons/assets', diff --git a/lib/issues_controller_patch.rb b/lib/issues_controller_patch.rb deleted file mode 100644 index 7acc504..0000000 --- a/lib/issues_controller_patch.rb +++ /dev/null @@ -1,48 +0,0 @@ -module IssueHotButtons - module IssuesControllerPatch - - def self.included(base) - base.send(:helper, :sort) - base.send(:include, SortHelper) - base.send(:include, InstanceMethods) - base.class_eval do - before_filter :nearby_issues, :only => :show - before_filter :store_last_seen_project, :only => :index - end - end - - module InstanceMethods - def nearby_issues - restore_project = nil - unless session[:last_seen_project].nil? - last_seen_project = Project.find(session[:last_seen_project]) - if @project.self_and_ancestors.include? last_seen_project - restore_project = @project - @project = last_seen_project - end - end - - session['issues_show_sort'] = session['issues_index_sort'] unless session['issues_index_sort'].nil? - retrieve_query - sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) - sort_update(@query.sortable_columns) - - @nearby_issues = []; - if @query.valid? - @issues = @query.issues( - :include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => sort_clause - ) - @issues.uniq! - @issues.each {|issue| @nearby_issues.push issue.id} - end - - @project = restore_project unless restore_project.nil? - end - - def store_last_seen_project - session[:last_seen_project] = @project.id unless @project.nil? - end - end - end -end \ No newline at end of file