v1.1.0
This commit is contained in:
parent
6b030fd41d
commit
ba8048d710
15 changed files with 141 additions and 147 deletions
|
@ -638,3 +638,12 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
|
|||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
input[type="text"],
|
||||
input[type="password"],
|
||||
textarea
|
||||
{
|
||||
background: none repeat scroll 0 0 #FFBBBB
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,35 +8,16 @@ class TeamMembersController < ApplicationController
|
|||
|
||||
def show
|
||||
@team_member = project.users_projects.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@team_member = project.users_projects.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@team_member = UsersProject.new(params[:team_member])
|
||||
@team_member.project = project
|
||||
|
||||
respond_to do |format|
|
||||
if @team_member.save
|
||||
format.html { redirect_to @team_member, notice: 'Team member was successfully created.' }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
@team_member.save
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -45,7 +26,12 @@ class TeamMembersController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html { redirect_to team_project_path(@project)}
|
||||
format.html do
|
||||
unless @team_member.valid?
|
||||
flash[:alert] = "User should have at least one role"
|
||||
end
|
||||
redirect_to team_project_path(@project)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ class Project < ActiveRecord::Base
|
|||
:presence => true
|
||||
|
||||
validate :check_limit
|
||||
|
||||
validate :repo_name
|
||||
|
||||
after_destroy :destroy_gitosis_project
|
||||
after_save :update_gitosis_project
|
||||
|
||||
|
@ -168,6 +169,12 @@ class Project < ActiveRecord::Base
|
|||
errors[:base] << ("Cant check your ability to create project")
|
||||
end
|
||||
|
||||
def repo_name
|
||||
if path == "gitosis-admin"
|
||||
errors.add(:path, " like 'gitosis-admin' is not allowed")
|
||||
end
|
||||
end
|
||||
|
||||
def valid_repo?
|
||||
repo
|
||||
rescue
|
||||
|
|
|
@ -9,7 +9,8 @@ class UsersProject < ActiveRecord::Base
|
|||
validates_uniqueness_of :user_id, :scope => [:project_id]
|
||||
validates_presence_of :user_id
|
||||
validates_presence_of :project_id
|
||||
|
||||
validate :user_has_a_role_selected
|
||||
|
||||
delegate :name, :email, :to => :user, :prefix => true
|
||||
|
||||
def update_gitosis_project
|
||||
|
@ -18,6 +19,10 @@ class UsersProject < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def user_has_a_role_selected
|
||||
errors.add(:base, "Please choose at least one Role in the Access list") unless read || write || admin
|
||||
end
|
||||
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
|
|
@ -1,27 +1,5 @@
|
|||
.file_stats
|
||||
- @commit.diffs.each do |diff|
|
||||
- if diff.deleted_file
|
||||
%span.removed_file
|
||||
%a{:href => "##{diff.a_path}"}
|
||||
= diff.a_path
|
||||
= image_tag "blueprint_delete.png"
|
||||
- elsif diff.renamed_file
|
||||
%span.moved_file
|
||||
%a{:href => "##{diff.b_path}"}
|
||||
= diff.a_path
|
||||
= "->"
|
||||
= diff.b_path
|
||||
= image_tag "blueprint_notice.png"
|
||||
- elsif diff.new_file
|
||||
%span.new_file
|
||||
%a{:href => "##{diff.b_path}"}
|
||||
= diff.b_path
|
||||
= image_tag "blueprint_add.png"
|
||||
- else
|
||||
%span.edit_file
|
||||
%a{:href => "##{diff.b_path}"}
|
||||
= diff.b_path
|
||||
= image_tag "blueprint_info.png"
|
||||
.file_stats= render "commits/diff_head"
|
||||
|
||||
- @commit.diffs.each do |diff|
|
||||
- next if diff.diff.empty?
|
||||
- file = (@commit.tree / diff.b_path)
|
||||
|
@ -31,24 +9,12 @@
|
|||
- if diff.deleted_file
|
||||
%strong{:id => "#{diff.b_path}"}= diff.a_path
|
||||
- else
|
||||
%strong{:id => "#{diff.b_path}"}= diff.b_path
|
||||
= link_to tree_file_project_path(@project, @commit.id, diff.b_path) do
|
||||
%strong{:id => "#{diff.b_path}"}= diff.b_path
|
||||
%br/
|
||||
.diff_file_content
|
||||
- if file.text?
|
||||
- lines_arr = diff.diff.lines.to_a
|
||||
- line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0
|
||||
- line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0
|
||||
- lines = lines_arr[3..-1].join
|
||||
- lines.each_line do |line|
|
||||
= diff_line(line, line_new, line_old)
|
||||
- if line[0] == "+"
|
||||
- line_new += 1
|
||||
- elsif
|
||||
- line[0] == "-"
|
||||
- line_old += 1
|
||||
- else
|
||||
- line_new += 1
|
||||
- line_old += 1
|
||||
= render :partial => "commits/text_file", :locals => { :diff => diff }
|
||||
- elsif file.image?
|
||||
.diff_file_content_image
|
||||
%img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
|
||||
|
|
24
app/views/commits/_diff_head.html.haml
Normal file
24
app/views/commits/_diff_head.html.haml
Normal file
|
@ -0,0 +1,24 @@
|
|||
- @commit.diffs.each do |diff|
|
||||
- if diff.deleted_file
|
||||
%span.removed_file
|
||||
%a{:href => "##{diff.a_path}"}
|
||||
= diff.a_path
|
||||
= image_tag "blueprint_delete.png"
|
||||
- elsif diff.renamed_file
|
||||
%span.moved_file
|
||||
%a{:href => "##{diff.b_path}"}
|
||||
= diff.a_path
|
||||
= "->"
|
||||
= diff.b_path
|
||||
= image_tag "blueprint_notice.png"
|
||||
- elsif diff.new_file
|
||||
%span.new_file
|
||||
%a{:href => "##{diff.b_path}"}
|
||||
= diff.b_path
|
||||
= image_tag "blueprint_add.png"
|
||||
- else
|
||||
%span.edit_file
|
||||
%a{:href => "##{diff.b_path}"}
|
||||
= diff.b_path
|
||||
= image_tag "blueprint_info.png"
|
||||
|
15
app/views/commits/_text_file.html.haml
Normal file
15
app/views/commits/_text_file.html.haml
Normal file
|
@ -0,0 +1,15 @@
|
|||
- lines_arr = diff.diff.lines.to_a
|
||||
- line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0
|
||||
- line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0
|
||||
- lines = lines_arr[3..-1].join
|
||||
- lines.each_line do |line|
|
||||
= diff_line(line, line_new, line_old)
|
||||
- if line[0] == "+"
|
||||
- line_new += 1
|
||||
- elsif
|
||||
- line[0] == "-"
|
||||
- line_old += 1
|
||||
- else
|
||||
- line_new += 1
|
||||
- line_old += 1
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue