Minor improve to UI and code formatting of gitlab web editor
This commit is contained in:
parent
47d9732a07
commit
809aefb828
8 changed files with 37 additions and 19 deletions
|
@ -1,6 +1,9 @@
|
|||
module Gitlab
|
||||
# GitLab file editor
|
||||
#
|
||||
# It gives you ability to make changes to files
|
||||
# & commit this changes from GitLab UI.
|
||||
class FileEditor
|
||||
|
||||
attr_accessor :user, :project, :ref
|
||||
|
||||
def initialize(user, project, ref)
|
||||
|
@ -35,22 +38,21 @@ module Gitlab
|
|||
r.git.sh "git add ."
|
||||
r.git.sh "git commit -am '#{commit_message}'"
|
||||
output = r.git.sh "git push origin #{ref}"
|
||||
|
||||
if output =~ /reject/
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
true
|
||||
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def can_edit?(path, last_commit)
|
||||
current_last_commit = @project.commits(ref, path, 1).first.sha
|
||||
last_commit == current_last_commit
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue