Skip to content
Snippets Groups Projects
Commit 0541b3f3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

1.0.1

parent d3784687
No related branches found
No related tags found
No related merge requests found
Showing
with 113 additions and 127 deletions
v 1.0.1
- fixed: with invalid source code for commit
- fixed: lose branch/tag selection when use tree navigateion
- when history clicked - display path
- bug fix & code cleaning
v 1.0.0
- bug fix
- projects preview mode
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ gem "carrierwave"
gem 'six'
gem 'therubyracer'
gem 'faker'
gem 'seed-fu', :branch => 'rails-3-1', :git => 'git://github.com/mbleigh/seed-fu.git'
gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git'
gem "inifile"
gem "albino", :git => "git://github.com/gitlabhq/albino.git"
gem "kaminari"
Loading
Loading
Loading
Loading
@@ -22,12 +22,11 @@ GIT
 
GIT
remote: git://github.com/mbleigh/seed-fu.git
revision: 29fe8c61ca6cc4408115ea7475fe2647081bd348
branch: rails-3-1
revision: 77be06852b18fb01e272ab763ddb292da575586c
specs:
seed-fu (2.0.1.rails31)
activerecord (~> 3.1.0.rc4)
activesupport (~> 3.1.0.rc4)
seed-fu (2.1.0)
activerecord (~> 3.1.0)
activesupport (~> 3.1.0)
 
GEM
remote: http://rubygems.org/
Loading
Loading
1.0.0
1.0.1
Loading
Loading
@@ -41,4 +41,24 @@ class ApplicationController < ActionController::Base
super
end
end
def load_refs
@branch = unless params[:branch].blank?
params[:branch]
else
nil
end
@tag = unless params[:tag].blank?
params[:tag]
else
nil
end
@ref = @branch || @tag || "master"
end
def render_404
render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404"
end
end
Loading
Loading
@@ -8,25 +8,19 @@ class CommitsController < ApplicationController
before_filter :authorize_read_project!
 
def index
load_refs # load @branch, @tag & @ref
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]
elsif !params[:tag].blank?
params[:tag]
else
"master"
end
 
if params[:path]
@commits = @repo.log(@branch, params[:path], :max_count => params[:limit] || 100, :skip => params[:offset] || 0)
@commits = @repo.log(@ref, params[:path], :max_count => params[:limit] || 100, :skip => params[:offset] || 0)
else
@commits = @repo.commits(@branch, params[:limit] || 100, params[:offset] || 0)
@commits = @repo.commits(@ref, params[:limit] || 100, params[:offset] || 0)
end
 
respond_to do |format|
format.html # index.html.erb
format.js
format.json { render json: @commits }
end
end
 
Loading
Loading
@@ -38,7 +32,6 @@ class CommitsController < ApplicationController
respond_to do |format|
format.html # show.html.erb
format.js
format.json { render json: @commit }
end
end
end
Loading
Loading
@@ -3,11 +3,6 @@ class KeysController < ApplicationController
 
def index
@keys = current_user.keys.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @keys }
end
end
 
def new
Loading
Loading
@@ -23,8 +18,6 @@ class KeysController < ApplicationController
respond_with(@key)
end
 
# DELETE /keys/1
# DELETE /keys/1.json
def destroy
@key = current_user.keys.find(params[:id])
@key.destroy
Loading
Loading
@@ -32,7 +25,6 @@ class KeysController < ApplicationController
respond_to do |format|
format.html { redirect_to keys_url }
format.js { render :nothing => true }
format.json { head :ok }
end
end
end
Loading
Loading
@@ -8,78 +8,10 @@ class ProjectsController < ApplicationController
 
