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

121 lines
4.3 KiB
Plaintext
Raw Normal View History

2015-09-24 15:43:47 +00:00
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<%= stylesheet_link_tag "lib/dropzone" %>
2015-11-24 05:51:47 +00:00
<%= stylesheet_link_tag "//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" %>
2015-09-24 15:43:47 +00:00
<%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.6/animate.min.css" %>
2015-11-24 05:51:47 +00:00
<%= stylesheet_link_tag "space-admin" %>
2015-09-24 15:43:47 +00:00
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/dropzone" %>
<%= javascript_include_tag "validator" %>
2015-11-24 05:51:47 +00:00
<%= javascript_include_tag "space/space" %>
2015-09-24 15:43:47 +00:00
<% end %>
2015-11-24 05:51:47 +00:00
<div class="message hide">
2015-09-24 15:43:47 +00:00
<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">
2020-10-01 06:27:54 +00:00
<%= f.label t(:title) + " (" + t(locale) + ")", :class => "control-label muted" %>
2015-09-24 15:43:47 +00:00
<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" %>
2015-11-24 05:51:47 +00:00
<div class="group group-clear-4 clearfix">
2015-09-24 15:43:47 +00:00
<% @sub_unit.floor_sub_unit_images.each do |image| %>
2015-11-24 05:51:47 +00:00
<div class="group-item col-md-3">
<div class="group-item-inner">
<img class="group-img" src="<%= image.image.thumb.url %>">
<div class="group-actions">
<input class="group-checkbox" type="checkbox" name="images_to_destroy[]" value="<%= image.id.to_s %>" />
<label class="group-label">Delete Image</label>
</div>
2015-09-24 15:43:47 +00:00
</div>
2015-11-24 05:51:47 +00:00
2015-09-24 15:43:47 +00:00
</div>
<% end %>
2015-11-24 05:51:47 +00:00
2015-09-24 15:43:47 +00:00
</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>
2020-10-01 06:27:54 +00:00
<% @site_in_use_locales.each do |locale| %>
<%= f.fields_for :content_translations do |f| %>
<div class="control-group">
<%= f.label t(:content) + " (" + t(locale) + ")", :class => "control-label muted" %>
<div class="controls">
<%= f.text_area locale, placeholder: t(:content), :value => @sub_unit.content_translations[locale.to_s], :class=> 'ckeditor' %>
</div>
</div>
<% end %>
<% end %>
2015-09-24 15:43:47 +00:00
</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" %>
2015-11-24 05:51:47 +00:00
</div>
<script>
function equalHeight(items) {
if (typeof items === 'string' && items.length > 0) {
var $items = $(items);
var $this = null;
var maxHeight = -1;
// when images are loaded
$items.find('img').load(function() {
console.log('g')
$.each($items, function(i, val) {
$this = $(this);
if ($this.outerHeight() > maxHeight) {
maxHeight = $this.outerHeight();
}
console.log($this)
}).css('min-height', maxHeight + 'px');
});
}
}
equalHeight('.group-item-inner');
</script>