[phase-12]can be download attached file, new term with attachment
This commit is contained in:
parent
fe492e0488
commit
ac1db68faa
@ -20,7 +20,9 @@ class GlossaryTermsController < ApplicationController
|
||||
def create
|
||||
term = GlossaryTerm.new(glossary_term_params)
|
||||
term.project = @project
|
||||
term.save_attachments params[:attachments]
|
||||
if term.save
|
||||
render_attachment_warning_if_needed term
|
||||
redirect_to [@project, term], notice: l(:notice_successful_create)
|
||||
end
|
||||
end
|
||||
@ -30,9 +32,9 @@ class GlossaryTermsController < ApplicationController
|
||||
|
||||
def update
|
||||
@term.attributes = glossary_term_params
|
||||
@term.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@term)
|
||||
@term.save_attachments params[:attachments]
|
||||
if @term.save
|
||||
render_attachment_warning_if_needed @term
|
||||
redirect_to [@project, @term], notice: l(:notice_successful_update)
|
||||
end
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
|
@ -3,7 +3,7 @@ class GlossaryTerm < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
|
||||
# class method from Redmine::Acts::Attachable::ClassMethods
|
||||
acts_as_attachable
|
||||
acts_as_attachable view_permission: :view_glossary, edit_permission: :manage_glossary, delete_permission: :manage_glossary
|
||||
|
||||
scope :search_by_name, -> (keyword) {
|
||||
where 'name like ?', "#{sanitize_sql_like(keyword)}%"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<h2><%=l :label_glossary_term %> #<%= @term.id %></h2>
|
||||
|
||||
<%= labelled_form_for :glossary_term, @term, url: project_glossary_term_path do |f| %>
|
||||
<%= labelled_form_for @term, url: project_glossary_term_path, html: {multipart: true} do |f| %>
|
||||
<%= render partial: 'glossary_terms/form', locals: {form: f} %>
|
||||
<%= f.submit l(:button_edit) %>
|
||||
<% end %>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<h2><%=l :label_glossary_term_new %></h2>
|
||||
|
||||
<%= labelled_form_for :glossary_term, @term,
|
||||
url: project_glossary_terms_path do |f| %>
|
||||
url: project_glossary_terms_path, html: {multipart: true} do |f| %>
|
||||
<%= render partial: 'glossary_terms/form', locals: {form: f} %>
|
||||
<%= f.submit l(:button_create) %>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user