def index
@projects = current_user.projects.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @projects }
end
end
def show
@repo = project.repo
@commit = @repo.commits.first
@tree = @commit.tree
@tree = @tree / params[:path] if params[:path]
respond_to do |format|
format.html # show.html.erb
format.json { render json: project }
end
rescue Grit::NoSuchPathError => ex
respond_to do |format|
format.html {render "projects/empty"}
end
end
def tree
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]
elsif !params[:tag].blank?
params[:tag]
else
"master"
end
if params[:commit_id]
@commit = @repo.commits(params[:commit_id]).first
else
@commit = @repo.commits(@branch || "master").first
end
@tree = @commit.tree
@tree = @tree / params[:path] if params[:path]
respond_to do |format|
format.html # show.html.erb
format.js do
# temp solution
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
format.json { render json: project }
end
end
def blob
@repo = project.repo
@commit = project.commit(params[:commit_id])
@tree = project.tree(@commit, params[:path])
if @tree.is_a?(Grit::Blob)
send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name)
else
head(404)
end
end
 
def new
@project = Project.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @project }
end
end
 
def edit
Loading
Loading
@@ -98,11 +30,9 @@ class ProjectsController < ApplicationController
if @project.valid?
format.html { redirect_to @project, notice: 'Project was successfully created.' }
format.js
format.json { render json: @project, status: :created, location: @project }
else
format.html { render action: "new" }
format.js
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
rescue Gitosis::AccessDenied
Loading
Loading
@@ -112,7 +42,6 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html { render action: "new" }
format.js
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
 
Loading
Loading
@@ -121,29 +50,87 @@ class ProjectsController < ApplicationController
if project.update_attributes(params[:project])
format.html { redirect_to project, notice: 'Project was successfully updated.' }
format.js
format.json { head :ok }
else
format.html { render action: "edit" }
format.js
format.json { render json: project.errors, status: :unprocessable_entity }
end
end
end
 
def destroy
project.destroy
def show
@repo = project.repo
@commit = @repo.commits.first
@tree = @commit.tree
@tree = @tree / params[:path] if params[:path]
 
rescue Grit::NoSuchPathError => ex
respond_to do |format|
format.html { redirect_to projects_url }
format.json { head :ok }
format.html {render "projects/empty"}
end
end
 
#
# Wall
#
def wall
@notes = @project.common_notes
@note = Note.new
end
 
#
# Repository preview
#
def tree
load_refs # load @branch, @tag & @ref
@repo = project.repo
if params[:commit_id]
@commit = @repo.commits(params[:commit_id]).first
else
@commit = @repo.commits(@ref || "master").first
end
@tree = @commit.tree
@tree = @tree / params[:path] if params[:path]
respond_to do |format|
format.html # show.html.erb
format.js do
# diasbale cache to allow back button works
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
end
rescue
return render_404
end
def blob
@repo = project.repo
@commit = project.commit(params[:commit_id])
@tree = project.tree(@commit, params[:path])
if @tree.is_a?(Grit::Blob)
send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name)
else
head(404)
end
rescue
return render_404
end
def destroy
project.destroy
respond_to do |format|
format.html { redirect_to projects_url }
end
end
protected
 
def project
Loading
Loading
Loading
Loading
@@ -12,7 +12,6 @@ class TeamMembersController < ApplicationController
respond_to do |format|
format.html # show.html.erb
format.js
format.json { render json: @team_member }
end
end
 
Loading
Loading
@@ -22,7 +21,6 @@ class TeamMembersController < ApplicationController
respond_to do |format|
format.html # new.html.erb
format.js
format.json { render json: @team_member }
end
end
 
Loading
Loading
@@ -34,11 +32,9 @@ class TeamMembersController < ApplicationController
if @team_member.save
format.html { redirect_to @team_member, notice: 'Team member was successfully created.' }
format.js
format.json { render json: @team_member, status: :created, location: @team_member }
else
format.html { render action: "new" }
format.js
format.json { render json: @team_member.errors, status: :unprocessable_entity }
end
end
end
Loading
Loading
@@ -59,7 +55,6 @@ class TeamMembersController < ApplicationController
 
respond_to do |format|
format.html { redirect_to root_path }
format.json { head :ok }
format.js { render :nothing => true }
end
end
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@
 
