@@ -1,83 +1,83 | |||||
1 | <%= labelled_fields_for :issue, @issue do |f| %> |
|
1 | <%= labelled_fields_for :issue, @issue do |f| %> | |
2 |
|
2 | |||
3 | <div class="splitcontent"> |
|
3 | <div class="splitcontent"> | |
4 | <div class="splitcontentleft"> |
|
4 | <div class="splitcontentleft"> | |
5 | <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> |
|
5 | <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> | |
6 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true}, |
|
6 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true}, | |
7 | :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p> |
|
7 | :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p> | |
8 | <%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %> |
|
8 | <%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %> | |
9 | <% else %> |
|
9 | <% else %> | |
10 | <p><label><%= l(:field_status) %></label> <%= @issue.status %></p> |
|
10 | <p><label><%= l(:field_status) %></label> <%= @issue.status %></p> | |
11 | <% end %> |
|
11 | <% end %> | |
12 |
|
12 | |||
13 | <% if @issue.safe_attribute? 'priority_id' %> |
|
13 | <% if @issue.safe_attribute? 'priority_id' %> | |
14 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true} %></p> |
|
14 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true} %></p> | |
15 | <% end %> |
|
15 | <% end %> | |
16 |
|
16 | |||
17 | <% if @issue.safe_attribute? 'assigned_to_id' %> |
|
17 | <% if @issue.safe_attribute? 'assigned_to_id' %> | |
18 | <p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %></p> |
|
18 | <p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %></p> | |
19 | <% end %> |
|
19 | <% end %> | |
20 |
|
20 | |||
21 | <% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %> |
|
21 | <% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %> | |
22 | <p><%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true, :required => @issue.required_attribute?('category_id') %> |
|
22 | <p><%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true, :required => @issue.required_attribute?('category_id') %> | |
23 | <%= link_to(l(:label_issue_category_new), |
|
23 | <%= link_to(l(:label_issue_category_new), | |
24 | new_project_issue_category_path(@issue.project), |
|
24 | new_project_issue_category_path(@issue.project), | |
25 | :remote => true, |
|
25 | :remote => true, | |
26 | :method => 'get', |
|
26 | :method => 'get', | |
27 | :title => l(:label_issue_category_new), |
|
27 | :title => l(:label_issue_category_new), | |
28 | :tabindex => 200, |
|
28 | :tabindex => 200, | |
29 | :class => 'icon-only icon-add' |
|
29 | :class => 'icon-only icon-add' | |
30 | ) if User.current.allowed_to?(:manage_categories, @issue.project) %></p> |
|
30 | ) if User.current.allowed_to?(:manage_categories, @issue.project) %></p> | |
31 | <% end %> |
|
31 | <% end %> | |
32 |
|
32 | |||
33 | <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %> |
|
33 | <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %> | |
34 | <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true, :required => @issue.required_attribute?('fixed_version_id') %> |
|
34 | <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true, :required => @issue.required_attribute?('fixed_version_id') %> | |
35 | <%= link_to(l(:label_version_new), |
|
35 | <%= link_to(l(:label_version_new), | |
36 | new_project_version_path(@issue.project), |
|
36 | new_project_version_path(@issue.project), | |
37 | :remote => true, |
|
37 | :remote => true, | |
38 | :method => 'get', |
|
38 | :method => 'get', | |
39 | :title => l(:label_version_new), |
|
39 | :title => l(:label_version_new), | |
40 | :tabindex => 200, |
|
40 | :tabindex => 200, | |
41 | :class => 'icon-only icon-add' |
|
41 | :class => 'icon-only icon-add' | |
42 | ) if User.current.allowed_to?(:manage_versions, @issue.project) %> |
|
42 | ) if User.current.allowed_to?(:manage_versions, @issue.project) %> | |
43 | </p> |
|
43 | </p> | |
44 | <% end %> |
|
44 | <% end %> | |
45 | </div> |
|
45 | </div> | |
46 |
|
46 | |||
47 | <div class="splitcontentright"> |
|
47 | <div class="splitcontentright"> | |
48 | <% if @issue.safe_attribute? 'parent_issue_id' %> |
|
48 | <% if @issue.safe_attribute? 'parent_issue_id' %> | |
49 | <p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10, :required => @issue.required_attribute?('parent_issue_id') %></p> |
|
49 | <p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10, :required => @issue.required_attribute?('parent_issue_id') %></p> | |
50 | <%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @issue.project, :scope => Setting.cross_project_subtasks)}')" %> |
|
50 | <%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @issue.project, :scope => Setting.cross_project_subtasks)}')" %> | |
51 | <% end %> |
|
51 | <% end %> | |
52 |
|
52 | |||
53 | <% if @issue.safe_attribute? 'start_date' %> |
|
53 | <% if @issue.safe_attribute? 'start_date' %> | |
54 | <p id="start_date_area"> |
|
54 | <p id="start_date_area"> | |
55 | <%= f.date_field(:start_date, :size => 10, :required => @issue.required_attribute?('start_date')) %> |
|
55 | <%= f.date_field(:start_date, :size => 10, :required => @issue.required_attribute?('start_date')) %> | |
56 | <%= calendar_for('issue_start_date') %> |
|
56 | <%= calendar_for('issue_start_date') %> | |
57 | </p> |
|
57 | </p> | |
58 | <% end %> |
|
58 | <% end %> | |
59 |
|
59 | |||
60 | <% if @issue.safe_attribute? 'due_date' %> |
|
60 | <% if @issue.safe_attribute? 'due_date' %> | |
61 | <p id="due_date_area"> |
|
61 | <p id="due_date_area"> | |
62 | <%= f.date_field(:due_date, :size => 10, :required => @issue.required_attribute?('due_date')) %> |
|
62 | <%= f.date_field(:due_date, :size => 10, :required => @issue.required_attribute?('due_date')) %> | |
63 | <%= calendar_for('issue_due_date') %> |
|
63 | <%= calendar_for('issue_due_date') %> | |
64 | </p> |
|
64 | </p> | |
65 | <% end %> |
|
65 | <% end %> | |
66 |
|
66 | |||
67 | <% if @issue.safe_attribute? 'estimated_hours' %> |
|
67 | <% if @issue.safe_attribute? 'estimated_hours' %> | |
68 |
<p><%= f. |
|
68 | <p><%= f.hours_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %></p> | |
69 | <% end %> |
|
69 | <% end %> | |
70 |
|
70 | |||
71 | <% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %> |
|
71 | <% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %> | |
72 | <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :required => @issue.required_attribute?('done_ratio') %></p> |
|
72 | <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :required => @issue.required_attribute?('done_ratio') %></p> | |
73 | <% end %> |
|
73 | <% end %> | |
74 | </div> |
|
74 | </div> | |
75 | </div> |
|
75 | </div> | |
76 |
|
76 | |||
77 | <% if @issue.safe_attribute? 'custom_field_values' %> |
|
77 | <% if @issue.safe_attribute? 'custom_field_values' %> | |
78 | <%= render :partial => 'issues/form_custom_fields' %> |
|
78 | <%= render :partial => 'issues/form_custom_fields' %> | |
79 | <% end %> |
|
79 | <% end %> | |
80 |
|
80 | |||
81 | <% end %> |
|
81 | <% end %> | |
82 |
|
82 | |||
83 | <% include_calendar_headers_tags %> |
|
83 | <% include_calendar_headers_tags %> |
@@ -1,80 +1,80 | |||||
1 | <%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %> |
|
1 | <%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %> | |
2 | <%= error_messages_for 'issue', 'time_entry' %> |
|
2 | <%= error_messages_for 'issue', 'time_entry' %> | |
3 | <%= render :partial => 'conflict' if @conflict %> |
|
3 | <%= render :partial => 'conflict' if @conflict %> | |
4 | <div class="box"> |
|
4 | <div class="box"> | |
5 | <% if @issue.attributes_editable? %> |
|
5 | <% if @issue.attributes_editable? %> | |
6 | <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend> |
|
6 | <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend> | |
7 | <div id="all_attributes"> |
|
7 | <div id="all_attributes"> | |
8 | <%= render :partial => 'form', :locals => {:f => f} %> |
|
8 | <%= render :partial => 'form', :locals => {:f => f} %> | |
9 | </div> |
|
9 | </div> | |
10 | </fieldset> |
|
10 | </fieldset> | |
11 | <% end %> |
|
11 | <% end %> | |
12 | <% if User.current.allowed_to?(:log_time, @project) %> |
|
12 | <% if User.current.allowed_to?(:log_time, @project) %> | |
13 | <fieldset class="tabular"><legend><%= l(:button_log_time) %></legend> |
|
13 | <fieldset class="tabular"><legend><%= l(:button_log_time) %></legend> | |
14 | <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %> |
|
14 | <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %> | |
15 | <div class="splitcontent"> |
|
15 | <div class="splitcontent"> | |
16 | <div class="splitcontentleft"> |
|
16 | <div class="splitcontentleft"> | |
17 |
<p><%= time_entry. |
|
17 | <p><%= time_entry.hours_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p> | |
18 | </div> |
|
18 | </div> | |
19 | <div class="splitcontentright"> |
|
19 | <div class="splitcontentright"> | |
20 | <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p> |
|
20 | <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p> | |
21 | </div> |
|
21 | </div> | |
22 | </div> |
|
22 | </div> | |
23 | <p><%= time_entry.text_field :comments, :size => 60 %></p> |
|
23 | <p><%= time_entry.text_field :comments, :size => 60 %></p> | |
24 | <% @time_entry.custom_field_values.each do |value| %> |
|
24 | <% @time_entry.custom_field_values.each do |value| %> | |
25 | <p><%= custom_field_tag_with_label :time_entry, value %></p> |
|
25 | <p><%= custom_field_tag_with_label :time_entry, value %></p> | |
26 | <% end %> |
|
26 | <% end %> | |
27 | <% end %> |
|
27 | <% end %> | |
28 | </fieldset> |
|
28 | </fieldset> | |
29 | <% end %> |
|
29 | <% end %> | |
30 | <% if @issue.notes_addable? %> |
|
30 | <% if @issue.notes_addable? %> | |
31 | <fieldset><legend><%= l(:field_notes) %></legend> |
|
31 | <fieldset><legend><%= l(:field_notes) %></legend> | |
32 | <%= f.text_area :notes, :cols => 60, :rows => 10, :class => 'wiki-edit', :no_label => true %> |
|
32 | <%= f.text_area :notes, :cols => 60, :rows => 10, :class => 'wiki-edit', :no_label => true %> | |
33 | <%= wikitoolbar_for 'issue_notes' %> |
|
33 | <%= wikitoolbar_for 'issue_notes' %> | |
34 |
|
34 | |||
35 | <% if @issue.safe_attribute? 'private_notes' %> |
|
35 | <% if @issue.safe_attribute? 'private_notes' %> | |
36 | <%= f.check_box :private_notes, :no_label => true %> <label for="issue_private_notes"><%= l(:field_private_notes) %></label> |
|
36 | <%= f.check_box :private_notes, :no_label => true %> <label for="issue_private_notes"><%= l(:field_private_notes) %></label> | |
37 | <% end %> |
|
37 | <% end %> | |
38 |
|
38 | |||
39 | <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %> |
|
39 | <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %> | |
40 | </fieldset> |
|
40 | </fieldset> | |
41 |
|
41 | |||
42 | <fieldset><legend><%= l(:label_attachment_plural) %></legend> |
|
42 | <fieldset><legend><%= l(:label_attachment_plural) %></legend> | |
43 | <% if @issue.attachments.any? && @issue.safe_attribute?('deleted_attachment_ids') %> |
|
43 | <% if @issue.attachments.any? && @issue.safe_attribute?('deleted_attachment_ids') %> | |
44 | <div class="contextual"><%= link_to l(:label_edit_attachments), '#', :onclick => "$('#existing-attachments').toggle(); return false;" %></div> |
|
44 | <div class="contextual"><%= link_to l(:label_edit_attachments), '#', :onclick => "$('#existing-attachments').toggle(); return false;" %></div> | |
45 | <div id="existing-attachments" style="<%= @issue.deleted_attachment_ids.blank? ? 'display:none;' : '' %>"> |
|
45 | <div id="existing-attachments" style="<%= @issue.deleted_attachment_ids.blank? ? 'display:none;' : '' %>"> | |
46 | <% @issue.attachments.each do |attachment| %> |
|
46 | <% @issue.attachments.each do |attachment| %> | |
47 | <span class="existing-attachment"> |
|
47 | <span class="existing-attachment"> | |
48 | <%= text_field_tag '', attachment.filename, :class => "filename", :disabled => true %> |
|
48 | <%= text_field_tag '', attachment.filename, :class => "filename", :disabled => true %> | |
49 | <label> |
|
49 | <label> | |
50 | <%= check_box_tag 'issue[deleted_attachment_ids][]', |
|
50 | <%= check_box_tag 'issue[deleted_attachment_ids][]', | |
51 | attachment.id, |
|
51 | attachment.id, | |
52 | @issue.deleted_attachment_ids.include?(attachment.id), |
|
52 | @issue.deleted_attachment_ids.include?(attachment.id), | |
53 | :id => nil, :class => "deleted_attachment" %> <%= l(:button_delete) %> |
|
53 | :id => nil, :class => "deleted_attachment" %> <%= l(:button_delete) %> | |
54 | </label> |
|
54 | </label> | |
55 | </span> |
|
55 | </span> | |
56 | <% end %> |
|
56 | <% end %> | |
57 | <hr /> |
|
57 | <hr /> | |
58 | </div> |
|
58 | </div> | |
59 | <% end %> |
|
59 | <% end %> | |
60 |
|
60 | |||
61 | <div id="new-attachments" style="display:inline-block;"> |
|
61 | <div id="new-attachments" style="display:inline-block;"> | |
62 | <%= render :partial => 'attachments/form', :locals => {:container => @issue} %> |
|
62 | <%= render :partial => 'attachments/form', :locals => {:container => @issue} %> | |
63 | </div> |
|
63 | </div> | |
64 | </fieldset> |
|
64 | </fieldset> | |
65 | <% end %> |
|
65 | <% end %> | |
66 | </div> |
|
66 | </div> | |
67 |
|
67 | |||
68 | <%= f.hidden_field :lock_version %> |
|
68 | <%= f.hidden_field :lock_version %> | |
69 | <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %> |
|
69 | <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %> | |
70 | <%= submit_tag l(:button_submit) %> |
|
70 | <%= submit_tag l(:button_submit) %> | |
71 | <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' %> |
|
71 | <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' %> | |
72 | | <%= link_to l(:button_cancel), {}, :onclick => "$('#update').hide(); return false;" %> |
|
72 | | <%= link_to l(:button_cancel), {}, :onclick => "$('#update').hide(); return false;" %> | |
73 |
|
73 | |||
74 | <%= hidden_field_tag 'prev_issue_id', @prev_issue_id if @prev_issue_id %> |
|
74 | <%= hidden_field_tag 'prev_issue_id', @prev_issue_id if @prev_issue_id %> | |
75 | <%= hidden_field_tag 'next_issue_id', @next_issue_id if @next_issue_id %> |
|
75 | <%= hidden_field_tag 'next_issue_id', @next_issue_id if @next_issue_id %> | |
76 | <%= hidden_field_tag 'issue_position', @issue_position if @issue_position %> |
|
76 | <%= hidden_field_tag 'issue_position', @issue_position if @issue_position %> | |
77 | <%= hidden_field_tag 'issue_count', @issue_count if @issue_count %> |
|
77 | <%= hidden_field_tag 'issue_count', @issue_count if @issue_count %> | |
78 | <% end %> |
|
78 | <% end %> | |
79 |
|
79 | |||
80 | <div id="preview" class="wiki"></div> |
|
80 | <div id="preview" class="wiki"></div> |
@@ -1,47 +1,47 | |||||
1 | <%= error_messages_for 'time_entry' %> |
|
1 | <%= error_messages_for 'time_entry' %> | |
2 | <%= back_url_hidden_field_tag %> |
|
2 | <%= back_url_hidden_field_tag %> | |
3 |
|
3 | |||
4 | <div class="box tabular"> |
|
4 | <div class="box tabular"> | |
5 | <% if @time_entry.new_record? %> |
|
5 | <% if @time_entry.new_record? %> | |
6 | <% if params[:project_id] %> |
|
6 | <% if params[:project_id] %> | |
7 | <%= hidden_field_tag 'project_id', params[:project_id] %> |
|
7 | <%= hidden_field_tag 'project_id', params[:project_id] %> | |
8 | <% elsif params[:issue_id] %> |
|
8 | <% elsif params[:issue_id] %> | |
9 | <%= hidden_field_tag 'issue_id', params[:issue_id] %> |
|
9 | <%= hidden_field_tag 'issue_id', params[:issue_id] %> | |
10 | <% else %> |
|
10 | <% else %> | |
11 | <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).to_a, :selected => @time_entry.project, :include_blank => true), :required => true %></p> |
|
11 | <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).to_a, :selected => @time_entry.project, :include_blank => true), :required => true %></p> | |
12 | <% end %> |
|
12 | <% end %> | |
13 | <% end %> |
|
13 | <% end %> | |
14 | <p> |
|
14 | <p> | |
15 | <%= f.text_field :issue_id, :size => 6 %> |
|
15 | <%= f.text_field :issue_id, :size => 6 %> | |
16 | <span id="time_entry_issue"> |
|
16 | <span id="time_entry_issue"> | |
17 | <%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %> |
|
17 | <%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %> | |
18 | </span> |
|
18 | </span> | |
19 | </p> |
|
19 | </p> | |
20 | <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> |
|
20 | <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> | |
21 |
<p><%= f. |
|
21 | <p><%= f.hours_field :hours, :size => 6, :required => true %></p> | |
22 | <p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p> |
|
22 | <p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p> | |
23 | <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p> |
|
23 | <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p> | |
24 | <% @time_entry.custom_field_values.each do |value| %> |
|
24 | <% @time_entry.custom_field_values.each do |value| %> | |
25 | <p><%= custom_field_tag_with_label :time_entry, value %></p> |
|
25 | <p><%= custom_field_tag_with_label :time_entry, value %></p> | |
26 | <% end %> |
|
26 | <% end %> | |
27 | <%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %> |
|
27 | <%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %> | |
28 | </div> |
|
28 | </div> | |
29 |
|
29 | |||
30 | <%= javascript_tag do %> |
|
30 | <%= javascript_tag do %> | |
31 | $(document).ready(function(){ |
|
31 | $(document).ready(function(){ | |
32 | $('#time_entry_project_id, #time_entry_issue_id').change(function(){ |
|
32 | $('#time_entry_project_id, #time_entry_issue_id').change(function(){ | |
33 | $.ajax({ |
|
33 | $.ajax({ | |
34 | url: '<%= escape_javascript(@time_entry.new_record? ? new_time_entry_path(:format => 'js') : edit_time_entry_path(:format => 'js')) %>', |
|
34 | url: '<%= escape_javascript(@time_entry.new_record? ? new_time_entry_path(:format => 'js') : edit_time_entry_path(:format => 'js')) %>', | |
35 | type: 'post', |
|
35 | type: 'post', | |
36 | data: $(this).closest('form').serialize() |
|
36 | data: $(this).closest('form').serialize() | |
37 | }); |
|
37 | }); | |
38 | }); |
|
38 | }); | |
39 | }); |
|
39 | }); | |
40 |
|
40 | |||
41 | observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', { |
|
41 | observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', { | |
42 | select: function(event, ui) { |
|
42 | select: function(event, ui) { | |
43 | $('#time_entry_issue').text(''); |
|
43 | $('#time_entry_issue').text(''); | |
44 | $('#time_entry_issue_id').val(ui.item.value).change(); |
|
44 | $('#time_entry_issue_id').val(ui.item.value).change(); | |
45 | } |
|
45 | } | |
46 | }); |
|
46 | }); | |
47 | <% end %> |
|
47 | <% end %> |
@@ -1,55 +1,64 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require 'action_view/helpers/form_helper' |
|
18 | require 'action_view/helpers/form_helper' | |
19 |
|
19 | |||
20 | class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder |
|
20 | class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder | |
21 | include Redmine::I18n |
|
21 | include Redmine::I18n | |
22 |
|
22 | |||
23 | (field_helpers.map(&:to_s) - %w(radio_button hidden_field fields_for check_box label) + |
|
23 | (field_helpers.map(&:to_s) - %w(radio_button hidden_field fields_for check_box label) + | |
24 | %w(date_select)).each do |selector| |
|
24 | %w(date_select)).each do |selector| | |
25 | src = <<-END_SRC |
|
25 | src = <<-END_SRC | |
26 | def #{selector}(field, options = {}) |
|
26 | def #{selector}(field, options = {}) | |
27 | label_for_field(field, options) + super(field, options.except(:label)).html_safe |
|
27 | label_for_field(field, options) + super(field, options.except(:label)).html_safe | |
28 | end |
|
28 | end | |
29 | END_SRC |
|
29 | END_SRC | |
30 | class_eval src, __FILE__, __LINE__ |
|
30 | class_eval src, __FILE__, __LINE__ | |
31 | end |
|
31 | end | |
32 |
|
32 | |||
33 | def check_box(field, options={}, checked_value="1", unchecked_value="0") |
|
33 | def check_box(field, options={}, checked_value="1", unchecked_value="0") | |
34 | label_for_field(field, options) + super(field, options.except(:label), checked_value, unchecked_value).html_safe |
|
34 | label_for_field(field, options) + super(field, options.except(:label), checked_value, unchecked_value).html_safe | |
35 | end |
|
35 | end | |
36 |
|
36 | |||
37 | def select(field, choices, options = {}, html_options = {}) |
|
37 | def select(field, choices, options = {}, html_options = {}) | |
38 | label_for_field(field, options) + super(field, choices, options, html_options.except(:label)).html_safe |
|
38 | label_for_field(field, options) + super(field, choices, options, html_options.except(:label)).html_safe | |
39 | end |
|
39 | end | |
40 |
|
40 | |||
41 | def time_zone_select(field, priority_zones = nil, options = {}, html_options = {}) |
|
41 | def time_zone_select(field, priority_zones = nil, options = {}, html_options = {}) | |
42 | label_for_field(field, options) + super(field, priority_zones, options, html_options.except(:label)).html_safe |
|
42 | label_for_field(field, options) + super(field, priority_zones, options, html_options.except(:label)).html_safe | |
43 | end |
|
43 | end | |
44 |
|
44 | |||
|
45 | # A field for entering hours value | |||
|
46 | def hours_field(field, options={}) | |||
|
47 | # display the value before type cast when the entered value is not valid | |||
|
48 | if @object.errors[field].blank? | |||
|
49 | options = options.merge(:value => format_hours(@object.send field)) | |||
|
50 | end | |||
|
51 | text_field field, options | |||
|
52 | end | |||
|
53 | ||||
45 | # Returns a label tag for the given field |
|
54 | # Returns a label tag for the given field | |
46 | def label_for_field(field, options = {}) |
|
55 | def label_for_field(field, options = {}) | |
47 | return ''.html_safe if options.delete(:no_label) |
|
56 | return ''.html_safe if options.delete(:no_label) | |
48 | text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label] |
|
57 | text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label] | |
49 | text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym) |
|
58 | text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym) | |
50 | text += @template.content_tag("span", " *", :class => "required") if options.delete(:required) |
|
59 | text += @template.content_tag("span", " *", :class => "required") if options.delete(:required) | |
51 | @template.content_tag("label", text.html_safe, |
|
60 | @template.content_tag("label", text.html_safe, | |
52 | :class => (@object && @object.errors[field].present? ? "error" : nil), |
|
61 | :class => (@object && @object.errors[field].present? ? "error" : nil), | |
53 | :for => (@object_name.to_s + "_" + field.to_s)) |
|
62 | :for => (@object_name.to_s + "_" + field.to_s)) | |
54 | end |
|
63 | end | |
55 | end |
|
64 | end |
General Comments 0
You need to be logged in to leave comments.
Login now