Patch #42966 » 0002-Replace-autocomplete-input-loading-icon-with-SVG.patch
| app/assets/javascripts/application-legacy.js | ||
|---|---|---|
|
source: url,
|
||
|
minLength: 2,
|
||
|
position: {collision: "flipfit"},
|
||
|
search: function(){$('#'+fieldId).addClass('ajax-loading');},
|
||
|
response: function(){$('#'+fieldId).removeClass('ajax-loading');}
|
||
|
search: function(){showAutocompleteLoadingIcon(fieldId)},
|
||
|
response: function(){restoreAutocompleteSearchIcon(fieldId)}
|
||
|
}, options));
|
||
|
$('#'+fieldId).addClass('autocomplete');
|
||
|
});
|
||
|
}
|
||
|
function showAutocompleteLoadingIcon(fieldId) {
|
||
|
const input = document.getElementById(fieldId);
|
||
|
if (!input) return;
|
||
|
const container = input.closest('p');
|
||
|
if (!container) return;
|
||
|
const svg = container.querySelector('svg.svg-search');
|
||
|
if (!svg) return;
|
||
|
updateSVGIcon(svg, 'loader');
|
||
|
svg.classList.remove('svg-search');
|
||
|
svg.classList.add('svg-loader');
|
||
|
input.classList.add('ajax-loading');
|
||
|
}
|
||
|
function restoreAutocompleteSearchIcon(fieldId) {
|
||
|
const input = document.getElementById(fieldId);
|
||
|
if (!input) return;
|
||
|
const container = input.closest('p');
|
||
|
if (!container) return;
|
||
|
const svg = container.querySelector('svg.svg-loader');
|
||
|
if (!svg) return;
|
||
|
updateSVGIcon(svg, 'search');
|
||
|
svg.classList.remove('svg-loader');
|
||
|
svg.classList.add('svg-search');
|
||
|
input.classList.remove('ajax-loading');
|
||
|
}
|
||
|
function multipleAutocompleteField(fieldId, url, options) {
|
||
|
function split(val) {
|
||
|
return val.split(/,\s*/);
|
||
| ... | ... | |
|
minLength: 2,
|
||
|
position: {collision: "flipfit"},
|
||
|
search: function () {
|
||
|
$('#' + fieldId).addClass('ajax-loading');
|
||
|
showAutocompleteLoadingIcon(fieldId);
|
||
|
},
|
||
|
response: function () {
|
||
|
$('#' + fieldId).removeClass('ajax-loading');
|
||
|
restoreAutocompleteSearchIcon(fieldId);
|
||
|
},
|
||
|
select: function (event, ui) {
|
||
|
var terms = split(this.value);
|
||
| ... | ... | |
|
type: 'get',
|
||
|
data: {q: $this.val()},
|
||
|
success: function(data){ if(targetId) $('#'+targetId).html(data); },
|
||
|
beforeSend: function(){ $this.addClass('ajax-loading'); },
|
||
|
complete: function(){ $this.removeClass('ajax-loading'); }
|
||
|
beforeSend: function(){ showAutocompleteLoadingIcon(fieldId); },
|
||
|
complete: function(){ restoreAutocompleteSearchIcon(fieldId); }
|
||
|
});
|
||
|
}
|
||
|
};
|
||
| app/assets/stylesheets/application.css | ||
|---|---|---|
|
.total-hours span.hours-int { font-size: 120%; }
|
||
|
.autoscroll {overflow-x: auto; padding:1px; margin-bottom: 1.2em; position: relative;}
|
||
|
#user_login, #user_firstname, #user_lastname, #user_mail, #my_account_form select, #user_form select { width: 90%; }
|
||
|
#user_firstname, #user_lastname, #user_mail, #my_account_form select, #user_form select { width: 90%; }
|
||
|
#user_login { width: calc(90% - 18px); }
|
||
|
#workflow_copy_form select { width: 200px; }
|
||
|
table.transitions td.enabled {background: #bfb;}
|
||
| ... | ... | |
|
input#principal_search, input#user_search {width:90%}
|
||
|
.roles-selection label {display:inline-block; width:210px;}
|
||
|
input.autocomplete {
|
||
|
background: #fff url(/search.svg) no-repeat 2px 50%; padding-left:20px !important;
|
||
|
}
|
||
|
input.autocomplete.ajax-loading {
|
||
|
background-image: url(/loading.gif);
|
||
|
}
|
||
|
.role-visibility {padding-left:2em;}
|
||
|
.objects-selection {
|
||
| app/assets/stylesheets/rtl.css | ||
|---|---|---|
|
.attachments_fields input.description {margin-left:0px; margin-right:4px;}
|
||
|
.attachments_fields input.filename {background:url(/attachment.png) no-repeat right 1px top 50%; padding-left:0px; padding-right:18px;}
|
||
|
.attachments_fields .ajax-waiting input.filename {background:url(/hourglass-empty.svg) no-repeat right top 50%;}
|
||
|
.attachments_fields .ajax-loading input.filename {background:url(/loading.gif) no-repeat right top 50%;}
|
||
|
.attachments_fields div.ui-progressbar {margin: 2px 8px -5px 0;}
|
||
|
a.remove-upload {background: url(/delete.png) no-repeat right 1px top 50%; padding-left:0px; padding-right:16px;}
|
||
| ... | ... | |
|
table.members td.name {padding-right: 20px; padding-left:0; }
|
||
|
table.members td.group, table.members td.groupnonmember, table.members td.groupanonymous {background: url(/group.png) no-repeat right 50%;}
|
||
|
input.autocomplete {
|
||
|
background: #fff url(/search.svg) no-repeat right 2px top 50%; padding-left:0px !important; padding-right:20px !important;
|
||
|
}
|
||
|
.role-visibility {padding-right:2em; padding-left:0;}
|
||
|
/***** Flash & error messages ****/
|
||
| app/views/groups/_new_users_form.html.erb | ||
|---|---|---|
|
<fieldset class="box">
|
||
|
<legend><%= label_tag "user_search", l(:label_user_search) %></legend>
|
||
|
<p><%= text_field_tag 'user_search', nil %></p>
|
||
|
<p>
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<%= text_field_tag 'user_search', nil %>
|
||
|
</p>
|
||
|
<%= javascript_tag "observeSearchfield('user_search', null, '#{ escape_javascript autocomplete_for_user_group_path(@group) }')" %>
|
||
|
<div id="users">
|
||
| app/views/issue_relations/_form.html.erb | ||
|---|---|---|
|
</div>
|
||
|
<% end %>
|
||
|
<p><%= f.select :relation_type, collection_for_relation_type_select, {}, :onchange => "setPredecessorFieldsVisibility();" %>
|
||
|
<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :value => unsaved_relations_ids, :size => 10 %>
|
||
|
<span>
|
||
|
<%= l(:label_issue) %> #<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %><%= f.text_field :issue_to_id, :value => unsaved_relations_ids, :size => 10 %>
|
||
|
</span>
|
||
|
<span id="predecessor_fields" style="display:none;">
|
||
|
<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
|
||
|
</span>
|
||
| app/views/issues/_attributes.html.erb | ||
|---|---|---|
|
<div class="splitcontentright">
|
||
|
<% if @issue.safe_attribute? 'parent_issue_id' %>
|
||
|
<p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10,
|
||
|
<p id="parent_issue">
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<%= f.text_field :parent_issue_id, :size => 9,
|
||
|
:required => @issue.required_attribute?('parent_issue_id'),
|
||
|
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
|
||
|
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %>
|
||
|
</p>
|
||
|
<%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript(auto_complete_issues_path(:project_id => @issue.project, :scope => Setting.cross_project_subtasks, :status => @issue.closed? ? 'c' : 'o', :issue_id => @issue.id))}')" %>
|
||
|
<% end %>
|
||
| app/views/issues/bulk_edit.html.erb | ||
|---|---|---|
|
<% if @safe_attributes.include?('parent_issue_id') && @project %>
|
||
|
<p>
|
||
|
<label for='issue_parent_issue_id'><%= l(:field_parent_issue) %></label>
|
||
|
<%= text_field_tag 'issue[parent_issue_id]', '', :size => 10, :value => @issue_params[:parent_issue_id] %>
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<%= text_field_tag 'issue[parent_issue_id]', '', :size => 9, :value => @issue_params[:parent_issue_id] %>
|
||
|
<label class="inline"><%= check_box_tag 'issue[parent_issue_id]', 'none', (@issue_params[:parent_issue_id] == 'none'), :id => nil, :data => {:disables => '#issue_parent_issue_id'} %><%= l(:button_clear) %></label>
|
||
|
</p>
|
||
|
<%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => Setting.cross_project_subtasks)}')" %>
|
||
| app/views/issues/destroy.html.erb | ||
|---|---|---|
|
<label><%= radio_button_tag 'todo', 'nullify', false %> <%= l(:text_assign_time_entries_to_project) %></label><br />
|
||
|
<% end %>
|
||
|
<% if @project %>
|
||
|
<span>
|
||
|
<label><%= radio_button_tag 'todo', 'reassign', false, :onchange => 'if (this.checked) { $("#reassign_to_id").focus(); }' %> <%= l(:text_reassign_time_entries) %></label>
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<%= text_field_tag 'reassign_to_id', params[:reassign_to_id], :size => 6, :onfocus => '$("#todo_reassign").attr("checked", true);' %>
|
||
|
</span>
|
||
|
<%= javascript_tag "observeAutocompleteField('reassign_to_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project)}')" %>
|
||
|
<% end %>
|
||
|
</p>
|
||
| app/views/members/_new_form.html.erb | ||
|---|---|---|
|
<fieldset class="box">
|
||
|
<legend><%= label_tag("principal_search", l(:label_principal_search)) %></legend>
|
||
|
<p><%= text_field_tag('principal_search', nil) %></p>
|
||
|
<p>
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<%= text_field_tag('principal_search', nil) %>
|
||
|
</p>
|
||
|
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
|
||
|
<div id="principals_for_new_member">
|
||
|
<%= render_principals_for_new_members(@project) %>
|
||
| app/views/repositories/_related_issues.html.erb | ||
|---|---|---|
|
:remote => true,
|
||
|
:method => :post,
|
||
|
:id => 'new-relation-form', :style => (@issue ? '' : 'display: none;')) do |f| %>
|
||
|
<%= l(:label_issue) %> #<%= text_field_tag 'issue_id', '', :size => 10 %>
|
||
|
<p>
|
||
|
<%= l(:label_issue) %> #
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<%= text_field_tag 'issue_id', '', :size => 10 %>
|
||
|
</p>
|
||
|
<%= submit_tag l(:button_add) %>
|
||
|
<%= toggle_link l(:button_cancel), 'new-relation-form'%>
|
||
|
<% end %>
|
||
| app/views/timelog/_form.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<p>
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<%= f.text_field :issue_id, :size => 6, :required => Setting.timelog_required_fields.include?('issue_id') %>
|
||
|
<span id="time_entry_issue">
|
||
|
<%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>
|
||
| app/views/timelog/bulk_edit.html.erb | ||
|---|---|---|
|
:onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')" ) %>
|
||
|
</p>
|
||
|
<p>
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %>
|
||
|
<label for="time_entry_issue_id"><%= l(:field_issue) %></label>
|
||
|
<%= text_field :time_entry, :issue_id, :size => 6 %>
|
||
|
<label class="inline"><%= check_box_tag 'time_entry[issue_id]', 'none', (@time_entry_params[:issue_id] == 'none'), :id => nil, :data => {:disables => '#time_entry_issue_id'} %><%= l(:button_clear) %></label>
|
||
| app/views/users/_form.html.erb | ||
|---|---|---|
|
<div class="splitcontentleft">
|
||
|
<fieldset class="box tabular">
|
||
|
<legend><%=l(:label_information_plural)%></legend>
|
||
|
<p><%= f.text_field :login, :required => true, :size => 25 %></p>
|
||
|
<p><%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %><%= f.text_field :login, :required => true, :size => 25 %></p>
|
||
|
<p><%= f.text_field :firstname, :required => true %></p>
|
||
|
<p><%= f.text_field :lastname, :required => true %></p>
|
||
|
<p><%= f.text_field :mail, :required => true %></p>
|
||
| app/views/watchers/_new.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<%= hidden_field_tag 'project_id', @project.id if @project %>
|
||
|
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
|
||
|
<p>
|
||
|
<%= label_tag 'user_search', l(:label_user_search) %><br>
|
||
|
<%= sprite_icon 'search', icon_only: true, css_class: 'svg-search' %><%= text_field_tag 'user_search', nil %>
|
||
|
</p>
|
||
|
<%= javascript_tag(
|
||
|
"observeSearchfield(
|
||
|
'user_search',
|
||