Merge branch 'develop' into 'develop'

版本库提交动态优化及界面调整



See merge request !34
This commit is contained in:
黄井泉 2016-12-02 13:34:18 +08:00
commit 23aef1ee3c
12 changed files with 115 additions and 94 deletions

View File

@ -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

View File

@ -0,0 +1,3 @@
class ProfessionalLevel < ActiveRecord::Base
attr_accessible :level
end

View File

@ -22,7 +22,8 @@
<p class=" fl c_grey pro_new_grey">
1.长度必须在1到254个字符之间<br/>
2.仅限使用小写字母a-z、数字、破折号-和下划线_<br>
3.一旦保存,标识无法修改
3.一旦保存,标识无法修改<br>
4.版本库名不能是纯数字
</p>
</li>
</ul>

View File

@ -21,7 +21,10 @@
<div class="c_grey clear mt5">
<p class="fl">由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "linkBlue2" %>于 <%= format_time(@request.created_at) %> 创建</p>
<span class="fl ml10">最近更新:<%= format_time(@request.updated_at) %></span>
<p class="fr"><%= @request.source_branch %><span class="c_grey02 ml10 mr10">合并到</span><%= @request.target_branch %></p>
<p class="fr">
<%= find_gitlab_project(@request.source_project_id)+"/"+@request.source_branch %><span class="c_grey02 ml10 mr10">合并到</span><%= find_gitlab_project(@request.target_project_id)+"/"+@request.target_branch %>
</p>
</div>
</div>
</div>

View File

@ -12,4 +12,7 @@
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time>&nbsp;
</div>
<% end %>
<% if params[:action] == "commit_diff" %>
<div class="fr">Commit<a class="ml5" style="color: #3498db"><%= changeset.id %></a></div>
<% end %>
</div>

View File

@ -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 %>
<table class="list changesets">
<!--<thead><tr>-->
<!--<th>#</th>-->
<!--<th></th>-->
<!--<th></th>-->
<!--<th><%= l(:label_date) %></th>-->
<!--<th><%= l(:field_author) %></th>-->
<!--<th><%= l(:field_comments) %></th>-->
<!--</tr></thead>-->
<tbody>
<% show_diff = revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
<div class="col-md-10 col-sm-12">
<ul class="bordered-list">
<li class="commit js-toggle-container">
<%= render :partial => 'commit_details', :locals => {:changeset => changeset} %>
<div style="padding-left:30px;" class="commit-row-title">
<strong class="str-truncated">
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
</strong>
<div class="pull-right" title="修订号">
<%= link_to truncate(changeset.short_id.to_s, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => project.id, :changeset => changeset.id} %>
</div>
<div class="notes_count">
</div>
</div>
</li>
</ul>
</div>
<% end %>
</tbody>
</table>
<p style="padding-top: 10px;">
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
</p>
<ul class="wlist">
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>
<% @commits.chunk { |c| format_date(c.created_at).to_date }.each do |day, commits| %>
<div class="pullreques_pullbox">
<div class="pullreques_pull_top clear">
<p class="fl c_grey ml15"><%= day %></p>
<p class="fr c_green mr15"><%= commits.count %>个提交</p>
</div>
<ul class="pullreques_pull_list">
<% commits.each do |commit| %>
<li class="clear">
<span class="fl c_grey ml15 "><%= time_tag(commit.created_at) %>前</span>
<%= 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" %>
<p class="pullreques_pull_txt ml10 fl"><%= commit.title %></p>
<%= 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" %>
</li>
<% end %>
</ul>
</div>
<% end %>

View File

@ -1,26 +1,38 @@
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<div class="wrap-big">
<div class="project_r_h">
<%= render :partial => "top" %>
<div class="new_roadmap_conbox mb10" >
<div class=" clear">
<ul class="reply-container-branch fl" >
<%= render :partial => 'navigation' %>
</ul>
</div>
<% @commits.chunk { |c| format_date(c.created_at).to_date }.each do |day, commits| %>
<div class="pullreques_pullbox">
<div class="pullreques_pull_top clear">
<p class="fl c_grey ml15"><%= day %></p>
<p class="fr c_green mr15"><%= commits.count %>个提交</p>
</div>
<ul class="pullreques_pull_list">
<% commits.each do |commit| %>
<li class="clear">
<span class="fl c_grey ml15 "><%= time_tag(commit.created_at) %>前</span>
<%= 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" %>
<p class="pullreques_pull_txt ml10 fl"><%= commit.title %></p>
<%= 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" %>
</li>
<% end %>
</ul>
</div>
<% end %>
<div class="repository_con " style="line-height:1.9;">
<%= render :partial => 'navigation' %>
<div class="cl"></div>
</div>
<%= render :partial => 'link_to_functions' %>
<%= render_properties(@properties) %>
<div class="mt10">
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path , :revisions => @commits, :entry => @entry , :commits_pages => @commits_pages , :commits_count => @commits_count}) unless @commits.empty? %>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @commits_pages, @commits_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
<% 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)) -%>
</div>
</div>

View File

@ -1,16 +1,27 @@
<div class="container-big">
<div class="project_r_h">
<%= render :partial => "top" %>
<div class="new_roadmap_conbox mb10" >
<div class="new_roadmap_info_top clear ">
<%= link_to "<span class='new_roadmap_icons_back mr5'></span>返回提交历史".html_safe, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :page => 1}, :class => "fl linkBlue2 mt3" %>
<!--<a href="javascript:void(0);" class="fl linkBlue2 mt3" ><span class="new_roadmap_icons_back mr5"></span>返回提交历史</a>-->
</div>
<div class="clear new_roadmap_listbox_commit">
<div class="c_grey02 mb10">
<p><%= @commit_details.message %></p>
</div>
<!--<div class=" clear mb10">-->
<!--<p class="fb">关联Issue:</p>-->
<!--<a href="javascript:void(0);" class="btn-small fl mr10">#123</a>-->
<!--<a href="javascript:void(0);" class="btn-small fl mr10">#123</a>-->
<!--<a href="javascript:void(0);" class="btn-small fl mr10">#123</a>-->
<!--</div>-->
<li class="commit js-toggle-container">
<%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %>
</li>
</div>
</div>
<div class="showing-changes-info fontGrey2"> Commit <a href="javascript:void(0);" class="linkGrey3">
<%= @commit_details.id %></a><br />
<li class="commit js-toggle-container">
<%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %>
</li>
</div>
<div class="showing-changes-project f14"><%= @commit_details.message %></div>
<% @commit_diff.each do |commit_diff| %>
<div class="showing-changes-row fontGrey2">
<div class="showing-changes-row-commit fontGrey2">
<a href="javascript:void(0);" class="linkGrey3" id="changed-files">
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= commit_diff.new_path %>
</a>

View File

@ -0,0 +1,9 @@
class CreateProfessionalLevels < ActiveRecord::Migration
def change
create_table :professional_levels do |t|
t.string :level
t.timestamps
end
end
end

View File

@ -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; }

View File

@ -0,0 +1,6 @@
FactoryGirl.define do
factory :professional_level do
level "MyString"
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ProfessionalLevel, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end