Public git read-only access via http
This commit is contained in:
parent
eb626edd3f
commit
4c6224aad1
10 changed files with 89 additions and 15 deletions
11
app/controllers/public/projects_controller.rb
Normal file
11
app/controllers/public/projects_controller.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class Public::ProjectsController < ApplicationController
|
||||
skip_before_filter :authenticate_user!,
|
||||
:reject_blocked, :set_current_user_for_observers,
|
||||
:add_abilities
|
||||
|
||||
layout 'public'
|
||||
|
||||
def index
|
||||
@projects = Project.where(public: true)
|
||||
end
|
||||
end
|
|
@ -28,7 +28,7 @@ class Project < ActiveRecord::Base
|
|||
attr_accessible :name, :path, :description, :default_branch, :issues_enabled,
|
||||
:wall_enabled, :merge_requests_enabled, :wiki_enabled, as: [:default, :admin]
|
||||
|
||||
attr_accessible :namespace_id, :creator_id, as: :admin
|
||||
attr_accessible :namespace_id, :creator_id, :public, as: :admin
|
||||
|
||||
attr_accessor :error_code
|
||||
|
||||
|
|
|
@ -43,6 +43,13 @@
|
|||
= f.label :wiki_enabled, "Wiki"
|
||||
.input= f.check_box :wiki_enabled
|
||||
|
||||
%fieldset.features
|
||||
%legend Public mode:
|
||||
.clearfix
|
||||
= f.label :public do
|
||||
%span Allow public http clone
|
||||
.input= f.check_box :public
|
||||
|
||||
%fieldset.features
|
||||
%legend Transfer:
|
||||
.control-group
|
||||
|
|
|
@ -77,6 +77,13 @@
|
|||
SSH:
|
||||
%td
|
||||
= link_to @project.ssh_url_to_repo
|
||||
- if @project.public
|
||||
%tr.bgred
|
||||
%td
|
||||
%b
|
||||
Public Read-Only Code access:
|
||||
%td
|
||||
= check_box_tag 'public', nil, @project.public
|
||||
|
||||
- if @repository
|
||||
%table.zebra-striped
|
||||
|
|
17
app/views/layouts/public.html.haml
Normal file
17
app/views/layouts/public.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
|||
!!! 5
|
||||
%html{ lang: "en"}
|
||||
= render "layouts/head", title: "Error"
|
||||
%body{class: "#{app_theme} application"}
|
||||
%header.navbar.navbar-static-top.navbar-gitlab
|
||||
.navbar-inner
|
||||
.container
|
||||
%div.app_logo
|
||||
%span.separator
|
||||
= link_to public_root_path, class: "home" do
|
||||
%h1 GITLAB
|
||||
%span.separator
|
||||
%h1.project_name Public
|
||||
.container
|
||||
.content
|
||||
.prepend-top-20
|
||||
= yield
|
14
app/views/public/projects/index.html.haml
Normal file
14
app/views/public/projects/index.html.haml
Normal file
|
@ -0,0 +1,14 @@
|
|||
%h3.page_title
|
||||
Projects
|
||||
%small Read-Only Access
|
||||
%hr
|
||||
|
||||
%ul.well-list
|
||||
- @projects.each do |project|
|
||||
%li.clearfix
|
||||
%h5
|
||||
%i.icon-star.cgreen
|
||||
= project.name_with_namespace
|
||||
.right
|
||||
%span.monospace.tiny
|
||||
git clone #{project.http_url_to_repo}
|
Loading…
Add table
Add a link
Reference in a new issue