summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-07-02 19:29:15 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-07-02 19:29:15 +0000
commitcaf5b9e5fa562cee2cca9cb484927a190b2bcf8a (patch)
tree84ba2564b6ba27dbb6c6649cf142c2848059582f /app
parentb3a0ee8e631c3e272c8ce3b60929192d3f7f1f22 (diff)
parent1d543e64300666e2abc5cc8562e6b55458878801 (diff)
downloadgitlab-ce-caf5b9e5fa562cee2cca9cb484927a190b2bcf8a.tar.gz
Merge branch 'feature/config' of dev.gitlabhq.com:gitlabhq
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/gitlab_bootstrap.scss5
-rw-r--r--app/controllers/admin/users_controller.rb2
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/mailers/notify.rb6
-rw-r--r--app/models/project.rb2
-rw-r--r--app/roles/git_push.rb2
-rw-r--r--app/roles/repository.rb10
-rw-r--r--app/views/admin/projects/_form.html.haml2
-rw-r--r--app/views/projects/_form.html.haml2
-rw-r--r--app/views/projects/_new_form.html.haml2
-rw-r--r--app/views/projects/show.html.haml15
11 files changed, 37 insertions, 13 deletions
diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss
index 087db6bb721..8c7d6989cd0 100644
--- a/app/assets/stylesheets/gitlab_bootstrap.scss
+++ b/app/assets/stylesheets/gitlab_bootstrap.scss
@@ -158,6 +158,11 @@ table {
&.small {
@extend .btn-small;
}
+
+ &.active {
+ border-color:#aaa;
+ background-color:#ccc;
+ }
}
a:focus {
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 4619cb01acf..4b123e4f032 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -34,7 +34,7 @@ class Admin::UsersController < ApplicationController
def new
- @admin_user = User.new(:projects_limit => GITLAB_OPTS["default_projects_limit"])
+ @admin_user = User.new(:projects_limit => Gitlab.config.default_projects_limit)
end
def edit
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 514e4661000..de3f36c84fc 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -13,7 +13,7 @@ module ApplicationHelper
end
def web_app_url
- "#{request_protocol}://#{GIT_HOST["host"]}/"
+ "#{request_protocol}://#{Gitlab.config.web_host}/"
end
def last_commit(project)
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 05fd17b511a..37b442bce71 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -2,10 +2,10 @@ class Notify < ActionMailer::Base
include Resque::Mailer
add_template_helper ApplicationHelper
- default_url_options[:host] = EMAIL_OPTS["host"]
- default_url_options[:protocol] = -> { EMAIL_OPTS["protocol"] ? EMAIL_OPTS["protocol"] : "http" }.call
+ default_url_options[:host] = Gitlab.config.web_host
+ default_url_options[:protocol] = Gitlab.config.web_protocol
- default from: EMAIL_OPTS["from"]
+ default from: Gitlab.config.email_from
def new_user_email(user_id, password)
@user = User.find(user_id)
diff --git a/app/models/project.rb b/app/models/project.rb
index 9f51f4e4e46..7cbc8928c60 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -113,7 +113,7 @@ class Project < ActiveRecord::Base
end
def web_url
- [GIT_HOST['host'], code].join("/")
+ [Gitlab.config.url, code].join("/")
end
def common_notes
diff --git a/app/roles/git_push.rb b/app/roles/git_push.rb
index d557ce4e96d..b4c59472a5a 100644
--- a/app/roles/git_push.rb
+++ b/app/roles/git_push.rb
@@ -73,7 +73,7 @@ module GitPush
id: commit.id,
message: commit.safe_message,
timestamp: commit.date.xmlschema,
- url: "http://#{GIT_HOST['host']}/#{code}/commits/#{commit.id}",
+ url: "#{Gitlab.config.url}/#{code}/commits/#{commit.id}",
author: {
name: commit.author_name,
email: commit.author_email
diff --git a/app/roles/repository.rb b/app/roles/repository.rb
index f61c77827e3..8d5b018de77 100644
--- a/app/roles/repository.rb
+++ b/app/roles/repository.rb
@@ -68,7 +68,7 @@ module Repository
end
def path_to_repo
- File.join(GIT_HOST["base_path"], "#{path}.git")
+ File.join(Gitlab.config.git_base_path, "#{path}.git")
end
def update_repository
@@ -141,4 +141,12 @@ module Repository
file_path
end
+
+ def ssh_url_to_repo
+ url_to_repo
+ end
+
+ def http_url_to_repo
+ http_url = [Gitlab.config.url, "/", path, ".git"].join()
+ end
end
diff --git a/app/views/admin/projects/_form.html.haml b/app/views/admin/projects/_form.html.haml
index 822dc06439c..41c620a0218 100644
--- a/app/views/admin/projects/_form.html.haml
+++ b/app/views/admin/projects/_form.html.haml
@@ -13,7 +13,7 @@
Path
.input
.input-prepend
- %span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
+ %span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !@admin_project.new_record?
.clearfix
= f.label :code do
diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
index 36923bedc7b..e057155bcdd 100644
--- a/app/views/projects/_form.html.haml
+++ b/app/views/projects/_form.html.haml
@@ -18,7 +18,7 @@
Git Clone
.input
.input-prepend
- %span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
+ %span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
%span.add-on= ".git"
.clearfix
diff --git a/app/views/projects/_new_form.html.haml b/app/views/projects/_new_form.html.haml
index e420f700948..9f3bfa86b91 100644
--- a/app/views/projects/_new_form.html.haml
+++ b/app/views/projects/_new_form.html.haml
@@ -17,7 +17,7 @@
Git Clone
.input
.input-prepend
- %span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
+ %span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
%span.add-on= ".git"
.clearfix
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 44f9053d3f6..23a49873d49 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -4,8 +4,11 @@
.row
.span7
.form-horizontal
- .input-prepend
+ .input-prepend.project_clone_holder
+
%span.add-on git clone
+ = link_to "SSH", "#", :class => "btn small active", :"data-clone" => @project.ssh_url_to_repo
+ = link_to "HTTP", "#", :class => "btn small", :"data-clone" => @project.http_url_to_repo
= text_field_tag :project_clone, @project.url_to_repo, :class => "one_click_select span5"
.span4.right
.right
@@ -23,4 +26,12 @@
= render "events/event_last_push", :event => @last_push
.content_list= render @events
-
+:javascript
+ $(function(){
+ var link_sel = ".project_clone_holder a";
+ $(link_sel).bind("click", function() {
+ $(link_sel).removeClass("active");
+ $(this).addClass("active");
+ $("#project_clone").val($(this).attr("data-clone"));
+ })
+ })