From 18ddb8604b48dd40a9d39e4c699d02d22d530f94 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 28 Jul 2014 14:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=8F=82=E8=B5=9B=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E5=90=8D=E7=A7=B0=E3=80=81=E6=8F=8F=E8=BF=B0=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=95=B0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 39 ++++--- .../contests/_new_softapplication.html.erb | 96 +++++++++++++++++ .../contests/show_attendingcontest.html.erb | 100 +----------------- config/locales/zh.yml | 1 + 4 files changed, 122 insertions(+), 114 deletions(-) create mode 100644 app/views/contests/_new_softapplication.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b6cd47924..dbc39f950 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -823,8 +823,11 @@ module ApplicationHelper def select_option_helper option tmp = Hash.new tmp={"" => ""} - option.each do |project| - tmp[project.name] = project.id + if option.nil? + else + option.each do |project| + tmp[project.name] = project.id + end end tmp end @@ -1168,25 +1171,27 @@ module ApplicationHelper objects = objects.first end # end - objects = objects.map {|o| o.is_a?(String) ? instance_variable_get("@#{o}") : o}.compact - errors = objects.map {|o| o.errors.full_messages}.flatten - if errors.any? - html << "
\n" end html.html_safe end diff --git a/app/views/contests/_new_softapplication.html.erb b/app/views/contests/_new_softapplication.html.erb new file mode 100644 index 000000000..830bcd314 --- /dev/null +++ b/app/views/contests/_new_softapplication.html.erb @@ -0,0 +1,96 @@ +<%#= error_messages_for 'softapplication' %> +<%= form_for Softapplication.new, :url => softapplications_path do |f| %> +
+ <%= hidden_field_tag 'contest_id', @contest.id %> + + <%= l(:label_work_name) %> + * : + <%= f.text_field :name, :required => true, :size => 60, :style => "width:350px;" %> + + +
+
+
+ + + <%= l(:label_running_platform) %> + * : + <%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %> + + +
+
+
+ + + <%= l(:label_work_type) %> + * : + + + <%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %> + + <%= f.select :app_type_name,work_type_opttion, {},{:style => "width:358px;",:onchange => "selectChange(this)"} %> + <%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %> + + + +
+
+
+ + + <%= l(:label_work_description) %> + * : + <%= f.text_field :description, :required => true, :size => 60, :style => "width:350px;" %> + + +
+
+
+ + + <%= l(:label_softapplication_developers) %> + * : + <%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %> + + +
+
+
+ + + <%= l(:label_work_deposit_project) %>: + <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %> + <%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %> + +
+
+
+ +
+ + <%= l(:label_upload_softworkpacket_photo) %> + + <%#= render_flash_messages %> +

+ <%= render :partial => 'attachments/form' %> +

+ +

+ 1、<%= l(:label_upload_softapplication_packets_mustpacketed) %>
+
+ 2、<%= l(:label_upload_softapplication_photo_condition) %> +

+ +
+

+
+ <%= submit_tag l(:button_create) %> + <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();", + :type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'", + :onmouseover => "this.style.backgroundPosition = 'left -30px'" %> +
+<% end %> \ No newline at end of file diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index f6b684e5f..415897492 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -88,7 +88,7 @@
<%= l(:label_attending_contest) %>: - <%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %> + <%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').slideToggle();" %>
<% else %> @@ -99,102 +99,8 @@ <% end %> -