OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/views/custom_actions/_form.html.erb

93 lines
4.0 KiB

<%= initialize_hide_sections_with @custom_action.all_actions.map { |a| { key: a.key, label: a.human_name } },
@custom_action.actions.map { |a| { key: a.key, label: a.human_name } } %>
<div class="form--field">
<%= f.text_field :name, required: true, container_class: '-middle' %>
</div>
<div class="form--field">
<%= f.text_area :description, container_class: '-middle' %>
</div>
<fieldset class="form--fieldset" id="custom-actions-form--conditions">
<legend class="form--fieldset-legend">
<%= t('custom_actions.conditions') %>
</legend>
<% @custom_action.all_conditions.each do |condition| %>
<div class="form--field">
<%= styled_label_tag("custom_action_conditions_#{condition.key}", condition.human_name) %>
<% input_name = "custom_action[conditions][#{condition.key}]" %>
<% selected_values = condition.values
select_options = options_for_select(condition.allowed_values.map { |v| [v[:label], v[:value]] },
selected: selected_values) %>
<%= styled_select_tag input_name,
select_options,
multiple: true,
container_class: '-middle' %>
</div>
<% end %>
</fieldset>
<fieldset class="form--fieldset" id="custom-actions-form--actions">
<legend class="form--fieldset-legend">
<%= t('custom_actions.actions.name') %>
</legend>
<div id="custom-actions-form--active-actions">
<% @custom_action.all_actions.each do |action| %>
<hide-section section-name="<%= action.key %>">
<div class="form--field">
<%= styled_label_tag("custom_action_actions_#{action.key}", action.human_name) %>
<% input_name = "custom_action[actions][#{action.key}]" %>
7 years ago
<% if %i(associated_property boolean).include?(action.type) %>
<% selected_values = action.values
select_options = options_for_select(action.allowed_values.map { |v| [v[:label], v[:value]] },
selected: selected_values) %>
<%= styled_select_tag input_name,
select_options,
7 years ago
multiple: action.multi_value?,
container_class: '-middle' %>
<% elsif %i(date_property).include?(action.type) %>
<op-date-picker>
<%= styled_text_field_tag input_name,
action.values,
container_class: '-slim',
size: '10' %>
</op-date-picker>
<% elsif %i(string_property text_property).include?(action.type) %>
<%= styled_text_field_tag input_name,
action.values,
container_class: '-slim',
step: 'any' %>
<% elsif %i(integer_property float_property).include?(action.type) %>
<%= styled_number_field_tag input_name,
action.values,
container_class: '-slim',
step: 'any' %>
<% end %>
<hide-section-link section-name="<%= action.key %>"></hide-section-link>
</div>
</hide-section>
<% end %>
</div>
7 years ago
<div class="form--space"></div>
<div class="form--field">
<label class="form--label" for="custom-actions-form--add-action">
<op-icon icon-classes="icon-add icon4" class="op-icon--wrapper">
<i class="icon-add icon4" aria-hidden="true"></i>
</op-icon>
<%= I18n.t(:'custom_actions.actions.add') %>
</label>
<span class="form--field-container">
<span class="form--text-field-container -middle">
<add-section-dropdown html-id="custom-actions-form--add-action"
id="custom-actions-form--selectable-actions">
</add-section-dropdown>
</span>
</span>
</div>
</fieldset>