- @admin_projects.each do |project|
%tr
%td= project.name
%td= link_to project.name, [:admin, project]
%td= project.code
%td= project.path
%td= project.users_projects.count
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@
- members.each do |tm|
- user = tm.user
%tr
%td.span-6= tm.user_name
%td.span-6= link_to tm.user_name, admin_team_member_path(tm)
%td.span-6= tm.user_email
%td.span-1= check_box_tag "read", 1, project.readers.include?(user), :disabled => :disabled
%td.span-1= check_box_tag "commit", 1, project.writers.include?(user), :disabled => :disabled
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@
- @admin_users.each do |user|
%tr
%td= check_box_tag "admin", 1, user.admin, :disabled => :disabled
%td= user.name
%td= link_to user.name, [:admin, user]
%td= user.email
%td= user.users_projects.count
%td= link_to 'Show', [:admin, user]
Loading
Loading
Loading
Loading
@@ -6,8 +6,10 @@
&nbsp;
.left.prepend-1
= form_tag project_commits_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
= text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url", "one_click_select"]
.clear
- if params[:path]
%h3{:style => "color:#555"} /#{params[:path]}
%div{:id => dom_id(@project)}
= render "commits"
%ul#notes-list
- @notes.each do |note|
- next unless note.author
= render :partial => "notes/show", :locals => {:note => note}
 
%br
Loading
Loading
-#- if current_user.can_create_project?
= link_to 'New Project', new_project_path, :class => "lbutton vm"
%table.round-borders#projects-list
%tr
%th Name
Loading
Loading
%div.top_project_menu
%span= link_to 'All', projects_path, :class => current_page?(projects_path) ? "current" : nil
%span= link_to "New Project", new_project_path, :class => current_page?(:controller => "projects", :action => "new") ? "current" : nil
- if current_user.can_create_project?
%span= link_to "New Project", new_project_path, :class => current_page?(:controller => "projects", :action => "new") ? "current" : nil
%span.right
= link_to_function(image_tag("list_view_icon.jpg"), "switchProjectView()", :style => "border:none;box-shadow:none;")
 
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
&nbsp;
.left.prepend-1
= form_tag tree_project_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
= text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url","one_click_select"]
.clear
 
Loading
Loading
@@ -18,7 +18,7 @@
- if part_path.empty?
- part_path = part
\/
= link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id)), :remote => :true
= link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true
#tree-content-holder
- if tree.is_a?(Grit::Blob)
= render :partial => "projects/tree_file", :locals => { :name => tree.name, :content => tree.data, :file => tree }
Loading
Loading
@@ -36,7 +36,7 @@
%tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) }
%td.tree-item-file-name
= image_tag "dir.png"
= link_to "..", tree_file_project_path(@project, @commit.id, file), :remote => :true
= link_to "..", tree_file_project_path(@project, @commit.id, file, :branch => @branch, :tag => @tag), :remote => :true
%td
%td
 
Loading
Loading
Loading
Loading
@@ -3,7 +3,6 @@
.view_file_header
%strong
= name
-#= file.mime_type
= link_to "raw", blob_project_path(@project, :commit_id => @commit.id, :path => params[:path] ), :class => "right", :target => "_blank"
= link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right", :style => "margin-right:10px;"
%br/
Loading
Loading
- file = params[:path] ? File.join(params[:path], content.name) : content.name
- content_commit = @project.repo.log(@branch, file, :max_count => 1).last
- content_commit = @project.repo.log(@commit.id, file, :max_count => 1).last
- return unless content_commit
%tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) }
%td.tree-item-file-name
Loading
Loading
@@ -7,7 +7,7 @@
= image_tag "txt.png"
- else
= image_tag "dir.png"
= link_to truncate(content.name, :length => 40), tree_file_project_path(@project, @commit.id, file), :remote => :true
= link_to truncate(content.name, :length => 40), tree_file_project_path(@project, @commit.id, file, :branch => @branch, :tag => @tag), :remote => :true
%td
= time_ago_in_words(content_commit.committed_date)
ago
Loading
Loading
root_path = File.expand_path(File.dirname(__FILE__))
require File.join(root_path, "install", "prepare")
env = ARGV[0] || "development"
Install.prepare(env)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment