space/app/views/admin/spaces/_sub_unit_form.html.erb

83 lines
3.2 KiB
Plaintext

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<%= stylesheet_link_tag "lib/dropzone" %>
<%= stylesheet_link_tag "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" %>
<%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.6/animate.min.css" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/dropzone" %>
<%= javascript_include_tag "validator" %>
<% end %>
<div class="upload-status-notice hide">
<i class="fa fa-refresh fa-spin"></i>
<span class="upload-text">Uploading...</span>
</div>
<!-- Input Area -->
<div class="input-area">
<!-- Module -->
<div class="tab-content">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% @site_in_use_locales.each do |locale| %>
<%= f.fields_for :title_translations do |f| %>
<div class="control-group">
<%= f.label :title.to_s + " (" + locale.to_s + ")", :class => "control-label muted" %>
<div class="controls">
<%= f.text_field locale, placeholder: t("space.sub_unit_name"), data: {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"}, :value => @sub_unit.title_translations[locale.to_s] %>
</div>
</div>
<% end %>
<% end %>
<div class="control-group">
<label class="control-label muted"><%= t(:images) %></label>
<div class="controls">
<% if params[:action] == "edit_sub_unit" %>
<div class="group-admin-edit-image-wrap clearfix">
<% @sub_unit.floor_sub_unit_images.each do |image| %>
<div class="group-admin-edit-image-item card clearfix">
<div class="group-admin-edit-image-item-inner">
<div class="group-admin-edit-image-container">
<img src="<%= image.image.thumb.url %>">
</div>
<div class="group-admin-edit-checkbox-wrap">
<input class="group-admin-edit-image-checkbox" type="checkbox" name="images_to_destroy[]" value="<%= image.id.to_s %>" />
<label class="group-admin-edit-image-label">Delete Image</label>
</div>
</div>
</div>
<% end %>
</div>
<% end %>
<div class="dropzone dropzone-pool" id="sub-unit-images">
<div class="dropzone-previews" id="sub-unit-images-container"></div>
</div>
<button class="remove_image_btn btn btn-warning">
<i class="fa fa-ban"></i>
<span>Remove all images</span>
</button>
</div>
<div id="image_ids">
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<% if params[:action] == "add_sub_unit" %>
<%= f.hidden_field :floor_unit, :value => @floor_unit.id %>
<% elsif params[:action] == "edit_sub_unit" %>
<%= hidden_field_tag :floor_sub_unit_id, @sub_unit.id.to_s %>
<% end %>
<%= f.submit t('submit'), class: 'btn btn-primary', :id => "floor-sub-unit-form-btn" %>
</div>