Skip to content

Commit

Permalink
fixed auto complete fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Treubert committed Jan 19, 2024
1 parent af4cfec commit 621b489
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
36 changes: 31 additions & 5 deletions app/views/issues/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<%= f.label_for_field :description, :required => @issue.required_attribute?('description') %>
<%= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%= content_tag 'span', :id => "issue_description_and_toolbar", :style => (@issue.new_record? ? nil : 'display:none') do %>
<%= f.text_area :description,
:cols => 60,
:rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
:accesskey => accesskey(:edit),
:class => 'wiki-edit',
<%= f.text_area :description, :cols => 60, :accesskey => accesskey(:edit), :class => 'wiki-edit',
:rows => [[10, @issue.description.to_s.length / 50].max, 20].min,
:data => {
:auto_complete => true,
},
:no_label => true %>
<% end %>
</p>
Expand All @@ -48,11 +48,37 @@
<% end %>

<% heads_for_wiki_formatter %>
<%= heads_for_auto_complete(@issue.project) %>

<% if User.current.allowed_to?(:add_issue_watchers, @issue.project)%>
<%= update_data_sources_for_auto_complete({users: watchers_autocomplete_for_mention_path(project_id: @issue.project, q: '', object_type: 'issue',
object_id: @issue.id)}) %>
<% end %>

<%= javascript_tag do %>
$(document).ready(function(){
$("#issue_tracker_id, #issue_status_id").each(function(){
$(this).val($(this).find("option[selected=selected]").val());
});
$(".assign-to-me-link").click(function(event){
event.preventDefault();
var element = $(event.target);
$('#issue_assigned_to_id').val(element.data('id'));
element.hide();
});
$('#issue_assigned_to_id').change(function(event){
var assign_to_me_link = $(".assign-to-me-link");

if (assign_to_me_link.length > 0) {
var user_id = $(event.target).val();
var current_user_id = assign_to_me_link.data('id');

if (user_id == current_user_id) {
assign_to_me_link.hide();
} else {
assign_to_me_link.show();
}
}
});
});
<% end %>
4 changes: 2 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@
name 'Mega Calendar plugin'
author 'Andreas Treubert'
description 'Better calendar for redmine'
version '1.9.5'
version '1.9.6'
url 'https://github.com/berti92/mega_calendar'
author_url 'https://github.com/berti92'
requires_redmine :version_or_higher => '5.0.0'
requires_redmine :version_or_higher => '5.1.1'
menu(:top_menu, :calendar, { :controller => 'calendar', :action => 'index' }, :caption => :calendar, :if => Proc.new {(!Setting.plugin_mega_calendar['allowed_users'].blank? && Setting.plugin_mega_calendar['allowed_users'].include?(User.current.id.to_s) ? true : false)})
menu(:top_menu, :holidays, { :controller => 'holidays', :action => 'index' }, :caption => :holidays, :if => Proc.new {(!Setting.plugin_mega_calendar['allowed_users'].blank? && Setting.plugin_mega_calendar['allowed_users'].include?(User.current.id.to_s) ? true : false)})
settings :default => {'display_empty_dates' => 0, 'displayed_type' => 'users', 'displayed_users' => User.where(["users.login IS NOT NULL AND users.login <> ''"]).collect {|x| x.id.to_s}, 'default_holiday_color' => 'D59235', 'default_event_color' => '4F90FF', 'sub_path' => '/', 'week_start' => '1', 'allowed_users' => User.where(["users.login IS NOT NULL AND users.login <> ''"]).collect {|x| x.id.to_s}}, :partial => 'settings/mega_calendar_settings'
Expand Down

0 comments on commit 621b489

Please sign in to comment.