Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

redmine 4.2.1support #5

Closed
wants to merge 10 commits into from
Closed

redmine 4.2.1support #5

wants to merge 10 commits into from

Conversation

Jiangshan00001
Copy link

1 add redmine 4.2.1support
2 add doing now threshold_cnt in settings
3 fix an issue that someone could not see the top menu.

1 add redmine 4.2.0support
2 add doing now threshold_cnt in settings
3 fix an issue that someone could not see the top menu.
@Jiangshan00001
Copy link
Author

#4

1 fix time grid add time bug:
   contentmenu will not show more than once.

2 add zh.yml chinese support
…er drag.

FIX BUG: contextmenu could not return to the correct page after reorder drag.
next week prev week function bug fix
update jquery lib from 1.10.1 to 3.5.1
disable time select function in  time_grid because it could work properly (in chrome?)
Copy link
Member

@mwaddell mwaddell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jiangshan0001 Thank you for your PR, please see my comments. Let me know if you have questions.

@@ -2,7 +2,7 @@
class StuffToDoMailer < Mailer
add_template_helper(StuffToDoHelper)

default to: Setting.plugin_stuff_to_do_plugin['email_to'].split(',')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unrelated to the 5 changes noted in the README. It also makes this line inconsistent with the rest of this file where email addresses are split by comma. Please remove this change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you are right.
but just after the plugin installed, the email address is empty. so split will fail.
i'll change the code anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a valid point - a better way to fix this issue however, is:
default to: (Setting.plugin_stuff_to_do_plugin['email_to'] || "").split(',')

(or using the ternary operator, etc)

