diff --git a/Gemfile b/Gemfile index bfc0b773f..7ff3df60c 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,18 @@ gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "builder", "3.0.0" gem 'acts-as-taggable-on' +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer', :platforms => :ruby + + gem 'uglifier', '>= 1.0.3' +end + # Optional gem for LDAP authentication group :ldap do gem "net-ldap", "~> 0.3.1" diff --git a/Gemfile.lock b/Gemfile.lock index 54d89f381..3486c743b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,7 +40,16 @@ GEM arel (3.0.2) builder (3.0.0) coderay (1.0.9) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.6.1) erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) fastercsv (1.5.0) hike (1.2.3) i18n (0.6.1) @@ -86,6 +95,11 @@ GEM rdoc (3.12.2) json (~> 1.4) ruby-openid (2.1.8) + sass (3.2.7) + sass-rails (3.2.6) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -97,6 +111,9 @@ GEM polyglot polyglot (>= 0.3.1) tzinfo (0.3.37) + uglifier (1.0.3) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) PLATFORMS x86-mingw32 @@ -107,6 +124,7 @@ DEPENDENCIES acts-as-taggable-on builder (= 3.0.0) coderay (~> 1.0.6) + coffee-rails (~> 3.2.1) fastercsv (~> 1.5.0) i18n (~> 0.6.0) jquery-rails (~> 2.0.2) @@ -116,4 +134,6 @@ DEPENDENCIES rails (= 3.2.13) rdoc (>= 2.4.2) ruby-openid (~> 2.1.4) + sass-rails (~> 3.2.3) seems_rateable! + uglifier (>= 1.0.3) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index e7490f5b0..b51a11436 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -5,7 +5,8 @@ class ContestsController < ApplicationController menu_item :project, :only => :show_project menu_item :application, :only => :show_softapplication menu_item :attendingcontest, :only => :show_attendingcontest - before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, + menu_item :contestnotification, :only => :show_notification + before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :show_notification, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, :show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] # added by fq @@ -355,6 +356,17 @@ class ContestsController < ApplicationController end ###end + +def show_notification + @contest = Contest.find_by_id(params[:id]) + respond_to do |format| + format.html { + render :layout => 'base_newcontest' + } + format.api + end +end + def set_reward_project @c_p = nil diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb index 7b9333647..ee3af10ce 100644 --- a/app/controllers/open_source_projects_controller.rb +++ b/app/controllers/open_source_projects_controller.rb @@ -12,6 +12,7 @@ class OpenSourceProjectsController < ApplicationController # GET /open_source_projects # GET /open_source_projects.json def index + @app_dir = params[:app_dir] @language = params[:language] @created_at = params[:created_at] @@ -24,6 +25,8 @@ class OpenSourceProjectsController < ApplicationController @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page'] @open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page) + + @bugs = BugToOsp.order('created_at desc').limit(8) # @open_source_projects = OpenSourceProject.all @@ -75,6 +78,19 @@ class OpenSourceProjectsController < ApplicationController format.json { render json: @open_source_project } end end + + def allbug + @bugs = BugToOsp.visible + + @bug_count = @bugs.count + @bug_pages = Paginator.new @bug_count, per_page_option, params['page'] + @bugs = @bugs.includes(:bug).reorder("#{RelativeMemo.table_name}.created_at DESC").limit(@bug_pages.per_page).offset(@bug_pages.offset).all + + respond_to do |format| + format.html + format.json { render json: @open_source_project } + end + end def search diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 31675ca5d..b8d81b108 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -47,7 +47,7 @@ class SoftapplicationsController < ApplicationController def show @softapplication = Softapplication.find(params[:id]) - @project = Project.find_by_identifier(@softapplication.deposit_project) + @project = @softapplication.project # 打分统计 stars_reates = @softapplication. rates(:quality) @@ -142,13 +142,16 @@ class SoftapplicationsController < ApplicationController def create @softapplication = Softapplication.new(params[:softapplication]) @softapplication.user = User.current - @softapplication.deposit_project = params[:project] + #@softapplication.deposit_project = params[:project] + @softapplication.project = Project.find_by_id(params[:project]) @softapplication.save_attachments(params[:attachments]) respond_to do |format| if @softapplication.save ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id) + #ProjectingSoftapplication.create_softapplication_projecting(:project_id => params[:project_id], :softapplication_id => @softapplication.id) + #ProjectingSoftapplication.create_softapplication_projecting(@project.id, softapplication.id) format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) } # format.json { render json: @softapplication, status: :created, location: @softapplication } else @@ -170,7 +173,8 @@ class SoftapplicationsController < ApplicationController # @softapplication = Softapplication.find(params[:id]) @softapplication.attachments.map{|attach| attach.destroy } @softapplication.save_attachments(params[:attachments]) - @softapplication.deposit_project = params[:project] + #@softapplication.deposit_project = params[:project] + @softapplication.project = Project.find_by_id(params[:project]) respond_to do |format| if @softapplication.update_attributes(params[:softapplication]) format.html { redirect_to @softapplication, notice: l(:notice_softapplication_was_successfully_updated) } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 76da3b684..fd1f6f162 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -745,7 +745,7 @@ module ApplicationHelper tmp = Hash.new tmp={"" => ""} option.each do |project| - tmp[project.name] = project.identifier + tmp[project.name] = project.id end tmp end diff --git a/app/helpers/open_source_projects_helper.rb b/app/helpers/open_source_projects_helper.rb index f1c1cd35e..dfc7cc8d0 100644 --- a/app/helpers/open_source_projects_helper.rb +++ b/app/helpers/open_source_projects_helper.rb @@ -46,4 +46,12 @@ module OpenSourceProjectsHelper end description end + + def show_description_of_bug(bug) + description = bug.description + if description.nil? || description == '' + description = bug.open_source_project.name + l(:label_bug) + end + description + end end diff --git a/app/models/bug_to_osp.rb b/app/models/bug_to_osp.rb index 5471bd3f9..9cd1d7359 100644 --- a/app/models/bug_to_osp.rb +++ b/app/models/bug_to_osp.rb @@ -5,4 +5,8 @@ class BugToOsp < ActiveRecord::Base validates_presence_of :osp_id, :relative_memo_id + scope :visible, lambda {|*args| + nil + } + end diff --git a/app/models/softapplication.rb b/app/models/softapplication.rb index 5e1e1bd50..f7eed43fc 100644 --- a/app/models/softapplication.rb +++ b/app/models/softapplication.rb @@ -6,10 +6,11 @@ class Softapplication < ActiveRecord::Base has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :contesting_softapplications, :dependent => :destroy - has_many :projecting_softapplications, :dependent => :destroy + #has_many :projecting_softapplications, :dependent => :destroy belongs_to :user belongs_to :project has_many :contests, :through => :contesting_softapplications + belongs_to :project def add_jour(user, notes, reference_user_id = 0, options = {}) if options.count == 0 diff --git a/app/views/contests/_list_softapplications.html.erb b/app/views/contests/_list_softapplications.html.erb index 9b99b675c..89e8a3172 100644 --- a/app/views/contests/_list_softapplications.html.erb +++ b/app/views/contests/_list_softapplications.html.erb @@ -4,7 +4,7 @@
帖子来源:<%=link_to topic.topic_resource, topic.url %> + | 帖子来源:<%=link_to topic.topic_resource, topic.url, :target => '_blank' %> | <%= no_use_link(topic, User.current) %> |
+ <%= pagination_links_full @bug_pages, @bug_count %>
+
+ <% else %>
+ + <%= l(:label_no_data) %> + + <% end %> +
-
-
-<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
-
- <%= link_to l(:label_memo_new_from_forum), new_open_source_project_relative_memo_path(@open_source_project), :class => 'icon icon-add',
- :onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
-
软件安全漏洞More >>软件安全态势<%= link_to '更多 >>', allbug_open_source_projects_path %>
+
@@ -236,7 +218,7 @@ li {
parseText:function(tip,name,value,text,i){
return name+"漏洞数:"+value;
}
- } ,
+ }
},
tipMocker:function(tips,i){
var index;
@@ -272,7 +254,7 @@ li {
label:false, //是否显示数值
// hollow_inside:false,
smooth : true,//平滑曲线
- point_size:2, // 焦点大小
+ point_size:2 // 焦点大小
// point_hollow : true,
@@ -298,7 +280,7 @@ li {
start_scale:0,
scale_space:50,
end_scale:70,
- scale_color:'#9f9f9f',
+ scale_color:'#9f9f9f'
// label : {color:'#ffffff',fontsize:11},
},{
@@ -417,7 +399,7 @@ line.target.line(28,97,400,97,2,'#b32c0d')
<%#= link_to(
diff --git a/app/views/softapplications/_form.html.erb b/app/views/softapplications/_form.html.erb
index 4703af9be..fd946cfc5 100644
--- a/app/views/softapplications/_form.html.erb
+++ b/app/views/softapplications/_form.html.erb
@@ -65,7 +65,7 @@
<%= render :partial => 'attachments/form' %> diff --git a/app/views/softapplications/index.html.erb b/app/views/softapplications/index.html.erb index 841a8a207..5b355f65c 100644 --- a/app/views/softapplications/index.html.erb +++ b/app/views/softapplications/index.html.erb @@ -16,13 +16,13 @@ <%= softapplication.description.truncate(95, omission: '...') %>
<%contest = softapplication.contests.first%>
-
所属竞赛:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%> -所属类别:<%= softapplication.app_type_name.truncate(10, omission: '...') %> -系统支持:<%= softapplication.android_min_version_available %> +<%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%> +<%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(10, omission: '...') %> +<%=l(:label_attendingcontestwork_adaptive_system)%>:<%= softapplication.android_min_version_available %>
- 开发人员:<%= softapplication.application_developers %>
- 发布时间:<%=format_time softapplication.created_at %>
+ <%=l(:label_attendingcontestwork_developers)%>:<%= softapplication.application_developers %>
+ <%=l(:label_attendingcontestwork_release_time)%>:<%=format_time softapplication.created_at %>
diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb
index 8b9b3260d..e41ecb842 100644
--- a/app/views/softapplications/show.html.erb
+++ b/app/views/softapplications/show.html.erb
@@ -16,38 +16,35 @@
所属类别:<%= @softapplication.app_type_name %> |
+ <%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %> |
<% contest = @softapplication.contests.first %>
- 所属竞赛:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %> |
+ <%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %> |
发布人员:<%= @softapplication.user.name %> |
- 系统支持:<%= @softapplication.android_min_version_available %> |
+ <%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %> |
+ <%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %> |
- 作品下载:
+ <%=l(:label_attendingcontestwork_download)%>:
<% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %>
|
- 开发人员:<%= @softapplication.application_developers %> |
+ <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %> |
平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> |
- 发布时间:<%=format_time @softapplication.created_at %> |
+ <%=l(:label_attendingcontestwork_average_scores)%>: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> |
+ <%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %> |
- <% if (@softapplication.deposit_project != "nil" && @softapplication.deposit_project != "") %>
- <%#= textilizable ("托管项目: " + @project.name) %>
- 托管项目:<%= link_to "#@project", project_path(@project.id) %>
- <% end %>
+ <% if @project %>
+ <%=l(:label_attendingcontestwork_deposit_project)%>:<%= link_to "#@project", project_path(@project) %>
+ <% end %>
|
|
@@ -56,7 +53,7 @@