[phase-11]add attachable, but have permission problem
This commit is contained in:
parent
f78775ac43
commit
fe492e0488
@ -30,6 +30,8 @@ class GlossaryTermsController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@term.attributes = glossary_term_params
|
@term.attributes = glossary_term_params
|
||||||
|
@term.save_attachments(params[:attachments])
|
||||||
|
render_attachment_warning_if_needed(@term)
|
||||||
if @term.save
|
if @term.save
|
||||||
redirect_to [@project, @term], notice: l(:notice_successful_update)
|
redirect_to [@project, @term], notice: l(:notice_successful_update)
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,9 @@ class GlossaryTerm < ActiveRecord::Base
|
|||||||
belongs_to :category, class_name: 'GlossaryCategory', foreign_key: 'category_id'
|
belongs_to :category, class_name: 'GlossaryCategory', foreign_key: 'category_id'
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
|
# class method from Redmine::Acts::Attachable::ClassMethods
|
||||||
|
acts_as_attachable
|
||||||
|
|
||||||
scope :search_by_name, -> (keyword) {
|
scope :search_by_name, -> (keyword) {
|
||||||
where 'name like ?', "#{sanitize_sql_like(keyword)}%"
|
where 'name like ?', "#{sanitize_sql_like(keyword)}%"
|
||||||
}
|
}
|
||||||
|
@ -8,3 +8,11 @@
|
|||||||
<p><%= form.select :category_id, GlossaryCategory.pluck(:name, :id), include_blank: true %></p>
|
<p><%= form.select :category_id, GlossaryCategory.pluck(:name, :id), include_blank: true %></p>
|
||||||
<p><%= form.text_area :description, size: "80x10", required: false %></p>
|
<p><%= form.text_area :description, size: "80x10", required: false %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<p>
|
||||||
|
<label><%=l :label_attachment_plural %></label>
|
||||||
|
<%= render partial: 'attachments/form' %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@ -52,3 +52,8 @@
|
|||||||
<td><%= format_time(@term.updated_at) %></td>
|
<td><%= format_time(@term.updated_at) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<%= render partial: 'attachments/links',
|
||||||
|
locals: {attachments: @term.attachments,
|
||||||
|
options: {deletable: User.current.logged?}
|
||||||
|
}%>
|
||||||
|
Loading…
Reference in New Issue
Block a user