@@ -32,7 +32,7 @@ class StuffToDo < ApplicationRecord
where( user_id: user.id )
.order('position ASC')
.limit(self.count)
.offset(5)
.offset(Setting.plugin_stuff_to_do_plugin['threshold_cnt'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When first deploying this branch and no value is set yet, both panels display identical lists since the setting is set to Nil instead of 5

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i fix it.

Comment on lines -61 to +63
<%= javascript_include_tag 'jquery-1.10.1.js', plugin: 'stuff_to_do_plugin' %>
<%= javascript_include_tag 'jquery-ui.js', plugin: 'stuff_to_do_plugin' %>
<%= javascript_include_tag 'jquery-3.5.1.min.js', plugin: 'stuff_to_do_plugin' %>
<%= javascript_include_tag 'jquery-migrate-3.3.2.min.js', plugin: 'stuff_to_do_plugin' %>
<%= javascript_include_tag 'jquery-ui.min.js', plugin: 'stuff_to_do_plugin' %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jquery-3.5.1-ui-1.12.1-ujs-5.2.4.5.js (which includes jquery ui) and jquery-migrate-3.3.2.min.js are already imported to the header of all pages by redmine 4.2.1, so including these same exact versions again again for the plugin pages is unnecessary.

Comment on lines -46 to +51
menu(:top_menu, :stuff_to_do, { controller: 'stuff_to_do', action: 'index'}, caption: :stuff_to_do_title, if: Proc.new{
User.current.allowed_to?({ controller: 'stuff_to_do', action: 'index'}, nil, global: true) && !User.current.nil? && User.current.pref[:stuff_to_do_enabled]
})

menu(:top_menu, :stuff_to_do, { controller: 'stuff_to_do', action: 'index'}, caption: :stuff_to_do_title, if: Proc.new{!User.current.nil?})
#menu(:top_menu, :stuff_to_do, { controller: 'stuff_to_do', action: 'index'}, caption: :stuff_to_do_title, if: Proc.new{
# User.current.allowed_to?({ controller: 'stuff_to_do', action: 'index'}, nil, global: true) && !User.current.nil? && User.current.pref[:stuff_to_do_enabled]
#})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will show the StD menu for all users regardless of whether they have permission or even if the StD plugin is enabled. Please remove this change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I do not know how to set the permission.
I never get the top menu with the old code.

User.current.pref[:stuff_to_do_enabled] -- how to set?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Permissions are handled in Administration -> Roles and Permissions -- a new "Stuff To Do" section is added to the permissions for each role.

@@ -0,0 +1,1312 @@
/*! jQuery UI - v1.12.1 - 2021-10-10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is never actually used by StD

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually NONE of the jquery UI css files are ever used

Comment on lines -225 to +244
$("#time-grid-table tr td.time-grid-date").
contextMenu(

$.contextMenu(
{
menu: 'time-grid-menu',
menuCssName: 'context-menu'
},
function(action, el, pos) {
timeLogFacebox(parseIssueId(el.parent()),
parseDateFromGrid(el));
selector:"#time-grid-table tr td.time-grid-date",
callback:function(key,options) {
var el = options.$trigger;
timeLogFacebox(parseIssueId(el.parent()),
parseDateFromGrid(el));
},
items:{firstCommand: {name: $("#log-time").text() }}
}

);

$("#time-grid-table tr td.time-grid-date").hover(function(){
$(this).css("background-color","yellow");
},function(){
$(this).css("background-color","white");
});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting the following client-side error when using this:

stuff-to-do.js?1633982868:200 Uncaught TypeError: Cannot read properties of undefined (reading 'split')
    at parseIssueId (stuff-to-do.js?1633982868:200)
    at s.fn.init.callback (stuff-to-do.js?1633982868:231)
    at HTMLLIElement.itemClick (jquery.contextMenu.js?1633982868:894)
    at HTMLDocument.dispatch (jquery-3.5.1.min.js?1633982868:2)
    at HTMLDocument.v.handle (jquery-3.5.1.min.js?1633982868:2)

Is there a conflict between the jquery.contextMenu plugin and Redmine 4.2.1's own custom contextMenu handler

@mwaddell
Copy link
Member

mwaddell commented Oct 12, 2021

1 add redmine 4.2.1support

The current version already supports redmine 4.2.1 - I suspect your deployment has multiple plugins that are conflicting with one another. When I deployed your branch in my test environment (see #4 (comment)), I got no bundler issues.

It is also not possible (currently) to upgrade jQuery since facebox.js and jquery.contextmenu rely on the older version. I created a separate issue for addressing this (PR #6).

2 add doing now threshold_cnt in settings

I would merge this new feature as a separate PR, the only thing it's missing is to better handle the case where the setting is still Nil

3 fix an issue that someone could not see the top menu.

Your fix enables the top menu for everyone even if they should not see it.

Visibility for the StD plugin is managed by ROLE-based permissions. Go into your administration page and give the roles that should have access to StD those permissions:

image

Comment on lines 1 to 48
en:
stuff_to_do_title: "待办事项"
stuff_to_do_what_im_doing_now: "进行中"
stuff_to_do_what_is_recommended: "即将进行"
stuff_to_do_what_is_available: "可进行"
stuff_to_do_text_order_im_doing_it: "做事情的顺序"
stuff_to_do_text_by_project_manager: "通过项目管理者"
stuff_to_do_label_view_user_list: "查看另一个用户的列表:"
stuff_to_do_text_total_progress: "总进度"
stuff_to_do_text_total_estimates: "总估计"
stuff_to_do_label_project_manager_emails: "项目管理者email"
stuff_to_do_label_threshold: "门限"
stuff_to_do_label_threshold_cnt: "待办事项最大数"
stuff_to_do_doing_now_threshold_cnt_setting: "设置进行中的事情的最大个数"
stuff_to_do_label_email_to: "Email 地址"
stuff_to_do_text_settings: "当用户的即将进行项目少于指定数时,会发送邮件到项目管理者. 多个邮件可以通过逗号分隔."
stuff_to_do_label_filter: "过滤"
stuff_to_do_label_filter_by: "通过 ...过滤"
stuff_to_do_drag_issue_create_list: "将问题拖动到这里来创建一个新的列表."
stuff_to_do_drag_issue_remove_list: "将问题拖动到这里来从一个列表移除."
stuff_to_do_use_as_stuff_to_do: "可用作代办事项的项"
stuff_to_do_statuses_available: "可以用于代办事项的状态"
stuff_to_do_time_grid: "时间表格"
stuff_to_do_time_grid_save_error: "{{count}} 时间项不能保存."
stuff_to_do_time_grid_save_notice: "{{count}} 时间项保存成功."
stuff_to_do_time_grid_daily_totals: "每日统计"
stuff_to_do_time_grid_running_total: "所有统计"
stuff_to_do_use_time_grid: "使用时间网格"
stuff_to_do_below_threshold: "%{user} 只有 %{count} 待办事项剩余,低于门限: %{threshold}."
field_stuff_to_do_enabled: "使能待办事项"
stuff_to_do_add_to_front: "添加到前面"
stuff_to_do_add_to_back: "添加到后面"
stuff_to_do_remove: "移除"
stuff_to_do_reportee: "汇报者"
stuff_to_do_reportees: "汇报者"
stuff_to_do_reportees_for: "Reportees for: "
stuff_to_do_cannot_create_reportee_error: "Cannot add reportee"
stuff_to_do_manage_reportees: "Manage Reportees"
stuff_to_do_reportee_new: "New Reportees"
stuff_to_do_issue_unathorized: "Not authorized to view this issue."
stuff_to_do_project_unathorized: "未授权访问此项目."
stuff_to_do_title_user: "%{user} 的 待办事项"
stuff_to_do_clear_confirm: "确认清空所有代办事项?"
permission_view_stuff_to_do: "使用 代办 列表"
permission_view_others_stuff_to_do: "改变其他人的 代办 列表"
permission_manage_stuff_to_do_reportees: "Manage own reportees"
permission_view_all_reportee_issues: "See all available issues of reportees"
permission_view_all_reportee_stuff_to_do: "See all issues of reportees with name"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled out into a separate PR #7

@mwaddell
Copy link
Member

This PR contains too many distinct, partially-implemented things to be merged as-is:

Please do the following:

  • Split out the threshold_cnt functionality into a separate PR where you can address the Nil issue
  • Make this PR contain only your changes to the following files:
    • app/models/stuff_to_do_mailer.rb (but addressing the Nil issue using || (or a ternary operator, etc))
    • app/views/stuff_to_do/_time_grid.html.erb
    • app/views/stuff_to_do/_panes.html.erb (add details about how to trigger this error for testing)

The rest of the changes from this PR will be addressed more completely in issue #6

@mwaddell
Copy link
Member

Replaced by PR #9

@mwaddell mwaddell closed this Oct 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants