Snippets - fixed after bootstrap

Project - restyled show page, removed info page
Repository - restyled show page, added download option
Tags - added download options
This commit is contained in:
Dmitriy Zaporozhets 2012-02-08 01:00:49 +02:00
parent 3d77183c16
commit 4d89322d67
37 changed files with 298 additions and 333 deletions

View file

@ -57,7 +57,7 @@ class ProjectsController < ApplicationController
def update
respond_to do |format|
if project.update_attributes(params[:project])
format.html { redirect_to info_project_path(project), :notice => 'Project was successfully updated.' }
format.html { redirect_to edit_project_path(project), :notice => 'Project was successfully updated.' }
format.js
else
format.html { render action: "edit" }
@ -69,17 +69,13 @@ class ProjectsController < ApplicationController
def show
return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
limit = (params[:limit] || 10).to_i
@activities = @project.activities(limit)#updates_wo_repo(limit)
@activities = @project.activities(limit)
end
def files
@notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)
end
def info
end
#
# Wall
#

View file

@ -19,4 +19,28 @@ class RepositoriesController < ApplicationController
def tags
@tags = @project.repo.tags.sort_by(&:name).reverse
end
def archive
unless can?(current_user, :download_code, @project)
render_404 and return
end
ref = params[:ref] || @project.root_ref
commit = @project.commit(ref)
render_404 and return unless commit
# Build file path
file_name = @project.code + "-" + commit.id.to_s + ".tar.gz"
storage_path = File.join(Rails.root, "tmp", "repositories", @project.code)
file_path = File.join(storage_path, file_name)
# Create file if not exists
unless File.exists?(file_path)
FileUtils.mkdir_p storage_path
file = @project.repo.archive_to_file(ref, nil, file_path)
end
# Send file to user
send_file file_path
end
end

View file

@ -59,6 +59,7 @@ class SnippetsController < ApplicationController
@snippet = @project.snippets.find(params[:id])
@notes = @snippet.notes
@note = @project.notes.new(:noteable => @snippet)
render_full_content
end
def destroy