2018-02-06 17:41:39 +08:00
|
|
|
|
<div id="create_new_statis" class="bg_white_bor pl10 pt20 pr10 cl mb20">
|
|
|
|
|
<%= form_for(@statistic) do |f| %>
|
|
|
|
|
<% if @statistic.errors.any? %>
|
|
|
|
|
<div id="error_explanation">
|
|
|
|
|
<h2><%= pluralize(@statistic.errors.count, "error") %> prohibited this statistic from being saved:</h2>
|
2018-02-05 12:03:35 +08:00
|
|
|
|
|
2018-02-06 17:41:39 +08:00
|
|
|
|
<ul>
|
|
|
|
|
<% @statistic.errors.full_messages.each do |msg| %>
|
|
|
|
|
<li><%= msg %></li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2018-02-05 12:03:35 +08:00
|
|
|
|
<% end %>
|
|
|
|
|
|
2018-02-06 17:41:39 +08:00
|
|
|
|
<div class="field line_field">
|
|
|
|
|
<label><span>*</span>数据名称:</label>
|
2018-02-07 14:13:09 +08:00
|
|
|
|
<%= f.text_field :name, :class => "wb85" %>
|
2018-02-06 17:41:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="field line_field">
|
|
|
|
|
<label><span>*</span>数据分类:</label>
|
2018-02-07 16:01:14 +08:00
|
|
|
|
<%= f.select :main_category_id, (@main_categories.collect { |mc| [mc.name, mc.id] }),
|
|
|
|
|
{:no_label => true}, :onchange => "get_sub_category(this.options[this.options.selectedIndex].value)",
|
|
|
|
|
:class => "w150" %>
|
2018-02-06 17:41:39 +08:00
|
|
|
|
<%#= f.text_field :description %>
|
2018-02-07 16:01:14 +08:00
|
|
|
|
<!--<div class="fl pr wb20 change_sort">-->
|
|
|
|
|
<!--<input type="text" placeholder="请选择主类别" class="wb100 c_sort_input" id="parent_down"/><span class="down"></span>-->
|
|
|
|
|
<!--<ul class="c_sort_list">-->
|
|
|
|
|
|
|
|
|
|
<!--</ul>-->
|
|
|
|
|
<!--</div>-->
|
|
|
|
|
<!--<div class="fl pr wb20 ml20 change_sort">-->
|
|
|
|
|
<!--<input type="text" placeholder="请选择子类" class="wb100 c_sort_input" id="child_down"/><span class="down"></span>-->
|
|
|
|
|
<!--<ul class="c_sort_list">-->
|
|
|
|
|
|
|
|
|
|
<!--</ul>-->
|
|
|
|
|
<!--</div>-->
|
2018-02-06 17:41:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="field line_field">
|
|
|
|
|
<label>数据描述:</label>
|
|
|
|
|
<%#= f.number_field :user_id %>
|
|
|
|
|
<textarea class="wb85 h200 mb20"></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="field line_field">
|
|
|
|
|
<label>标签:</label>
|
|
|
|
|
<%#= f.number_field :status %>
|
|
|
|
|
<div class="tag_modal fl" id="tag_modal">
|
|
|
|
|
<span class="tag_span">数据结构<input type="hidden" value="数据结构" class="tag_hide"><a class="tag_del ml3" onclick="tag_del(this)">×</a></span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mr10 save_tag_all none" id="save_tag_all">
|
|
|
|
|
<input type="text" class="input_tag" id="input_tag"/>
|
|
|
|
|
<a class="blue_btn_big c_white ml10 fl mr20" href="javascript:void(0)" onclick="save_tag();">确定</a>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="javascript:void(0)" onclick="show_inputContent();" class="mb15 c_blue mt6 fl">+ 标签</a>
|
|
|
|
|
</div>
|
2018-02-05 15:13:03 +08:00
|
|
|
|
|
2018-02-06 17:41:39 +08:00
|
|
|
|
<div class="field cl">
|
|
|
|
|
<%#= f.label :label_attachment_plural %>
|
|
|
|
|
<label> </label>
|
|
|
|
|
<%= render :partial => 'attachments/form_statistic', :locals => {:container => @statistic, :isReply => @isReply} %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="actions cl mb20">
|
|
|
|
|
<%#= f.submit %>
|
|
|
|
|
<a class="blue_btn_big c_white fr mr45" onclick="$('#create_new_statis').submit()">保存</a>
|
|
|
|
|
<%= link_to '取消', statistics_path ,:class=>"grey_btn_big fr c_white mr10" %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
2018-02-07 16:01:14 +08:00
|
|
|
|
// 获取子类别
|
|
|
|
|
function get_sub_category(id) {
|
|
|
|
|
alert(id);
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: <%= get_sub_category_statistics_path %>,
|
|
|
|
|
type: 'get',
|
|
|
|
|
data: {main_category_id: id}
|
|
|
|
|
});
|
|
|
|
|
}
|
2018-02-06 17:41:39 +08:00
|
|
|
|
//删除标签
|
|
|
|
|
function tag_del(item){
|
|
|
|
|
$(item).parents(".tag_span").remove();
|
|
|
|
|
}
|
|
|
|
|
function save_tag(){
|
|
|
|
|
var value=$("#input_tag").val();
|
|
|
|
|
var html="";
|
|
|
|
|
if(value != ""){
|
|
|
|
|
html='<span class="tag_span">'+value+'<input type="hidden" value="'+value+'" class="tag_hide"><a class="tag_del ml3" onclick="tag_del(this)">×</a></span>';
|
|
|
|
|
}
|
|
|
|
|
$("#input_tag").val('');
|
|
|
|
|
$("#tag_modal").append(html);
|
|
|
|
|
$("#save_tag_all").addClass("none");
|
|
|
|
|
}
|
|
|
|
|
function show_inputContent(){
|
|
|
|
|
$("#save_tag_all").removeClass("none");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
|
$(".c_sort_input").live("focus",function(){
|
|
|
|
|
$(".c_sort_list").hide();
|
|
|
|
|
$(this).siblings(".c_sort_list").show();
|
|
|
|
|
})
|
|
|
|
|
$(".c_sort_list li").live("click",function(){
|
|
|
|
|
var p=$(this).parent(".c_sort_list");
|
|
|
|
|
var value=$(this).html().trim();
|
|
|
|
|
$(p).siblings(".c_sort_input").val(value);
|
|
|
|
|
$(".c_sort_list").hide();
|
|
|
|
|
})
|
|
|
|
|
$("body").live("click",function(e){
|
|
|
|
|
var idv=$(e.target).attr("id");
|
|
|
|
|
if(idv !="parent_down" && idv != "child_down"){
|
|
|
|
|
$(".c_sort_list").hide();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
</script>
|