-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from centosadmin/develop
Release 0.3.0
- Loading branch information
Showing
8 changed files
with
55 additions
and
8 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
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,5 @@ | ||
<%= issue_fields_rows do |rows| | ||
<% if issue.open_date %> | ||
<%= issue_fields_rows do |rows| | ||
rows.right l(:field_open_date), format_time(issue.open_date), :class => 'due-date' | ||
end %> | ||
end %> | ||
<% end %> |
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,19 @@ | ||
<% if @projects.all? { |project| User.current.allowed_to?(:edit_issues, project) } && | ||
Setting.plugin_redmine_issue_open_date['freezed_statuses'].include?(@issue_params[:status_id]) %> | ||
<style type="text/css"> | ||
#open_date_area select { | ||
width: auto; | ||
} | ||
</style> | ||
|
||
<p id="open_date_area"> | ||
<%= label_tag t('field_open_date') %> | ||
<span style="display: inline-block;"> | ||
<%= date_select :issue, :open_date, default: User.current.issue_open_time , minute_step: 5 %> | ||
</span> | ||
<span style="display: inline-block;"> | ||
<%= time_select :issue, :open_date, default: User.current.issue_open_time , minute_step: 5, ignore_date: true %> | ||
</span> | ||
</p> | ||
|
||
<% end %> |
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 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 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 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 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,13 +1,27 @@ | ||
class IssueOpenDateHookListener < Redmine::Hook::ViewListener | ||
render_on :view_issues_form_details_bottom, partial: 'issues/open_date_field' | ||
render_on :view_issues_bulk_edit_details_bottom, partial: 'issues/open_date_field_bulk' | ||
render_on :view_issues_show_details_bottom, partial: 'issues/open_date' | ||
render_on :view_my_account, partial: 'my/open_date' | ||
|
||
def controller_issues_edit_before_save(context = {}) | ||
return unless User.current.allowed_to?(:edit_issues, context[:issue].project) | ||
assign_issue_attributes(context) | ||
end | ||
|
||
def controller_issues_bulk_edit_before_save(context = {}) | ||
assign_issue_attributes(context) | ||
end | ||
|
||
def controller_issues_new_before_save(context = {}) | ||
assign_issue_attributes(context) | ||
end | ||
|
||
private | ||
|
||
def assign_issue_attributes(context) | ||
params, issue = context[:params].to_unsafe_h, context[:issue] | ||
Time.use_zone(User.current.time_zone || Time.now.localtime.utc_offset / 3600) do | ||
context[:issue].assign_attributes(context[:params][:issue].slice(*(1..5).map { |i| "open_date(#{i}i)" })) | ||
issue.assign_attributes(params[:issue].slice(*(1..5).map { |i| "open_date(#{i}i)" })) | ||
end | ||
end | ||
end |