Merge remote-tracking branch 'origin/szzh' into szzh

dev_xiangzheng
lizanle 10 years ago
commit 76ac5a49f2

@ -7,6 +7,7 @@ unless RUBY_PLATFORM =~ /w32/
end
gem 'grack', path:'./lib/grack'
gem 'gitlab', path: 'lib/gitlab-cli'
gem 'rest-client'
gem "mysql2", "= 0.3.18"
gem 'redis-rails'
@ -45,7 +46,7 @@ group :development, :test do
gem 'pry-stack_explorer'
if RUBY_PLATFORM =~ /darwin/
gem 'puma'
end
end
end
gem 'rspec-rails', '~> 3.0'

@ -38,7 +38,8 @@ class ApplicationController < ActionController::Base
protect_from_forgery
def handle_unverified_request
super
cookies.delete(autologin_cookie_name)
raise(ActionController::InvalidAuthenticityToken)
# cookies.delete(autologin_cookie_name)
end
before_filter :find_first_page

File diff suppressed because it is too large Load Diff

@ -25,6 +25,7 @@ module RepositoriesHelper
end
PROJECT_PATH_CUT = 40
REPO_IP_ADDRESS = Setting.host_repository
REPO_GITLAB_ADDRESS = "git.trustie.net"
def format_revision(revision)
if revision.respond_to? :format_identifier
@ -34,6 +35,10 @@ module RepositoriesHelper
end
end
def repository_creater rep
repository_creater = User.find_by_login(rep.login) unless rep.login.nil?
end
def truncate_at_line_break(text, length = 255)
if text
text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...')

@ -34,6 +34,7 @@ class Member < ActiveRecord::Base
after_destroy :delete_ivite_list
def role
end

@ -35,8 +35,11 @@ class MemberRole < ActiveRecord::Base
!inherited_from.nil?
end
include Trustie::Gitlab::ManageMember
private
def remove_member_if_empty
if member.roles.empty?
member.destroy

@ -770,7 +770,8 @@ class Project < ActiveRecord::Base
'project_type',
'dts_test',
'attachmenttype',
'enterprise_name'
'enterprise_name',
'gpid'
@ -853,6 +854,10 @@ class Project < ActiveRecord::Base
end
end
def owner
User.find(self.user_id)
end
private
def after_parent_changed(parent_was)
@ -1167,5 +1172,7 @@ class Project < ActiveRecord::Base
:forge_act_id => self.id,:forge_act_type => "ProjectCreateInfo")
fa.save!
end
end

@ -57,6 +57,11 @@ class Repository < ActiveRecord::Base
safe_attributes 'url',
:if => lambda {|repository, user| repository.new_record?}
def gitlab?
self.type == 'Repository::Gitlab'
end
def repo_create_validation
unless Setting.enabled_scm.include?(self.class.name.demodulize)
errors.add(:type, :invalid)

File diff suppressed because it is too large Load Diff

@ -77,6 +77,27 @@ class Role < ActiveRecord::Base
self.givable[3..5]
end
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
def to_gitlab_role
case self.position
when 1,2
GUEST
when 5
REPORTER
when 4
DEVELOPER
when 3
MASTER
else
GUEST
end
end
# Copies attributes from another role, arg can be an id or a Role
def copy_from(arg, options={})
return unless arg.present?

@ -209,7 +209,7 @@ class User < Principal
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
validate :validate_password_length
# validates_email_realness_of :mail
before_create :set_mail_notification
before_create :set_mail_notification, :sync_gitlab_user
before_save :update_hashed_password
before_destroy :remove_references_before_destroy
# added by fq
@ -358,7 +358,7 @@ class User < Principal
name
end
## end
#added by nie
def count_new_journal_reply
count = self.journal_reply.count
@ -1079,6 +1079,17 @@ class User < Principal
end
private
def sync_gitlab_user
user = self
g = Gitlab.client
u = g.get("/users?search=#{user.mail}").first
unless u
u = g.create_user(user.mail, user.password, name: user.show_name, username: user.login, confirm: "true")
self.gid = u.id
puts "create user #{user.login}"
end
end
end

@ -8,7 +8,7 @@
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
</th>
<td class="line-code">
<pre style="width:880px;word-wrap: break-word; word-break: normal; "><%= line.html_safe %></pre>
<pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre>
</td>
</tr>
<% line_num += 1 %>

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header' %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

