196 lines
7.4 KiB
Plaintext
196 lines
7.4 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" %>
|
|
<%= stylesheet_link_tag "ruling_template/template" %>
|
|
<%= stylesheet_link_tag "ruling_template/colorpicker" %>
|
|
<% 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/file-type" %>
|
|
<%= javascript_include_tag "lib/module-area" %>
|
|
<%= javascript_include_tag "ruling_template/colorpicker" %>
|
|
<% 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 class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
|
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
|
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
|
</ul>
|
|
<!-- Module -->
|
|
<div class="tab-content module-area">
|
|
<!-- Basic Module -->
|
|
<div class="tab-pane fade in active" id="basic">
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:category) %></label>
|
|
<div class="controls">
|
|
<%= select_category(f, @module_app) %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<%= f.label :allow_domain, t("ruling_template.allow_domain"), :class => "control-label muted" %>
|
|
<div class="controls">
|
|
<%= f.text_field :allow_domain, placeholder: 'example.com', :value=>(f.object.allow_domain.class==Array ? f.object.allow_domain.join(",") : f.object.allow_domain) %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<%= f.label :price, t("ruling_template.price"), :class => "control-label muted" %>
|
|
<div class="controls">
|
|
<%= f.number_field :price, :min => 0, :step => 1000 %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<%= f.label :colors, t("ruling_template.colors"), :class => "control-label muted" %>
|
|
<div class="controls">
|
|
<a href="" id="add-color" class="btn btn-info"><%= t("ruling_template.add_color") %></a>
|
|
</div>
|
|
<div class="controls">
|
|
<div id="color-box-area">
|
|
<% if !@template.new_record? && !@template.colors.empty? %>
|
|
<% @template.colors.each do |color| %>
|
|
<div class='customWidget'>
|
|
<div class='color-holder' style='background-color: #<%= color %>'></div>
|
|
<input type='hidden' value='<%= color %>' name='r_template[colors][]'>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Status -->
|
|
<div class="tab-pane fade" id="status">
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:status) %></label>
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
|
<label class="checkbox inline btn <%= 'active' if @template.is_top? %>">
|
|
<%= f.check_box :is_top %> <%= t(:top) %>
|
|
</label>
|
|
<label class="checkbox inline btn <%= 'active' if @template.is_hot? %>">
|
|
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
|
</label>
|
|
<label class="checkbox inline btn <%= 'active' if @template.is_hidden? %>">
|
|
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Tag -->
|
|
<div class="tab-pane fade" id="tag">
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:tags) %></label>
|
|
<%= select_tags(f, @module_app) %>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<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) %></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: (@template.title_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<!-- Description -->
|
|
<div class="control-group input-subtitle">
|
|
<label class="control-label muted"><%= t(:description) %></label>
|
|
<div class="controls">
|
|
<div class="textarea">
|
|
<%= f.fields_for :description_translations do |f| %>
|
|
<%= f.text_area locale, rows: 5, class: "input-block-level", value: (@template.description_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="form-actions">
|
|
<%= f.hidden_field :user_id, :value => current_user.id.to_s %>
|
|
<%= f.submit t('ruling_template.upload_files'), class: 'btn btn-primary' %>
|
|
<a href="" onclick="window.history.back();return false;" class="btn" ><%= t("cancel") %></a>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$("form#template-form").on("submit",function(){
|
|
if($("input[name='r_template[tags][]']:checked").length == 0){
|
|
alert("Please select at least one tag.");
|
|
return false;
|
|
}
|
|
})
|
|
|
|
$("#add-color").on("click",function(){
|
|
var input = $("<div class='customWidget'><div class='color-holder' style='background-color: #0000ff'></div><input type='hidden' value='0000ff' name='r_template[colors][]'></div>");
|
|
$("#color-box-area").append(input);
|
|
input.ColorPicker({
|
|
color: '#0000ff',
|
|
onShow: function (colpkr) {
|
|
$(colpkr).fadeIn(500);
|
|
return false;
|
|
},
|
|
onHide: function (colpkr) {
|
|
$(colpkr).fadeOut(500);
|
|
return false;
|
|
},
|
|
onChange: function (hsb, hex, rgb) {
|
|
input.find("div.color-holder").css('background-color', '#' + hex);
|
|
input.find("input").val(hex);
|
|
},
|
|
onSubmit: function(hsb, hex, rgb){
|
|
input.find("div.color-holder").css('background-color', '#' + hex);
|
|
input.find("input").val(hex);
|
|
}
|
|
});
|
|
return false;
|
|
})
|
|
|
|
<% if !@template.new_record? && !@template.colors.empty? %>
|
|
$(".customWidget").each(function(){
|
|
var el = $(this);
|
|
el.ColorPicker({
|
|
color: "#" + el.find("input").val(),
|
|
onShow: function (colpkr) {
|
|
$(colpkr).fadeIn(500);
|
|
return false;
|
|
},
|
|
onHide: function (colpkr) {
|
|
$(colpkr).fadeOut(500);
|
|
return false;
|
|
},
|
|
onChange: function (hsb, hex, rgb) {
|
|
el.find("div.color-holder").css('background-color', '#' + hex);
|
|
el.find("input").val(hex);
|
|
},
|
|
onSubmit: function(hsb, hex, rgb){
|
|
el.find("div.color-holder").css('background-color', '#' + hex);
|
|
el.find("input").val(hex);
|
|
}
|
|
})
|
|
})
|
|
<% end %>
|
|
|
|
|
|
</script> |