Merge branch 'szzh' into develop

Conflicts:
	db/schema.rb
This commit is contained in:
yanxd 2014-05-22 09:58:19 +08:00
commit 3517dbb88b
35 changed files with 413 additions and 121 deletions

View File

@ -0,0 +1,29 @@
class AppliedProjectController < ApplicationController
#申请加入项目
def applied_join_project
@user_id = params[:user_id]
@project = Project.find(params[:project_id])
AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
#redirect_to project_path(params[:project_id])
#redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
respond_to do |format|
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_applied'}
end
end
#取消申请
def unapplied_join_project
@project = Project.find(params[:project_id])
@applied = AppliedProject.find(params[:id])
@applied.destroy
#redirect_to project_path(params[:project_id])
#redirect_to_referer_or {render :text => ( 'unsubscribe success.'), :layout => true}
respond_to do |format|
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_applied' }
end
end
end

View File

@ -209,7 +209,12 @@ private
end end
def read_authorize def read_authorize
@attachment.visible? ? true : deny_access if @attachment.container_type == "HomeworkAttach"
true
#User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access
else
@attachment.visible? ? true : deny_access
end
end end
def delete_authorize def delete_authorize

View File

@ -14,6 +14,8 @@ class BidsController < ApplicationController
# end # end
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ] before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
before_filter :memberAccess, only: :show_project
helper :watchers helper :watchers
helper :attachments helper :attachments
include AttachmentsHelper include AttachmentsHelper
@ -875,7 +877,14 @@ class BidsController < ApplicationController
end end
rescue rescue
render_404 render_404
end end
def memberAccess
# 是课程,则判断当前用户是否参加了课程
return 0 if @bid.courses.first.project_type == Project::ProjectType_project
currentUser = User.current
render_403 unless currentUser.member_of?(@bid.courses.first)
end
end end

View File

@ -33,12 +33,12 @@ class ProjectsController < ApplicationController
menu_item l(:label_course_news), :only => :index menu_item l(:label_course_news), :only => :index
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise] before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
# :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share,
# :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index]
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches]
before_filter :authorize_global, :only => [:new, :create] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :file, :statistics, :watcherlist before_filter :file, :statistics, :watcherlist

View File

@ -209,8 +209,6 @@ class UsersController < ApplicationController
## 判断课程是否过期 [需封装] ## 判断课程是否过期 [需封装]
@memberships_doing = [] @memberships_doing = []
@memberships_done = [] @memberships_done = []
@OwningCouses =[]
@JoinCouses=[]
now_time = Time.now.year now_time = Time.now.year
@memberships.map { |e| @memberships.map { |e|
end_time = e.project.course_extra.get_time.year end_time = e.project.course_extra.get_time.year
@ -220,12 +218,6 @@ class UsersController < ApplicationController
else else
@memberships_doing.push e @memberships_doing.push e
end end
if e.project.course_extra.tea_id == User.current.id
@OwningCouses.push e
else
@JoinCouses.push e
end
} }
# respond_to do |format| # respond_to do |format|
# format.html # format.html

View File

@ -158,6 +158,6 @@ class WatchersController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} 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} } format.js { render :partial => 'set_watcher', :locals => {:user => user, :watched => watchables} }
end end
end end
end end

View File

@ -0,0 +1,28 @@
module AppliedProjectHelper
def applied_css(project)
id = project.id
"#{project.class.to_s.underscore}-#{id}-applied"
end
def applied_link(project, user, options=[])
return '' unless user && user.logged?
applied = project.applied_projects.find_by_user_id(user.id)
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
@applied_flag = project.instance_of?(Project)
css = @applied_flag ? ([applied_css(project), applied ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
([applied_css(project), applied ? 'icon icon-applied ' : 'icon icon-applied-off '].join(' ') << options[0].to_s)
if applied
appliedid = applied.id
end
url = appliedproject_path(
:id=>appliedid,
:user_id => user.id,
:project_id => project.id
)
method = applied ? 'delete' : 'post'
link_to text, url, :remote => true, :method => method ,:class=>css
end
end

View File

@ -30,7 +30,7 @@ module WatchersHelper
objects = Array.wrap(objects) objects = Array.wrap(objects)
watched = objects.any? {|object| object.watched_by?(user)} watched = objects.any? {|object| object.watched_by?(user)}
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid))) @watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid)))
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) : 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) ([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
@ -187,4 +187,31 @@ module WatchersHelper
:class => "floating" :class => "floating"
end.join.html_safe end.join.html_safe
end end
end
def applied_css(project)
id = project.id
"#{project.class.to_s.underscore}-#{id}-applied"
end
def applied_link(project, user, options=[])
return '' unless user && user.logged?
applied = project.applied_projects.find_by_user_id(user.id)
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
@applied_flag = project.instance_of?(Project)
css = @applied_flag ? ([applied_css(project), applied ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
([applied_css(project), applied ? 'icon icon-applied ' : 'icon icon-applied-off '].join(' ') << options[0].to_s)
if applied
appliedid = applied.id
end
url = appliedproject_path(
:id=>appliedid,
:user_id => user.id,
:project_id => project.id
)
method = applied ? 'delete' : 'post'
link_to text, url, :remote => true, :method => method ,:class=>css
end
end

View File

@ -0,0 +1,6 @@
class AppliedProject < ActiveRecord::Base
attr_accessible :project_id, :user_id
belongs_to :user
belongs_to :project
end

View File

@ -2,7 +2,7 @@ class Course < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password
belongs_to :project, :class_name => 'Project', :foreign_key => :extra # 定义一个project方法 该方法通过extra来调用project表 belongs_to :project, :class_name => 'Project', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表 belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
has_many :bid has_many :bid

View File

@ -29,6 +29,13 @@ class HomeworkAttach < ActiveRecord::Base
result result
end end
def project
work = HomeworkForCourse.find_by_bid_id(self.bid_id)
if work
work.project
end
end
def add_jours options def add_jours options
jfm = self.journals_for_messages.build(options) jfm = self.journals_for_messages.build(options)
jfm.save jfm.save

View File

@ -64,7 +64,8 @@ class Project < ActiveRecord::Base
# has_many :students_for_courses, :dependent => :destroy # has_many :students_for_courses, :dependent => :destroy
has_many :student, :through => :students_for_courses, :source => :user has_many :student, :through => :students_for_courses, :source => :user
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
has_many :applied_projects
# end # end
#ADDED BY NIE #ADDED BY NIE
has_many :project_infos, :dependent => :destroy has_many :project_infos, :dependent => :destroy

View File

@ -18,6 +18,11 @@
require "digest/sha1" require "digest/sha1"
class User < Principal class User < Principal
TEACHER = 0
STUDENT = 1
ENTERPRISE = 2
DEVELOPER = 3
include Redmine::SafeAttributes include Redmine::SafeAttributes
# Different ways of displaying/sorting users # Different ways of displaying/sorting users

View File

@ -0,0 +1,4 @@
<% selector = ".#{applied_css(@project)}" %>
$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript applied_link(@project, User.current) %>")});

View File

@ -20,7 +20,6 @@
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %> <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<%= sort_header_tag('tags', :caption => l(:label_tag), :id => "vzebra-tag") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> --> <!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr> </tr>
</thead> </thead>
@ -52,14 +51,15 @@
<%= link_to(image_tag('delete.png'), attachment_path(file), <%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td> </td>
<td class='filename' style="font-size: 13px; "> </tr>
<tr>
<td class='description' colspan="6">
<div class="tags_area"> <div class="tags_area">
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div> <div class="tags_gradint"></div>
</div> </div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a> <div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div>
</div>
</td> </td>
</tr> </tr>
<% end -%> <% end -%>

View File

@ -20,7 +20,6 @@
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<%= sort_header_tag('tags', :caption => l(:label_tag), :id => "vzebra-tag") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> --> <!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr> </tr>
</thead> </thead>
@ -48,15 +47,17 @@
<%= link_to(image_tag('delete.png'), attachment_path(file), <%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td> </td>
<td class='filename' style="font-size: 13px; "> </tr>
<div class="tags_area"> <tr>
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> <td class='description' colspan="6">
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> <div class="tags_area">
<div class="tags_gradint"></div> <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
</div> <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a> <div class="tags_gradint"></div>
</div> </div>
</td> <div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
</div>
</td>
</tr> </tr>
<% end -%> <% end -%>
<% end -%> <% end -%>

View File

@ -7,7 +7,7 @@
<div class="forums-index-content"> <div class="forums-index-content">
<p ><%= link_to h(forum.name), forum_path(forum) %></p> <p ><%= link_to h(forum.name), forum_path(forum) %></p>
<p ><%= forum.description%></p> <p ><%= forum.description%></p>
<p ><%= authoring forum.created_at, forum.creator %></p></div> <p ><%= authoring forum.created_at, forum.creator %></p></div>
<div class="forums-index-count"> <div class="forums-index-count">
<table class="forums-count-color"><tr class="forums-count-color" align="center"><td><%= link_to (forum.memo_count), forum_path(forum) %></td><td><%= link_to (forum.topic_count), forum_path(forum) %></td></tr> <table class="forums-count-color"><tr class="forums-count-color" align="center"><td><%= link_to (forum.memo_count), forum_path(forum) %></td><td><%= link_to (forum.topic_count), forum_path(forum) %></td></tr>
<tr align="center"><td>回答</td><td>帖子</td></tr></table></div> <tr align="center"><td>回答</td><td>帖子</td></tr></table></div>

View File

@ -25,6 +25,9 @@
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %> <td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
<span class="font_description2">
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
</span>
<br /> <br />
</span></td> </span></td>
</tr> </tr>

View File

@ -114,10 +114,18 @@
<td class="font_index"> <td class="font_index">
<!-- 1 教师; 2 学生0 全部--> <!-- 1 教师; 2 学生0 全部-->
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1), :course => '1' %> <% if User.current.member_of?(@project) %>
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1), :course => '1' %>
<% else %>
<span><%= teacherCount(@project)%></span> <!--<%= link_to "#{teacherCount(@project)}", "javascript:void(0)", :course => '1' %>-->
<% end%>
</td> </td>
<td class="font_index"> <td class="font_index">
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2), :course => '1' %> <% if User.current.member_of?(@project) %>
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2), :course => '1' %>
<% else %>
<span><%= studentCount(@project)%></span>
<% end %>
</td> </td>
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td> <td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
<tr class="font_aram"> <tr class="font_aram">

View File

@ -151,6 +151,7 @@
<li> <li>
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show' },:class => link_class(:respond)%> <%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show' },:class => link_class(:respond)%>
</li> </li>
<% if User.current.member_of? @bid.courses.first%>
<li> <li>
<% if User.current.logged? && @bid.courses.first && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %> <% if User.current.logged? && @bid.courses.first && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%> <%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>
@ -159,9 +160,10 @@
<% end %> <% end %>
</li> </li>
<% end %>
<!-- <li><%= link_to l(:label_homework_statistics), { :controller => 'bids', :action => 'homework_statistics' },:class => link_class(:homework_statistics)%></li> --> <!-- <li><%= link_to l(:label_homework_statistics), { :controller => 'bids', :action => 'homework_statistics' },:class => link_class(:homework_statistics)%></li> -->
<!-- <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li> <!-- <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
--><ul> --></ul>
</div> </div>
<%= yield %> <%= yield %>

View File

@ -103,6 +103,14 @@
<span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %> <span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %>
<% end %> <% end %>
</div> </div>
<!--添加项目申请-->
<div style="margin-left: 20px;">
<% if ( !(User.current.member_of? @project) && User.current.login?) %>
<span class="icon-fav icon"></span>
<%= applied_link(@project, User.current) %>
<% end %>
</div>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -45,7 +45,7 @@
<%= content_tag('span', l(:label_x_data,:count => files_count)) %> <%= content_tag('span', l(:label_x_data,:count => files_count)) %>
</p> </p>
<p class="stats"> <p class="stats">
<%= content_tag('span', "#{@project.members.count}", :class => "info") %> <%= content_tag('span', "#{garble @project.members.count}", :class => "info") %>
<%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %> <%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
</p> </p>

View File

@ -0,0 +1,22 @@
<div class="user_course_list">
<div class="menu">
<%= link_to "#{l(:label_course_new)}", new_project_path(course: 1, project_type: 1), class: 'icon icon-add' if @user == User.current %>
<ul>
<li mode='doing' class="on">进行中</li>
<li mode='end'>已完结</li>
</ul>
</div>
<div class="dyn_list_wrapper" mode='doing'>
<div class='created_course'>
<%= render :partial => 'course_form', :locals => {:memberships => @memberships_doing} %>
</div>
</div>
<div class="dyn_list_wrapper hidden" mode='end'>
<div class="created_course ">
<%= render :partial => 'course_form', :locals => {:memberships => @memberships_done} %>
</div>
</div>
</div>

View File

@ -1,38 +1,16 @@
<div class="content-title-top"> <div class="content-title-top">
<% if @memberships.empty? %> <% if @memberships.empty? %>
<% if @user != User.current %> <% if @user != User.current %>
<p class="font_description"> <p class="font_description">
<%= l(:label_project_course_un) %> <%= l(:label_project_course_un) %>
</p> </p>
<% else %> <% else %>
<p class="font_description"> <p class="font_description">
<!--teacher could create the course directly--> <!--teacher could create the course directly-->
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' %> <%= l(:label_project_course_unadd) %><%= link_to "#{l(:label_course_new)}", {:controller => 'projects', :action => 'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' %>
</p> </p>
<% end %> <% end %>
<% else %> <% else %>
<p> <%= render partial: 'course_list_have_entity' %>
<span><%=l(:label_course_doing)%>(<%=@memberships_doing.count%>)</span> <% end %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %>
</p>
<p>
<%= l(:label_created_course) %>
<div> <%= render :partial => 'course_form', :locals => {:memberships => @OwningCouses}%>
</div> </p>
<div style="clear:both;"></div>
<p> <%= l(:label_joined_course) %>
<div> <%= render :partial => 'course_form', :locals => {:memberships => @JoinCouses}%>
</div> </p>
<div style="clear:both;"></div>
<p>
<%= link_to l(:label_course_done)+"("+@memberships_done.count.to_s+")", 'javascript:void(0);', :onclick => '$("#courses_history_block").slideToggle(400);' , style:"color:#666666" if User.current.logged? %>
</p>
<div id="courses_history_block" class="courses_history hidden" >
<%= render :partial => 'course_form', :locals => {:memberships => @memberships_done}%>
</div>
<% end %>
</div> </div>

View File

@ -11,23 +11,27 @@
</p> </p>
<% end %> <% end %>
<% else %> <% else %>
<p> <div class="user_course_list">
<span><%=l(:label_course_doing)%>(<%=@memberships_doing.count%>)</span> <div class="menu">
<%= link_to"#{l(:label_course_view_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %> <%= link_to"#{l(:label_course_view_student)}",course_path(course: 1), :class => 'icon icon-add' %>
</p> <ul>
<div> <li mode='doing' class="on">进行中</li>
<%= render :partial => 'course_form', :locals => {:memberships => @memberships_doing}%> <li mode='end'>已完结</li>
</div> </ul>
</div>
<div style="clear:both;"></div> <div class="dyn_list_wrapper" mode='doing'>
<div class='created_course'>
<%= render :partial => 'course_form', :locals => {:memberships => @memberships_doing} %>
</div>
</div>
<p> <div class="dyn_list_wrapper hidden" mode='end'>
<%= link_to l(:label_course_done)+"("+@memberships_done.count.to_s+")", 'javascript:void(0);', :onclick => '$("#courses_history_block").slideToggle(400); ', style:"color:#666666" if User.current.logged? %> <div class="created_course ">
</p> <%= render :partial => 'course_form', :locals => {:memberships => @memberships_done} %>
</div>
<div id="courses_history_block" class="courses_history hidden" > </div>
<%= render :partial => 'course_form', :locals => {:memberships => @memberships_done}%> </div>
</div>
<% end %> <% end %>

View File

@ -12,3 +12,22 @@
}); });
</script> </script>
<script type="text/javascript">
$(document).ready(function() {
var $menu = $('.user_course_list .menu');
var $li_tags = $menu.find('[mode]');
var $dyn_list = $('.dyn_list_wrapper');
$menu.find('[mode]').each(function(index, el) {
$(el).click(function() {
mode = $(el).attr('mode');
$menu.find('[mode]').removeClass( "on" );
$( this ).addClass( "on" );
var wrapper = $('[mode='+mode+']')
$dyn_list.addClass( "hidden" );
wrapper.removeClass('hidden')
})
});
});
</script>

