Project

General

Profile

Actions

Feature #8168

open

Allow to disable feature attachment

Added by Maxim Nikolaevich almost 13 years ago. Updated about 4 years ago.

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

Has duplicate Redmine - Feature #24836: Option to disable file uploadClosed

Actions
Actions #1

Updated by Maxim Nikolaevich over 11 years ago

issue should be renamed to "Allow to disable feature attachment"
I don't have permission for that

Actions #2

Updated by Toshi MARUYAMA over 11 years ago

  • Subject changed from Disabling Attachment Feature to Allow to disable feature attachment
Actions #3

Updated by Go MAEDA about 7 years ago

Actions #4

Updated by Go MAEDA about 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.

Actions #5

Updated by Yuichi HARADA over 5 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 || '&nbsp;'.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.

Actions #6

Updated by Aleksandar Pavic about 4 years ago

+1

This is related to #24623

Actions

Also available in: Atom PDF