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/admin_controller.rb b/app/controllers/admin_controller.rb
index f96cf66fb..ab3d7b120 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -23,6 +23,7 @@ class AdminController < ApplicationController
before_filter :require_admin
helper :sort
+ helper :Users
include SortHelper
def index
@@ -39,6 +40,121 @@ class AdminController < ApplicationController
render :action => "projects", :layout => false if request.xhr?
end
+ def users
+ @project_type = params[:project_type]
+ role = params[:role]
+
+ sort_init 'login', 'asc'
+ sort_update %w(login firstname lastname mail admin created_on last_login_on)
+
+ case params[:format]
+ when 'xml', 'json'
+ @offset, @limit = api_offset_and_limit({:limit => 15})
+ else
+ @limit = 15#per_page_option
+ end
+
+ @status = params[:status] || 1
+ has = {
+ "show_changesets" => true
+ }
+ # @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count
+
+ scope = UserStatus.visible
+ case role
+ when 'teacher'
+ scope = UserStatus.teacher
+ when 'student'
+ scope = UserStatus.student
+ else
+
+ end
+
+ scope = scope.in_group(params[:group_id]) if params[:group_id].present?
+ # scope.each do |user|
+ # UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id)
+ # end
+ @user_count = scope.count
+ @user_pages = Paginator.new @user_count, @limit, params['page']
+ #@offset ||= @user_pages.offset
+ #@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
+ @user_base_tag = params[:id] ? 'base_users':'base'
+ if params[:user_sort_type].present?
+ case params[:user_sort_type]
+ when '0'
+ @offset ||= @user_pages.reverse_offset
+ unless @offset == 0
+ @users_statuses = scope.offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @user_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @users_statuses = scope.offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 0
+ # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
+ # @projects = @projects[@offset, @limit]
+ when '1'
+ @offset ||= @user_pages.reverse_offset
+ unless @offset == 0
+ @users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @user_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 1
+ #sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
+ #@users = @users[@offset, @limit]
+ when '2'
+ @offset ||= @user_pages.reverse_offset
+ unless @offset == 0
+ @users_statuses = scope.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @user_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @users_statuses = scope.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 2
+ #@users = @users[@offset, @limit]
+ end
+
+ else
+ @offset ||= @user_pages.reverse_offset
+ unless @offset == 0
+ @users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @user_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 1
+ # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
+ # @projects = @projects[@offset, @limit]
+ end
+
+ @users = []
+ @users_statuses.each do |obj|
+ @users << User.find_by_id("#{obj.user_id}")
+ end
+
+
+ respond_to do |format|
+ format.html {
+ @groups = Group.all.sort
+ render :layout => @user_base_tag
+ }
+ format.api
+ end
+ end
+
def plugins
@plugins = Redmine::Plugin.all
end
diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb
index 1ca7ddcef..ee3af10ce 100644
--- a/app/controllers/open_source_projects_controller.rb
+++ b/app/controllers/open_source_projects_controller.rb
@@ -1,8 +1,8 @@
class OpenSourceProjectsController < ApplicationController
-
+
before_filter :find_osp, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
before_filter :require_master, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
-
+
helper :sort
include SortHelper
helper :apply_project_masters
@@ -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]
@@ -22,8 +23,10 @@ class OpenSourceProjectsController < ApplicationController
@os_project_count = @open_source_projects.count
@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
@@ -32,11 +35,11 @@ class OpenSourceProjectsController < ApplicationController
format.json { render json: @open_source_projects }
end
end
-
+
def master_apply
@apply = @open_source_project.apply_tips
@applicants = @open_source_project.applicants
-
+
respond_to do |format|
format.html {
render :layout => "base_opensource_p"
@@ -49,7 +52,7 @@ class OpenSourceProjectsController < ApplicationController
# GET /open_source_projects/1.json
def show
@open_source_project = OpenSourceProject.find(params[:id])
-
+
sort_init 'updated_at', 'desc'
sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at",
'replies' => "#{RelativeMemo.table_name}.replies_count",
@@ -63,9 +66,9 @@ class OpenSourceProjectsController < ApplicationController
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
- order(sort_clause).
+ order(sort_clause).
all
-
+
@bugs = @open_source_project.bugs.limit(6)
respond_to do |format|
@@ -75,26 +78,64 @@ 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
-def search
-
end
+ def showbug
+ @open_source_project = OpenSourceProject.find(params[:id])
+
+ sort_init 'updated_at', 'desc'
+ sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at",
+ 'replies' => "#{RelativeMemo.table_name}.replies_count",
+ 'updated_at' => "COALESCE (last_replies_relative_memos.created_at, #{RelativeMemo.table_name}.created_at)"
-# added by yiang 暴力添加,请绕道
-def showmemo
- @open_source_project = OpenSourceProject.find(params[:id])
+ @memo = RelativeMemo.new(:open_source_project => @open_source_project)
+ @topic_count = @open_source_project.bugs.count
+ @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
+ @memos = @open_source_project.bugs.
+ reorder("#{RelativeMemo.table_name}.sticky DESC").
+ includes(:last_reply).
+ limit(@topic_pages.per_page).
+ offset(@topic_pages.offset).
+ order(sort_clause).
+ all
- sort_init 'updated_at', 'desc'
- sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at",
+ respond_to do |format|
+ format.html {
+ render :layout => "base_opensource_p"
+ }
+ format.json { render json: @open_source_project }
+ end
+ end
+
+ # added by yiang 暴力添加,请绕道
+ def showmemo
+ @open_source_project = OpenSourceProject.find(params[:id])
+
+ sort_init 'updated_at', 'desc'
+ sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at",
'replies' => "#{RelativeMemo.table_name}.replies_count",
'updated_at' => "COALESCE (last_replies_relative_memos.created_at, #{RelativeMemo.table_name}.created_at)"
- @memo = RelativeMemo.new(:open_source_project => @open_source_project)
- @topic_count = @open_source_project.topics.count
- @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
- @memos = @open_source_project.topics.
+ @memo = RelativeMemo.new(:open_source_project => @open_source_project)
+ @topic_count = @open_source_project.topics.count
+ @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
+ @memos = @open_source_project.topics.
reorder("#{RelativeMemo.table_name}.sticky DESC").
includes(:last_reply).
limit(@topic_pages.per_page).
@@ -102,13 +143,14 @@ def showmemo
order(sort_clause).
all
- respond_to do |format|
- format.html {
- render :layout => "base_opensource_p"
- }
- format.json { render json: @open_source_project }
+ respond_to do |format|
+ format.html {
+ render :layout => "base_opensource_p"
+ }
+ format.json { render json: @open_source_project }
+ end
end
-end
+
# GET /open_source_projects/new
# GET /open_source_projects/new.json
def new
@@ -168,52 +210,51 @@ end
format.json { head :no_content }
end
end
-
+
def remove_condition
@app_dir = params[:app_dir]
@language = params[:language]
@created_at = params[:created_at]
redirect_to open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => @created_at, :name => params[:name])
end
-
+
def search
# per_page_option = 10
-#
+ #
# @open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
# @open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
-#
+ #
# @os_project_count = @open_source_projects.count
# @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)
redirect_to open_source_projects_path(:name => params[:name])
end
-
+
def refuse_master_apply
@apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id)
@apply.first.destory
-
+
redirect_to master_apply_open_source_project_path
end
-
+
def accept_master_apply
@apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id)
if @apply.count == 1
- @apply.first.update_attributes(:status => 2)
+ @apply.first.update_attributes(:status => 2)
end
-
+
redirect_to master_apply_open_source_project_path
end
-
-
+
private
-
+
def require_master
render_403 unless @open_source_project.admin?(User.current)
end
-
+
def find_osp
@open_source_project = OpenSourceProject.find(params[:id])
render_404 unless @open_source_project.present?
diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb
index 0623dbee2..ec3e5cbdb 100644
--- a/app/controllers/test_controller.rb
+++ b/app/controllers/test_controller.rb
@@ -1,6 +1,9 @@
class TestController < ApplicationController
helper :UserScore
+ layout 'bootstrap_base'
+
+ def bootstrap; end
def zip
homeworks_attach_path = []
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 6174e2124..19c84cc33 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -67,7 +67,7 @@ class UsersController < ApplicationController
if User.current.admin?
@memberships = @user.memberships.all
else
- cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1"
+ cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
@memberships = @user.memberships.all(:conditions => cond)
end
events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
@@ -565,7 +565,7 @@ class UsersController < ApplicationController
end
def watch_projects
- @watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and user_id = ?", '1','Project', @user.id)
+ @watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and watchers.user_id = ?", '1','Project', @user.id)
@state = 1
respond_to do |format|
format.html {
@@ -782,7 +782,7 @@ class UsersController < ApplicationController
end
def setting_layout(default_base='base_users')
- User.current.admin? ? 'base_admin' : default_base
+ User.current.admin? ? default_base : default_base
end
# 必填自己的工作单位,其实就是学校
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ca946bf7d..fd1f6f162 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1338,9 +1338,22 @@ module ApplicationHelper
def hubspot_head
tags = javascript_include_tag('hubspot/messenger.min', 'hubspot/messenger-theme-future')
tags << stylesheet_link_tag('hubspot/messenger', 'hubspot/messenger-theme-future', 'hubspot/messenger-theme-flat')
- unless User.current.pref.warn_on_leaving_unsaved == '0'
- tags << "\n".html_safe + javascript_tag("$(window).load(function(){ warnLeavingUnsaved('#{escape_javascript l(:text_warn_on_leaving_unsaved)}'); });")
- end
+ end
+
+ def bootstrap_head
+ tags = stylesheet_link_tag('bootstrap/bootstrap.min', 'bootstrap/bootstrap-theme.min')
+ tags << javascript_include_tag('bootstrap/affix')
+ tags << javascript_include_tag('bootstrap/alert')
+ tags << javascript_include_tag('bootstrap/button')
+ tags << javascript_include_tag('bootstrap/carousel')
+ tags << javascript_include_tag('bootstrap/collapse')
+ tags << javascript_include_tag('bootstrap/dropdown')
+ tags << javascript_include_tag('bootstrap/modal')
+ tags << javascript_include_tag('bootstrap/popover')
+ tags << javascript_include_tag('bootstrap/scrollspy')
+ tags << javascript_include_tag('bootstrap/tab')
+ tags << javascript_include_tag('bootstrap/tooltip')
+ tags << javascript_include_tag('bootstrap/transition')
tags
end
@@ -1610,6 +1623,13 @@ module ApplicationHelper
def render_dynamic_nav
home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'}
+ home_link = "
+ <%= link_to l(:label_user_new), new_user_path, :class => 'icon icon-add' %>
+
+
+
<% if memos.any? %>
@@ -18,12 +18,12 @@
<% if topic.url.nil? || topic.url == '' %>
<%= link_to h(topic.subject), open_source_project_relative_memo_path(open_source_project, topic) %>
<% else %>
- <%= link_to h(topic.subject), topic.url %>
+ <%= link_to h(topic.subject), topic.url, :target => '_blank' %>
<% end %>
- <%= link_to (topic.replies_count), open_source_project_relative_memo_path(open_source_project, topic) %> |
+ <%= link_to (topic.replies_count), topic.url, :target => '_blank' %> |
回帖 |
@@ -33,7 +33,7 @@
- <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %> |
+ <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %> |
关注 |
@@ -43,7 +43,7 @@
- <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %> |
+ <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %> |
浏览 |
@@ -51,17 +51,16 @@
|
- |
+ |
- <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
+ | <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
|
- 帖子来源:<%=link_to 'OSChina', topic.url %>
+ | 帖子来源:<%=link_to 'OSChina', topic.url %>
|
- <%= no_use_link(topic, User.current) %> |
diff --git a/app/views/open_source_projects/_show_topics.html.erb b/app/views/open_source_projects/_show_topics.html.erb
index 3ba463944..38f689244 100644
--- a/app/views/open_source_projects/_show_topics.html.erb
+++ b/app/views/open_source_projects/_show_topics.html.erb
@@ -5,12 +5,13 @@
-
+
<%= javascript_include_tag "ichart.1.2.min" %>
<%= stylesheet_link_tag "sec-analysis.css" %>
<%= stylesheet_link_tag "buglist-ichart.css" %>
<%= stylesheet_link_tag "buglist.css" %>
+
@@ -20,33 +21,63 @@
- 项目安全态势 <%= link_to "更多 >>", :controller => "open_source_projects",:action => "showmemo", :id => @open_source_project.id %>
-
-
-
- <% @bugs.each do |bug| %>
- - >[<%= show_description(bug, open_source_project) %>]<%= link_to bug.subject, bug.url %>
- <% end %>
+ 项目安全态势 <%= link_to "更多 >>", :controller => "open_source_projects",:action => "showbug", :id => @open_source_project.id %>
-
+<% if @open_source_project.id ==42 then %>
+
+
+
+
+
+ 聚焦:
+ 栈溢出
+ 远程权限
+ 框架安全
-
+
-
+<% elsif @open_source_project.id ==70 then %>
-
+
+
+
+
+ 聚焦:
+ Kernel安全
+ 函数漏洞
+ ping_init_sock()
+
-
+<% elsif @open_source_project.id ==17 then %>
-
+
+
+
+
+ 聚焦:
+ Heartbleed
+ 致命漏洞
+
-
+<% elsif @open_source_project.id ==55 then %>
-
+
+
+
+
+ 聚焦:
+ DDos攻击
+ 信息泄露
+
-
+<%end%>
-
+
+
+
+ <% @bugs.each do |bug| %>
+ - >[<%= show_description(bug, open_source_project) %>]<%= link_to bug.subject, bug.url, :target => '_blank' %>
+ <% end %>
@@ -61,8 +92,6 @@
// t.push(Math.floor(Math.random()*(30+((i%12)*5)))+10);
}
-
-
var data = [
{
name :'',
@@ -127,7 +156,7 @@
parseText:function(tip,name,value,text,i){
return name+"漏洞数:"+value;
}
- } ,
+ }
},
tipMocker:function(tips,i){
@@ -143,18 +172,7 @@
labels[index]+" "+//日期
((i%12)==0?"1 月":((i%12+1))+"月")+ //时间
" "+tips.join(" ");
- },
-
- // legend : {
- // enable : true,
- // row:1,//设置在一行上显示,与column配合使用
- // column : 'max',
- // valign:'top',
- // sign:'bar',
- // background_color:null,//设置透明背景
- // offsetx:-80,//设置x轴偏移,满足位置需要
- // border : true
- // },
+ },
crosshair:{
enable:true, //十字交叉线
line_color:'#62bce9'
@@ -194,8 +212,7 @@
start_scale:0,
scale_space:50,
end_scale:70,
- scale_color:'#9f9f9f',
- // label : {color:'#ffffff',fontsize:11},
+ scale_color:'#9f9f9f'
},{
position:'bottom',
@@ -203,35 +220,10 @@
}]
}
});
- //开始画图
- /**
-*自定义组件,画平均线。
-*/
-// line.plugin(new iChart.Custom({
-// drawFn:function(){
-// /**
-// *计算平均值的高度(坐标Y值)
-// *计算高度还不会! 会划线了!
-// */
-// // var avg = line.total/5,
-// // coo = line.getCoordinate(),
-// // x = coo.get('originx'),
-// // W = coo.width,
-// // S = coo.getScale('left'),
-// // H = coo.height,
-// // h = (avg - S.start) * H / S.distance,
-// // y = line.y + H - h;
-// line.target.line(28,97,400,97,2,'#b32c0d')
-// .textAlign('start')
-// .textBaseline('middle')
-// .textFont('600 12px Verdana');
-// }
-// }));
line.draw();
});
- //]]>
@@ -282,10 +274,7 @@
// t.push(Math.floor(Math.random()*(30+((i%12)*5)))+10);
}
-
-
-
- var data = [
+ var data = [
{
name : '',
value:flow,
@@ -297,16 +286,9 @@
//创建x轴标签文本
var date = new Date()
-
var labels = [];
- /* labels.push(date.getFullYear()-2);
- labels.push(date.getFullYear()-1);
- labels.push(date.getFullYear());
- labels.push(date.getFullYear()+1);*/
labels=["2012","","","","","","","","","","","","2013","","","","","","","","","","","","2014","","","",""];
-
-
var line = new iChart.LineBasic2D({
render : 'canvasDiv2',
data: data,
@@ -352,7 +334,7 @@
parseText:function(tip,name,value,text,i){
return name+"帖子数:"+value+"万";
}
- } ,
+ }
},
tipMocker:function(tips,i){
@@ -378,10 +360,9 @@
label:false, //是否显示数值
// hollow_inside:false,
smooth : true,//平滑曲线
- point_size:2, // 焦点大小
+ point_size:2 // 焦点大小
// point_hollow : true,
-
-
+
},
coordinate:{
width:225, // 图表大小
@@ -404,7 +385,7 @@
start_scale:0,
scale_space:50,
end_scale:70,
- scale_color:'#9f9f9f',
+ scale_color:'#9f9f9f'
// label : {color:'#ffffff',fontsize:11},
},{
@@ -435,11 +416,11 @@
- <%= link_to h(topic.subject), topic.url %> |
+ <%= link_to h(topic.subject), topic.url, :target => '_blank' %> |
- <%= link_to (topic.replies_count), open_source_project_relative_memo_path(open_source_project, topic) %> |
+ <%= link_to (topic.replies_count), topic.url, :target => '_blank' %> |
回帖 |
@@ -449,7 +430,7 @@
- <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %> |
+ <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %> |
关注 |
@@ -459,7 +440,7 @@
- <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %> |
+ <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %> |
浏览 |
@@ -467,17 +448,16 @@
|
- |
+ |
-
+
- 帖子来源:<%=link_to 'OSChina', topic.url %>
+ | 帖子来源:<%=link_to 'OSChina', topic.url %>
|
- <%= no_use_link(topic, User.current) %> |
|
diff --git a/app/views/open_source_projects/allbug.html.erb b/app/views/open_source_projects/allbug.html.erb
new file mode 100644
index 000000000..d5c0c2e55
--- /dev/null
+++ b/app/views/open_source_projects/allbug.html.erb
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+ 共有 <%= link_to @bug_count %> 个安全贴子
+
+
+ <% if @bugs.any? %>
+ <% @bugs.each do |bug| %>
+ <% topic = bug.bug %>
+
+
+ <%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%>
+ <%= image_tag('../images/avatars/User/0', :class => "avatar") unless topic.author%> |
+
+
+
+
+ <% if topic.url.nil? || topic.url == '' %>
+ <%= link_to h(topic.subject), open_source_project_relative_memo_path(bug.open_source_project, topic) %>
+ <% else %>
+ <%= link_to h(topic.subject), topic.url, :target => '_blank' %>
+ <% end %> |
+
+
+
+ <%= link_to (topic.replies_count), topic.url, :target => '_blank' %> |
+
+
+ 回帖 |
+
+ |
+
+
+
+
+ <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %> |
+
+
+ 关注 |
+
+ |
+
+
+
+
+ <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %> |
+
+
+ 浏览 |
+
+ |
+
+
+ <%= topic.short_content(100) %> |
+
+
+ <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
+
+ |
+
+
+ 帖子来源:<%=link_to topic.topic_resource, topic.url, :target => '_blank' %>
+ |
+
+
+
+
+ |
+
+
+
+
+ <% end %>
+
+ <% else %>
+
+ <%= l(:label_no_data) %>
+
+ <% end %>
+
+
+<%#= render :partial => 'open_source_projects/show_memo', :locals => {:memos => @memos, :open_source_project => @open_source_project} %>
+
\ No newline at end of file
diff --git a/app/views/open_source_projects/index.html.erb b/app/views/open_source_projects/index.html.erb
index e51ef4fc1..99e34333f 100644
--- a/app/views/open_source_projects/index.html.erb
+++ b/app/views/open_source_projects/index.html.erb
@@ -48,7 +48,7 @@
background-position: -266px 3px;
}
.navigation .icon-search, .navigation .nav-pill-cancle, .navigation .nav-switch-icon, .navigation .nav-topbar .topbar-search .topbar-submit, .navigation .nav-topbar-arror {
- background: url();
+ /*background: url()*/
}
.nav-switch-icon {
width: 15px;
@@ -129,8 +129,6 @@ li {
.nav-search-con{
padding-top: 7px;
}
-
-
<%= javascript_include_tag "ichart.1.2.min" %>
<%= stylesheet_link_tag "buglist-div-use.css" %>
@@ -146,29 +144,13 @@ li {
-
+ 软件安全态势<%= 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')
diff --git a/app/views/open_source_projects/show.html.erb b/app/views/open_source_projects/show.html.erb
index d1751dec8..ec9d521d5 100644
--- a/app/views/open_source_projects/show.html.erb
+++ b/app/views/open_source_projects/show.html.erb
@@ -32,7 +32,7 @@
<% #= 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',
+ <%#= 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? %>
diff --git a/app/views/open_source_projects/showbug.html.erb b/app/views/open_source_projects/showbug.html.erb
new file mode 100644
index 000000000..679e06f89
--- /dev/null
+++ b/app/views/open_source_projects/showbug.html.erb
@@ -0,0 +1,49 @@
+
+
+ <%=l(:label_memo_new)%>
+ <% if User.current.logged? %>
+ <%= labelled_form_for(@memo, :url => open_source_project_relative_memos_path(@open_source_project), :html => {:multipart => true} ) do |f| %>
+ <% if @memo.errors.any? %>
+
+ <%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:
+
+
+ <% @memo.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
+
+ <%= f.text_field :subject, :required => true%>
+ <%= f.text_area :content, :required => true, :id => 'editor02' %>
+
+
+
+ <%#= l(:label_attachment_plural) %>
+ <%#= render :partial => 'attachments/form', :locals => {:container => @memo} %>
+
+ <%= f.submit :value => l(:label_memo_create) %>
+ <%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
+
+ <% end %>
+<% end %>
+
+
+
+ <%#= link_to(
+ image_tag('edit.png')+l(:label_forum_edit),
+ {:action => 'edit', :id => @forum},
+ :method => 'get',
+ :title => l(:button_edit)
+ ) if @forum.editable_by?(User.current) %>
+ <%#= link_to(
+ image_tag('delete.png')+'删除讨论区',
+ {:action => 'destroy', :id => @forum},
+ :method => :delete,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:button_delete)
+ ) if @forum.destroyable_by?(User.current) %>
+
+<%= render :partial => 'open_source_projects/show_bug', :locals => {:memos => @memos, :open_source_project => @open_source_project} %>
+
\ No newline at end of file
diff --git a/app/views/open_source_projects/showmemo.html.erb b/app/views/open_source_projects/showmemo.html.erb
index 387237113..7c3bd5c31 100644
--- a/app/views/open_source_projects/showmemo.html.erb
+++ b/app/views/open_source_projects/showmemo.html.erb
@@ -51,5 +51,6 @@
:title => l(:button_delete)
) if @forum.destroyable_by?(User.current) %>
+
<%= render :partial => 'open_source_projects/show_memo', :locals => {:memos => @memos, :open_source_project => @open_source_project} %>
\ No newline at end of file
diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb
index 297f813df..4891cc233 100644
--- a/app/views/tags/_tag_name.html.erb
+++ b/app/views/tags/_tag_name.html.erb
@@ -1,100 +1,100 @@
<% @tags = obj.reload.tag_list %>
<% if non_list_all and (@tags.size > 0) %>
-
-<% if @tags.size > Setting.show_tags_length.to_i then %>
-<% i = 0 %>
+
+ <% if @tags.size > Setting.show_tags_length.to_i then %>
+ <% i = 0 %>
-<% until i>Setting.show_tags_length.to_i do %>
-
- <%= link_to @tags[i], :controller => "tags",:action => "index",:q => @tags[i],:object_flag => object_flag,:obj_id => obj.id %>
-
-<% i += 1%>
-<% end %>
+ <% until i>Setting.show_tags_length.to_i do %>
+
+ <%= link_to @tags[i], :controller => "tags", :action => "index", :q => @tags[i], :object_flag => object_flag, :obj_id => obj.id %>
+
+ <% i += 1 %>
+ <% end %>
-<%= link_to l(:label_more_tags),:action => "show",:id => obj.id %>
+ <%= link_to l(:label_more_tags), :action => "show", :id => obj.id %>
-<% else %>
+ <% else %>
-<% @tags.each do |tag| %>
-
- <%= link_to tag,:controller => "tags",:action => "index",:q=>tag,:object_flag => object_flag,:obj_id => obj.id %>
-
-<% end %>
+ <% @tags.each do |tag| %>
+
+ <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
+
+ <% end %>
-<% end %>
+ <% end %>
<% else %>
-
-<% if @tags.size > 0 %>
-<% @tags.each do |tag| %>
-
- <%= link_to tag,:controller => "tags",:action => "index",:q=>tag ,:object_flag => object_flag,:obj_id => obj.id %>
-
- <% case object_flag %>
- <% when '1'%>
+
+ <% if @tags.size > 0 %>
+ <% @tags.each do |tag| %>
+
+ <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
+
+ <% case object_flag %>
+ <% when '1' %>
<% if User.current.eql?(obj) %>
- <%= link_to 'x',:controller => "tags",:action => "remove_tag",:remote => true,:tag_name => tag,
- :taggable_id => obj.id,:taggable_type => object_flag %>
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ :taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
<% when '2' %>
<% if (ProjectInfo.find_by_project_id(obj.id)).user_id == User.current.id %>
- <%= link_to 'x',:controller => "tags",:action => "remove_tag",:remote => true,:tag_name => tag,
- :taggable_id => obj.id,:taggable_type => object_flag %>
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ :taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
<% when '3' %>
<% if (ProjectInfo.find_by_project_id(obj.project_id)).user_id == User.current.id %>
- <%= link_to 'x',:controller => "tags",:action => "remove_tag",:remote => true,:tag_name => tag,
- :taggable_id => obj.id,:taggable_type => object_flag %>
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ :taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
- <% when '4'%>
+ <% when '4' %>
<% if obj.author_id == User.current.id %>
- <%= link_to 'x',:controller => "tags",:action => "remove_tag",:remote => true,:tag_name => tag,
- :taggable_id => obj.id,:taggable_type => object_flag %>
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ :taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
- <% when '6'%>
- <% if ( User.current.logged? &&
- User.current.admin?
- # && (@project && User.current.member_of?(@project))
- )
- %>
- <%= link_to 'x',:controller => "tags",:action => "remove_tag",:remote => true,:tag_name => tag,
- :taggable_id => obj.id,:taggable_type => object_flag %>
+ <% when '6' %>
+ <% if (User.current.logged? &&
+ User.current.admin?
+ # && (@project && User.current.member_of?(@project))
+ )
+ %>
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ :taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
- <% when '7'%>
+ <% when '7' %>
<% if obj.author_id == User.current.id %>
- <%= link_to 'x',:controller => "tags",:action => "remove_tag",:remote => true,:tag_name => tag,
- :taggable_id => obj.id,:taggable_type => object_flag %>
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ :taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
<% end %>
-
-<% end %>
-<% else %>
-
+
+ <% end %>
+ <% else %>
+
<%= l(:label_tags_no) %>
-<% end %>
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/test/bootstrap.html.erb b/app/views/test/bootstrap.html.erb
new file mode 100644
index 000000000..56c1d11bf
--- /dev/null
+++ b/app/views/test/bootstrap.html.erb
@@ -0,0 +1 @@
+<%= image_tag "http://image227.poco.cn/mypoco/myphoto/20140516/17/5527437020140516173219035.png", class: "img-responsive" %>
\ No newline at end of file
diff --git a/app/views/test/courselist.html.erb b/app/views/test/courselist.html.erb
index 959d6a4be..e11c16fad 100644
--- a/app/views/test/courselist.html.erb
+++ b/app/views/test/courselist.html.erb
@@ -1,42 +1,54 @@
-
-<% @courses.each do |course| %>
-
- <%= course.name %>
+
+ Well done! You successfully read this important alert message.
+
+
+ Heads up! This alert needs your attention, but it's not super important.
+
+
+ Warning! Best check yo self, you're not looking too good.
+
+
+ Oh snap! Change a few things up and try submitting again.
+
+
+ | | | |