View File

@ -192,13 +192,21 @@
<span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
</span> </span>
<br> <div class='memo_activity memo_attr'>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span> <span class='memo_timestamp'>
<span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;"> <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %>&nbsp;发表 </span>
</span> <span class="memo_author">
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span> 楼主: <%= link_to_user(topic.author) %>
</div> </span>
<span class="memo_last_person">
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
</span>
<span class="memo_reply">
回复(<%= link_to topic.try(:replies_count), topic.event_url %>)
</span>
</div>
</div>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -239,12 +239,20 @@
<span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
</span> </span>
<br> <div class='memo_activity memo_attr'>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span> <span class='memo_timestamp'>
<span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;"> <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %>&nbsp;发表 </span>
</span> <span class="memo_author">
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span> 楼主: <%= link_to_user(topic.author) %>
</span>
<span class="memo_last_person">
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
</span>
<span class="memo_reply">
回复(<%= link_to topic.try(:replies_count), topic.event_url %>)
</span>
</div>
</div> </div>
</li> </li>
<% end %> <% end %>

View File

@ -1165,6 +1165,8 @@ en:
label_tags_bid_description: call description label_tags_bid_description: call description
label_tags_issue_description: issue description label_tags_issue_description: issue description
label_tags_all_objects: all objects label_tags_all_objects: all objects
label_apply_project: Apply Project
label_unapply_project: Unsubscribe
#fq #fq
button_leave_meassge: Submit button_leave_meassge: Submit

