Actions
Feature #8168
openAllow to disable feature attachment
Status:
New
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
-
Start date:
2011-04-16
Due date:
% Done:
0%
Estimated time:
Resolution:
Description
Attachment max. size
should be as
Attachment max. size (zero for disabling feature)
Related issues
Updated by Maxim Nikolaevich over 12 years ago
issue should be renamed to "Allow to disable feature attachment"
I don't have permission for that
Updated by Toshi MARUYAMA over 12 years ago
- Subject changed from Disabling Attachment Feature to Allow to disable feature attachment
Updated by Go MAEDA almost 8 years ago
- Has duplicate Feature #24836: Option to disable file upload added
Updated by Go MAEDA over 7 years ago
We will have new custom field format "File" in Redmine 3.4.0 (#6719). It would be great if we can disable default "Files" field by tracker like #25052.
We can configure to show specific field name (e.g. "Screenshot", "Error log", "Patch" ...) instead of generic "Files" if this feature is implemented.
Updated by Yuichi HARADA almost 6 years ago
I investigated, but I abandoned it.
I did the following things.
1. Add attachment to tracker.
diff --git a/app/models/tracker.rb b/app/models/tracker.rb
index d90ab3e15..9c3c9a1a8 100644
--- a/app/models/tracker.rb
+++ b/app/models/tracker.rb
@@ -21,7 +21,7 @@ class Tracker < ActiveRecord::Base
CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject priority_id is_private).freeze
# Fields that can be disabled
# Other (future) fields should be appended, not inserted!
- CORE_FIELDS = %w(assigned_to_id category_id fixed_version_id parent_issue_id start_date due_date estimated_hours done_ratio description).freeze
+ CORE_FIELDS = %w(assigned_to_id category_id fixed_version_id parent_issue_id start_date due_date estimated_hours done_ratio description filename).freeze
CORE_FIELDS_ALL = (CORE_FIELDS_UNDISABLABLE + CORE_FIELDS).freeze
before_destroy :check_integrity
2. Hide the attachmented file area of [issues/new] and [issues/edit].
diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb
index 22a174a11..2f5b3416d 100644
--- a/app/views/issues/new.html.erb
+++ b/app/views/issues/new.html.erb
@@ -44,3 +44,13 @@
<% content_for :header_tags do %>
<%= robot_exclusion_tag %>
<% end %>
+
+<%= javascript_tag do %>
+$(document).ready(function(){
+ <% if @issue.disabled_core_fields.include?('filename') %>
+ $('#attachments_form').hide();
+ <% else %>
+ $('#attachments_form').show();
+ <% end %>
+});
+<% end %>
diff --git a/app/views/issues/new.js.erb b/app/views/issues/new.js.erb
index 702d922ab..b0fc1eefa 100644
--- a/app/views/issues/new.js.erb
+++ b/app/views/issues/new.js.erb
@@ -4,4 +4,10 @@ replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>');
$("#watchers_form_container").html('<%= escape_javascript(render :partial => 'issues/watchers_form') %>');
<% when "issue_category_id" %>
$('#issue_assigned_to_id').find('option').first().html('<%= escape_javascript(@issue.category.try(:assigned_to).try(:name)).presence || ' '.html_safe %>');
+<% when "issue_tracker_id" %>
+ <% if @issue.disabled_core_fields.include?('filename') %>
+ $('#attachments_form').hide();
+ <% else %>
+ $('#attachments_form').show();
+ <% end %>
<% end %>
diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb
index 3afaee4ca..05bdbb72f 100644
--- a/app/views/issues/_edit.html.erb
+++ b/app/views/issues/_edit.html.erb
@@ -77,3 +77,12 @@
<% end %>
+<%= javascript_tag do %>
+$(document).ready(function(){
+ <% if @issue.disabled_core_fields.include?('filename') %>
+ $('#new-attachments').parent().hide();
+ <% else %>
+ $('#new-attachments').parent().show();
+ <% end %>
+});
+<% end %>
diff --git a/app/views/issues/edit.js.erb b/app/views/issues/edit.js.erb
index 8c94aeceb..b02f93671 100644
--- a/app/views/issues/edit.js.erb
+++ b/app/views/issues/edit.js.erb
@@ -5,3 +5,9 @@ replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>');
<% else %>
$('#log_time').hide();
<% end %>
+
+<% if @issue.disabled_core_fields.include?('filename') %>
+ $('#new-attachments').parent().hide();
+<% else %>
+ $('#new-attachments').parent().show();
+<% end %>
However, there seems to be more considerations.for example,
- Reflects "read only" and "required" to attached files..
- Disable drag & drop of attached files.
etc.
Updated by Go MAEDA 5 months ago
- Has duplicate Feature #38682: Disable option to upload files in tickets added
Actions