diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index f932748af..fc7ec3b48 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -430,29 +430,21 @@ update end + # 注:由于考虑到性能所以commits api每次返回20条记录 def changes # 顶部导航 @project_menu_type = 5 - @entry = @repository.entry(@path, @rev) (show_error_not_found; return) unless @entry g = Gitlab.client - limit = 20 - #每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来 + limit = 10 + # 每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来 @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:@rev) + @commits_count = params[:commit_count].nil? ? @g.user_static(@project.gpid, :rev => @rev).count : params[:commit_count].to_i + @commits_pages = Paginator.new @commits_count, limit, params[:page] + # @offset ||= @commits_pages.offset + # @commits = paginateHelper @commits, limit - #add by hx - #rep_count = commit_count(@project) - - #页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化 - @commits_count = params[:commit_count].to_i - @commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page] - - @commit = g.commit(@project.gpid,@rev) - # @changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}") - #@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i) - @properties = @repository.properties(@path, @rev) - @changeset = @repository.find_changeset_by_name(@rev) render :layout => 'base_projects' end diff --git a/app/models/professional_level.rb b/app/models/professional_level.rb new file mode 100644 index 000000000..b04741f91 --- /dev/null +++ b/app/models/professional_level.rb @@ -0,0 +1,3 @@ +class ProfessionalLevel < ActiveRecord::Base + attr_accessible :level +end diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index edffbdd19..7dc2a68d0 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -22,7 +22,8 @@

1.长度必须在1到254个字符之间
2.仅限使用小写字母(a-z)、数字、破折号(-)和下划线(_)
- 3.一旦保存,标识无法修改 + 3.一旦保存,标识无法修改
+ 4.版本库名不能是纯数字

diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index adf0ded0c..e09e1f6d3 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -21,7 +21,10 @@

由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "linkBlue2" %>于 <%= format_time(@request.created_at) %> 创建

最近更新:<%= format_time(@request.updated_at) %> -

<%= @request.source_branch %>合并到<%= @request.target_branch %>

+

+ <%= find_gitlab_project(@request.source_project_id)+"/"+@request.source_branch %>合并到<%= find_gitlab_project(@request.target_project_id)+"/"+@request.target_branch %> + +

diff --git a/app/views/repositories/_commit_details.html.erb b/app/views/repositories/_commit_details.html.erb index 07620e48d..420cac846 100644 --- a/app/views/repositories/_commit_details.html.erb +++ b/app/views/repositories/_commit_details.html.erb @@ -12,4 +12,7 @@   <% end %> + <% if params[:action] == "commit_diff" %> +
Commit<%= changeset.id %>
+ <% end %> \ No newline at end of file diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index a27789dc1..79db43a83 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -1,48 +1,21 @@ -<%= form_tag( - {:controller => 'repositories', :action => 'diff', :id => project, - :repository_id => @repository.identifier_param, :path => to_path_param(path)}, - :method => :get - ) do %> - - - - - - - - - - - - <% show_diff = revisions.size > 1 %> - <% line_num = 1 %> - <% revisions.each do |changeset| %> -
- -
- <% end %> - -
-

- <%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %> -

- - +<% @commits.chunk { |c| format_date(c.created_at).to_date }.each do |day, commits| %> +
+
+

<%= day %>

+

<%= commits.count %>个提交

+
+ +
<% end %> + + diff --git a/app/views/repositories/changes.html.erb b/app/views/repositories/changes.html.erb index f634a0285..a305b9ec5 100644 --- a/app/views/repositories/changes.html.erb +++ b/app/views/repositories/changes.html.erb @@ -1,26 +1,38 @@ -<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %> -
-
- <%= render :partial => "top" %> +
+
+
    + <%= render :partial => 'navigation' %> +
+ <% @commits.chunk { |c| format_date(c.created_at).to_date }.each do |day, commits| %> +
+
+

<%= day %>

+

<%= commits.count %>个提交

+
+
    + <% commits.each do |commit| %> +
  • + <%= time_tag(commit.created_at) %>前 + <%= link_to get_user_by_mail(commit.author_email).show_name, user_path(get_user_by_mail(commit.author_email)), :target => "_blank", :class => "pullreques_pull_name fl ml10" %> +

    <%= commit.title %>

    + <%= link_to truncate(commit.short_id, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank", :class => "fr mr15 c_grey" %> +
  • + <% end %> +
+
+ <% end %> -
- <%= render :partial => 'navigation' %> -
-
- - <%= render :partial => 'link_to_functions' %> - - <%= render_properties(@properties) %> - -
- <%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path , :revisions => @commits, :entry => @entry , :commits_pages => @commits_pages , :commits_count => @commits_count}) unless @commits.empty? %> +
+
+
    + <%= pagination_links_full @commits_pages, @commits_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %> +
