版本库编辑
This commit is contained in:
parent
14fd5eb113
commit
f607f72ce4
|
@ -600,6 +600,31 @@ update
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def entry_edit
|
||||||
|
@content = @repository.cat(@path, @rev)
|
||||||
|
# @changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev))
|
||||||
|
@changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
|
||||||
|
# 总的提交数
|
||||||
|
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
|
||||||
|
if is_entry_text_data?(@content, @path)
|
||||||
|
render :layout => 'base_projects'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def entry_update
|
||||||
|
g = Gitlab.client
|
||||||
|
@path = params[:path]
|
||||||
|
@rev = params[:rev]
|
||||||
|
@content = params[:content]
|
||||||
|
code_file = g.edit_file(@project.gpid, :content => params[:content], :file_path => @path, :branch_name => @rev, :commit_message => "...")
|
||||||
|
# if @shixun.try(:status).to_i < 2
|
||||||
|
# shixun_modify_status_without_publish(@shixun, 1)
|
||||||
|
# end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def entry_and_raw(is_raw)
|
def entry_and_raw(is_raw)
|
||||||
@entry = @repository.entry(@path, @rev)
|
@entry = @repository.entry(@path, @rev)
|
||||||
(show_error_not_found; return) unless @entry
|
(show_error_not_found; return) unless @entry
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<form action="<%= entry_update_shixun_path(@project, :rev => @rev, :path => @path) %>" method="post" id="shixun_entry_update_id" data-remote="true">
|
||||||
|
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||||
|
<textarea class="undis" id="content_shixun_entry" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||||
|
</li>
|
||||||
|
</form>
|
|
@ -22,4 +22,10 @@
|
||||||
:path => to_path_param(@path),
|
:path => to_path_param(@path),
|
||||||
:rev => @rev}, :class => "fr mr5") if @repository.supports_cat? %>
|
:rev => @rev}, :class => "fr mr5") if @repository.supports_cat? %>
|
||||||
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
|
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
|
||||||
|
|
||||||
|
<% if params[:action] == "entry_edit" %>
|
||||||
|
<a href="javascript:void(0);" onclick="$('#shixun_entry_update_id').submit();" class = "fl mr5">保存</a>
|
||||||
|
<% elsif params[:action] == "entry" || params[:action] == "entry_update" %>
|
||||||
|
<%= link_to "编辑", entry_edit_repository_path(@project, :path => @path, :rev => @rev), :class => "fl mr5", :remote => true %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$("#common_file_content").html('<%= escape_javascript(render :partial => 'repositories/entry_content') %>');
|
||||||
|
$("#file_action").html('<%= escape_javascript(render :partial => 'repositories/link_to_functions') %>');
|
|
@ -0,0 +1,2 @@
|
||||||
|
$("#common_file_content").html('<%= escape_javascript(render :partial => 'common/file', :locals => {:filename => @path, :content => @content}) %>')
|
||||||
|
$("#file_action").html('<%= escape_javascript(render :partial => 'repositories/link_to_functions') %>');
|
Loading…
Reference in New Issue