eac_redmine_usability 0.3.5 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/eac_redmine_usability/issue_done_ratio_alternative_input.js +99 -0
- data/app/assets/javascripts/eac_redmine_usability.js +1 -0
- data/app/assets/stylesheets/eac_redmine_usability/issue_done_ratio_alternative_input.css +8 -0
- data/app/assets/stylesheets/eac_redmine_usability.css +1 -0
- data/config/initializers/002_hooks.rb +3 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/pt-BR.yml +2 -0
- data/lib/eac_redmine_usability/hooks/done_ratio_alternative_input.rb +65 -0
- data/lib/eac_redmine_usability/version.rb +1 -1
- data/lib/tasks/eac_redmine_usability.rake +2 -11
- metadata +14 -13
- data/config/initializers/000_dependencies.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 576f3ab9afa3613ef8262939ffcc8c79802b612f64a7033932b1dd361cc3adc4
|
4
|
+
data.tar.gz: ec6870572847a67ac1a5565f076023f048cf841fa012befe17911e9bc9d01537
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0b0bf3175a2fd2b74bada1ddc983932c1745e2a3a0656c09d056e4b58ba0bde716a9bd25130c17ec8bafddbe12f891632cc15441e06ca5d77a7bfb37705c7fc
|
7
|
+
data.tar.gz: f4b9c7d23c943307d730d5187d579d6502d961b2bf25b11a431021c10c70e4696b78077df38753c93b1961b6cf45e17f6e0722b82d05aa5d2dd706c38c559355
|
@@ -0,0 +1,99 @@
|
|
1
|
+
class IssueDoneRatioAlternativeInput {
|
2
|
+
constructor(originalInputId, alternativeInputId, changerControlId, hiddenContentId) {
|
3
|
+
this.originalInputId = originalInputId;
|
4
|
+
this.alternativeInputId = alternativeInputId;
|
5
|
+
this.changerControlId = changerControlId;
|
6
|
+
this.hiddenContentId = hiddenContentId;
|
7
|
+
this.initialValue = this.alternativeInput().value;
|
8
|
+
this.originalInputSelected = true
|
9
|
+
}
|
10
|
+
|
11
|
+
alternativeInput() {
|
12
|
+
return $('#' + this.alternativeInputId);
|
13
|
+
}
|
14
|
+
|
15
|
+
changeInput() {
|
16
|
+
if (this.originalInputSelected) {
|
17
|
+
this.useAlternativeInput();
|
18
|
+
} else {
|
19
|
+
this.useOriginalInput();
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
changerControl() {
|
24
|
+
return $('#' + this.changerControlId);
|
25
|
+
}
|
26
|
+
|
27
|
+
hiddenContent() {
|
28
|
+
return $('#' + this.hiddenContentId);
|
29
|
+
}
|
30
|
+
|
31
|
+
init() {
|
32
|
+
if (this.originalInput().length > 0) {
|
33
|
+
this.initOriginalInput();
|
34
|
+
this.initAlternativeInput();
|
35
|
+
this.initChangerControl();
|
36
|
+
this.initContent();
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
initAlternativeInput() {
|
41
|
+
var THIS = this;
|
42
|
+
this.alternativeInput().change(function() {
|
43
|
+
THIS.onAlternativeValueChanged();
|
44
|
+
});
|
45
|
+
this.alternativeInput().attr('name', this.originalInput().attr('name'));
|
46
|
+
}
|
47
|
+
|
48
|
+
initChangerControl() {
|
49
|
+
var THIS = this;
|
50
|
+
this.changerControl().insertAfter(this.originalInput());
|
51
|
+
this.changerControl().click(function() {
|
52
|
+
THIS.changeInput();
|
53
|
+
return false;
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
initOriginalInput() {
|
58
|
+
var THIS = this;
|
59
|
+
this.onAlternativeValueChanged()
|
60
|
+
this.originalInput().change(function() {
|
61
|
+
THIS.onOriginalValueChanged();
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
initContent() {
|
66
|
+
$('body').append(this.hiddenContent());
|
67
|
+
if (this.originalInput().val() != this.alternativeInput().val()) {
|
68
|
+
this.useAlternativeInput();
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
onAlternativeValueChanged() {
|
73
|
+
this.originalInput().val(Math.round(this.alternativeInput().val() / 10) * 10);
|
74
|
+
}
|
75
|
+
|
76
|
+
onOriginalValueChanged() {
|
77
|
+
this.alternativeInput().val(this.originalInput().val());
|
78
|
+
}
|
79
|
+
|
80
|
+
originalInput() {
|
81
|
+
return $('#' + this.originalInputId);
|
82
|
+
}
|
83
|
+
|
84
|
+
useAlternativeInput() {
|
85
|
+
if (this.originalInputSelected) {
|
86
|
+
this.alternativeInput().insertBefore(this.changerControl());
|
87
|
+
this.originalInput().appendTo(this.hiddenContent());
|
88
|
+
this.originalInputSelected = false;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
useOriginalInput() {
|
93
|
+
if (!this.originalInputSelected) {
|
94
|
+
this.originalInput().insertBefore(this.changerControl());
|
95
|
+
this.alternativeInput().appendTo(this.hiddenContent());
|
96
|
+
this.originalInputSelected = true;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require eac_redmine_usability/issue_done_ratio_alternative_input
|
@@ -0,0 +1 @@
|
|
1
|
+
@import 'eac_redmine_usability/issue_done_ratio_alternative_input';
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRedmineUsability
|
4
|
+
module Hooks
|
5
|
+
class DoneRatioAlternativeInput < ::Redmine::Hook::ViewListener
|
6
|
+
attr_accessor :output_buffer
|
7
|
+
|
8
|
+
ORIGINAL_INPUT_ID = 'issue_done_ratio'
|
9
|
+
ALTERNATIVE_INPUT_ID = ORIGINAL_INPUT_ID + '_alternative'
|
10
|
+
CHANGER_CONTROL_ID = ORIGINAL_INPUT_ID + '_changer'
|
11
|
+
HIDDEN_CONTENT_ID = ORIGINAL_INPUT_ID + '_hidden_content'
|
12
|
+
ELEMENTS_IDS = [ORIGINAL_INPUT_ID, ALTERNATIVE_INPUT_ID, CHANGER_CONTROL_ID,
|
13
|
+
HIDDEN_CONTENT_ID].freeze
|
14
|
+
|
15
|
+
MINIMUM_VALUE = 0
|
16
|
+
MAXIMUM_VALUE = 100
|
17
|
+
|
18
|
+
# @param context [Hash]
|
19
|
+
# return [ActiveSupport::SafeBuffer]
|
20
|
+
def view_issues_form_details_bottom(context = {})
|
21
|
+
safe_join([hidden_content(context[:issue]), script_tag])
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# return [ActiveSupport::SafeBuffer]
|
27
|
+
def alternative_input(issue)
|
28
|
+
tag(:input, id: ALTERNATIVE_INPUT_ID, type: 'number', value: issue.done_ratio,
|
29
|
+
min: MINIMUM_VALUE, max: MAXIMUM_VALUE)
|
30
|
+
end
|
31
|
+
|
32
|
+
# return [ActiveSupport::SafeBuffer]
|
33
|
+
def changer_control
|
34
|
+
link_to('', '#', id: CHANGER_CONTROL_ID, class: 'icon icon-move',
|
35
|
+
title: I18n.t('issue_done_ratio_change_control'))
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
def elements_ids_argument_list
|
40
|
+
ELEMENTS_IDS.map { |id| "'#{id}'" }.join(', ')
|
41
|
+
end
|
42
|
+
|
43
|
+
# return [ActiveSupport::SafeBuffer]
|
44
|
+
def hidden_content(issue)
|
45
|
+
tag.div(id: HIDDEN_CONTENT_ID, style: 'display: none;') do
|
46
|
+
safe_join([alternative_input(issue), changer_control])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# return [String]
|
51
|
+
def script_content
|
52
|
+
<<~SCRIPT
|
53
|
+
$(document).ready(function() {
|
54
|
+
(new IssueDoneRatioAlternativeInput(#{elements_ids_argument_list})).init();
|
55
|
+
});
|
56
|
+
SCRIPT
|
57
|
+
end
|
58
|
+
|
59
|
+
# return [ActiveSupport::SafeBuffer]
|
60
|
+
def script_tag
|
61
|
+
javascript_tag script_content
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -1,18 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'redmine_plugins_helper/test_tasks/auto'
|
4
|
+
RedminePluginsHelper::TestTasks::Auto.register(:eac_redmine_usability)
|
4
5
|
|
5
6
|
namespace :eac_redmine_usability do
|
6
|
-
Rake::TestTask.new(test: 'db:test:prepare') do |t|
|
7
|
-
plugin_root = ::File.dirname(::File.dirname(__dir__))
|
8
|
-
|
9
|
-
t.description = 'Run plugin eac_redmine_usability\'s tests.'
|
10
|
-
t.libs << 'test'
|
11
|
-
t.test_files = FileList["#{plugin_root}/test/**/*_test.rb"]
|
12
|
-
t.verbose = false
|
13
|
-
t.warning = false
|
14
|
-
end
|
15
|
-
|
16
7
|
desc 'Close projects no longer used.'
|
17
8
|
task :close_unused_projects, %i[expire_days confirm] => :environment do |_t, args|
|
18
9
|
::EacRedmineUsability::CloseUnusedProjects.new(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_redmine_usability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Henrique Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -16,45 +16,46 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.95.1
|
19
|
+
version: '0.121'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.95.1
|
26
|
+
version: '0.121'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: eac_ruby_gem_support
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
33
|
+
version: 0.6.0
|
40
34
|
type: :development
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
40
|
+
version: 0.6.0
|
47
41
|
description:
|
48
42
|
email:
|
49
43
|
executables: []
|
50
44
|
extensions: []
|
51
45
|
extra_rdoc_files: []
|
52
46
|
files:
|
53
|
-
-
|
47
|
+
- app/assets/javascripts/eac_redmine_usability.js
|
48
|
+
- app/assets/javascripts/eac_redmine_usability/issue_done_ratio_alternative_input.js
|
49
|
+
- app/assets/stylesheets/eac_redmine_usability.css
|
50
|
+
- app/assets/stylesheets/eac_redmine_usability/issue_done_ratio_alternative_input.css
|
54
51
|
- config/initializers/001_patches.rb
|
52
|
+
- config/initializers/002_hooks.rb
|
53
|
+
- config/locales/en.yml
|
54
|
+
- config/locales/pt-BR.yml
|
55
55
|
- init.rb
|
56
56
|
- lib/eac_redmine_usability/close_unused_projects.rb
|
57
57
|
- lib/eac_redmine_usability/close_unused_projects/project_check.rb
|
58
|
+
- lib/eac_redmine_usability/hooks/done_ratio_alternative_input.rb
|
58
59
|
- lib/eac_redmine_usability/patches/test_case.rb
|
59
60
|
- lib/eac_redmine_usability/undeletable.rb
|
60
61
|
- lib/eac_redmine_usability/version.rb
|