diff --git a/app/controllers/git_usage_controller.rb b/app/controllers/git_usage_controller.rb new file mode 100644 index 00000000..69b0c7f5 --- /dev/null +++ b/app/controllers/git_usage_controller.rb @@ -0,0 +1,11 @@ +#added by baiyu +class GitUsageController < ApplicationController + def ch_usage + + end + + def en_usage + + end +end +#end \ No newline at end of file diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9c67b4c9..65b30602 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -22,7 +22,7 @@ class ProjectsController < ApplicationController # menu_item :settings, :only => :settings 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] + before_filter :authorize, :except => [ :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 @@ -122,6 +122,16 @@ class ProjectsController < ApplicationController } end end + + def feedback + @jours = @project.journals_for_messages.reverse + @limit = 10 + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] + @state = false + end def new @issue_custom_fields = IssueCustomField.sorted.all diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 60b7d8bd..2fe1f61d 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -107,6 +107,15 @@ class WordsController < ApplicationController end end + def add_project_respond + user = User.current + message = params[:new_form][:project_message] + Project.add_jour(user, message) + + redirect_to project_feedback_path('trustie') + # redirect_to signin_path + end + private def find_user diff --git a/app/models/project.rb b/app/models/project.rb index 97c4f732..7af230aa 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -51,6 +51,9 @@ class Project < ActiveRecord::Base has_one :repository, :conditions => ["is_default = ?", true] has_many :repositories, :dependent => :destroy has_many :changesets, :through => :repository + # added by fq + has_many :journals_for_messages, :as => :jour, :dependent => :destroy + # end #ADDED BY NIE has_many :project_infos, :dependent => :destroy #end @@ -127,6 +130,14 @@ class Project < ActiveRecord::Base where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p", :p => pattern) end } + + +# 项目留言 added by fq + def self.add_jour(user, notes) + project = Project.find('trustie') + project.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => 0) + end +# end def initialize(attributes=nil, *args) super diff --git a/app/views/git_usage/ch_usage.html.erb b/app/views/git_usage/ch_usage.html.erb new file mode 100644 index 00000000..dc5cf23e --- /dev/null +++ b/app/views/git_usage/ch_usage.html.erb @@ -0,0 +1,242 @@ + + + + + + +无标题文档 + + + + + + + + +
Git使用说明
+ + + + + +
我们将使用 git 这个分布式版本控制系统来提交代码,下面就来介绍一下代码的提交方法。
+ + + + + +
 
+ + + + + + + + + + +

Step1:

打开终端,输入如下命令:

$git config --global user.name “your_name”

+

+

$git config --global user.email “your_email”

+ + + + + + + + + + + + + +

用户名和email是用来设置自己的用户名和联系方式的(user.name和user.email必须填写,这些将在版本库提交时用到)。

 

Tips:

在碰到不熟悉的命令时,可以通过 git help命令查看git的用户手册,命令如下:

+ + + + +

$git help <command>

+ + + + + + + + + + +
 

Step2:

创建版本库(两种途径)

+ + + + +

(1)从远程服务器上克隆一个已存在的版本库到本地:

+ + + + +

$git clone http://user_name@domain/repo_path.git

+ + + + + + + + + + +

其中,domain是服务器的域名(在trustie系统域名222.247.54.100),repo_path.git是版本库在服务器的相对路径(这个地址在trustie系统中会给出)

 

(2)在本地初始化一个版本库,比如将版本库命名为“DEMO”,使用名为/path/to/my/workspace的目录作为个人的工作区根目录,进入该目录后,执行git init创建版本库。

+ + + + + + + + + + + + + +

           $cd /path/to/my/workspace

           $mkdir demo

           $cd demo

           $git init 

+

 

+

 

+ + + + + + + + + + + + + +

完成上述操作后,可以看到git init命令在工作区创建了隐藏目录 .git。这个隐藏的 .git目录就是git版本库(repository)。

 

Step3:

提交文件到本地仓库:

+ + + + +

$git add file1 file2 

+ + + + +

files是做了修改的文件,多个文件使用空格隔开。

+ + + + +

$git commit –m "commit message" 

+ + + + + + + + + + + + + + + + +

