diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index babd06c2..80b2046b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -43,7 +43,7 @@ class ProjectsController < ApplicationController before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise] 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] + :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond] before_filter :authorize_global, :only => [:new, :create] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] #by young diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb index e668a234..46ae016e 100644 --- a/app/controllers/test_controller.rb +++ b/app/controllers/test_controller.rb @@ -4,6 +4,12 @@ class TestController < ApplicationController def index + # @users = User.where('status = ?', 1) + # for user in @users + # if user.user_extensions.nil? + # UserExtensions.create(:user_id => user.id) + # end + # end # @message = Message.all # @message.each do |m| diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6857e8a1..f7a9442e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -54,7 +54,8 @@ class UsersController < ApplicationController helper :words #added by young def user_projects - @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current)) + cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" + @memberships = @user.memberships.all(:conditions => cond) events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) @events_by_day = events.group_by(&:event_date) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index b38d3497..7e6760bc 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -17,6 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +include AvatarHelper module ProjectsHelper def link_to_version(version, options = {}) return '' unless version && version.is_a?(Version) diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index ce666940..59184d69 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -218,7 +218,8 @@ <%= select_tag 'identity', " - ".html_safe %>

+ + ".html_safe %>

diff --git a/app/views/bids/_bid_show.html.erb b/app/views/bids/_bid_show.html.erb index 37946ed6..75b7ac84 100644 --- a/app/views/bids/_bid_show.html.erb +++ b/app/views/bids/_bid_show.html.erb @@ -23,6 +23,12 @@ + <% unless bid.courses.empty? %> + <% teacher = Course.find_by_extra(bid.courses.first.identifier).teacher %> + + + + <% end %> <% end %>
<%= l(:label_gender) %>
<%= l(:label_x_homework_project, :count => bid.biding_projects.count) %>(<%= link_to bid.biding_projects.count, project_for_bid_path(bid) %>) <%= l(:label_x_responses, :count => bid.commit) %>(<%= link_to bid.commit, respond_path(bid) %>) <%= l(:label_x_followers, :count => bid.watcher_users.count) %>(<%= link_to bid.watcher_users.count, respond_path(bid) %>)
课程名称:<%= link_to bid.courses.first.name, project_path(bid.courses.first)%>  教师:<%= link_to teacher.lastname+teacher.firstname, user_path(teacher) %>
<%= format_time bid.created_on %> diff --git a/app/views/bids/_fork_form.html.erb b/app/views/bids/_fork_form.html.erb index c910a399..1a454d9f 100644 --- a/app/views/bids/_fork_form.html.erb +++ b/app/views/bids/_fork_form.html.erb @@ -1,9 +1,12 @@ - + <%= error_messages_for 'bid' %>

<%= l(:label_homeworks_form_new_description) %>

-

选择课程<%= select_tag 'course', course_options_for_select(@courses) %>

+ + +

<%= l(:label_choose_course) %><%= select_tag 'course', course_options_for_select(@courses) %>

<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :value => @bid.name %>

+

<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

diff --git a/app/views/bids/fork.html.erb b/app/views/bids/fork.html.erb index 592e7138..5d9192c8 100644 --- a/app/views/bids/fork.html.erb +++ b/app/views/bids/fork.html.erb @@ -1,5 +1,5 @@ -

<%=l(:label_new_call)%>

+

<%=l(:label_course_homework_new)%>

<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_fork', :id => @bid.id} do |f| %>
diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb index d7bb4c6a..25208b82 100644 --- a/app/views/bids/index.html.erb +++ b/app/views/bids/index.html.erb @@ -12,9 +12,9 @@ <% if User.current.logged? %> - + <% unless @project_type == '1' %> <%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %> - + <% end %> <% end %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 164c31fa..965f1dd0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -38,7 +38,18 @@ <% @course = Course.find_by_extra(@project.identifier)%> - + - + <% end %> + <% end %>
<%= link_to image_tag(url_to_avatar(@project), :class => 'avatar2') %> + <% if(@project.project_type==1)%> + + <% if get_avatar?(@project)%> + <%= link_to image_tag(url_to_avatar(@project), :class => "avatar2"), project_path(@project) %> + <% else %> + <%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(@project)%> + <% end %> + <% else %> + <%= link_to image_tag(url_to_avatar(@project), :class => "avatar2") %> + <% end %> +
<%= @project.name %> diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index f16eb735..009b40d5 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -122,7 +122,7 @@
<%= l(:field_occupation) %>:<%= @user.user_extensions.occupation %>
<%= l(:label_location) %>:<%= @user.user_extensions.location %><%= l(:label_location) %>:<%= @user.user_extensions.location %><%= @user.user_extensions.location_city %>
diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index fbb0c5ca..619e9698 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -1,7 +1,15 @@
+ <% if(@project.project_type==1)%> + <% if get_avatar?(project)%> + <%= link_to image_tag(url_to_avatar(project), :class => "avatar2"), project_path(project) %> + <% else %> + <%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(project)%> + <% end %> + <% else %> <%=link_to image_tag(url_to_avatar(project), :class => "avatar2"), project_path(project) %> + <% end %>

@@ -39,6 +47,10 @@ <% if @admin.size > 0 %> <%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %> <% end %> + <% if(@project.project_type==1)%> +    大学: + <%= @admin.first.user.user_extensions.occupation %> + <% end %>

<%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(@project.created_on)) %> diff --git a/app/views/projects/course.html.erb b/app/views/projects/course.html.erb index dce1d715..30af2849 100644 --- a/app/views/projects/course.html.erb +++ b/app/views/projects/course.html.erb @@ -8,9 +8,11 @@
<%= l(:label_new_course)%> + <% if User.current.logged?%> <% if User.current.user_extensions.identity == 0 %> <%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>