+
+
- <% content_for :header_tags do %> - <%= stylesheet_link_tag "scm" %> - <% end %> - + <%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %> <% html_title(l(:label_change_plural)) -%> -
\ No newline at end of file +
diff --git a/app/views/repositories/commit_diff.html.erb b/app/views/repositories/commit_diff.html.erb index 7693b385c..913561bc2 100644 --- a/app/views/repositories/commit_diff.html.erb +++ b/app/views/repositories/commit_diff.html.erb @@ -1,16 +1,27 @@
-
- <%= render :partial => "top" %> +
+
+ <%= link_to "返回提交历史".html_safe, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :page => 1}, :class => "fl linkBlue2 mt3" %> + +
+
+
+

<%= @commit_details.message %>

+
+ + + + + + +
  • + <%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %> +
  • +
    -
    Commit - <%= @commit_details.id %>
    -
  • - <%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %> -
  • -
    -
    <%= @commit_details.message %>
    + <% @commit_diff.each do |commit_diff| %> -
    +
    <%= commit_diff.new_path %> diff --git a/db/migrate/20161201073217_create_professional_levels.rb b/db/migrate/20161201073217_create_professional_levels.rb new file mode 100644 index 000000000..0a0588fcc --- /dev/null +++ b/db/migrate/20161201073217_create_professional_levels.rb @@ -0,0 +1,9 @@ +class CreateProfessionalLevels < ActiveRecord::Migration + def change + create_table :professional_levels do |t| + t.string :level + + t.timestamps + end + end +end diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index cc0ded22a..37f755c3f 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -399,6 +399,7 @@ tr.open span.expander {background-image: url(/images/bullet_toggle_minus.png);} .showing-changes-info {width:710px; padding:10px; padding-top: 0px; background-color:#ffffff; line-height:2;} .showing-changes-project {padding:10px; border-top:1px solid #dce0e6; border-bottom:1px solid #dce0e6; background-color:#f1f1f1;} .showing-changes-row {padding:10px; border-bottom:1px solid #dce0e6; background-color:#f1f1f1;} +.showing-changes-row-commit {padding:10px; border:1px solid #dbdbdb; background-color:#f1f1f1;border-bottom: none} #changed-files-detail {display:none;} #changed-files-detail li {list-style-type:disc; margin-left:15px;} .showing-changes-detail {width:670px; border-bottom:1px solid #dce0e6; background-color:#f1f1f1;} @@ -931,6 +932,7 @@ p.pro_new_grey{ line-height: 1.9; } .container-big-grey {width:970px; background-color:#f1f1f1;} .reply-banner {width:968px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} .reply-container {border-bottom:1px solid #e3e3e3; width:940px; margin-top:15px; min-height:50px;} +.reply-container-branch {width:940px; margin-top:6px; min-height:35px; padding-left: 10px;} .reply-content {float:left; width:892px;} /* 新版里程碑 20161019byLB */ @@ -950,6 +952,7 @@ p.pro_new_grey{ line-height: 1.9; } .undis {display:none;} .dis {display:block;} .new_roadmap_listbox{ padding:15px;border-bottom:1px solid #dbdbdb;} +.new_roadmap_listbox_commit{ padding:15px;} .new_roadmap_listtitle a{ color: #333;display:block;max-width:800px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} .new_roadmap_listtitle a:hover{ color:#3498db;} .new_roadmap_list_txt{ color: #666;} @@ -997,7 +1000,7 @@ a.sortdownbtn{background: url(/images/sy/liststyle.png) 0 -12px no-repeat; width a.pullreques_reply_name{ font-weight: bold; color: #333;} .pullreques_reply_txt{ width: 900px;color: #666;} .pullreques_pull_top { width: 100%; height: 40px; line-height: 40px; background: #f4f4f4; border-top:1px solid #e1e1e1;border-bottom:1px solid #e1e1e1;} -a.pullreques_pull_name{display: block; margin-left: 10px;max-width:80px; color:#3b94d6 !important; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} +a.pullreques_pull_name{display: block; margin-left: 5px;max-width:80px; color:#3b94d6 !important; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} .pullreques_pull_list li{ height: 30px; line-height: 30px; } .pullreques_pull_txt{display: block; margin-left: 10px;max-width:740px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} .pullreques_change_list li{height: 40px; line-height: 40px;border-bottom:1px solid #e1e1e1; } diff --git a/spec/factories/professional_levels.rb b/spec/factories/professional_levels.rb new file mode 100644 index 000000000..214be4b63 --- /dev/null +++ b/spec/factories/professional_levels.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :professional_level do + level "MyString" + end + +end diff --git a/spec/models/professional_level_spec.rb b/spec/models/professional_level_spec.rb new file mode 100644 index 000000000..32509f986 --- /dev/null +++ b/spec/models/professional_level_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe ProfessionalLevel, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end