通过-m参数设置提交说明为“commit message”,Git强制性的要求在提交过程中需要输入提交说明,可以使用git log命令来查看提交日志。

 

Step4:

将本地分支推送到远程仓库:

上述操作仅仅是在本地建立了一个git版本库,为了协同工作,我们可以将其推送到远程服务器。

+ + + + +

$git remote add origin http://user_name@domain/repo_path.git 

+ + + + +

远程库别名为origin

+ + + + +

$git push origin master 

+ + + + +

将本地的master分支推送到origin的master分支

+ + + + +
 
+ + + + + + + + + + +

Step5:

将远程仓库的分支更新到本地:

当项目小组有成员将其自己的代码推送到服务器,我们可以使用git pull (或者git fetch)获取更新后的代码。

+ + + + +

$git pull origin master

+ + + + +

将远程库origin的master分支更新到本地的master分支

+ + + + +
 
+ + + + +
——Trustie团队
+

 

+

 

+

 

+

 

+

 

+ + + + \ No newline at end of file diff --git a/app/views/git_usage/en_usage.html.erb b/app/views/git_usage/en_usage.html.erb new file mode 100644 index 00000000..9579ae88 --- /dev/null +++ b/app/views/git_usage/en_usage.html.erb @@ -0,0 +1,245 @@ + + + + + + +无标题文档 + + + + + + + + +
Git User Guide
+ + + + + +
We will use git which is a distributed version control and source code management system to submit our code, here is the submission method.
+ + + + + + + + + + + + + + +
 

Step1:

Enter the following command in the terminal:

$git config --global user.name “your_name”

+

+

$git config --global user.email “your_email”

+ + + + + + + + + + + + + +

User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository).

 

Tips:

You can read the user manual by enter " git help " command when you are confused, command as follows:

+ + + + +

$git help <command>

+ + + + + + + + + + +
 

Step2:

Create a new repository by two ways, here we go

+ + + + +

(1) The first way is clone a repository which is already exists from remote Server to local:

+ + + + +

$git clone http://user_name@domain/repo_path.git

+ + + + + + + + + + +

The "domain" in the command means the server's domain name(the domain name in Trustie system is 222.247.54.100), "repo_path.git" is the relative path(this address will be given in Trustie)

 

(2) Initialize a repository on the local, we named repository as “DEMO” for example, use the directory "/path/to/my/workspace" as a root of personal workspace.

+ + + + +

Enter the directory, execute the "git init" command to create the repository.

+ + + + + + + + + + + + + +

           $cd /path/to/my/workspace

           $mkdir demo

           $cd demo

           $git init 

+

 

+

 

+ + + + + + + + + + + + + +

After completed these operation, you can see "git init " command creates a hidden directory in the workspace and this hidden directory is the git repository.

 

Step3:

Submit the file to the local repository:

+ + + + +

$git add file1 file2 

+ + + + +

"file1" is the file which is already modified, multiple files separated by spaces.

+ + + + +

$git commit –m "commit message" 

+ + + + + + + + + + + + + + + + +

commit message”is a submission instructions which is a mandatory requirement in the Git, you can use "git log" to list the commit log.

 

Step4:

Push the local branches to the remote repository:

The operation we mentioned above is only to establish a local git repository, we can push it to the remote server in order to work together in the future.

+ + + + +

$git remote add origin http://user_name@domain/repo_path.git 

+ + + + +

In Git, we call remote repository as origin

+ + + + +

$git push origin master 

+ + + + +

Push the local master branch to the origin master branch .

+ + + + +
 
+ + + + + + + + + + +

Step5:

Get the latest branch from the remote repository:

When your team members push the code to the server, we can use "git pull " (or "git fetch") to obtain the modified code.。

+ + + + +

$git pull origin master

+ + + + +

Pull the remote master branch to the local master branch.

+ + + + + + + +
 
--By Trustie Team
+

 

+

 

+

 

+

 

+

 

+ + + + diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 45034667..822e9978 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -117,6 +117,11 @@ <%=image_tag("/images/sidebar/tool_tag2.png", weight:"15px", height:"15px") %> <%= link_to l(:project_module_boards) ,project_boards_path(@project) %> + <% if @project.identifier = 'trustie' %> + <%=image_tag("/images/sidebar/tool_tag2.png", weight:"15px", height:"15px") %> + <%= link_to l(:label_user_response) ,project_feedback_path(@project) %> + + <% end %> diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb new file mode 100644 index 00000000..8f316527 --- /dev/null +++ b/app/views/projects/feedback.html.erb @@ -0,0 +1,38 @@ + +

<%= l(:label_user_response) %>

+<% if @jour.size >0 %> + +<% for journal in @jour%> + + + + + +
<%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> + + + + + + + + + + +
<%=link_to journal.user, user_path(journal.user)%> + <% if @user == User.current%> + <%= l(:label_leave_me_message) %> + <% else %> + <%= l(:label_leave_others_message) %> + <% end %> +

<%= textilizable journal.notes%>

<%= format_time journal.created_on %> +
+
+<% end %> +<% end %> + + \ No newline at end of file diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index bd610bcd..46713e9c 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -76,6 +76,8 @@ <% end %> <% end %> +如何提交代码 <%= link_to('中文', ch_usage_path)%> <%= link_to('English', en_usage_path)%> + <% content_for :header_tags do %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index a8a42a26..7231eefc 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -217,8 +217,53 @@ software development and software crowdsourcing. + + + + + + + + + +
+ + + @@ -262,8 +307,12 @@ software development and software crowdsourcing. +
朋友,系统仍在不断完善,有意见和建议请 <%= toggle_link '点击我', 'put-bid-form', {:focus => 'new_form_project_message'} %>
+ +
<%= link_to image_tag("/images/welcome/1.png", weight:"190px", height:"190px"), :controller => 'projects', :action => 'index' %>
<%= l(:label_milestone_description) %>
+ + + diff --git a/config/routes.rb b/config/routes.rb index 1f82dc52..4ff256ba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,6 +27,10 @@ RedmineApp::Application.routes.draw do get "praise_tread/tread_plus" 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' match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] @@ -131,6 +135,7 @@ RedmineApp::Application.routes.draw do # get 'on', :action => 'on', :as => 'on' get 'file', :action => 'file', :as => 'file' get 'statistics', :action => 'statistics', :as => 'statistics' + get 'feedback', :action => 'feedback' #end post 'modules' @@ -141,6 +146,7 @@ RedmineApp::Application.routes.draw do match 'copy', :via => [:get, :post] end + #by young match '/member', :controller => 'projects', :action => 'member', :as => 'member', :via => :get # match '/focus', :controller => 'projects', :action => 'focus', :as => 'focus', :via => :get @@ -430,6 +436,8 @@ RedmineApp::Application.routes.draw do match 'bids/new_bid', :controller => 'bids', :action => 'new_bid' match 'bids/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid' match 'bids/:id/add', :controller => 'bids', :action => 'add' + match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond' + match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' ## 测试用 # match 'test/index', :controller => 'test', :action => 'index' # added by young diff --git a/lib/redmine.rb b/lib/redmine.rb index d41b6b96..ff1e175c 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -256,17 +256,18 @@ Redmine::MenuManager.map :project_menu do |menu| # menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural # menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id, # :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } -# menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, -# :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural + # menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, + # :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_new, :param => :project_id menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil }, - :if => Proc.new { |p| p.repository && !p.repository.new_record? } + :if => Proc.new { |p| p.repository && !p.repository.new_record? } menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true + end #end #added by young Redmine::MenuManager.map :user_menu do |menu| - menu.push :activity, {:controller => 'users', :action => 'show' } + menu.push :activity, {:controller => 'users', :action => 'show' } menu.push :project, {:controller => 'users', :action => 'user_projects'} menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback'} diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index a9c6c437..556ee206 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -350,6 +350,16 @@ ul.tool li{list-style-type:none; overflow:hidden; margin-top: 10px; } +.homepage_underline{ + margin:1; + padding:1; + width:240px; + height:1px; + background-color:#c6e9fe; + overflow:hidden; + margin-top: 0px; + margin-bottom: 20px; +} .line_under{ border-bottom: 1px dashed rgb(204, 204, 204); }