210 lines
7.8 KiB
Plaintext
210 lines
7.8 KiB
Plaintext
|
<% # encoding: utf-8 %>
|
||
|
<% content_for :page_specific_css do %>
|
||
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
||
|
<%= stylesheet_link_tag "lib/main-list" %>
|
||
|
<% end %>
|
||
|
<% content_for :page_specific_javascript do %>
|
||
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||
|
<%= javascript_include_tag "lib/file-type" %>
|
||
|
<%= javascript_include_tag "lib/module-area" %>
|
||
|
<% end %>
|
||
|
<!-- Input Area -->
|
||
|
<div class="input-area">
|
||
|
|
||
|
<!-- Module Tabs -->
|
||
|
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||
|
<ul class="nav nav-pills module-nav">
|
||
|
<li></li>
|
||
|
<li class="active">
|
||
|
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<!-- Module -->
|
||
|
<div class="tab-content module-area">
|
||
|
|
||
|
<!-- Basic Module -->
|
||
|
<div class="tab-pane fade in active" id="basic">
|
||
|
|
||
|
<!-- Unit Name -->
|
||
|
<div class="control-group">
|
||
|
<label class="control-label muted"><%= t("property.unit") %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.select :lab, Lab.all.map{|lab| [lab.lab_title,lab.id.to_s]}, :selected => (@property_item.lab.id.to_s rescue nil) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Administrator -->
|
||
|
<div class="control-group">
|
||
|
<label class="control-label muted"><%= t("property.administrator") %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.select :member_profile, MemberProfile.all.map{|mp| ["#{mp.first_name} #{mp.last_name}",mp.id.to_s]}, :selected => (@property_item.member_profile.id.to_s rescue nil) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Phone Number -->
|
||
|
<div class="control-group input-title">
|
||
|
<label class="control-label muted"><%= t("property.phone_number") %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.text_field :phone_number ,class: "input-block-level",value: (@property_item.phone_number rescue nil) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Price -->
|
||
|
<div class="control-group input-title">
|
||
|
<label class="control-label muted"><%= t("property.price") %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.text_field :price ,class: "input-block-level",value: (@property_item.price rescue nil) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Category -->
|
||
|
<div class="control-group">
|
||
|
<label class="control-label muted"><%= t(:category) %></label>
|
||
|
<div class="controls">
|
||
|
<%= select_category(f, @module_app) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Item ID -->
|
||
|
<div class="control-group input-title">
|
||
|
<label class="control-label muted"><%= t("property.item_id") %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.text_field :item_id ,class: "input-block-level",value: (@property_item.item_id rescue nil) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Item Date -->
|
||
|
<div class="control-group input-title">
|
||
|
<label class="control-label muted"><%= t("property.item_date") %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.date_field :item_date , class: "input-block-level",value: (@property_item.item_date rescue nil) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Tag Module -->
|
||
|
<div class="tab-pane fade" id="tag">
|
||
|
<!-- Tag -->
|
||
|
<div class="control-group">
|
||
|
<label class="control-label muted"><%= t(:tags) %></label>
|
||
|
<%= select_tags(f, @module_app) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- Images Module -->
|
||
|
<div class="tab-pane fade" id="imageupload">
|
||
|
<!-- Images Upload -->
|
||
|
<div class="control-group">
|
||
|
<label class="control-label muted"><%= t(:image) %></label>
|
||
|
<div class="controls">
|
||
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @property_item.image.file %>" data-provides="fileupload">
|
||
|
<div class="fileupload-new thumbnail pull-left">
|
||
|
<% if @property_item.image.file %>
|
||
|
<%= image_tag @property_item.image %>
|
||
|
<% else %>
|
||
|
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||
|
<span class="btn btn-file">
|
||
|
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
||
|
<%= f.file_field :image %>
|
||
|
</span>
|
||
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||
|
<div class="controls" data-toggle="buttons-checkbox">
|
||
|
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||
|
<%= f.check_box :remove_image %><%= t(:remove) %>
|
||
|
</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<!-- Language Tabs -->
|
||
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||
|
<ul class="nav nav-pills language-nav">
|
||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||
|
<li class="<%= 'active' if i == 0 %>">
|
||
|
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale.to_s) %></a>
|
||
|
</li>
|
||
|
<% end %>
|
||
|
</ul>
|
||
|
|
||
|
<!-- Language -->
|
||
|
<div class="tab-content language-area">
|
||
|
|
||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||
|
|
||
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||
|
|
||
|
<!-- Title-->
|
||
|
<div class="control-group input-title">
|
||
|
<label class="control-label muted"><%= t(:title) %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.fields_for :title_translations do |f| %>
|
||
|
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@property_item.title_translations[locale] rescue nil)%>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Description -->
|
||
|
<div class="control-group input-title">
|
||
|
<label class="control-label muted"><%= t("property.description") %></label>
|
||
|
<div class="controls">
|
||
|
<%= f.fields_for :description_translations do |f| %>
|
||
|
<%= f.text_area locale, class: "input-block-level",placeholder: t("property.description"),value: (@property_item.description_translations[locale] rescue nil) %>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Form Actions -->
|
||
|
<div class="form-actions">
|
||
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||
|
<a href="/<%= I18n.locale.to_s %>/admin/property_items/" class="btn" >Cancel</a>
|
||
|
</div>
|
||
|
|
||
|
<% content_for :page_specific_javascript do %>
|
||
|
<script>
|
||
|
$(document).ready(function() {
|
||
|
$('.main-forms .add-on').tooltip();
|
||
|
$(document).on('click', '#add_file', function(){
|
||
|
var new_id = $(this).prev().attr('value');
|
||
|
var old_id = new RegExp("new_digital_content_archive_files", "g");
|
||
|
var on = $('.language-nav li.active').index();
|
||
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
||
|
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
||
|
});
|
||
|
formTip();
|
||
|
});
|
||
|
$(document).on('click', '.delete_file', function(){
|
||
|
$(this).parents('.input-prepend').remove();
|
||
|
});
|
||
|
$(document).on('click', '.remove_existing_record', function(){
|
||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||
|
$(this).children('.should_destroy').attr('value', 1);
|
||
|
$(this).parents('.start-line').hide();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
<% end %>
|