diff --git a/app/controllers/statistics_controller.rb b/app/controllers/statistics_controller.rb index 310aa4c90..2de38c25b 100644 --- a/app/controllers/statistics_controller.rb +++ b/app/controllers/statistics_controller.rb @@ -32,7 +32,7 @@ class StatisticsController < ApplicationController # GET /statistics/new.json def new @statistic = Statistic.new - + @sub_categories = @main_categories.first.sub_categories respond_to do |format| format.html # new.html.erb format.json { render json: @statistic } @@ -89,6 +89,8 @@ class StatisticsController < ApplicationController end def get_sub_category + main_category = MainCategory.find(params[:main_category_id]) + @sub_categories = main_category.sub_categories respond_to do |format| format.js end diff --git a/app/views/statistics/_form.html.erb b/app/views/statistics/_form.html.erb index 30c2588d4..f476f353c 100644 --- a/app/views/statistics/_form.html.erb +++ b/app/views/statistics/_form.html.erb @@ -21,6 +21,7 @@ <%= f.select :main_category_id, (@main_categories.collect { |mc| [mc.name, mc.id] }), {:no_label => true}, :onchange => 'getSubCategory(this.options[this.options.selectedIndex].value)', :class => "w150" %> + <%#= f.text_field :description %> @@ -28,30 +29,29 @@ - - - - - - +
+ <%= f.select :sub_category_id, (@sub_categories.collect { |mc| [mc.name, mc.id] }), + {:no_label => true}, :class => "w150" %> + <%#= render :partial => "statistics/sub_category", :locals => { :f => f } %> +
<%#= f.number_field :user_id %>
-
- - <%#= f.number_field :status %> -
- 数据结构× -
-
- - 确定 -
- + 标签 -
+ + + + + + + + + + + +
<%#= f.label :label_attachment_plural %> @@ -69,6 +69,7 @@