diff --git a/app/controllers/ticket_time_controller.rb b/app/controllers/ticket_time_controller.rb deleted file mode 100644 index e69de29..0000000 diff --git a/init.rb b/init.rb index 211a3d5..4bb6ca1 100644 --- a/init.rb +++ b/init.rb @@ -1,4 +1,100 @@ -require_relative './lib/mega_calendar/filters.rb' +## SNIP - Filters +$mc_filters = {} +$mc_filters['assignee'] = { + :type => 'lookup', + :label => 'field_assigned_to', + :db_field => 'issues.assigned_to_id', + :db_field_holiday => 'holidays.user_id', + :lookup_id => 'id', + :operators => [:contains, :not_contains], + :lookup_value => 'name', + :lookup_query_model => 'Holiday', + :lookup_query_method => 'get_activated_users', + :lookup_query_order => nil, + :condition => nil, + :condition_holiday => nil +} +$mc_filters['assignee_group'] = { + :type => 'lookup', + :label => 'label_group', + :db_field => 'issues.assigned_to_id', + :db_field_holiday => 'holidays.user_id', + :lookup_id => 'id', + :operators => [:contains, :not_contains], + :lookup_value => 'lastname', + :lookup_query_model => 'Holiday', + :lookup_query_method => 'get_activated_groups', + :lookup_query_order => nil, + :condition => '##FIELD_ID## IN (SELECT user_id FROM groups_users WHERE group_id ##OPERATOR## (?)) OR ##FIELD_ID## ##OPERATOR## (?)', + :condition_holiday => '##FIELD_ID## IN (SELECT user_id FROM groups_users WHERE group_id ##OPERATOR## (?))' +} +$mc_filters['status'] = { + :type => 'lookup', + :label => 'label_issue_status', + :db_field => 'issues.status_id', + :lookup_id => 'id', + :operators => [:contains, :not_contains], + :lookup_value => 'name', + :lookup_query_model => 'IssueStatus', + :lookup_query_method => 'all', + :lookup_query_order => "issue_statuses.name ASC", + :condition => nil, + :condition_holiday => nil +} +$mc_filters['project'] = { + :type => 'lookup', + :label => 'label_project', + :db_field => 'issues.project_id', + :lookup_id => 'id', + :operators => [:contains, :not_contains], + :lookup_value => 'name', + :lookup_query_model => 'Project', + :lookup_query_method => 'all', + :lookup_query_order => "projects.name ASC", + :condition => nil, + :condition_holiday => nil +} +$mc_filters['tracker'] = { + :type => 'lookup', + :label => 'label_tracker', + :db_field => 'issues.tracker_id', + :lookup_id => 'id', + :operators => [:contains, :not_contains], + :lookup_value => 'name', + :lookup_query_model => 'Tracker', + :lookup_query_method => 'all', + :lookup_query_order => "trackers.name ASC", + :condition => nil, + :condition_holiday => nil +} +$mc_filters['priority'] = { + :type => 'lookup', + :label => 'field_priority', + :db_field => 'issues.priority_id', + :lookup_id => 'id', + :operators => [:contains, :not_contains], + :lookup_value => 'name', + :lookup_query_model => 'IssuePriority', + :lookup_query_method => 'all', + :lookup_query_order => nil, + :condition => nil, + :condition_holiday => nil +} +$mc_filters['version'] = { + :type => 'lookup', + :label => 'field_version', + :db_field => 'issues.fixed_version_id', + :lookup_id => 'id', + :operators => [:contains, :not_contains], + :lookup_value => 'name', + :lookup_query_model => 'Version', + :lookup_query_method => 'all', + :lookup_query_order => "versions.name ASC", + :condition => nil, + :condition_holiday => nil +} +## SNAP - Filters + require 'vpim' require_dependency Rails.root.join('plugins','mega_calendar','lib','mega_calendar','users_controller_patch') require_dependency Rails.root.join('plugins','mega_calendar','lib','mega_calendar','issues_controller_patch') @@ -7,7 +103,7 @@ name 'Mega Calendar plugin' author 'Andreas Treubert' description 'Better calendar for redmine' - version '1.9.0' + version '1.9.1' url 'https://github.com/berti92/mega_calendar' author_url 'https://github.com/berti92' requires_redmine :version_or_higher => '5.0.0' diff --git a/lib/mega_calendar/filters.rb b/lib/mega_calendar/filters.rb deleted file mode 100644 index 588fd72..0000000 --- a/lib/mega_calendar/filters.rb +++ /dev/null @@ -1,94 +0,0 @@ -$mc_filters = {} -$mc_filters['assignee'] = { - :type => 'lookup', - :label => 'field_assigned_to', - :db_field => 'issues.assigned_to_id', - :db_field_holiday => 'holidays.user_id', - :lookup_id => 'id', - :operators => [:contains, :not_contains], - :lookup_value => 'name', - :lookup_query_model => 'Holiday', - :lookup_query_method => 'get_activated_users', - :lookup_query_order => nil, - :condition => nil, - :condition_holiday => nil -} -$mc_filters['assignee_group'] = { - :type => 'lookup', - :label => 'label_group', - :db_field => 'issues.assigned_to_id', - :db_field_holiday => 'holidays.user_id', - :lookup_id => 'id', - :operators => [:contains, :not_contains], - :lookup_value => 'lastname', - :lookup_query_model => 'Holiday', - :lookup_query_method => 'get_activated_groups', - :lookup_query_order => nil, - :condition => '##FIELD_ID## IN (SELECT user_id FROM groups_users WHERE group_id ##OPERATOR## (?)) OR ##FIELD_ID## ##OPERATOR## (?)', - :condition_holiday => '##FIELD_ID## IN (SELECT user_id FROM groups_users WHERE group_id ##OPERATOR## (?))' -} -$mc_filters['status'] = { - :type => 'lookup', - :label => 'label_issue_status', - :db_field => 'issues.status_id', - :lookup_id => 'id', - :operators => [:contains, :not_contains], - :lookup_value => 'name', - :lookup_query_model => 'IssueStatus', - :lookup_query_method => 'all', - :lookup_query_order => "issue_statuses.name ASC", - :condition => nil, - :condition_holiday => nil -} -$mc_filters['project'] = { - :type => 'lookup', - :label => 'label_project', - :db_field => 'issues.project_id', - :lookup_id => 'id', - :operators => [:contains, :not_contains], - :lookup_value => 'name', - :lookup_query_model => 'Project', - :lookup_query_method => 'all', - :lookup_query_order => "projects.name ASC", - :condition => nil, - :condition_holiday => nil -} -$mc_filters['tracker'] = { - :type => 'lookup', - :label => 'label_tracker', - :db_field => 'issues.tracker_id', - :lookup_id => 'id', - :operators => [:contains, :not_contains], - :lookup_value => 'name', - :lookup_query_model => 'Tracker', - :lookup_query_method => 'all', - :lookup_query_order => "trackers.name ASC", - :condition => nil, - :condition_holiday => nil -} -$mc_filters['priority'] = { - :type => 'lookup', - :label => 'field_priority', - :db_field => 'issues.priority_id', - :lookup_id => 'id', - :operators => [:contains, :not_contains], - :lookup_value => 'name', - :lookup_query_model => 'IssuePriority', - :lookup_query_method => 'all', - :lookup_query_order => nil, - :condition => nil, - :condition_holiday => nil -} -$mc_filters['version'] = { - :type => 'lookup', - :label => 'field_version', - :db_field => 'issues.fixed_version_id', - :lookup_id => 'id', - :operators => [:contains, :not_contains], - :lookup_value => 'name', - :lookup_query_model => 'Version', - :lookup_query_method => 'all', - :lookup_query_order => "versions.name ASC", - :condition => nil, - :condition_holiday => nil -}