diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 4def99075..f42865ead 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -175,8 +175,16 @@ class SoftapplicationsController < ApplicationController @softapplication.save_attachments(params[:attachments]) #@softapplication.deposit_project = params[:project] @softapplication.project = Project.find_by_id(params[:project]) + + @softapplication.name = params[:softapplication][:name] + @softapplication.android_min_version_available = params[:softapplication][:android_min_version_available] + @softapplication.app_type_name = params[:other_input] == "" ? params[:softapplication][:app_type_name] : params[:other_input] + @softapplication.description = params[:softapplication][:description] + @softapplication.application_developers = params[:softapplication][:application_developers] + #@softapplication.app_type_name = params[:other_input] if params[:other_input] != "" respond_to do |format| - if @softapplication.update_attributes(params[:softapplication]) + #if @softapplication.update_attributes(params[:softapplication]) + if @softapplication.save format.html { redirect_to @softapplication, notice: l(:notice_softapplication_was_successfully_updated) } format.json { head :no_content } else diff --git a/app/helpers/softapplications_helper.rb b/app/helpers/softapplications_helper.rb index 8bb5d0d1a..8d85e275f 100644 --- a/app/helpers/softapplications_helper.rb +++ b/app/helpers/softapplications_helper.rb @@ -13,6 +13,19 @@ module SoftapplicationsHelper content = content_tag('ul', content) content_tag('div', content, :class => "tabs") end + + #作品分类下拉框 + def work_type_opttion + type = [] + #work_types = WorksCategory.all + WorksCategory.all.each do |work_type| + option = [] + option << work_type.category + option << work_type.category + type << option + end + type + end # def select_option_helper option # tmp = Hash.new diff --git a/app/views/softapplications/_form.html.erb b/app/views/softapplications/_form.html.erb index fd946cfc5..d0f6b5bc6 100644 --- a/app/views/softapplications/_form.html.erb +++ b/app/views/softapplications/_form.html.erb @@ -1,3 +1,19 @@ + <%= form_for(softapplication) do |f| %> <% if softapplication.errors.any? %> @@ -17,7 +33,7 @@ <%= l(:label_work_name) %> * : <%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %> <%= l(:label_softapplication_name_condition)%> - +


@@ -25,16 +41,24 @@ <%= l(:label_running_platform) %> * : <%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %> - + +


<%= l(:label_work_type) %> - - * : <%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %> - - + * : + + <%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %> + <%= f.select :app_type_name,work_type_opttion, {},{:style => "width:410px;",:onchange => "selectChange(this)"} %> + + + +


@@ -42,7 +66,8 @@ <%= l(:label_work_description) %> * : <%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %> <%= l(:label_softapplication_description_condition)%> - + +


@@ -50,7 +75,8 @@ <%= l(:label_softapplication_developers) %> * : <%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %> - + +


@@ -58,7 +84,8 @@ <%= l(:label_work_deposit_project) %>: <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline3' %> <%#= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%> -
+ +


diff --git a/app/views/softapplications/edit.html.erb b/app/views/softapplications/edit.html.erb index 0be2fab3e..535de9917 100644 --- a/app/views/softapplications/edit.html.erb +++ b/app/views/softapplications/edit.html.erb @@ -2,7 +2,7 @@ <%= render partial: 'form', locals:{softapplication: @softapplication} %> - +