summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-12 21:54:52 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-13 17:25:18 +0200
commit122acb2254c94823bd7b7b64aa1bd953df5fdf66 (patch)
tree1841930cd0718232f2076428949a85b3de57ad82
parent4c6224aad173a26f1fbe20588b4b155f031d779f (diff)
downloadgitlab-ce-122acb2254c94823bd7b7b64aa1bd953df5fdf66.tar.gz
fix unauth for public
-rw-r--r--app/controllers/public/projects_controller.rb2
-rw-r--r--app/models/project.rb1
-rw-r--r--app/views/layouts/_head.html.haml18
-rw-r--r--app/views/layouts/public.html.haml6
-rw-r--r--app/views/public/projects/index.html.haml2
5 files changed, 16 insertions, 13 deletions
diff --git a/app/controllers/public/projects_controller.rb b/app/controllers/public/projects_controller.rb
index e53c1a48485..28f46c6f239 100644
--- a/app/controllers/public/projects_controller.rb
+++ b/app/controllers/public/projects_controller.rb
@@ -6,6 +6,6 @@ class Public::ProjectsController < ApplicationController
layout 'public'
def index
- @projects = Project.where(public: true)
+ @projects = Project.public
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index ece7da26e75..a826e04eac8 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -81,6 +81,7 @@ class Project < ActiveRecord::Base
scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") }
scope :personal, ->(user) { where(namespace_id: user.namespace_id) }
scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) }
+ scope :public, where(public: true)
class << self
def active
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index 9d035f0e012..4b4f5da3324 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -6,12 +6,14 @@
= favicon_link_tag 'favicon.ico'
= stylesheet_link_tag "application"
= javascript_include_tag "application"
- -# Atom feed
- - if controller_name == 'projects' && action_name == 'index'
- = auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed"
- - if @project && !@project.new_record?
- - if current_controller?(:tree, :commits)
- = auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}")
- - if current_controller?(:issues)
- = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
= csrf_meta_tags
+
+ -# Atom feed
+ - if current_user
+ - if controller_name == 'projects' && action_name == 'index'
+ = auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed"
+ - if @project && !@project.new_record?
+ - if current_controller?(:tree, :commits)
+ = auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}")
+ - if current_controller?(:issues)
+ = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml
index e82459c1e29..864b854c757 100644
--- a/app/views/layouts/public.html.haml
+++ b/app/views/layouts/public.html.haml
@@ -1,16 +1,16 @@
!!! 5
%html{ lang: "en"}
- = render "layouts/head", title: "Error"
+ = render "layouts/head", title: "Public Area"
%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
+ = link_to root_path, class: "home" do
%h1 GITLAB
%span.separator
- %h1.project_name Public
+ %h1.project_name Public Area
.container
.content
.prepend-top-20
diff --git a/app/views/public/projects/index.html.haml b/app/views/public/projects/index.html.haml
index ba4fd72628f..fceb4817210 100644
--- a/app/views/public/projects/index.html.haml
+++ b/app/views/public/projects/index.html.haml
@@ -3,7 +3,7 @@
%small Read-Only Access
%hr
-%ul.well-list
+%ul.unstyled
- @projects.each do |project|
%li.clearfix
%h5