@ -41,7 +41,7 @@
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% if visible_repository?(@project) %>
<div class="subNav">
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id, to: 'gitlab'}, :class => "f14 c_blue02" %>
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
</div>
<% end %>

@ -18,6 +18,13 @@
<script type="text/javascript">
function clickCanel(){hideModal("#popbox02");}
function clickSure()
{
if ($('#new_join_course').submit())
{
hideModal("#popbox02");
}
}
</script>
</head>
@ -33,7 +40,7 @@
<label>请输入课程密码:</label>
<%= text_field_tag 'course_password', nil, :style=>'width:300px;'%>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="$('#new_join_course').submit();" >
<a href="javascript:" class="tijiao" onclick="clickSure();" >
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();">

@ -73,13 +73,6 @@
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<% unless judge_main_repository(@project) %>
<li>
<label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li>
<% end %>
<li >
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
@ -89,11 +82,6 @@
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
<% end %>
</li>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
<%= f.password_field :upassword, :label=> "", :no_label => true%>
<span class="c_grey"><%= l(:label_upassword_info)%></span>
</li>
<div class="cl"></div>
</ul>
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml110"><%=l(:button_save)%></a>

@ -1,32 +1,13 @@
<%= link_to @repository.identifier.present? ? h(@repository.identifier) : 'root',
{:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev },
:class=>"fl c_blue f14 fb" %>
<%
dirs = path.split('/')
if 'file' == kind
filename = dirs.pop
end
link_path = ''
dirs.each do |dir|
next if dir.blank?
link_path << '/' unless link_path.empty?
link_path << "#{dir}"
%>
/ <%= link_to h(dir), :action => 'show', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param(link_path), :rev => @rev %>
<% end %>
<% if filename %>
/ <%= link_to h(filename),
:action => 'changes', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param("#{link_path}/#{filename}"), :rev => @rev %>
<% end %>
<%
# @rev is revsion or Git and Mercurial branch or tag.
# For Mercurial *tip*, @rev and @changeset are nil.
rev_text = @changeset.nil? ? @rev : format_revision(@changeset)
%>
<p class="fl f14 fb c_grey02"><%= "@ #{h rev_text}" unless rev_text.blank? %></p>
<div class="git_usr_title">
<span><%= link_to @repository.identifier.present? ? h(@repository.identifier) : 'root',
{:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev },
:class => "repository-title-dec"
%>
/
<%=link_to @project.owner, user_path(@project.owner), :class => "repository-title-dec" %>
</span>
</div>
<% html_title(with_leading_slash(path)) -%>

@ -1,17 +1,6 @@
<div class="autoscroll">
<table class="list entries" id="browser">
<thead>
<tr id="root">
<th><%= l(:field_name) %></th>
<th><%= l(:field_filesize) %></th>
<% if @repository.report_last_commit %>
<th><%= l(:label_revision) %></th>
<th><%= l(:label_age) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
<% end %>
</tr>
</thead>
<tbody>
<%= render :partial => 'dir_list_content' %>
</tbody>

@ -7,6 +7,7 @@
<td style="padding-left: <%=18 * depth%>px;" class="<%=
@repository.report_last_commit ? "filename" : "filename_no_report" %>">
<% if entry.is_dir? %>
<%# 展开文件目录 %>
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
:action => 'show',
:id => @project,
@ -17,10 +18,11 @@
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'changes'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<% if @repository.report_last_commit %>
<td class="revision"><%= link_to_revision(entry.changeset, @repository) if entry.changeset %></td>
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>

@ -31,12 +31,7 @@
<%= f.text_field :login, :size => 30 %>
<input type="text" hidden="hidden">
</p>
<p>
<%= f.password_field :password, :size => 30, :name => 'ignore',
:value => ((@repository.new_record? || @repository.password.blank?) ? '' : ('x'*15)),
:onfocus => "this.value=''; this.name='repository[password]';",
:onchange => "this.name='repository[password]';" %>
</p>
</div>
<!--Ended by tanxianbo-->
<p>