View File

@ -1326,7 +1326,8 @@ zh:
label_tags_bid_description: 需求描述 label_tags_bid_description: 需求描述
label_tags_issue_description: 问题描述 label_tags_issue_description: 问题描述
label_tags_all_objects: 所有 label_tags_all_objects: 所有
label_apply_project: 申请加入
label_unapply_project: 取消申请
#fq #fq
button_leave_meassge: 留言 button_leave_meassge: 留言

View File

@ -247,6 +247,9 @@ RedmineApp::Application.routes.draw do
post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
post 'appliedproject/applied', :to => 'applied_project#applied_join_project', :as => 'appliedproject'
delete 'appliedproject/applied', :to => 'applied_project#unapplied_join_project'
resources :bids, :only=>[:edit,:update,:show] do resources :bids, :only=>[:edit,:update,:show] do
member do member do
match 'homework_ajax_modal' match 'homework_ajax_modal'

View File

@ -0,0 +1,12 @@
class CreateAppliedProjects < ActiveRecord::Migration
def self.up
create_table :applied_projects do |t|
t.column :project_id, :integer, :null => false
t.column :user_id, :integer, :null => false
end
end
def self.down
drop_table :applied_projects
end
end

View File

@ -178,6 +178,11 @@ Redmine::AccessControl.map do |map|
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]} map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]}
end end
#作业模块权限
map.project_module :bids do |map|
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true
end
map.project_module :boards do |map| map.project_module :boards do |map|
map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true

