Merge branch 'master' into fixes/api, code clean up and tests fixed

Conflicts:
	doc/api/projects.md
	spec/requests/api/projects_spec.rb
This commit is contained in:
Sebastian Ziebell 2013-03-07 14:51:56 +01:00
commit 3374027e3a
49 changed files with 820 additions and 163 deletions

View file

@ -11,12 +11,7 @@ $ ->
# Make the entire tree-item row clickable, but not if clicking another link (like a commit message)
$("#tree-slider .tree-item").live 'click', (e) ->
$('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A")
# Show/Hide the loading spinner
$('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live
"ajax:beforeSend": -> $('.tree_progress').addClass("loading")
"ajax:complete": -> $('.tree_progress').removeClass("loading")
# Maintain forward/back history while browsing the file tree
((window) ->
History = window.History
@ -33,7 +28,12 @@ $ ->
History.Adapter.bind window, 'statechange', ->
state = History.getState()
window.ajaxGet(state.url)
$.ajax({
url: state.url,
dataType: 'script',
beforeSend: -> $('.tree_progress').addClass("loading"),
complete: -> $('.tree_progress').removeClass("loading")
})
)(window)
# See if there are lines selected

View file

@ -34,13 +34,6 @@
padding: 15px;
word-wrap: break-word;
pre {
background: none !important;
margin: 0;
border: none;
padding: 0;
}
.clearfix {
margin: 0;
}

View file

@ -2,6 +2,7 @@
.cgray { color:gray }
.cred { color:#D12F19 }
.cgreen { color:#4a2 }
.cblue { color:#29A }
.cblack { color:#111 }
.cdark { color:#444 }
.cwhite { color:#fff!important }

View file

@ -120,3 +120,16 @@ ul.nav.nav-projects-tabs {
.team_member_row form {
margin: 0px;
}
.public-projects {
li {
margin-top: 8px;
margin-bottom: 5px;
border-bottom: 1px solid #eee;
.description {
margin-left: 22px;
color: #aaa;
}
}
}

View file

@ -91,7 +91,7 @@ class MergeRequest < ActiveRecord::Base
def validate_branches
if target_branch == source_branch
errors.add :base, "You can not use same branch for source and target branches"
errors.add :branch_conflict, "You can not use same branch for source and target branches"
end
end

View file

@ -1,4 +1,6 @@
class Repository
include Gitlab::Popen
# Repository directory name with namespace direcotry
# Examples:
# gitlab/gitolite
@ -147,4 +149,21 @@ class Repository
file_path
end
# Return repo size in megabytes
# Cached in redis
def size
Rails.cache.fetch(cache_key(:size)) do
size = popen('du -s', path_to_repo).first.strip.to_i
(size.to_f / 1024).round(2)
end
end
def expire_cache
Rails.cache.delete(cache_key(:size))
end
def cache_key(type)
"#{type}:#{path_with_namespace}"
end
end

View file

@ -23,6 +23,7 @@ class GitPushService
project.ensure_satellite_exists
project.discover_default_branch
project.repository.expire_cache
if push_to_branch?(ref, oldrev)
project.update_merge_requests(oldrev, newrev, ref, @user)

View file

@ -1,6 +1,6 @@
= form_tag(user_omniauth_callback_path(:ldap), :class => "login-box", :id => 'new_ldap_user' ) do
= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo"
= text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"}
= text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login", :autofocus => "autofocus"}
= password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"}
%br/
= submit_tag "LDAP Sign in", :class => "btn-primary btn"

View file

@ -1,15 +1,16 @@
- if event.proper?
%div.event-item
%span.cgray.pull-right
#{time_ago_in_words(event.created_at)} ago.
= cache event do
%div.event-item
%span.cgray.pull-right
#{time_ago_in_words(event.created_at)} ago.
= image_tag gravatar_icon(event.author_email), class: "avatar s24"
= image_tag gravatar_icon(event.author_email), class: "avatar s24"
- if event.push?
= render "events/event/push", event: event
.clearfix
- elsif event.note?
= render "events/event/note", event: event
- else
= render "events/event/common", event: event
- if event.push?
= render "events/event/push", event: event
.clearfix
- elsif event.note?
= render "events/event/note", event: event
- else
= render "events/event/common", event: event

View file

@ -21,6 +21,8 @@
= link_to "Milestones", "#milestones", 'data-toggle' => 'tab'
%li
= link_to "Notes", "#notes", 'data-toggle' => 'tab'
%li
= link_to "System Hooks", "#system_hooks", 'data-toggle' => 'tab'
.tab-content
.tab-pane.active#README
@ -103,3 +105,12 @@
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "notes.md"))
.tab-pane#system_hooks
.file_holder
.file_title
%i.icon-file
System Hooks
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "system_hooks.md"))

View file

@ -22,7 +22,7 @@
= mail_to Gitlab.config.gitlab.support_email, "support contact"
%li
Use the
= link_to "search bar", '#', onclick: "$("#search").focus();"
= link_to "search bar", '#', onclick: "$('#search').focus();"
on the top of this page
%li
Ask in our

View file

@ -10,7 +10,7 @@
= link_to root_path, class: "home" do
%h1 GITLAB
%span.separator
%h1.project_name Public Projects
%h1.project_name Public Projects
.container
.content
.prepend-top-20

View file

@ -9,11 +9,19 @@
Project name is
.input
= f.text_field :name, placeholder: "Example Project", class: "xxlarge"
- unless @repository.heads.empty?
.clearfix
= f.label :default_branch, "Default Branch"
.input= f.select(:default_branch, @repository.heads.map(&:name), {}, style: "width:210px;")
.clearfix
= f.label :description do
Project description
%span.light (optional)
.input
= f.text_area :description, placeholder: "awesome project", class: "xxlarge", rows: 3, maxlength: 250
%fieldset.features
%legend Features:

View file

@ -1,8 +1,33 @@
= render "project_head"
= render 'clone_panel'
= render "events/event_last_push", event: @last_push
.content_list= render @events
.loading.hide
.row
.span9
.content_list= render @events
.loading.hide
.span3
.ui-box.white
.padded
%h3.page_title
= @project.name
- if @project.description.present?
%p.light= @project.description
%hr
%p
Access level:
- if @project.public
%span.cblue
%i.icon-share
Public
- else
%span.cgreen
%i.icon-lock
Private
%p Repo Size: #{@project.repository.size} MB
%p Created at: #{@project.created_at.stamp('Aug 22, 2013')}
%p Owner: #{link_to @project.owner_name, @project.owner}
:javascript
$(function(){ Pager.init(20); });

View file

@ -1,18 +1,20 @@
%h3.page_title
Projects
Projects (#{@projects.total_count})
%small with read-only access
%hr
%ul.unstyled
- @projects.each do |project|
%li.clearfix
%h5
%i.icon-share
= project.name_with_namespace
.pull-right
%pre.dark.tiny git clone #{project.http_url_to_repo}
.public-projects
%ul.unstyled
- @projects.each do |project|
%li.clearfix
%h5
%i.icon-share
= project.name_with_namespace
.pull-right
%pre.dark.tiny git clone #{project.http_url_to_repo}
%p.description
= project.description
- unless @projects.present?
%h3.nothing_here_message No public projects
- unless @projects.present?
%h3.nothing_here_message No public projects
= paginate @projects, theme: "admin"
= paginate @projects, theme: "admin"

View file

@ -11,9 +11,6 @@
- else
= link_to title, '#'
.clear
%div.tree_progress
%div#tree-content-holder.tree-content-holder
- if tree.is_blob?
= render "tree/blob", blob: tree
@ -40,6 +37,8 @@
- if tree.readme
= render "tree/readme", readme: tree.readme
%div.tree_progress
- unless tree.is_blob?
:javascript
// Load last commit log for each file in tree