From 4d82cad51d7c81cc35a68fe141771a8362ce04f7 Mon Sep 17 00:00:00 2001 From: zhangyang Date: Fri, 30 Aug 2013 09:34:21 +0800 Subject: [PATCH] move 2013.8.29 --- app/controllers/boards_controller.rb | 15 +- app/controllers/documents_controller.rb | 9 +- app/controllers/files_controller.rb | 11 +- app/controllers/messages_controller.rb | 6 +- app/controllers/projects_controller.rb | 88 +++-- app/controllers/repositories_controller.rb | 24 +- app/helpers/projects_helper.rb | 22 +- app/models/journals_for_message_observer.rb | 7 + app/models/mailer.rb | 9 + app/models/project.rb | 3 +- app/views/layouts/base_courses.html.erb | 146 ++++++++ .../journals_for_message_added.html.erb | 2 + app/views/news/index.html.erb | 2 +- app/views/projects/_course_form.html.erb | 47 +++ app/views/projects/_form.html.erb | 4 +- app/views/projects/homework.html.erb | 34 ++ app/views/projects/index.html.erb | 8 +- app/views/projects/new.html.erb | 25 +- app/views/projects/new_homework.html.erb | 9 + app/views/projects/settings.html.erb | 6 +- .../projects/settings/_repositories.html.erb | 5 +- app/views/projects/show.html.erb | 2 +- app/views/projects/statistics.html.erb | 0 app/views/repositories/_navigation.html.erb | 2 +- app/views/repositories/stats.html.erb | 10 +- app/views/users/info.html.erb | 2 +- app/views/users/show.html.erb | 2 +- app/views/users/user_newfeedback.html.erb | 2 +- app/views/users/user_projects.html.erb | 2 +- app/views/users/watch_bids.html.erb | 2 +- app/views/versions/index.html.erb | 1 - config/application.rb | 2 +- config/locales/en.yml | 16 +- config/locales/zh.yml | 18 +- config/routes.rb | 28 +- ...30827003308_add_project_type_to_project.rb | 9 + db/schema.rb | 17 +- files/2013/08/130806152654_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153250_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153331_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153435_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153511_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153649_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153715_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153855_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806153935_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154013_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154103_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154135_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154627_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154720_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154826_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154843_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806154858_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806155359_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806155534_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806155622_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806155745_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806155911_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130806160031_desktop.ini | Bin 0 -> 174 bytes files/2013/08/130807094116_Chrysanthemum.jpg | Bin 0 -> 879394 bytes files/2013/08/130807094539_Jellyfish.jpg | Bin 0 -> 775702 bytes ...70642_1675b2d45e868443acb3447a529c1ace.txt | 4 + ...95300_1675b2d45e868443acb3447a529c1ace.txt | 4 + lib/redmine.rb | 12 +- lib/redmine/menu_manager.rb | 2 +- public/500.html | 2 +- public/images/avatars/Project/6316 | Bin 0 -> 775702 bytes public/images/avatars/Project/6356 | Bin 0 -> 879394 bytes public/images/avatars/Project/6358 | Bin 0 -> 777835 bytes public/statistics/trustie2/arrow-down.gif | Bin 0 -> 73 bytes public/statistics/trustie2/arrow-none.gif | Bin 0 -> 71 bytes public/statistics/trustie2/arrow-up.gif | Bin 0 -> 73 bytes public/statistics/trustie2/gitstats.cache | Bin 0 -> 54340 bytes public/statistics/trustie2/gitstats.css | 154 +++++++++ public/statistics/trustie2/index.html | 20 ++ public/statistics/trustie2/sortable.js | 324 ++++++++++++++++++ public/stylesheets/application.css | 6 +- statistics/trustie2/trustie/activity.html | 47 +++ statistics/trustie2/trustie/arrow-down.gif | Bin 0 -> 73 bytes statistics/trustie2/trustie/arrow-none.gif | Bin 0 -> 71 bytes statistics/trustie2/trustie/arrow-up.gif | Bin 0 -> 73 bytes statistics/trustie2/trustie/authors.html | 33 ++ .../trustie2/trustie/commits_by_year.dat | 1 + .../trustie2/trustie/commits_by_year.plot | 10 + .../trustie2/trustie/commits_by_year.svg | 110 ++++++ .../trustie/commits_by_year_month.dat | 1 + .../trustie/commits_by_year_month.plot | 13 + .../trustie/commits_by_year_month.svg | 110 ++++++ statistics/trustie2/trustie/day_of_week.dat | 7 + statistics/trustie2/trustie/day_of_week.plot | 10 + statistics/trustie2/trustie/day_of_week.svg | 147 ++++++++ statistics/trustie2/trustie/domains.dat | 3 + statistics/trustie2/trustie/domains.plot | 9 + statistics/trustie2/trustie/domains.svg | 143 ++++++++ statistics/trustie2/trustie/files.html | 32 ++ statistics/trustie2/trustie/files_by_date.dat | 34 ++ .../trustie2/trustie/files_by_date.plot | 14 + statistics/trustie2/trustie/files_by_date.svg | 166 +++++++++ statistics/trustie2/trustie/gitstats.cache | Bin 0 -> 54344 bytes statistics/trustie2/trustie/gitstats.css | 155 +++++++++ statistics/trustie2/trustie/hour_of_day.dat | 24 ++ statistics/trustie2/trustie/hour_of_day.plot | 10 + statistics/trustie2/trustie/hour_of_day.svg | 173 ++++++++++ statistics/trustie2/trustie/index.html | 22 ++ statistics/trustie2/trustie/lines.html | 26 ++ statistics/trustie2/trustie/lines_of_code.dat | 101 ++++++ .../trustie2/trustie/lines_of_code.plot | 13 + statistics/trustie2/trustie/lines_of_code.svg | 171 +++++++++ statistics/trustie2/trustie/month_of_year.dat | 12 + .../trustie2/trustie/month_of_year.plot | 10 + statistics/trustie2/trustie/month_of_year.svg | 137 ++++++++ statistics/trustie2/trustie/sortable.js | 324 ++++++++++++++++++ statistics/trustie2/trustie/tags.html | 21 ++ 114 files changed, 3096 insertions(+), 118 deletions(-) create mode 100644 app/models/journals_for_message_observer.rb create mode 100644 app/views/layouts/base_courses.html.erb create mode 100644 app/views/mailer/journals_for_message_added.html.erb create mode 100644 app/views/projects/_course_form.html.erb create mode 100644 app/views/projects/homework.html.erb create mode 100644 app/views/projects/new_homework.html.erb create mode 100644 app/views/projects/statistics.html.erb create mode 100644 db/migrate/20130827003308_add_project_type_to_project.rb create mode 100644 files/2013/08/130806152654_desktop.ini create mode 100644 files/2013/08/130806153250_desktop.ini create mode 100644 files/2013/08/130806153331_desktop.ini create mode 100644 files/2013/08/130806153435_desktop.ini create mode 100644 files/2013/08/130806153511_desktop.ini create mode 100644 files/2013/08/130806153649_desktop.ini create mode 100644 files/2013/08/130806153715_desktop.ini create mode 100644 files/2013/08/130806153855_desktop.ini create mode 100644 files/2013/08/130806153935_desktop.ini create mode 100644 files/2013/08/130806154013_desktop.ini create mode 100644 files/2013/08/130806154103_desktop.ini create mode 100644 files/2013/08/130806154135_desktop.ini create mode 100644 files/2013/08/130806154627_desktop.ini create mode 100644 files/2013/08/130806154720_desktop.ini create mode 100644 files/2013/08/130806154826_desktop.ini create mode 100644 files/2013/08/130806154843_desktop.ini create mode 100644 files/2013/08/130806154858_desktop.ini create mode 100644 files/2013/08/130806155359_desktop.ini create mode 100644 files/2013/08/130806155534_desktop.ini create mode 100644 files/2013/08/130806155622_desktop.ini create mode 100644 files/2013/08/130806155745_desktop.ini create mode 100644 files/2013/08/130806155911_desktop.ini create mode 100644 files/2013/08/130806160031_desktop.ini create mode 100644 files/2013/08/130807094116_Chrysanthemum.jpg create mode 100644 files/2013/08/130807094539_Jellyfish.jpg create mode 100644 files/2013/08/130827170642_1675b2d45e868443acb3447a529c1ace.txt create mode 100644 files/2013/08/130829095300_1675b2d45e868443acb3447a529c1ace.txt create mode 100644 public/images/avatars/Project/6316 create mode 100644 public/images/avatars/Project/6356 create mode 100644 public/images/avatars/Project/6358 create mode 100644 public/statistics/trustie2/arrow-down.gif create mode 100644 public/statistics/trustie2/arrow-none.gif create mode 100644 public/statistics/trustie2/arrow-up.gif create mode 100644 public/statistics/trustie2/gitstats.cache create mode 100644 public/statistics/trustie2/gitstats.css create mode 100644 public/statistics/trustie2/index.html create mode 100644 public/statistics/trustie2/sortable.js create mode 100644 statistics/trustie2/trustie/activity.html create mode 100644 statistics/trustie2/trustie/arrow-down.gif create mode 100644 statistics/trustie2/trustie/arrow-none.gif create mode 100644 statistics/trustie2/trustie/arrow-up.gif create mode 100644 statistics/trustie2/trustie/authors.html create mode 100644 statistics/trustie2/trustie/commits_by_year.dat create mode 100644 statistics/trustie2/trustie/commits_by_year.plot create mode 100644 statistics/trustie2/trustie/commits_by_year.svg create mode 100644 statistics/trustie2/trustie/commits_by_year_month.dat create mode 100644 statistics/trustie2/trustie/commits_by_year_month.plot create mode 100644 statistics/trustie2/trustie/commits_by_year_month.svg create mode 100644 statistics/trustie2/trustie/day_of_week.dat create mode 100644 statistics/trustie2/trustie/day_of_week.plot create mode 100644 statistics/trustie2/trustie/day_of_week.svg create mode 100644 statistics/trustie2/trustie/domains.dat create mode 100644 statistics/trustie2/trustie/domains.plot create mode 100644 statistics/trustie2/trustie/domains.svg create mode 100644 statistics/trustie2/trustie/files.html create mode 100644 statistics/trustie2/trustie/files_by_date.dat create mode 100644 statistics/trustie2/trustie/files_by_date.plot create mode 100644 statistics/trustie2/trustie/files_by_date.svg create mode 100644 statistics/trustie2/trustie/gitstats.cache create mode 100644 statistics/trustie2/trustie/gitstats.css create mode 100644 statistics/trustie2/trustie/hour_of_day.dat create mode 100644 statistics/trustie2/trustie/hour_of_day.plot create mode 100644 statistics/trustie2/trustie/hour_of_day.svg create mode 100644 statistics/trustie2/trustie/index.html create mode 100644 statistics/trustie2/trustie/lines.html create mode 100644 statistics/trustie2/trustie/lines_of_code.dat create mode 100644 statistics/trustie2/trustie/lines_of_code.plot create mode 100644 statistics/trustie2/trustie/lines_of_code.svg create mode 100644 statistics/trustie2/trustie/month_of_year.dat create mode 100644 statistics/trustie2/trustie/month_of_year.plot create mode 100644 statistics/trustie2/trustie/month_of_year.svg create mode 100644 statistics/trustie2/trustie/sortable.js create mode 100644 statistics/trustie2/trustie/tags.html diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 999544e7b..b998c44d2 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -33,6 +33,9 @@ class BoardsController < ApplicationController @board = @boards.first show end + if @project.project_type + render :layout => 'base_courses' + end end def show @@ -54,7 +57,11 @@ class BoardsController < ApplicationController preload(:author, {:last_reply => :author}). all @message = Message.new(:board => @board) - render :action => 'show', :layout => !request.xhr? + if @project.project_type + render :action => 'show', :layout => 'base_courses' + else + render :action => 'show', :layout => !request.xhr? + end } format.atom { @messages = @board.messages. @@ -70,6 +77,9 @@ class BoardsController < ApplicationController def new @board = @project.boards.build @board.safe_attributes = params[:board] + if @project.project_type + render :layout => 'base_courses' + end end def create @@ -90,6 +100,9 @@ class BoardsController < ApplicationController end def update + if @project.project_type + render :layout => 'base_courses' + end @board.safe_attributes = params[:board] if @board.save redirect_to_settings_in_projects diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index a311fc765..d00535aba 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -40,11 +40,18 @@ class DocumentsController < ApplicationController @grouped = documents.group_by(&:category) end @document = @project.documents.build - render :layout => false if request.xhr? + if @project.project_type + render :layout => 'base_courses' + else + render :layout => false if request.xhr? + end end def show @attachments = @document.attachments.all + if @project.project_type + render :action => 'show', :layout => 'base_courses' + end end def new diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index cb4c1b8ff..f47d4797f 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -34,11 +34,20 @@ class FilesController < ApplicationController @containers = [ Project.includes(:attachments).reorder(sort_clause).find(@project.id)] @containers += @project.versions.includes(:attachments).reorder(sort_clause).all.sort.reverse - render :layout => !request.xhr? + @course_tag = @project.project_type + if @course_tag + render :layout => 'base_courses' + else + render :layout => !request.xhr? + end end def new @versions = @project.versions.sort + @course_tag = @project.project_type + if @course_tag + render :layout => 'base_courses' + end end def create diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 27d195f0d..56422dcd6 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -49,7 +49,11 @@ class MessagesController < ApplicationController all @reply = Message.new(:subject => "RE: #{@message.subject}") - render :action => "show", :layout => "base_projects"#by young + if @message.board.project.project_type + render :action => "show", :layout => "base_courses"#by young + else + render :action => "show", :layout => "base_projects"#by young + end end # Create a new topic diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9a3e2d70f..875a8db0c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -19,14 +19,15 @@ class ProjectsController < ApplicationController layout 'base_projects'# by young menu_item :overview menu_item :roadmap, :only => :roadmap -# menu_item :settings, :only => :settings + menu_item :settings, :only => :settings + menu_item :homework, :only => :homework - before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] - before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback] + before_filter :find_project, :except => [ :index, :list, :new, :create, :copy, :statistics] + before_filter :authorize, :except => [:new_homework, :homework, :statistics, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback] before_filter :authorize_global, :only => [:new, :create] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] #by young - before_filter :member, :file, :statistics + before_filter :member, :file # accept_rss_auth :index accept_api_auth :index, :show, :create, :update, :destroy @@ -36,7 +37,9 @@ class ProjectsController < ApplicationController controller.send :expire_action, :controller => 'welcome', :action => 'robots' end end - + + helper :bids + include BidsHelper helper :sort include SortHelper helper :custom_fields @@ -51,32 +54,11 @@ class ProjectsController < ApplicationController helper :activities helper :documents helper :watchers - + ### added by william include ActsAsTaggableOn::TagsHelper - - # Lists visible projects -# def index -# respond_to do |format| -# format.html { -# scope = Project -# unless params[:closed] -# scope = scope.active -# end -# @projects = scope.visible.order('lft').all -# } -# format.api { -# @offset, @limit = api_offset_and_limit -# @project_count = Project.visible.count -# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all -# } -# format.atom { -# projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all -# render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") -# } -# end -# end - + + def index #Modified by nie # @offset, @limit = api_offset_and_limit({:limit => 10}) @@ -123,6 +105,33 @@ class ProjectsController < ApplicationController end end + #Added by young + def homework + @offset, @limit = api_offset_and_limit({:limit => 10}) + @bids = Bid.visible + @bids = @bids.like(params[:name]) if params[:name].present? + @bid_count = @bids.count + @bid_pages = Paginator.new @bid_count, @limit, params['page'] + + @offset ||= @bid_pages.reverse_offset + #@bids = @bids.offset(@offset).limit(@limit).all.reverse + unless @offset == 0 + @bids = @bids.offset(@offset).limit(@limit).all.reverse + else + limit = @bid_count % @limit + @bids = @bids.offset(@offset).limit(limit).all.reverse + end + render :layout => 'base_courses' + end + + def new_homework + @homework = Bid.new + @homework.safe_attributes = params[:bid] + render :layout => 'base_courses' + end +#Ended by young + + def feedback @jours = @project.journals_for_messages.reverse @limit = 10 @@ -134,14 +143,17 @@ class ProjectsController < ApplicationController end def new + @course_tag = params[:course] @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] render :layout => 'base' end + def create + @course_tag = params[:project][:project_type] @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @@ -163,8 +175,12 @@ class ProjectsController < ApplicationController if params[:continue] attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?} redirect_to new_project_path(attrs) + #Added by young + elsif params[:course_continue] + redirect_to new_project_path(:course => '1') + #Ended by young else - redirect_to settings_project_path(@project) + redirect_to settings_project_path(@project, :course => @course_tag) end } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) } @@ -276,8 +292,9 @@ class ProjectsController < ApplicationController end @document = @project.documents.build # + @base_courses_tag = @project.project_type respond_to do |format| - format.html + format.html{render :layout => 'base_courses' if @base_courses_tag } format.api end end @@ -289,6 +306,12 @@ class ProjectsController < ApplicationController @member ||= @project.members.new @trackers = Tracker.sorted.all @wiki ||= @project.wiki + #Added by young + @course_tag = params[:course] + if @course_tag == '1' + render :layout => 'base_courses' + end + #Ended by young end def edit @@ -302,9 +325,6 @@ class ProjectsController < ApplicationController def file end - def statistics - - end #end def update diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 94de4bfbb..0657ddfe4 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -43,15 +43,26 @@ class RepositoriesController < ApplicationController @repository = Repository.factory(scm) @repository.is_default = @project.repository.nil? @repository.project = @project - render :layout => 'base_projects' + @course_tag = params[:course] + if @course_tag + render :layout => 'base_courses' + else + render :layout => 'base_projects' + end end + def newrepo scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first @repository = Repository.factory(scm) @repository.is_default = @project.repository.nil? @repository.project = @project - render :layout => 'base_projects' + @course_tag = params[:course] + if @course_tag + render :layout => 'base_courses' + else + render :layout => 'base_projects' + end end def fork @@ -209,7 +220,12 @@ class RepositoriesController < ApplicationController @changesets = @repository.latest_changesets(@path, @rev) @properties = @repository.properties(@path, @rev) @repositories = @project.repositories - render :action => 'show', :layout => 'base_projects' + @course_tag = params[:course] + if @course_tag + render :action => 'show', :layout => 'base_courses' + else + render :action => 'show', :layout => 'base_projects' + end end end @@ -369,6 +385,8 @@ class RepositoriesController < ApplicationController end def stats + @project_id = params[:id] + @repository_id = @repository.identifier render :layout => 'base_projects' end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index cbe57d1c7..4b465a11e 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -35,8 +35,20 @@ module ProjectsHelper {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities} ] tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} + end - + + #Added by young + def course_settings_tabs + tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural}, + {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, + {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural} + ] + tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} + + end + #Ended by young + def parent_project_select_tag(project) selected = project.parent # retrieve the requested parent project @@ -54,7 +66,13 @@ module ProjectsHelper # Renders the projects index def render_project_hierarchy(projects) render_project_nested_lists(projects) do |project| - s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") + #Modified by young + if project.project_type + s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")+"(#{l(:label_course)})".html_safe + else + s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") + end + #Ended by young if project.description.present? #Delete by nie. # s << content_tag('td', textilizable(project.short_description, :project => project), :class => 'wiki description') diff --git a/app/models/journals_for_message_observer.rb b/app/models/journals_for_message_observer.rb new file mode 100644 index 000000000..3bca47791 --- /dev/null +++ b/app/models/journals_for_message_observer.rb @@ -0,0 +1,7 @@ +# Added by young +class JournalsForMessageObserver < ActiveRecord::Observer + def after_create(journal_for_message) + Mailer.journals_for_message_add(User.current, journal_for_message).deliver + end +end + diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 1db19f14e..b9d3fe847 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -26,6 +26,15 @@ class Mailer < ActionMailer::Base def self.default_url_options { :host => Setting.host_name, :protocol => Setting.protocol } end + + # Builds a Mail::Message object used to email recipients of the added journals for message. + # + def journals_for_message_add(user, journals_for_message) + @user = User.current + @url = url_for(:controller => 'users', :action => 'user_newfeedback') + mail :to => user.mail, + :subject => "hello" + end # Builds a Mail::Message object used to email recipients of the added issue. # diff --git a/app/models/project.rb b/app/models/project.rb index 7af230aa4..d249ec02a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -681,7 +681,8 @@ class Project < ActiveRecord::Base 'custom_field_values', 'custom_fields', 'tracker_ids', - 'issue_custom_field_ids' + 'issue_custom_field_ids', + 'project_type' safe_attributes 'enabled_module_names', :if => lambda {|project, user| project.new_record? || user.allowed_to?(:select_project_modules, project) } diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb new file mode 100644 index 000000000..d59980b75 --- /dev/null +++ b/app/views/layouts/base_courses.html.erb @@ -0,0 +1,146 @@ + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + + <%= yield :header_tags -%> + + + +
+
+
+ <%= render :partial => 'layouts/base_header'%> + +
+ + +
+
教师名称:XXX
+
所在单位:并行与分布重点实验室
+
课程学分:X学分
+
课程学时:XX学时
+
XXXX:XXXXXXXX
+
+
    +
  • <%= link_to(l(:label_overview), project_path(@project))%>
  • +
  • <%= link_to(l(:label_homework), {:controller => 'projects', :action => 'homework'})%>
  • +
  • <%= link_to(l(:label_repository), { :controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%>
  • +
  • <%= link_to(l(:label_settings),{:controller => 'projects', :action => 'settings', :id => @project, :course => 1})%>
+
+ <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+ <%= render_flash_messages %> + +
+ <%= render :partial => 'layouts/base_footer'%> +
+ + + +
+
+ <%= call_hook :view_layouts_base_body_bottom %> + + diff --git a/app/views/mailer/journals_for_message_added.html.erb b/app/views/mailer/journals_for_message_added.html.erb new file mode 100644 index 000000000..f68026492 --- /dev/null +++ b/app/views/mailer/journals_for_message_added.html.erb @@ -0,0 +1,2 @@ +

<%= link_to("hello", @url) %>

+<%=h @user %> diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 1b68e5b20..071dbec88 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -39,7 +39,7 @@

<%= l(:label_no_data) %>

<% else %> <% @newss.each do |news| %> - +
<%= image_tag(url_to_avatar(news.author), :class => "avatar") %> diff --git a/app/views/projects/_course_form.html.erb b/app/views/projects/_course_form.html.erb new file mode 100644 index 000000000..72dc3cd1e --- /dev/null +++ b/app/views/projects/_course_form.html.erb @@ -0,0 +1,47 @@ +<%= error_messages_for 'project' %> + +<% unless @project.new_record? %> +

<%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %>

+<% end %> +

<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %>

+ +

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

+

<%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %> +<% unless @project.identifier_frozen? %> + <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %> +<% end %>

+

<%= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %>

+

<%= f.check_box :is_public, :style => "margin-left:10px;" %>

+

<%= f.text_field :project_type, :value => 1 %>

+ + +<%= wikitoolbar_for 'project_description' %> + +<% @project.custom_field_values.each do |value| %> +

<%= custom_field_tag_with_label :project, value %>

+<% end %> +<%= call_hook(:view_projects_form, :project => @project, :form => f) %> + + + + + +<% unless @project.identifier_frozen? %> + <% content_for :header_tags do %> + <%= javascript_include_tag 'project_identifier' %> + <% end %> +<% end %> + +<% if !User.current.admin? && @project.inherit_members? && @project.parent && User.current.member_of?(@project.parent) %> + <%= javascript_tag do %> + $(document).ready(function() { + $("#project_inherit_members").change(function(){ + if (!$(this).is(':checked')) { + if (!confirm("<%= escape_javascript(l(:text_own_membership_delete_confirmation)) %>")) { + $("#project_inherit_members").attr("checked", true); + } + } + }); + }); + <% end %> +<% end %> diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index f752c7d0b..0802d9b2a 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -11,8 +11,8 @@ <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %> <% end %>

<%= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %>

-

<%= f.check_box :is_public, :style => "margin-left:10px;" %>

- +

<%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_public_info) %>

+

<%= f.text_field :project_type, :value => 0 %>

<%= wikitoolbar_for 'project_description' %> diff --git a/app/views/projects/homework.html.erb b/app/views/projects/homework.html.erb new file mode 100644 index 000000000..50a439db1 --- /dev/null +++ b/app/views/projects/homework.html.erb @@ -0,0 +1,34 @@ + + +
+
+ + + + + + +
<%= l(:label_course_homework_list)%><% if User.current.logged? %> + + + <%= link_to(l(:label_course_homework_new), {:controller => 'projects', :action => 'new_homework'}, :class => 'icon icon-add') %> + + + <% end %> +
+ + + +<% if User.current.logged? %> + +<% end %> + +
+ <%= render :partial => 'bids/bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %> +
+ diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 8f4852ef5..814d221f0 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -7,8 +7,8 @@ - - + +
<%= l(:label_project_plural)%><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %><%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
-<%end%> +<% end %>
<%= render_project_hierarchy(@projects)%>
- +