orbit-basic/app/views/admin/ad_images/_form.html.erb

257 lines
9.8 KiB
Plaintext

<% 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/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/modal-preview" %>
<%= javascript_include_tag "lib/file-type" %>
<% end %>
<!-- Forms -->
<form class="form-horizontal main-forms">
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong>Module</strong></div>
<ul class="nav nav-pills module-nav">
<li class="active">
<a href="#basic" data-toggle="tab">Basic</a>
</li>
<li>
<a href="#status" data-toggle="tab">Status</a>
</li>
<li>
<a href="#tag" data-toggle="tab">Tags</a>
</li>
<li>
<a href="#type" data-toggle="tab">Type</a>
</li>
<li>
<a href="#frequency" data-toggle="tab">Frequency</a>
</li>
<li>
<a href="#link" data-toggle="tab">Link</a>
</li>
<li>
<a href="#imageupload" data-toggle="tab">Images</a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Category -->
<div class="control-group">
<label class="control-label muted">Banner</label>
<div class="controls">
<%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title", @ad_image.ad_banner_id) , :class=>"input-medium" %>
</div>
</div>
<!-- Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t(:start_date) %></label>
<div class="controls">
<%= f.datetime_picker :post_date, :no_label => true %>
</div>
</div>
<!-- Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t(:end_date) %></label>
<div class="controls">
<%= f.datetime_picker :unpost_date, :no_label => true %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted">Status</label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn">
<input type="checkbox" value="1"> Top
</label>
<label class="checkbox inline btn">
<input type="checkbox" value="2"> Hot
</label>
<label class="checkbox inline btn">
<input type="checkbox" value="3"> Hide
</label>
</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>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @ad_image.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'ad_image[tag_ids][]', tag.id, @ad_image.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'ad_image[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
<!-- Type Module -->
<div class="tab-pane fade" id="type">
<!-- Type -->
<div class="control-group">
<label class="control-label muted">Type</label>
<div class="controls">
<%= f.select :link_open ,AdImage::LINK_OPEN_TYPES%>
</div>
</div>
</div>
<!-- Frequency Module -->
<div class="tab-pane fade" id="frequency">
<!-- Frequency -->
<div class="control-group">
<label class="control-label muted">Frequency</label>
<div class="controls">
<%= f.text_field :weight ,:class=> 'span3',:placeholder=> t('ad.chinese_1') %>
<span class="help-block">Please enter the number</span>
</div>
</div>
</div>
<!-- Link Module -->
<div class="tab-pane fade" id="link">
<!-- Link -->
<div class="control-group">
<label class="control-label muted">link</label>
<div class="controls">
<%= f.text_field :out_link ,:class=> 'span3',:placeholder=> "URL" %>
<span class="help-block">Please enter the URL</span>
</div>
</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">
<!-- if this page editing please add class "fileupload-edit" -->
<div class="fileupload fileupload-new clearfix fileupload-edit" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left">
<% if @ad_image.file %>
<%= image_tag @ad_image.file %>
<% else %>
<%= image_tag "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 :file %>
</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_file %><%= 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_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_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: (@ad_image.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :text_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@ad_image.text_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
<!-- Form Actions -->
<%= f.hidden_field :id, :value => @ad_image.id %>
<div class="form-actions">
<%= f.submit t("submit"),:class=>"btn btn-primary" %>
<%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
<!-- <button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn">Preview</button>
<button type="button" class="btn">Cancel</button> -->
</div>
</fieldset>
</form>