-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
106 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class CtrlController < ApplicationController | ||
def index | ||
@toto = "22" | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module CtrlHelper | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h2>goi2</h2> | ||
<%= @toto %> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# English strings go here for Rails i18n | ||
en: | ||
# my_label: "My label" | ||
depth_filter: "Depth" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# French strings go here for Rails i18n | ||
fr: | ||
# my_label: "My label" | ||
depth_filter: "Profondeur" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# Plugin's routes | ||
# See: http://guides.rubyonrails.org/routing.html | ||
get 'plan', to: 'plan#index' | ||
get 'plan/:id/new', to: 'plan#new' | ||
get 'issues/:id/plan', to: 'plan#show', as: 'edit_plan' | ||
get 'issues/:id/plan/new', to: 'plan#subtask', as: 'subtask' | ||
get 'actionplan', :to => 'ctrl#index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
#require_dependency 'issue_patch' | ||
require_dependency 'actionplan_hook_listener' | ||
require_dependency 'redmine_depth_issue_filter' | ||
|
||
Redmine::Plugin.register :plan do | ||
name 'Plan plugin' | ||
Redmine::Plugin.register :actionplan_redmine_plugin do | ||
name 'Actionplan Redmine Plugin' | ||
author 'Author name' | ||
description 'This is a plugin for Redmine' | ||
version '0.0.1' | ||
url 'http://example.com/path/to/plugin' | ||
author_url 'http://example.com/about' | ||
|
||
project_module :plan do | ||
permission :add_subtask, :subtask => :new | ||
end | ||
|
||
permission :plan, { :plan => [:index] }, :public => true | ||
menu :project_menu, :plan, { :controller => 'plan', :action => 'index' }, :caption => 'Plan' | ||
end | ||
|
||
#logger.debug "goi:init.rb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require 'byebug' | ||
|
||
class ActionplanHookListener < Redmine::Hook::ViewListener | ||
include IssuesHelper | ||
include RoutesHelper | ||
include ContextMenusHelper | ||
|
||
def view_issues_context_menu_start(context = {}) | ||
issue = context[:issues][0] | ||
attrs = { | ||
:parent_issue_id => issue | ||
} | ||
attrs[:tracker_id] = issue.tracker unless issue.tracker.disabled_core_fields.include?('parent_issue_id') | ||
# create subtask | ||
l1 = link_to("new subtask", new_project_issue_path(issue.project, :issue => attrs, :back_url => project_issues_path(issue.project))) | ||
# byebug | ||
# filter subtasks | ||
# TODO manage saved query | ||
current_filters = context[:request].session[:issue_query][:filters] | ||
query_params = url_filters current_filters | ||
l2 = context_menu_link("filter sustasks", _project_issues_path(@project, { :set_filter => 1, | ||
:f => query_params[:filter] << "parent_id", | ||
:op => query_params[:operator].merge({"parent_id" => "~"}), | ||
:v => query_params[:value].merge({"parent_id" => [issue.id.to_s]}), | ||
:sort => context[:request].session[:issue_query][:sort], | ||
:c => context[:request].session[:issue_query][:column_names], | ||
:group_by => context[:request].session[:issue_query][:group_by]})) | ||
# filter parent task | ||
# TODO manage no grand_parent | ||
direct_parent_id = issue.parent&.parent_id | ||
if direct_parent_id then | ||
l3 = context_menu_link("filter parent tasks", _project_issues_path(@project, { :set_filter => 1, | ||
:f => query_params[:filter] << "parent_id", | ||
:op => query_params[:operator].merge({"parent_id" => "~"}), | ||
:v => query_params[:value].merge({"parent_id" => [direct_parent_id.to_s]}), | ||
:sort => context[:request].session[:issue_query][:sort], | ||
:c => context[:request].session[:issue_query][:column_names], | ||
:group_by => context[:request].session[:issue_query][:group_by]})) | ||
else | ||
l3 = context_menu_link("filter parent tasks", _project_issues_path(@project, { :set_filter => 1, | ||
:f => query_params[:filter].without("parent_id"), | ||
:op => query_params[:operator].without("parent_id"), | ||
:v => query_params[:value].without("parent_id"), | ||
:sort => context[:request].session[:issue_query][:sort], | ||
:c => context[:request].session[:issue_query][:column_names], | ||
:group_by => context[:request].session[:issue_query][:group_by]})) | ||
end | ||
return "<li>" + l1 + "</li>" + | ||
"<li>" + l2 + "</li>" + | ||
"<li>" + l3 + "</li>" | ||
end | ||
|
||
def url_filters(filters_hash) | ||
result = { :filter => [], :operator => {}, :value => {}} | ||
filters_hash.each do |key, value| | ||
result[:filter] << key | ||
result[:operator].merge!({ key => value[:operator] }) | ||
result[:value].merge!({ key => value[:values] }) | ||
end | ||
result | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module RedmineDepthIssueFilter | ||
module PrependInstanceMethods | ||
def initialize_available_filters | ||
super | ||
add_available_filter "depth", :type => :integer, :label => :depth_filter | ||
end | ||
end | ||
|
||
module AddedInstanceMethods | ||
# Wrapper around the +available_filters+ to add a new Deliverable filter | ||
def sql_for_depth_field(field, operator, value) | ||
# TODO manage operator 'entre', 'aucun' et 'tous' | ||
"(select count(*) + 1 from issues as i2 where i2.lft < issues.lft and i2.rgt > issues.rgt) #{operator} #{value.first.to_i}" | ||
end | ||
|
||
end | ||
|
||
def self.included(base) # :nodoc: | ||
base.send(:include, AddedInstanceMethods) | ||
IssueQuery.prepend(PrependInstanceMethods) | ||
end | ||
end | ||
|
||
IssueQuery.send(:include, RedmineDepthIssueFilter) |
2 changes: 1 addition & 1 deletion
2
test/functional/plan_controller_test.rb → test/functional/ctrl_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.