summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-03 17:47:47 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-03 17:47:47 +0300
commit94ae27312ad5816e8efc8d228faceb1d144e98ae (patch)
tree8e6ea341e8a7b1b8a29d6082464559031ed789e8
parent26938bfa8aeb9d9d0e77a4c7f286542748a888f4 (diff)
downloadgitlab-ci-94ae27312ad5816e8efc8d228faceb1d144e98ae.tar.gz
Remove user resource. Add ssh url to repo for project
-rw-r--r--app/controllers/projects_controller.rb3
-rw-r--r--app/controllers/resques_controller.rb6
-rw-r--r--app/controllers/users_controller.rb40
-rw-r--r--app/models/project.rb6
-rw-r--r--app/views/projects/_form.html.haml3
-rw-r--r--app/views/users/edit.html.haml25
-rw-r--r--app/views/users/edit.html.haml~24
-rw-r--r--app/views/users/index.html.haml35
-rw-r--r--config/routes.rb1
-rw-r--r--db/migrate/20130603144030_add_more_fields_to_project.rb5
-rw-r--r--db/schema.rb3
11 files changed, 16 insertions, 135 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index e5b552b..9d2a4f1 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -108,7 +108,8 @@ class ProjectsController < ApplicationController
name: project.name_with_namespace,
gitlab_url: project.web_url,
scripts: 'ls -la',
- default_ref: project.default_branch
+ default_ref: project.default_branch,
+ ssh_url_to_repo: project.ssh_url_to_repo
}
@project = Project.new(params)
diff --git a/app/controllers/resques_controller.rb b/app/controllers/resques_controller.rb
deleted file mode 100644
index 19d2e6f..0000000
--- a/app/controllers/resques_controller.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class ResquesController < ApplicationController
- before_filter :authenticate_user!
-
- def show
- end
-end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
deleted file mode 100644
index 1c15aa0..0000000
--- a/app/controllers/users_controller.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-class UsersController < ApplicationController
- before_filter :authenticate_user!
-
- def index
- @users = User.all
- @new_user = User.new
- end
-
- def edit
- end
-
- def create
- @user = User.create(params[:user])
-
- redirect_to users_path
- end
-
- def update
- user_params = params[:user]
-
- if current_user.valid_password?(user_params.delete(:current_password))
-
- user_params.delete(:password) if user_params[:password].blank?
- user_params.delete(:password_confirmation) if user_params[:password_confirmation].blank?
-
- current_user.update_attributes(user_params)
-
- redirect_to :back
- else
-
- redirect_to :back, alert: 'Current password is invalid'
- end
- end
-
- def destroy
- User.find(params[:id]).destroy
-
- redirect_to users_path
- end
-end
diff --git a/app/models/project.rb b/app/models/project.rb
index d5dc79e..4f4bc1e 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1,6 +1,7 @@
class Project < ActiveRecord::Base
attr_accessible :name, :path, :scripts, :timeout, :token,
- :default_ref, :gitlab_url, :always_build, :polling_interval, :public
+ :default_ref, :gitlab_url, :always_build, :polling_interval,
+ :public, :ssh_url_to_repo
has_many :builds, dependent: :destroy
@@ -8,7 +9,8 @@ class Project < ActiveRecord::Base
#
# Validations
#
- validates_presence_of :name, :scripts, :timeout, :token, :default_ref, :gitlab_url
+ validates_presence_of :name, :scripts, :timeout, :token, :default_ref, :gitlab_url, :ssh_url_to_repo
+
validates_uniqueness_of :name
validates :polling_interval,
diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
index e905220..a097468 100644
--- a/app/views/projects/_form.html.haml
+++ b/app/views/projects/_form.html.haml
@@ -18,6 +18,9 @@
= f.label :gitlab_url, "GitLab url to project"
= f.text_field :gitlab_url, class: 'input-xlarge', placeholder: 'http://gitlab.domain.com/project-slug'
.field
+ = f.label :ssh_url_to_repo, "ssh url to repository"
+ = f.text_field :ssh_url_to_repo, class: 'input-xlarge', placeholder: 'git@gitlab.domain.com:project-slug.git'
+ .field
= f.label :default_ref, "Make tabs for next branches"
= f.text_field :default_ref, class: 'input-xlarge', placeholder: 'master, stable'
%small You will be able to filter builds by following branches
diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml
deleted file mode 100644
index 37d6ff1..0000000
--- a/app/views/users/edit.html.haml
+++ /dev/null
@@ -1,25 +0,0 @@
-%h3
- Edit #{current_user.email}
-%hr
-= form_for(current_user, :html => { :method => :put, class: 'form-horizontal' }) do |f|
- .control-group
- = f.label :email, class: 'control-label'
- .controls
- = f.email_field :email
- .control-group
- = f.label :password, class: 'control-label'
- .controls
- = f.password_field :password, :autocomplete => "off"
- %i (leave blank if you don't want to change it)
- .control-group
- = f.label :password_confirmation, class: 'control-label'
- .controls
- = f.password_field :password_confirmation
- .control-group
- = f.label :current_password, class: 'control-label'
- .controls
- = f.password_field :current_password
- %i (we need your current password to confirm your changes)
- .form-actions
- = f.submit "Update", class: 'btn btn-primary'
- = link_to "Remove my account", current_user, :data => { :confirm => "Are you sure?" }, :method => :delete, class: 'btn btn-danger btn-small right'
diff --git a/app/views/users/edit.html.haml~ b/app/views/users/edit.html.haml~
deleted file mode 100644
index f8f450e..0000000
--- a/app/views/users/edit.html.haml~
+++ /dev/null
@@ -1,24 +0,0 @@
-<h2>Edit <%= current_user.email %></h2>
-
-<%= form_for(current_user, :html => { :method => :put }) do |f| %>
-
- <div><%= f.label :email %><br />
- <%= f.email_field :email %></div>
-
- <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
- <%= f.password_field :password, :autocomplete => "off" %></div>
-
- <div><%= f.label :password_confirmation %><br />
- <%= f.password_field :password_confirmation %></div>
-
- <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
- <%= f.password_field :current_password %></div>
-
- <div class="form-actions"><%= f.submit "Update", class: 'btn btn-primary' %></div>
-<% end %>
-
-<h3>Cancel my account</h3>
-
-<p class="alert alert-error"> <%= link_to "Cancel my account", current_user, :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
-
-<%= link_to "Back", :back %>
diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml
deleted file mode 100644
index 5f2240b..0000000
--- a/app/views/users/index.html.haml
+++ /dev/null
@@ -1,35 +0,0 @@
-%h3
- Users
-%br
-
-.row-fluid
- .span7
- %ul.unstyled
- - @users.each do |user|
- %li
- = image_tag gravatar_icon(user.email, 24)
- = user.email
- = link_to 'Remove', user, :data => { :confirm => "Are you sure?" }, :method => :delete, class: 'btn btn-danger btn-small right'
- %hr
- .span5
- .sidebar
- %h4 New User
- %br
- = form_for(@new_user, html: { class: 'form-horizontal' }) do |f|
- .control-group
- = f.label :email, class: 'control-label'
- .controls
- = f.email_field :email
- .control-group
- = f.label :password, class: 'control-label'
- .controls
- = f.password_field :password, :autocomplete => "off"
- .control-group
- = f.label :password_confirmation, class: 'control-label'
- .controls
- = f.password_field :password_confirmation
- .form-actions
- = f.submit "Create", class: 'btn btn-primary'
-
-
-
diff --git a/config/routes.rb b/config/routes.rb
index bdebcd2..4bdde76 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,7 +26,6 @@ GitlabCi::Application.routes.draw do
end
end
- resources :users
resource :user_sessions
resources :runners, only: [:index, :destroy]
diff --git a/db/migrate/20130603144030_add_more_fields_to_project.rb b/db/migrate/20130603144030_add_more_fields_to_project.rb
new file mode 100644
index 0000000..0897682
--- /dev/null
+++ b/db/migrate/20130603144030_add_more_fields_to_project.rb
@@ -0,0 +1,5 @@
+class AddMoreFieldsToProject < ActiveRecord::Migration
+ def change
+ add_column :projects, :ssh_url_to_repo, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3a40381..7cbb32a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130603130920) do
+ActiveRecord::Schema.define(:version => 20130603144030) do
create_table "builds", :force => true do |t|
t.integer "project_id"
@@ -41,6 +41,7 @@ ActiveRecord::Schema.define(:version => 20130603130920) do
t.boolean "always_build", :default => false, :null => false
t.integer "polling_interval"
t.boolean "public", :default => false, :null => false
+ t.string "ssh_url_to_repo"
end
create_table "runners", :force => true do |t|