@ -26,7 +26,6 @@ border:none
<em class="info error"><%= l(:text_scm_command_not_available) %></em>
<% end %>
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p>
<input id="googleinputcache" size="30" type="text">
@ -36,8 +35,6 @@ border:none
<%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>
<!-- <p><%#= f.text_field :url, :size => 60, :required => true,:readonly=>true, :class=>'textbg'%></p> -->
<p><%= f.password_field :upassword, :required =>true, :label=> :field_password %>
<em class="info"><%= l(:label_upassword_info)%></em></p>
</div>
<p>
<%= submit_tag(@repository.new_record? ? l(:button_create) : l(:button_save)) %>

@ -1,34 +1,33 @@
<% content_for :header_tags do %>
<%= javascript_include_tag 'repository_navigation' %>
<% end %>
<a href="javascript:void(0);" class="pic_stats fl ml20 mt3"></a>
<%= link_to l(:label_statistics),
<!--<a href="javascript:void(0);" class="pic_stats fl ml20 mt3"></a>-->
<%#= link_to l(:label_statistics),
{:action => 'stats', :id => @project, :repository_id => @repository.identifier_param},
:class => 'mt3 c_blue fl' if @repository.supports_all_revisions? %>
<div class="repositorytitle mr15">
<% content_for :header_tags do %>
<%= javascript_include_tag 'repository_navigation' %>
<% end %>
<%= form_tag({:action => controller.action_name,
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => nil},
{:method => :get, :id => 'revision_selector', :class => "fl c_grey02 ml5"}) do -%>
<!-- Branches Dropdown -->
<% if !@repository.branches.nil? && @repository.branches.length > 0 -%>
| <%= l(:label_branch) %>:
<%= select_tag :branch,
options_for_select([''] + @repository.branches, @rev),
:id => 'branch' %>
<% end -%>
<% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
| <%= l(:label_tag) %>:
<%= select_tag :tag,
options_for_select([''] + @repository.tags, @rev),
:id => 'tag' %>
<% end -%>
<% if @repository.supports_all_revisions? %>
| <%= l(:label_revision) %>:
<%= text_field_tag 'rev', @rev, :size => 8 %>
<% end %>
<% end -%>
<%= form_tag({:action => controller.action_name,
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => nil},
{:method => :get, :id => 'revision_selector'}) do -%>
<!-- Branches Dropdown -->
<% if !@repository.branches.nil? && @repository.branches.length > 0 -%>
<%= l(:label_branch) %>:
<%= select_tag :branch, options_for_select([''] + @repository.branches, @rev), :id => 'branch' %>
<% end -%>
<% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
<%= select_tag :tag, options_for_select([''] + @repository.tags, @rev), :id => 'tag', :style=>" display:none" %>
<% end -%>
<% if @repository.supports_all_revisions? %>
<%= hidden_field_tag 'rev', @rev, :size => 8 %>
<% end %>
<% end -%>
</div>

@ -0,0 +1,37 @@
<div class="overall-summary overall-summary-bottomless">
<div class="stats-switcher-viewport js-stats-switcher-viewport">
<div class="stats-switcher-wrapper">
<ul class="numbers-summary">
<li class="commits">
<a data-pjax="" href="/redmine/redmine/commits/0.6-stable">
<span class="octicon octicon-history"></span>
<span class="num text-emphasized">
<%=link_to @changesets.count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev}, :class => "num text-emphasized c_blue" %>
</span>
commits
</a>
</li>
<li>
<span class="octicon image-type"></span>
<span class="num text-emphasized" style="color: #269AC9">
<%= @repository.branches.count %>
</span>
branches
</li>
<li>
<span class="octicon octicon-organization"></span>
<span class="num text-emphasized">
<%=link_to @repository.committers.count, committers_repository_path(@repository), :class => "c_blue" %>
</span>
contributors
</li>
</ul>
</div>
</div>
</div>

@ -1,18 +1,20 @@
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<div class="contextual">
<%= render :partial => 'navigation' %>
<div class="project_r_h">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
</div>
<h3><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h3>
<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="mt40">
<%= render(:partial => 'revisions',
:locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %>
<div class="mt10">
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>

@ -1,4 +1,8 @@
<h3><%= l(:label_repository) %></h3>
<div class="project_r_h">
<div class="fl">
<h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2>
</div>
</div>
<%= simple_format(l(:text_repository_usernames_mapping)) %>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save