Initial Redmine tooling and local plugin forks
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<%= back_url_hidden_field_tag %>
|
||||
<%= error_messages_for 'canned_response' %>
|
||||
|
||||
<div class="box tabular">
|
||||
<p><%= f.text_field :name, :size => 80, :required => true %></p>
|
||||
<% if User.current.admin? || User.current.allowed_to?(:manage_public_canned_responses, @project) %>
|
||||
<% if @canned_response.user %>
|
||||
<p>
|
||||
<label><%= l(:field_author) %></label>
|
||||
<%= @canned_response.user.name %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<%= f.check_box :is_public,
|
||||
:label => l(:field_is_public),
|
||||
:onchange => (User.current.admin? ? nil : 'if (this.checked) {$("#canned_response_is_for_all").removeAttr("checked"); $("#canned_response_is_for_all").attr("disabled", true);} else {$("#canned_response_is_for_all").removeAttr("disabled");}') %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p><label for="canned_response_is_for_all"><%=l(:field_is_for_all)%></label>
|
||||
<%= check_box_tag 'canned_response_is_for_all', 1, @canned_response.project.nil?,
|
||||
:disabled => (!@canned_response.new_record? && (@canned_response.project.nil? || (@canned_response.is_public? && !User.current.admin?))) %></p>
|
||||
|
||||
<p><%= f.text_area :content, :required => true, :class => 'wiki-edit', :rows => 5 %>
|
||||
<em class="info"><%= l(:text_helpdesk_answer_macros, :macro => HelpdeskSettings::MACRO_LIST.map{|m| link_to m, "#", :class => "mail-macro"}.join(', ')).html_safe %></em>
|
||||
<%= wikitoolbar_for 'canned_response_content' %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(".info a.mail-macro").bind("click", function() {
|
||||
$('#canned_response_content').insertAtCaret($(this).html());
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag :contacts, :plugin => 'redmine_contacts' %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,37 @@
|
||||
<div class="contextual">
|
||||
<%= link_to l(:label_helpdesk_new_canned_response), {:controller => "canned_responses", :action => 'new'}, :class => 'icon icon-add' %>
|
||||
</div>
|
||||
<h3><%= l(:label_helpdesk_canned_response_plural) %></h3>
|
||||
|
||||
<% if @canned_responses.any? %>
|
||||
<table class="list">
|
||||
<thead><tr>
|
||||
<th><%= l(:field_name) %></th>
|
||||
<th><%= l(:field_content) %></th>
|
||||
<th><%= l(:field_is_public) %></th>
|
||||
<th><%= l(:field_author) %></th>
|
||||
<th><%= l(:field_project) %></th>
|
||||
<th></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% @canned_responses.each do |canned_response| %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td class="name"><%= canned_response.name %></td>
|
||||
<td class="name"><em class="info"><%= canned_response.content.gsub(/$/, ' ').truncate(250) %></em></td>
|
||||
<td class="tick"><%= checked_image canned_response.is_public? %></td>
|
||||
<td class="project"><%= canned_response.user.try(:name) %></td>
|
||||
<td class="project"><%= canned_response.project ? canned_response.project.name : l(:field_is_for_all) %></td>
|
||||
<td class="buttons">
|
||||
<%= link_to l(:button_edit), edit_canned_response_path(canned_response), :class => 'icon icon-edit' %>
|
||||
<%= delete_link canned_response_path(canned_response, :project_id => canned_response.project) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% if @canned_response_pages %>
|
||||
<p class="pagination"><%= pagination_links_full @canned_response_pages %></p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
@@ -0,0 +1,43 @@
|
||||
(function($) {
|
||||
|
||||
$.fn.insertAtCaret = function (myValue) {
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
//IE support
|
||||
if (document.selection) {
|
||||
|
||||
this.focus();
|
||||
sel = document.selection.createRange();
|
||||
sel.text = myValue;
|
||||
this.focus();
|
||||
|
||||
} else if (this.selectionStart || this.selectionStart == '0') {
|
||||
|
||||
//MOZILLA / NETSCAPE support
|
||||
var startPos = this.selectionStart;
|
||||
var endPos = this.selectionEnd;
|
||||
var scrollTop = this.scrollTop;
|
||||
this.value = this.value.substring(0, startPos)+ myValue+ this.value.substring(endPos,this.value.length);
|
||||
this.focus();
|
||||
this.selectionStart = startPos + myValue.length;
|
||||
this.selectionEnd = startPos + myValue.length;
|
||||
this.scrollTop = scrollTop;
|
||||
|
||||
} else {
|
||||
|
||||
this.value += myValue;
|
||||
this.focus();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
$('#issue_notes').insertAtCaret("<%= raw escape_javascript(@content) %>")
|
||||
|
||||
$('#helpdesk_canned_response').val("");
|
||||
|
||||
if ($('#cke_issue_notes').length > 0) {
|
||||
CKEDITOR.instances['issue_notes'].insertHtml("<%= raw escape_javascript(@content) %>");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<h2><%=l(:label_helpdesk_canned_response)%></h2>
|
||||
|
||||
<%= labelled_form_for :canned_response, @canned_response, :url => { :action => 'update', :project_id => @project } do |f| %>
|
||||
<%= render :partial => 'canned_responses/form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'index' %>
|
||||
@@ -0,0 +1,6 @@
|
||||
<h2><%=l(:label_helpdesk_new_canned_response)%></h2>
|
||||
|
||||
<%= labelled_form_for :canned_response, @canned_response, :url => { :action => 'create', :project_id => @project } do |f| %>
|
||||
<%= render :partial => 'canned_responses/form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user