View File

@ -493,7 +493,6 @@ a.bids_user {
} }
.line{ .line{
width: 905px;
height: 1px; height: 1px;
margin: 0px; margin: 0px;
background-color: #cacaca; background-color: #cacaca;

View File

@ -1,14 +1,17 @@
/* TODO: base/common/page 准备封装一些基本样式组合调用 参考YUI /* TODO: base/common/page 准备封装一些基本样式组合调用 参考YUI
*******************************************************************************/ *******************************************************************************/
span[id^=valid_user]{ span[id^=valid_user] {
padding-left: 10px; padding-left: 10px;
} }
.red{
color: red; .red {
color: red;
} }
.green{
color: green; .green {
color: green;
} }
.border_box { .border_box {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
@ -1007,7 +1010,7 @@ div.issue {
} }
#ver-zebra1 td { #ver-zebra1 td {
padding: 8px ; padding: 8px;
border-right: 1px solid #fff; border-right: 1px solid #fff;
border-left: 1px solid #fff; border-left: 1px solid #fff;
color: #669; color: #669;
@ -1133,11 +1136,13 @@ div.pagination {
-o-transition: 1s width; -o-transition: 1s width;
transition: 1s width; transition: 1s width;
} }
.all_browse_div table .description{
border-bottom: 1px solid #efffff; .all_browse_div table .description {
border-bottom: 1px solid #efffff;
} }
.all_browse_div table td{
vertical-align: middle; .all_browse_div table td {
vertical-align: middle;
} }
/* softapplication show /* softapplication show
@ -1146,6 +1151,7 @@ div.pagination {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.softapplication-img { .softapplication-img {
margin: 5px auto; margin: 5px auto;
width: 860px; width: 860px;
@ -1154,25 +1160,29 @@ div.pagination {
box-shadow: 5px 5px 20px 5px #ccc; box-shadow: 5px 5px 20px 5px #ccc;
border-radius: 5px; border-radius: 5px;
} }
.soft-application { .soft-application {
width: 326px; width: 326px;
height: 580px; height: 580px;
} }
.softapplication-img .title{
.softapplication-img .title {
width: 326px; width: 326px;
position: absolute; position: absolute;
left: 0; left: 0;
bottom: 0; bottom: 0;
} }
.softapplication-img .title a{
.softapplication-img .title a {
display: block; display: block;
text-decoration: none; text-decoration: none;
color: #fff; color: #fff;
font-size: 20px; font-size: 20px;
padding: 20px; padding: 20px;
background: rgba(0,0,0,0.5); background: rgba(0, 0, 0, 0.5);
} }
.softapplication-img li{
.softapplication-img li {
list-style-type: none; list-style-type: none;
position: relative; position: relative;
float: left; float: left;
@ -1182,11 +1192,97 @@ div.pagination {
-ms-transition: all 0.5s; -ms-transition: all 0.5s;
-o-transition: all 0.5s; -o-transition: all 0.5s;
transition: all 0.5s; transition: all 0.5s;
box-shadow: -1px 0 3px 1px rgba(0,0,0,0.3); box-shadow: -1px 0 3px 1px rgba(0, 0, 0, 0.3);
} }
.softapplication-img ul:hover li{
.softapplication-img ul:hover li {
width: 160px; width: 160px;
} }
.softapplication-img ul li:hover{
.softapplication-img ul li:hover {
width: 326px; width: 326px;
} }
/* user_courses
*******************************************************************************/
.user_course_list {
margin: 0;
padding: 0;
position: relative;
margin-top: -15px;
}
.user_course_list .menu{
display: block;
background-color: #f9f9f9;
border-radius: 2px 2px 0 0;
position: relative;
height: 40px;
line-height: 40px;
border-bottom: 1px solid #ddd;
text-align: left;
margin-left: -10px;
padding-left: 15px;
}
.user_course_list .menu:after {
content: ".";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.user_course_list .menu ul {
margin: 0;
padding: 0;
float: right;
margin-right: 30px;
}
.user_course_list .menu ul {
}
.user_course_list .menu li {
display: inline-block;
position: relative;
height: 40px;
line-height: 40px;
cursor: pointer;
}
.user_course_list .menu li:hover {
color: #00a1d6;
}
.user_course_list .menu li.on {
color: #00a1d6;
font-weight: bold;
}
.user_course_list .list_top {
margin: 20px auto 0px;
}
.user_course_list .created_course {
position: relative;
display: block;
padding-top: 20px;
}
.user_course_list .created_course:after {
content: ".";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.user_course_list .created_course .field {
position: absolute;
display: inline-block;
color: rgb(213, 213, 213);
top: 0;
right: 5%;
}