Allow markup in job descriptions

Refs #2863
This commit is contained in:
Trevor Vallender 2024-01-21 16:07:41 +00:00
parent f79603dd46
commit c2e16d729d
3 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,7 @@
include ActionView::Helpers::UrlHelper
class Job < ActiveRecord::Base
include ActionView::Helpers::UrlHelper
include Redmine::SafeAttributes
validates :starts_on,
:ends_on,
:name,
@ -16,6 +17,8 @@ class Job < ActiveRecord::Base
scope :project_or_parent, ->(project) { where(project_id: [project&.id, project&.parent&.id]) }
scope :active, -> { where(starts_on: ..Date.today, ends_on: Date.today..) }
safe_attributes 'name', 'description'
def with_all_time_budgets
time_budgets.build(job_id: id, category_id: nil) unless time_budgets.where(category_id: nil).exists?
TimeBudgetCategory.where.not(id: time_budgets.pluck(:category_id)).each do |category|

View File

@ -2,12 +2,8 @@
<%= error_messages_for @job %>
<div class="box tabular">
<p>
<%= f.label :name %>
<%= f.text_field :name %>
<p>
<%= f.label :description %>
<%= f.text_area :description %>
<label>Name <span class="required">*</span></label>
<%= f.text_field :name, required: true %>
<p>
<%= f.label :category %>
@ -21,6 +17,11 @@
<%= f.label :ends_on %>
<%= f.date_field :ends_on %>
<p>
<%= f.label :description %>
<%= f.text_area :description, required: true, cols: 60, rows: 15, class: "wiki-edit",
data: { auto_complete: true }, id: "job_description" %>
<%= f.hidden_field :project_id, value: @job.project.id %>
<fieldset>
@ -34,6 +35,7 @@
<%= ff.hidden_field :_destroy, value: false %>
<% end %>
</fieldset>
<%= wikitoolbar_for 'job_description' %>
</div>
<%= f.submit %>

View File

@ -15,7 +15,7 @@
<h2>Job #<%= @job.id %></h2>
<div class="job">
<div class="subject"><h3><%= @job.name %></h3></div>
<p><%= @job.description %></p>
<p><%= textilizable(@job, :description) %></p>
<div class="attributes">
<div class="splitcontent">
<div class="splitcontentleft">