Feature #28085 » patch.patch
| redmine-3.4.4/app/controllers/previews_controller.rb 2018-02-06 17:25:39.826994006 +0900 | ||
|---|---|---|
| 16 | 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | 17 | |
| 18 | 18 |
class PreviewsController < ApplicationController |
| 19 |
before_action :find_project, :find_attachments |
|
| 19 |
before_action :find_project, :find_attachments, :except => [:project] |
|
| 20 | ||
| 21 |
def project |
|
| 22 |
@project = nil |
|
| 23 |
@project = Project.visible.find_by_id(params[:id]) unless params[:id].blank? |
|
| 24 |
@fulltexts = {}
|
|
| 25 |
if @project |
|
| 26 |
@description = (params[:project] ? params[:project][:description] : nil) |
|
| 27 |
if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @proj.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n") |
|
| 28 |
@description = nil |
|
| 29 |
end |
|
| 30 | ||
| 31 |
@project.custom_values.each do |value| |
|
| 32 |
cf = value.custom_field |
|
| 33 |
next unless cf.field_format == "text" && cf.text_formatting == "full" |
|
| 34 |
text = params[:project] && params[:project][:custom_field_values] && params[:project][:custom_field_values][cf.id.to_s.to_sym] |
|
| 35 |
next if text && text.gsub(/(\r?\n|\n\r?)/, "\n") == value.to_s.gsub(/(\r?\n|\n\r?)/, "\n") |
|
| 36 |
@fulltexts[cf.name] = text |
|
| 37 |
end |
|
| 38 | ||
| 39 |
else |
|
| 40 |
@description = (params[:project] ? params[:project][:description] : nil) |
|
| 41 | ||
| 42 |
CustomField.where(:type=>"ProjectCustomField", :field_format=>"text").each do |cf| |
|
| 43 |
next unless cf.text_formatting == "full" |
|
| 44 |
text = params[:project] && params[:project][:custom_field_values] && params[:project][:custom_field_values][cf.id.to_s.to_sym] |
|
| 45 |
@fulltexts[cf.name] = text if text |
|
| 46 |
end |
|
| 47 |
end |
|
| 48 |
render :layout => false |
|
| 49 |
end |
|
| 20 | 50 | |
| 21 | 51 |
def issue |
| 22 | 52 |
@issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank? |
| 53 |
@fulltexts = {}
|
|
| 23 | 54 |
if @issue |
| 24 | 55 |
@description = params[:issue] && params[:issue][:description] |
| 25 | 56 |
if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n") |
| ... | ... | |
| 27 | 58 |
end |
| 28 | 59 |
@notes = params[:journal] ? params[:journal][:notes] : nil |
| 29 | 60 |
@notes ||= params[:issue] ? params[:issue][:notes] : nil |
| 61 | ||
| 62 |
@issue.editable_custom_field_values.each do |value| |
|
| 63 |
cf = value.custom_field |
|
| 64 |
next unless cf.field_format == "text" && cf.text_formatting == "full" |
|
| 65 |
text = params[:issue] && params[:issue][:custom_field_values] && params[:issue][:custom_field_values][cf.id.to_s.to_sym] |
|
| 66 |
next if text && text.gsub(/(\r?\n|\n\r?)/, "\n") == value.to_s.gsub(/(\r?\n|\n\r?)/, "\n") |
|
| 67 |
@fulltexts[cf.name] = text |
|
| 68 |
end |
|
| 30 | 69 |
else |
| 31 | 70 |
@description = (params[:issue] ? params[:issue][:description] : nil) |
| 71 | ||
| 72 |
CustomField.where(:type=>"IssueCustomField", :field_format=>"text").each do |cf| |
|
| 73 |
next unless cf.text_formatting == "full" |
|
| 74 |
text = params[:issue] && params[:issue][:custom_field_values] && params[:issue][:custom_field_values][cf.id.to_s.to_sym] |
|
| 75 |
@fulltexts[cf.name] = text if text |
|
| 76 |
end |
|
| 32 | 77 |
end |
| 33 | 78 |
render :layout => false |
| 34 | 79 |
end |
| redmine-3.4.4/app/helpers/custom_fields_helper.rb 2018-02-07 10:55:48.002986236 +0900 | ||
|---|---|---|
| 79 | 79 | |
| 80 | 80 |
# Return custom field html tag corresponding to its format |
| 81 | 81 |
def custom_field_tag(prefix, custom_value) |
| 82 |
custom_value.custom_field.format.edit_tag self, |
|
| 83 |
custom_field_tag_id(prefix, custom_value.custom_field), |
|
| 84 |
custom_field_tag_name(prefix, custom_value.custom_field), |
|
| 82 |
cf = custom_value.custom_field |
|
| 83 |
tag = cf.format.edit_tag self, |
|
| 84 |
custom_field_tag_id(prefix, cf), |
|
| 85 |
custom_field_tag_name(prefix, cf), |
|
| 85 | 86 |
custom_value, |
| 86 |
:class => "#{custom_value.custom_field.field_format}_cf"
|
|
| 87 |
:class => "#{cf.field_format}_cf"
|
|
| 88 |
if cf.field_format == "text" && cf.text_formatting == "full" |
|
| 89 |
tag += wikitoolbar_for custom_field_tag_id(prefix, cf) |
|
| 90 |
end |
|
| 91 |
tag |
|
| 87 | 92 |
end |
| 88 | 93 | |
| 89 | 94 |
# Return custom field name tag |
| redmine-3.4.4/app/views/previews/issue.html.erb 2018-02-05 16:48:29.432277998 +0900 | ||
|---|---|---|
| 9 | 9 |
<%= textilizable @description, :attachments => @attachments, :object => @issue %> |
| 10 | 10 |
</fieldset> |
| 11 | 11 |
<% end %> |
| 12 | ||
| 13 |
<% @fulltexts.each do |name, text| %> |
|
| 14 |
<fieldset class="preview"><legend><%= name %></legend> |
|
| 15 |
<%= textilizable text, :attachments => @attachments, :object => @issue %> |
|
| 16 |
</fieldset> |
|
| 17 |
<% end %> |
|
| redmine-3.4.4/app/views/previews/project.html.erb 2018-02-06 15:18:41.023496004 +0900 | ||
|---|---|---|
| 1 |
<% if @description %> |
|
| 2 |
<fieldset class="preview"><legend><%= l(:field_description) %></legend> |
|
| 3 |
<%= textilizable @description, :object => @project %> |
|
| 4 |
</fieldset> |
|
| 5 |
<% end %> |
|
| 6 | ||
| 7 |
<% @fulltexts.each do |name, text| %> |
|
| 8 |
<fieldset class="preview"><legend><%= name %></legend> |
|
| 9 |
<%= textilizable text, :object => @project %> |
|
| 10 |
</fieldset> |
|
| 11 |
<% end %> |
|
| redmine-3.4.4/app/views/projects/_edit.html.erb 2018-02-06 17:13:00.155348000 +0900 | ||
|---|---|---|
| 1 | 1 |
<%= labelled_form_for @project, :html => {:multipart => true} do |f| %>
|
| 2 | 2 |
<%= render :partial => 'form', :locals => { :f => f } %>
|
| 3 | 3 |
<%= submit_tag l(:button_save) %> |
| 4 |
<%= preview_link preview_edit_project_path(:id => @project), "edit_project_#{@project.id}" %>
|
|
| 4 | 5 |
<% end %> |
| 6 |
<div id="preview" class="wiki"></div> |
|
| redmine-3.4.4/app/views/projects/new.html.erb 2018-02-07 11:04:02.330986236 +0900 | ||
|---|---|---|
| 4 | 4 |
<%= render :partial => 'form', :locals => { :f => f } %>
|
| 5 | 5 |
<%= submit_tag l(:button_create) %> |
| 6 | 6 |
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> |
| 7 |
<%= preview_link preview_new_project_path, 'new_project' %> |
|
| 7 | 8 |
<% end %> |
| 9 |
<div id="preview" class="wiki"></div> |
|
| 10 | ||
| redmine-3.4.4/config/routes.rb 2018-02-06 15:08:40.059163999 +0900 | ||
|---|---|---|
| 26 | 26 |
get 'account/activation_email', :to => 'account#activation_email', :as => 'activation_email' |
| 27 | 27 | |
| 28 | 28 |
match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put, :patch] |
| 29 |
match '/projects/preview/new', :to => 'previews#project', :as => 'preview_new_project', :via => [:get, :post, :put, :patch] |
|
| 30 |
match '/projects/preview/edit/:id', :to => 'previews#project', :as => 'preview_edit_project', :via => [:get, :post, :put, :patch] |
|
| 31 |
match '/projects/preview', :to => 'previews#project', :as => 'preview_project', :via => [:get, :post, :put, :patch] |
|
| 29 | 32 |
match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put, :patch] |
| 30 | 33 |
match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put, :patch] |
| 31 | 34 |
match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put, :patch] |
- « Previous
- 1
- 2
- 3
- Next »