<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%> |
diff --git a/app/views/layouts/base_opensource_p.html.erb b/app/views/layouts/base_opensource_p.html.erb
index dc5efe05c..df05d4f75 100644
--- a/app/views/layouts/base_opensource_p.html.erb
+++ b/app/views/layouts/base_opensource_p.html.erb
@@ -103,7 +103,7 @@
@@ -114,10 +114,10 @@
-
+ %>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
diff --git a/app/views/open_source_projects/_os_project.html.erb b/app/views/open_source_projects/_os_project.html.erb
index 010b4fb54..133f6c4cc 100644
--- a/app/views/open_source_projects/_os_project.html.erb
+++ b/app/views/open_source_projects/_os_project.html.erb
@@ -51,7 +51,7 @@
<%= content_tag('span', "数据更新时间") %><%= content_tag('span', format_time(project.created_at)) %>
-
+
<%= image_tag( "/images/sidebar/tags.png") %>
diff --git a/app/views/open_source_projects/_show_topics.html.erb b/app/views/open_source_projects/_show_topics.html.erb
new file mode 100644
index 000000000..172949e92
--- /dev/null
+++ b/app/views/open_source_projects/_show_topics.html.erb
@@ -0,0 +1,57 @@
+
+
+
+ 共有 <%= link_to memos.count %> 个贴子
+
+
+ <% if memos.any? %>
+ <% memos.each do |topic| %>
+
+
+ <%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%> |
+
+
+
+ <%= link_to h(topic.subject), open_source_project_relative_memo_path(topic.open_source_project, topic) %> |
+
+
+
+ <%= link_to (topic.replies_count), forum_memo_path(topic.open_source_project, topic) %> |
+
+
+ 回答 |
+
+ |
+
+
+ |
+
+
+ <%#= authoring topic.created_at, topic.author %>
+
+ |
+
+
+ <%= @open_source_project.url%> |
+
+
+ <%= image_tag( "/images/sidebar/tags.png") %>
+ <%= render :partial => 'tags/tag_name', :locals => {:obj => topic,:object_flag => "9",:non_list_all => true }%>
+
+ |
+
+ |
+
+
+
+
+ <% end %>
+
+ <% else %>
+
+ <%= l(:label_no_data) %>
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/open_source_projects/show.html.erb b/app/views/open_source_projects/show.html.erb
index f0657fc89..eb8e1b49f 100644
--- a/app/views/open_source_projects/show.html.erb
+++ b/app/views/open_source_projects/show.html.erb
@@ -1,10 +1,54 @@
- <%= notice %>
+
+
+ <%=l(:label_memo_new)%>
+ <% if User.current.logged? %>
+ <%= labelled_form_for(@memo, :url => forum_memos_path(@forum), :html => {:multipart => true} ) do |f| %>
+ <% if @memo.errors.any? %>
+
+ <%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:
-
- String:
- <%= @open_source_project.name %>
-
+
+ <% @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 '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
+
+ <%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
+ :onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
+
-
-<%= link_to 'Edit', edit_open_source_project_path(@open_source_project) %> |
-<%= link_to 'Back', open_source_projects_path %>
+
+ <%#= 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_topics', :locals => {:memos => @memos} %>
diff --git a/app/views/relative_memos/show.html.erb b/app/views/relative_memos/show.html.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb
index 7eb360d53..b674e5152 100644
--- a/app/views/tags/_tag.html.erb
+++ b/app/views/tags/_tag.html.erb
@@ -6,6 +6,8 @@
4 代表是bid类型
5 代表是forum类型
6 代表是Attachment类型
+ 7 代表是OpenSourceProject类型
+ 8 代表是RelativeMemo类型
#end%>
<% if object_flag == '3' %>
diff --git a/config/routes.rb b/config/routes.rb
index 67634b422..fac469985 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,14 +20,16 @@ RedmineApp::Application.routes.draw do
collection do
match 'search', via: [:get, :post]
end
+ resources :relative_memos do
+
+ end
end
-
match 'course', :to => 'welcome#course', :via => :get
resources :stores do
collection do
match 'search', via: [:get, :post]
- end
+ end
end
resources :forums do
@@ -44,21 +46,20 @@ RedmineApp::Application.routes.draw do
end
end
-
resources :shares
-
+
#added by william
get "tags/index"
-
+
get "tags/show"
-
+
get "praise_tread/praise_plus"
get "praise_tread/tread_plus"
#end
root :to => 'welcome#index', :as => 'home'
-
+
#added by baiyu
match 'git_usage/ch_usage', :controller => 'git_usage', :action => 'ch_usage', :via => :get, :as => 'ch_usage'
match 'git_usage/en_usage', :controller => 'git_usage', :action => 'en_usage', :via => :get, :as => 'en_usage'
@@ -103,7 +104,6 @@ RedmineApp::Application.routes.draw do
match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
match '/journals/destroy/:id', :to => 'journals#destroy', :id => /\d+/, :via => [:get, :post]
-
get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
get '/issues/gantt', :to => 'gantts#show'
@@ -113,21 +113,21 @@ RedmineApp::Application.routes.draw do
get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report'
get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details'
post '/users/:id/user_activities', :to => 'users#show', :as => "user_activities"
-
+
#added by young
- resources :users do
+ resources :users do
member do
match 'user_projects', :to => 'users#user_projects', :via => :get
match 'user_activities', :to => 'users#show', :via => :get, :as => "user_activities"
- match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback"
- match 'watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
+ match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback"
+ match 'watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info'
match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang
match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang
match 'user_courses', :to => 'users#user_courses', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
- match 'watch_projects', :to => 'users#watch_projects', :via => :get
- # added by bai
+ match 'watch_projects', :to => 'users#watch_projects', :via => :get
+ # added by bai
match 'show_score', :to => 'users#show_score', :via => :get
match 'topic_score_index', :controller => 'users', :action => 'topic_score_index', :via => [:get, :post]
match 'project_score_index', :to => 'users#project_score_index', :via => :get
@@ -141,13 +141,13 @@ RedmineApp::Application.routes.draw do
match 'file_score_index', :to => 'projects#file_score_index', :via => [:get, :post]
match 'code_submit_score_index', :to => 'projects#code_submit_score_index', :via => [:get, :post]
match 'projects_topic_score_index', :to => 'projects#projects_topic_score_index', :via => [:get, :post]
- # end
+ # end
end
end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
match 'users/:id/user_projects', :controller => 'users', :action => 'user_projects', :via => :get
- #match 'user/:id/watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
-
+ #match 'user/:id/watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
+
#end
match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
@@ -203,7 +203,6 @@ RedmineApp::Application.routes.draw do
post 'reopen'
match 'copy', :via => [:get, :post]
end
-
#by young
match '/member', :controller => 'projects', :action => 'member', :as => 'member', :via => :get
@@ -212,7 +211,6 @@ RedmineApp::Application.routes.draw do
# match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
match '/homework', :controller => 'projects', :action => 'homework', :as => 'homework', :via => :get
-
# match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get
# match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get
# match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get
@@ -220,7 +218,7 @@ RedmineApp::Application.routes.draw do
# get 'projects/:project_id/repository', :to => 'repositories#show', :as => 'project_repository'
# match '/show', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get
- match '/watcherlist', :controller=>'projects', :action=> 'watcherlist', :as => 'watcherlist', :via => :get #add by huang
+ match '/watcherlist', :controller=>'projects', :action=> 'watcherlist', :as => 'watcherlist', :via => :get #add by huang
# matche '/news', :controller => 'news', :action => 'index', :as => 'news', :via => :get
#end
@@ -270,7 +268,7 @@ RedmineApp::Application.routes.draw do
resources :repositories, :except => [:index, :show] do
member do
get 'newrepo', :via => [:get, :post]
- # get 'create', :via=>[:get, :post]
+ # get 'create', :via=>[:get, :post]
end
end
match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
@@ -447,8 +445,6 @@ RedmineApp::Application.routes.draw do
get 'autocomplete_for_new_user'
end
end
-
-
match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
@@ -464,7 +460,7 @@ RedmineApp::Application.routes.draw do
match 'uploads', :to => 'attachments#upload', :via => :post
# Added by Tao
- match 'upload_avatar', :to => 'avatar#upload', :via => :post
+ match 'upload_avatar', :to => 'avatar#upload', :via => :post
# Endof Tao's code
get 'robots.txt', :to => 'welcome#robots'
@@ -479,7 +475,7 @@ RedmineApp::Application.routes.draw do
end
end
end
-
+
##############测试留言功能 fq
post 'words/new', :to => 'words#new'
post 'words/create', :to => 'words#create'
@@ -503,7 +499,7 @@ RedmineApp::Application.routes.draw do
match 'calls/:id/new_submit_homework', to: 'bids#new_submit_homework', via: :get, as: 'new_submit_homework'
match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond'
match 'words/:id/leave_project_message', :controller => 'words', :action => 'leave_project_message'
-
+
match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback'
match 'calls/create_bid', :to => 'bids#create_bid'
match 'contest/create_contest', :to => 'bids#create_contest' #huang
@@ -517,24 +513,24 @@ RedmineApp::Application.routes.draw do
match 'calls/:id/show_course', :to => 'bids#show_course', :as => 'show_course'
match 'calls/:id/show_bid_project', :to => 'bids#show_bid_project', :as => 'show_bid_project'
match 'calls/:id/show_bid_user', :to => 'bids#show_bid_user', :as => 'show_bid_user'
-
+
match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share
-
- post 'join_in/join', :to => 'courses#join', :as => 'join'
+
+ post 'join_in/join', :to => 'courses#join', :as => 'join'
delete 'join_in/join', :to => 'courses#unjoin'
post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest'
delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest'
match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai
match 'calls/:id/update_contest', :to => 'bids#update_contest' #bai
match 'calls/:id/settings', :to => 'bids#settings' #bai
-
+
delete 'attachment/:id', :to => 'attachments#delete_homework'
match 'new_join', :to => 'projects#new_join', :as => 'try_join'
match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest'
match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post]
match 'project/course', :to => 'projects#course', :as => 'course'
-
+
#added by william
# match 'calls/:id/set_results',:controller => 'bids', :action => 'set_results',:via => [:get,:post],:as => 'set_results'
# match 'calls/:id/set_prizes',:controller => 'bids',:action => 'set_prizes',:as => 'set_prizes'
@@ -544,10 +540,10 @@ RedmineApp::Application.routes.draw do
match 'test/index', :controller => 'test', :action => 'index'
# added by young
match 'calls', :controller => 'bids', :action => 'index'
-
+
match 'calls/:id', :controller => 'bids', :action => 'show', :as => 'respond'
match 'contest', :controller => 'bids', :action => 'contest', :as => 'contest'
-
+
######added by nie
match 'tags/show_projects_tags',:to => 'tags#show_projects_tags'
########### added by liuping
@@ -558,6 +554,6 @@ RedmineApp::Application.routes.draw do
match 'parise_tread/tread_plus',:to => 'parise_tread#tread_plus',:as=>"tread"
match 'tags/delete',:to=>'tags#delete'
match 'tags/remove_tag',:to=>'tags#remove_tag',:as=>"remove_tag"
-
+
match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution'
end
From 9af808821dbb64c5b6f206186e459b30fe06538f Mon Sep 17 00:00:00 2001
From: fanqiang <316257774@qq.com>
Date: Thu, 3 Apr 2014 20:47:09 +0800
Subject: [PATCH 04/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A1=86=E6=9E=B6?=
=?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0"=E6=B2=A1=E6=9C=89=E5=B8=AE?=
=?UTF-8?q?=E5=8A=A9"=E5=92=8C"=E7=94=B3=E8=AF=B7=E6=88=90=E4=B8=BA?=
=?UTF-8?q?=E7=89=88=E4=B8=BB"=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../javascripts/apply_project_masters.js | 2 +
app/assets/javascripts/no_uses.js | 2 +
.../stylesheets/apply_project_masters.css | 4 +
app/assets/stylesheets/no_uses.css | 4 +
.../apply_project_masters_controller.rb | 83 ++++++++++++
app/controllers/no_uses_controller.rb | 123 ++++++++++++++++++
.../open_source_projects_controller.rb | 4 +
app/helpers/apply_project_masters_helper.rb | 23 ++++
app/helpers/no_uses_helper.rb | 22 ++++
app/helpers/open_source_projects_helper.rb | 1 +
app/models/apply_project_master.rb | 3 +
app/models/no_use.rb | 3 +
app/models/open_source_project.rb | 8 ++
app/models/relative_memo.rb | 10 ++
.../apply_project_masters/_form.html.erb | 17 +++
app/views/apply_project_masters/edit.html.erb | 6 +
.../apply_project_masters/index.html.erb | 21 +++
app/views/apply_project_masters/new.html.erb | 5 +
app/views/apply_project_masters/show.html.erb | 5 +
app/views/layouts/base_opensource_p.html.erb | 1 +
app/views/no_uses/_form.html.erb | 17 +++
app/views/no_uses/edit.html.erb | 6 +
app/views/no_uses/index.html.erb | 21 +++
app/views/no_uses/new.html.erb | 5 +
app/views/no_uses/show.html.erb | 5 +
.../_show_topics.html.erb | 16 +--
app/views/open_source_projects/show.html.erb | 8 +-
config/routes.rb | 6 +
...0403075029_create_apply_project_masters.rb | 12 ++
db/migrate/20140403113341_create_no_uses.rb | 11 ++
db/schema.rb | 19 ++-
test/fixtures/apply_project_masters.yml | 11 ++
test/fixtures/no_uses.yml | 11 ++
.../apply_project_masters_controller_test.rb | 49 +++++++
test/functional/no_uses_controller_test.rb | 49 +++++++
test/unit/apply_project_master_test.rb | 7 +
.../apply_project_masters_helper_test.rb | 4 +
test/unit/helpers/no_uses_helper_test.rb | 4 +
test/unit/no_use_test.rb | 7 +
39 files changed, 602 insertions(+), 13 deletions(-)
create mode 100644 app/assets/javascripts/apply_project_masters.js
create mode 100644 app/assets/javascripts/no_uses.js
create mode 100644 app/assets/stylesheets/apply_project_masters.css
create mode 100644 app/assets/stylesheets/no_uses.css
create mode 100644 app/controllers/apply_project_masters_controller.rb
create mode 100644 app/controllers/no_uses_controller.rb
create mode 100644 app/helpers/apply_project_masters_helper.rb
create mode 100644 app/helpers/no_uses_helper.rb
create mode 100644 app/models/apply_project_master.rb
create mode 100644 app/models/no_use.rb
create mode 100644 app/views/apply_project_masters/_form.html.erb
create mode 100644 app/views/apply_project_masters/edit.html.erb
create mode 100644 app/views/apply_project_masters/index.html.erb
create mode 100644 app/views/apply_project_masters/new.html.erb
create mode 100644 app/views/apply_project_masters/show.html.erb
create mode 100644 app/views/no_uses/_form.html.erb
create mode 100644 app/views/no_uses/edit.html.erb
create mode 100644 app/views/no_uses/index.html.erb
create mode 100644 app/views/no_uses/new.html.erb
create mode 100644 app/views/no_uses/show.html.erb
create mode 100644 db/migrate/20140403075029_create_apply_project_masters.rb
create mode 100644 db/migrate/20140403113341_create_no_uses.rb
create mode 100644 test/fixtures/apply_project_masters.yml
create mode 100644 test/fixtures/no_uses.yml
create mode 100644 test/functional/apply_project_masters_controller_test.rb
create mode 100644 test/functional/no_uses_controller_test.rb
create mode 100644 test/unit/apply_project_master_test.rb
create mode 100644 test/unit/helpers/apply_project_masters_helper_test.rb
create mode 100644 test/unit/helpers/no_uses_helper_test.rb
create mode 100644 test/unit/no_use_test.rb
diff --git a/app/assets/javascripts/apply_project_masters.js b/app/assets/javascripts/apply_project_masters.js
new file mode 100644
index 000000000..dee720fac
--- /dev/null
+++ b/app/assets/javascripts/apply_project_masters.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/no_uses.js b/app/assets/javascripts/no_uses.js
new file mode 100644
index 000000000..dee720fac
--- /dev/null
+++ b/app/assets/javascripts/no_uses.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/stylesheets/apply_project_masters.css b/app/assets/stylesheets/apply_project_masters.css
new file mode 100644
index 000000000..afad32db0
--- /dev/null
+++ b/app/assets/stylesheets/apply_project_masters.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
diff --git a/app/assets/stylesheets/no_uses.css b/app/assets/stylesheets/no_uses.css
new file mode 100644
index 000000000..afad32db0
--- /dev/null
+++ b/app/assets/stylesheets/no_uses.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
diff --git a/app/controllers/apply_project_masters_controller.rb b/app/controllers/apply_project_masters_controller.rb
new file mode 100644
index 000000000..7dadaf2ed
--- /dev/null
+++ b/app/controllers/apply_project_masters_controller.rb
@@ -0,0 +1,83 @@
+class ApplyProjectMastersController < ApplicationController
+ # GET /apply_project_masters
+ # GET /apply_project_masters.json
+ def index
+ @apply_project_masters = ApplyProjectMaster.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @apply_project_masters }
+ end
+ end
+
+ # GET /apply_project_masters/1
+ # GET /apply_project_masters/1.json
+ def show
+ @apply_project_master = ApplyProjectMaster.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @apply_project_master }
+ end
+ end
+
+ # GET /apply_project_masters/new
+ # GET /apply_project_masters/new.json
+ def new
+ @apply_project_master = ApplyProjectMaster.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @apply_project_master }
+ end
+ end
+
+ # GET /apply_project_masters/1/edit
+ def edit
+ @apply_project_master = ApplyProjectMaster.find(params[:id])
+ end
+
+ # POST /apply_project_masters
+ # POST /apply_project_masters.json
+ def create
+ @apply_project_master = ApplyProjectMaster.new(params[:apply_project_master])
+
+ respond_to do |format|
+ if @apply_project_master.save
+ format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully created.' }
+ format.json { render json: @apply_project_master, status: :created, location: @apply_project_master }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /apply_project_masters/1
+ # PUT /apply_project_masters/1.json
+ def update
+ @apply_project_master = ApplyProjectMaster.find(params[:id])
+
+ respond_to do |format|
+ if @apply_project_master.update_attributes(params[:apply_project_master])
+ format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /apply_project_masters/1
+ # DELETE /apply_project_masters/1.json
+ def destroy
+ @apply_project_master = ApplyProjectMaster.find(params[:id])
+ @apply_project_master.destroy
+
+ respond_to do |format|
+ format.html { redirect_to apply_project_masters_url }
+ format.json { head :no_content }
+ end
+ end
+end
diff --git a/app/controllers/no_uses_controller.rb b/app/controllers/no_uses_controller.rb
new file mode 100644
index 000000000..c18c6c3b6
--- /dev/null
+++ b/app/controllers/no_uses_controller.rb
@@ -0,0 +1,123 @@
+class NoUsesController < ApplicationController
+ # GET /no_uses
+ # GET /no_uses.json
+ def index
+ @no_uses = NoUse.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @no_uses }
+ end
+ end
+
+ # GET /no_uses/1
+ # GET /no_uses/1.json
+ def show
+ @no_use = NoUse.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @no_use }
+ end
+ end
+
+ # GET /no_uses/new
+ # GET /no_uses/new.json
+ def new
+ @no_use = NoUse.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @no_use }
+ end
+ end
+
+ # GET /no_uses/1/edit
+ def edit
+ @no_use = NoUse.find(params[:id])
+ end
+
+ # POST /no_uses
+ # POST /no_uses.json
+ def create
+ @no_use = NoUse.new(params[:no_use])
+
+ respond_to do |format|
+ if @no_use.save
+ format.html { redirect_to @no_use, notice: 'No use was successfully created.' }
+ format.json { render json: @no_use, status: :created, location: @no_use }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @no_use.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /no_uses/1
+ # PUT /no_uses/1.json
+ def update
+ @no_use = NoUse.find(params[:id])
+
+ respond_to do |format|
+ if @no_use.update_attributes(params[:no_use])
+ format.html { redirect_to @no_use, notice: 'No use was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @no_use.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /no_uses/1
+ # DELETE /no_uses/1.json
+ def destroy
+ @no_use = NoUse.find(params[:id])
+ @no_use.destroy
+
+ respond_to do |format|
+ format.html { redirect_to no_uses_url }
+ format.json { head :no_content }
+ end
+ end
+ private
+
+ def find_no_use
+ klass = Object.const_get(params[:object_type].camelcase) rescue nil
+ if klass && klass.respond_to?('watched_by')
+ @no_use = klass.find_all_by_id(Array.wrap(params[:object_id]))
+ end
+ render_404 unless @no_use.present?
+ end
+
+ def set_watcher(watchables, user, watching)
+ watchables.each do |watchable|
+ watchable.set_watcher(user, watching)
+ # @user = watchable # added by william
+ if watching
+ # 修改 user和project的状态
+ if watchable.instance_of?(User)
+ #写user_statuses表
+ UserStatus.find_by_user_id(watchable.id).update_watchers_count(1)
+ elsif watchable.instance_of?(Project)
+ #写project_statuese表
+ ProjectStatus.find_by_project_id(watchable.id).update_watchers_count(1)
+ end
+ else
+ # 修改 user和project的状态
+ if watchable.instance_of?(User)
+ #写user_statuses表
+ UserStatus.find_by_user_id(watchable.id).update_watchers_count(-1)
+ elsif watchable.instance_of?(Project)
+ #写project_statuese表 :project_status
+ ProjectStatus.find_by_project_id(watchable.id).update_watchers_count(-1)
+ end
+ end
+
+ end
+ respond_to do |format|
+ format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
+ format.js { render :partial => 'set_watcher', :locals => {:user => user, :watched => watchables} }
+ end
+ end
+end
diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb
index f7f32a43b..55892d457 100644
--- a/app/controllers/open_source_projects_controller.rb
+++ b/app/controllers/open_source_projects_controller.rb
@@ -2,6 +2,10 @@ class OpenSourceProjectsController < ApplicationController
helper :sort
include SortHelper
+ helper :apply_project_masters
+ include ApplyProjectMastersHelper
+ helper :no_uses
+ include NoUsesHelper
# GET /open_source_projects
# GET /open_source_projects.json
def index
diff --git a/app/helpers/apply_project_masters_helper.rb b/app/helpers/apply_project_masters_helper.rb
new file mode 100644
index 000000000..11724cde0
--- /dev/null
+++ b/app/helpers/apply_project_masters_helper.rb
@@ -0,0 +1,23 @@
+module ApplyProjectMastersHelper
+ def apply_super_user(objects, user, options=[])
+ return '' unless user && user.logged?
+ objects = Array.wrap(objects)
+
+ applied = objects.any? {|object| object.applied_by?(user)}
+ allowed = objects.any? {|object| object.allowed?(user)}
+ # @watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid)))
+ # css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
+ # ([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
+
+ text = applied ? (allowed ? ("123") : ("123")) : ("231")
+
+ url = apply_project_master_path(
+ :object_type => objects.first.class.to_s.underscore,
+ :object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
+ )
+ method = applied ? 'delete' : 'post'
+
+ link_to text, url, :remote => true, :method => method
+ #, :class => css
+ end
+end
diff --git a/app/helpers/no_uses_helper.rb b/app/helpers/no_uses_helper.rb
new file mode 100644
index 000000000..2c7c268fc
--- /dev/null
+++ b/app/helpers/no_uses_helper.rb
@@ -0,0 +1,22 @@
+module NoUsesHelper
+ def no_use_link(objects, user, options=[])
+ return '' unless user && user.logged?
+ objects = Array.wrap(objects)
+
+ clicked = objects.any? {|object| object.no_use_for?(user)}
+ # @watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid)))
+ # css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
+ # ([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
+
+ text = clicked ? ("123") : ("231")
+
+ url = apply_project_master_path(
+ :object_type => objects.first.class.to_s.underscore,
+ :object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
+ )
+ method = clicked ? 'delete' : 'post'
+
+ link_to text, url, :remote => true, :method => method
+ #, :class => css
+ end
+end
diff --git a/app/helpers/open_source_projects_helper.rb b/app/helpers/open_source_projects_helper.rb
index f6735688b..793e1458e 100644
--- a/app/helpers/open_source_projects_helper.rb
+++ b/app/helpers/open_source_projects_helper.rb
@@ -11,4 +11,5 @@ module OpenSourceProjectsHelper
end
s << ""
end
+
end
diff --git a/app/models/apply_project_master.rb b/app/models/apply_project_master.rb
new file mode 100644
index 000000000..336c102df
--- /dev/null
+++ b/app/models/apply_project_master.rb
@@ -0,0 +1,3 @@
+class ApplyProjectMaster < ActiveRecord::Base
+ # attr_accessible :title, :body
+end
diff --git a/app/models/no_use.rb b/app/models/no_use.rb
new file mode 100644
index 000000000..333174a8d
--- /dev/null
+++ b/app/models/no_use.rb
@@ -0,0 +1,3 @@
+class NoUse < ActiveRecord::Base
+ # attr_accessible :title, :body
+end
diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb
index f6ec5a8ce..57bcfeabc 100644
--- a/app/models/open_source_project.rb
+++ b/app/models/open_source_project.rb
@@ -11,6 +11,14 @@ class OpenSourceProject < ActiveRecord::Base
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
+ def applied_by?(user)
+ false
+ end
+
+ def allowed?(user)
+ false
+ end
+
def reset_counters!
self.class.reset_counters!(id)
end
diff --git a/app/models/relative_memo.rb b/app/models/relative_memo.rb
index 060312f86..cd2d0e8a6 100644
--- a/app/models/relative_memo.rb
+++ b/app/models/relative_memo.rb
@@ -69,6 +69,16 @@ class RelativeMemo < ActiveRecord::Base
# Forum.reset_counters!(forum_id)
# end
# end
+
+
+ scope :no_use_for, lambda { |user_id|
+ { :include => :no_uses,
+ :conditions => ["#{NoUse.table_name}.user_id = ?", user_id] }
+ }
+
+ def no_use_for?(user)
+ false
+ end
def reset_counters!
if parent && parent.id
diff --git a/app/views/apply_project_masters/_form.html.erb b/app/views/apply_project_masters/_form.html.erb
new file mode 100644
index 000000000..f817c1bcf
--- /dev/null
+++ b/app/views/apply_project_masters/_form.html.erb
@@ -0,0 +1,17 @@
+<%= form_for(@apply_project_master) do |f| %>
+ <% if @apply_project_master.errors.any? %>
+
+ <%= pluralize(@apply_project_master.errors.count, "error") %> prohibited this apply_project_master from being saved:
+
+
+ <% @apply_project_master.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
+
+
+ <%= f.submit %>
+
+<% end %>
diff --git a/app/views/apply_project_masters/edit.html.erb b/app/views/apply_project_masters/edit.html.erb
new file mode 100644
index 000000000..47d85b99c
--- /dev/null
+++ b/app/views/apply_project_masters/edit.html.erb
@@ -0,0 +1,6 @@
+ Editing apply_project_master
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @apply_project_master %> |
+<%= link_to 'Back', apply_project_masters_path %>
diff --git a/app/views/apply_project_masters/index.html.erb b/app/views/apply_project_masters/index.html.erb
new file mode 100644
index 000000000..16023cd83
--- /dev/null
+++ b/app/views/apply_project_masters/index.html.erb
@@ -0,0 +1,21 @@
+ Listing apply_project_masters
+
+
+
+ |
+ |
+ |
+
+
+<% @apply_project_masters.each do |apply_project_master| %>
+
+ <%= link_to 'Show', apply_project_master %> |
+ <%= link_to 'Edit', edit_apply_project_master_path(apply_project_master) %> |
+ <%= link_to 'Destroy', apply_project_master, method: :delete, data: { confirm: 'Are you sure?' } %> |
+
+<% end %>
+
+
+
+
+<%= link_to 'New Apply project master', new_apply_project_master_path %>
diff --git a/app/views/apply_project_masters/new.html.erb b/app/views/apply_project_masters/new.html.erb
new file mode 100644
index 000000000..7cdcac28b
--- /dev/null
+++ b/app/views/apply_project_masters/new.html.erb
@@ -0,0 +1,5 @@
+ New apply_project_master
+
+<%= render 'form' %>
+
+<%= link_to 'Back', apply_project_masters_path %>
diff --git a/app/views/apply_project_masters/show.html.erb b/app/views/apply_project_masters/show.html.erb
new file mode 100644
index 000000000..a7edc11ff
--- /dev/null
+++ b/app/views/apply_project_masters/show.html.erb
@@ -0,0 +1,5 @@
+ <%= notice %>
+
+
+<%= link_to 'Edit', edit_apply_project_master_path(@apply_project_master) %> |
+<%= link_to 'Back', apply_project_masters_path %>
diff --git a/app/views/layouts/base_opensource_p.html.erb b/app/views/layouts/base_opensource_p.html.erb
index df05d4f75..b982a3a19 100644
--- a/app/views/layouts/base_opensource_p.html.erb
+++ b/app/views/layouts/base_opensource_p.html.erb
@@ -54,6 +54,7 @@
+ <%= apply_super_user(@open_source_project, User.current) %>
diff --git a/app/views/no_uses/_form.html.erb b/app/views/no_uses/_form.html.erb
new file mode 100644
index 000000000..0bcedb031
--- /dev/null
+++ b/app/views/no_uses/_form.html.erb
@@ -0,0 +1,17 @@
+<%= form_for(@no_use) do |f| %>
+ <% if @no_use.errors.any? %>
+
+ <%= pluralize(@no_use.errors.count, "error") %> prohibited this no_use from being saved:
+
+
+ <% @no_use.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
+
+
+ <%= f.submit %>
+
+<% end %>
diff --git a/app/views/no_uses/edit.html.erb b/app/views/no_uses/edit.html.erb
new file mode 100644
index 000000000..d7a0ea439
--- /dev/null
+++ b/app/views/no_uses/edit.html.erb
@@ -0,0 +1,6 @@
+Editing no_use
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @no_use %> |
+<%= link_to 'Back', no_uses_path %>
diff --git a/app/views/no_uses/index.html.erb b/app/views/no_uses/index.html.erb
new file mode 100644
index 000000000..5535d74c1
--- /dev/null
+++ b/app/views/no_uses/index.html.erb
@@ -0,0 +1,21 @@
+Listing no_uses
+
+
+
+ |
+ |
+ |
+
+
+<% @no_uses.each do |no_use| %>
+
+ <%= link_to 'Show', no_use %> |
+ <%= link_to 'Edit', edit_no_use_path(no_use) %> |
+ <%= link_to 'Destroy', no_use, method: :delete, data: { confirm: 'Are you sure?' } %> |
+
+<% end %>
+
+
+
+
+<%= link_to 'New No use', new_no_use_path %>
diff --git a/app/views/no_uses/new.html.erb b/app/views/no_uses/new.html.erb
new file mode 100644
index 000000000..fb295879c
--- /dev/null
+++ b/app/views/no_uses/new.html.erb
@@ -0,0 +1,5 @@
+New no_use
+
+<%= render 'form' %>
+
+<%= link_to 'Back', no_uses_path %>
diff --git a/app/views/no_uses/show.html.erb b/app/views/no_uses/show.html.erb
new file mode 100644
index 000000000..1e580700c
--- /dev/null
+++ b/app/views/no_uses/show.html.erb
@@ -0,0 +1,5 @@
+<%= notice %>
+
+
+<%= link_to 'Edit', edit_no_use_path(@no_use) %> |
+<%= link_to 'Back', no_uses_path %>
diff --git a/app/views/open_source_projects/_show_topics.html.erb b/app/views/open_source_projects/_show_topics.html.erb
index 172949e92..f4400ed39 100644
--- a/app/views/open_source_projects/_show_topics.html.erb
+++ b/app/views/open_source_projects/_show_topics.html.erb
@@ -33,18 +33,18 @@
<%= @open_source_project.url%> |
+ <%= no_use_link(topic, User.current) %> |
-
- <%= image_tag( "/images/sidebar/tags.png") %>
- <%= render :partial => 'tags/tag_name', :locals => {:obj => topic,:object_flag => "9",:non_list_all => true }%>
-
- |
-
+
+ <%= image_tag( "/images/sidebar/tags.png") %>
+ <%= render :partial => 'tags/tag_name', :locals => {:obj => topic,:object_flag => "9",:non_list_all => true }%> |
+
+
|
-
+