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

Snippets - fixed after bootstrap

Project - restyled show page, removed info page
Repository - restyled show page, added download option
Tags - added download options
parent 3d77183c
No related branches found
No related tags found
No related merge requests found
Showing
with 148 additions and 186 deletions
var Pager = {
ref:null,
limit:0,
offset:0,
init:
function(ref, limit) {
this.ref=ref;
this.limit=limit;
this.offset=limit;
this.initLoadMore();
$('.loading').show();
},
getOld:
function() {
$('.loading').show();
$.ajax({
type: "GET",
url: location.href,
data: "limit=" + this.limit + "&offset=" + this.offset,
complete: function(){ $('.loading').hide()},
dataType: "script"});
},
append:
function(count, html) {
$(".content_list").append(html);
if(count > 0) {
this.offset += count;
this.initLoadMore();
}
},
initLoadMore:
function() {
$(window).bind('scroll', function(){
if($(window).scrollTop() == $(document).height() - $(window).height()){
$(window).unbind('scroll');
Pager.getOld();
}
});
}
}
Loading
Loading
@@ -97,7 +97,7 @@ $blue_link: "#2fa0bb";
min-width:$min_app_width;
max-width:$max_app_width;
margin:auto;
margin-top:51px;
margin-top:52px;
}
 
.container-fluid > .sidebar {
Loading
Loading
@@ -113,7 +113,7 @@ $blue_link: "#2fa0bb";
aside a {
display:block;
position:relative;
padding:15px 10px;
padding:12px 10px;
margin:10px 0 0 0;
font-size:13px;
font-weight:bold;
Loading
Loading
@@ -169,6 +169,7 @@ img.lil_av {
p { padding-top:5px;}
}
 
.visible_link,
.author_link {
color: $active_link_color;
}
Loading
Loading
Loading
Loading
@@ -17,6 +17,7 @@ td.code,
td.linenos{
padding:0;
margin:0;
border-top:0;
vertical-align:top;
}
 
Loading
Loading
Loading
Loading
@@ -191,3 +191,13 @@ a.project-update.titled {
}
}
 
input.git_clone_url {
width:475px;
}
.team_member_row {
img {
width:60px;
}
}
Loading
Loading
@@ -3,7 +3,7 @@ body header {
width:100%;
padding:0;
margin:0;
top:0;
top:1px;
left:0;
background: #F1F1F1; /* for non-css3 browsers */
border-bottom: 1px solid #ccc;
Loading
Loading
@@ -23,12 +23,13 @@ body header {
 
.project_name {
float:left;
width:235px;
width:400px;
margin-right:30px;
font-size:16px;
font-weight:bold;
padding:8px;
color:#333;
text-shadow: 0 1px 1px #FFF;
}
 
.git_url_wrapper {
Loading
Loading
Loading
Loading
@@ -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" }
Loading
Loading
@@ -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
#
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -17,7 +17,7 @@ module ProjectsHelper
end
 
def project_tab_class
[:show, :files, :team, :edit, :update, :info].each do |action|
[:show, :files, :team, :edit, :update].each do |action|
return "current" if current_page?(:controller => "projects", :action => action, :id => @project)
end
 
Loading
Loading
Loading
Loading
@@ -40,6 +40,10 @@ class Ability
:admin_note
] if project.allow_admin_for?(user)
 
rules << [
:download_code,
] if project.allow_pull_for?(user)
rules.flatten
end
 
Loading
Loading
Loading
Loading
@@ -233,6 +233,10 @@ class Project < ActiveRecord::Base
!users_projects.where(:user_id => user.id, :project_access => [PROJECT_RWA]).empty? || owner_id == user.id
end
 
def allow_pull_for?(user)
!users_projects.where(:user_id => user.id, :repo_access => [Repository::REPO_R, Repository::REPO_RW]).empty?
end
def root_ref
default_branch || "master"
end
Loading
Loading
%li.entry
= link_to project_commit_path(@project, :id => commit.id) do
%div
%strong
= truncate commit.id.to_s, :length => 10
%code= commit.id.to_s[0..10]
&ndash;
= image_tag gravatar_icon(commit.author_email), :class => "", :width => 16
= truncate(commit.safe_message, :length => 50)
Loading
Loading
= form_tag project_commits_path(@project), :method => :get do
%h3
= @project.name
[ #{select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "small"} ]
= link_to 'Back', project_path(@project), :class => "button"
%h1 Listing commits
%div{:id => dom_id(@project)}
= render "commits"
%br/
.commit
%span.commit-info
= link_to tree_project_ref_path(@project, @commit.id), :class => "btn right" do
Browse Code »
- if @commit.author_email
= image_tag gravatar_icon(@commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
- else
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
%span.commit-title
%strong
= truncate(@commit.id.to_s, :length => 60)
%span.commit-author
%strong= @commit.author_name
= @commit.created_at.stamp("Aug 21, 2011 9:23pm")
= link_to tree_project_ref_path(@project, @commit.id), :class => "btn right small" do
Browse Code »
= image_tag gravatar_icon(@commit.author_email), :class => "avatar"
%code= @commit.id.to_s
%h5
= @commit.author_name
%small= @commit.created_at.stamp("Aug 21, 2011 9:23pm")
 
%hr
%pre.commit_message
Loading
Loading
Loading
Loading
@@ -8,9 +8,7 @@
 
- if project_layout
.project_name
= truncate @project.name, :length => 28
.git_url_wrapper
%input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo, :class => "one_click_select"}
= truncate @project.name, :length => 35
 
 
.account-box
Loading
Loading
Loading
Loading
@@ -6,8 +6,12 @@
 
- if @project.repo_exists?
= link_to "Repository", project_repository_path(@project), :class => repository_tab_class
= link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
= link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil
%ul
%li
= link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
%li
= link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil
= link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
- if @project.issues_enabled
= link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
Loading
Loading
%li.wll
.row
.span9
= image_tag gravatar_icon(update.author_email), :class => "avatar thumb"
%p
%strong.author= update.author_name
%span
- @activities.each do |update|
.entry
= link_to dashboard_feed_path(@project, update) do
- if update.kind_of? Note
%p
%strong
- if update.target
= update.target.class.name.titleize
= truncate update.target.id.to_s, :length => 10
commented
- else
Project wall
&ndash;
authored
= time_ago_in_words(update.created_at)
ago
- if update.kind_of? MergeRequest
= link_to project_merge_request_path(@project, update) do
= "Opened merge request ##{update.id}."
%span.label= update.source_branch
&rarr;
%span.label= update.target_branch
- elsif update.kind_of? Issue
= link_to project_issue_path(@project, update) do
Opened new
%span.label.important= "issue ##{update.id}"
= truncate update.title
= image_tag gravatar_icon(update.author_email), :class => "", :width => 16
= truncate dashboard_feed_title(update), :length => 50
- else
= link_to [@project, update.target] do
%p
= update.target.class.name.titleize
= truncate(update.target.id.to_s, :length => 10)
&nbsp;
= dashboard_feed_title(update)
%p
%strong
= update.class.name.titleize
= truncate update.id.to_s
&ndash;
= image_tag gravatar_icon(update.author_email), :class => "", :width => 16
= truncate dashboard_feed_title(update), :length => 50
Loading
Loading
@@ -10,13 +10,17 @@
.clearfix
= f.label :path do
Path
%cite= "git@#{GIT_HOST["host"]}:"
.input= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
.input
.input-prepend
%span.add-on= "git@#{GIT_HOST["host"]}:"
= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
.clearfix
= f.label :code do
Code
%cite= "http://#{GIT_HOST["host"]}/"
.input= f.text_field :code, :placeholder => "example"
.input
.input-prepend
%span.add-on= "http://#{GIT_HOST["host"]}/"
= f.text_field :code, :placeholder => "example"
 
- unless @project.new_record? || @project.heads.empty?
.clearfix
Loading
Loading
%ul.tabs
%li{ :class => "#{'active' if current_page?(project_path(@project)) }" }
= link_to project_path(@project), :class => "activities-tab tab" do
Activities
%li{ :class => "#{'active' if current_page?(info_project_path(@project)) || current_page?(edit_project_path(@project)) }" }
= link_to info_project_path(@project), :class => "stat-tab tab " do
Info
Show
- if can? current_user, :admin_project, @project
%li{ :class => "#{'active' if current_page?(edit_project_path(@project)) }" }
= link_to edit_project_path(@project), :class => "stat-tab tab " do
Edit
%li{ :class => " #{'active' if current_page?(team_project_path(@project)) }" }
%li{ :class => " #{'active' if (controller.controller_name == "team_members") || current_page?(team_project_path(@project)) }" }
= link_to team_project_path(@project), :class => "team-tab tab" do
Team
%li{ :class => "#{'active' if current_page?(files_project_path(@project)) }" }
= link_to files_project_path(@project), :class => "files-tab tab " do
Files
%li{ :class => " #{'active' if current_page?(project_snippets_path(@project)) }" }
%li{ :class => " #{'active' if (controller.controller_name == "snippets") }" }
= link_to project_snippets_path(@project), :class => "snippets-tab tab" do
Snippets
- if current_page?(project_snippets_path(@project))
- if can? current_user, :write_snippet, @project
%li
= link_to new_project_snippet_path(@project), :class => "add_new", :title => "New Snippet" do
Add new
- if current_page?(team_project_path(@project))
- if can? current_user, :admin_team_member, @project
%li
= link_to new_project_team_member_path(@project), :class => "add_new", :title => "New Team Member" do
Add New
= render "project_head"
.entry
%h3= @project.name
%br
%pre
= "git clone #{@project.url_to_repo}"
%h4 Details:
%table
%tr
%td Name
%td= @project.name
%tr
%td Slug
%td= @project.code
%tr
%td Path
%td= @project.path
%tr
%td Owner
%td= link_to @project.owner.name, project_team_member_path(@project, @project.team_member_by_id(@project.owner))
%tr
%td Last commit
%td
= time_ago_in_words(@project.commit.committed_date)
ago
%tr
%td Team
%td
= @project.users_projects.count
users
%tr
%td Open Issues
%td
= @project.issues.opened.count
%tr
%td Merge Requests
%td
= @project.merge_requests.opened.count
%tr
%td Created
%td= @project.created_at.stamp("Aug 21, 2011")
%tr
%td{:colspan => 2}= simple_format @project.description
%h4 Features:
%table
%tr
%td Issues
%td
- if @project.issues_enabled
.alert-message.success
Enabled
- else
.alert-message.error
Disabled
%tr
%td Merge Requests
%td
- if @project.merge_requests_enabled
.alert-message.success
Enabled
- else
.alert-message.error
Disabled
%tr
%td Wall
%td
- if @project.wall_enabled
.alert-message.success
Enabled
- else
.alert-message.error
Disabled
.actions
= link_to "Edit", edit_project_path(@project), :class => "btn"
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