From b1251db30cce850f5ed41cb3e6daf80e44a36722 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 21 Jul 2014 17:23:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E7=AB=9E=E8=B5=9B=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E6=97=B6=E5=A2=9E=E5=8A=A0=E4=BD=9C=E5=93=81=E7=B1=BB?= =?UTF-8?q?=E5=88=AB=E4=B8=8B=E6=8B=89=E6=A1=86=E9=80=89=E6=8B=A9=202.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AB=9E=E8=B5=9B=E4=BD=9C=E5=93=81=E6=97=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96=E9=80=89=E6=8B=A9=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E6=97=B6=E4=BD=9C=E5=93=81=E7=B1=BB=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../softapplications_controller.rb | 10 ++++- app/helpers/softapplications_helper.rb | 13 ++++++ app/views/softapplications/_form.html.erb | 45 +++++++++++++++---- app/views/softapplications/edit.html.erb | 4 +- 4 files changed, 60 insertions(+), 12 deletions(-) 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) %> * :