forked from mainio/decidim-module-simple_proposal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:simple_proposal: create a form view proposal file for admin with…
… checkbox fields for scopes and categories
- Loading branch information
1 parent
95020a0
commit 0961b7f
Showing
1 changed file
with
109 additions
and
0 deletions.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
app/views/decidim/proposals/admin/proposals/_form.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<div class="card"> | ||
<div class="card-divider"> | ||
<h2 class="card-title"><%= title %></h2> | ||
</div> | ||
|
||
<div class="card-section"> | ||
<div class="row column hashtags__container"> | ||
<%= form.translated :text_field, :title, autofocus: true, class: "js-hashtags", hashtaggable: true %> | ||
</div> | ||
|
||
<div class="row column hashtags__container"> | ||
<%= form.translated :editor, :body, hashtaggable: true %> | ||
</div> | ||
|
||
<div class="row column"> | ||
<%= form.check_box :require_category, label: t(".require_category") %> | ||
</div> | ||
|
||
<div class="row column"> | ||
<%= form.check_box :require_scope, label: t(".require_scope") %> | ||
</div> | ||
|
||
<% if @form.component_automatic_hashtags.any? %> | ||
<div class="field"> | ||
<%= form.label :automatic_hashtags %> | ||
<div class="checkboxes hashtags"> | ||
<% @form.component_automatic_hashtags.each do |hashtag| %> | ||
<label> | ||
<%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %> | ||
</label> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
||
<% if @form.component_suggested_hashtags.any? %> | ||
<div class="field"> | ||
<%= form.label :suggested_hashtags %> | ||
<div class="checkboxes hashtags"> | ||
<%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map {|hashtag| [hashtag.downcase, "##{hashtag}"]}, :first, :last do |option| | ||
option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text } | ||
end %> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
||
<% if @form.meetings %> | ||
<div class="meeting-fields"> | ||
<div class="row column"> | ||
<%= form.check_box :created_in_meeting, label: t(".created_in_meeting") %> | ||
</div> | ||
|
||
<div class="row column" id="proposal_meeting"> | ||
<%= form.select :meeting_id, | ||
options_for_select(@form.meetings&.map { |meeting| [present(meeting).title(html_escape: true), meeting.id] }, selected: meetings_as_authors_selected ), | ||
{ include_blank: true, label: t(".select_a_meeting") }, | ||
{ multiple: false, class: "chosen-select" } %> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
||
<% if @form.geocoding_enabled? %> | ||
<div class="row column"> | ||
<%= form.geocoding_field :address %> | ||
</div> | ||
<% end %> | ||
|
||
<% if @form.categories&.any? %> | ||
<div class="row column"> | ||
<%= form.categories_select :category_id, @form.categories, include_blank: t(".select_a_category") %> | ||
</div> | ||
<% end %> | ||
|
||
<% if current_component.has_subscopes? %> | ||
<div class="row column"> | ||
<%= scopes_picker_field form, :scope_id, root: current_component.scope %> | ||
</div> | ||
<% end %> | ||
|
||
<% if component_settings.attachments_allowed? %> | ||
<%= render partial: "decidim/admin/shared/gallery", locals: { form: form } %> | ||
<% end %> | ||
|
||
<% if component_settings.attachments_allowed? %> | ||
<div class="row column"> | ||
<fieldset> | ||
<legend><%= t(".attachment_legend") %></legend> | ||
<%= form.fields_for :attachment, @form.attachment do |form| %> | ||
<div class="row column"> | ||
<%= form.text_field :title %> | ||
</div> | ||
|
||
<div class="row column"> | ||
<%= form.upload :file %> | ||
<% if params[:id].present? %> | ||
<% if proposal.documents.present? %> | ||
<%= form.hidden_field :id, value: proposal.documents.first.id %> | ||
<%= form.check_box :delete_file, label: t(".delete_attachment"), value: proposal.documents.first.id %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</fieldset> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
<%= javascript_pack_tag "decidim_proposals_admin" %> |