fix unauth for public

This commit is contained in:
Dmitriy Zaporozhets 2013-01-12 21:54:52 +02:00
parent 4c6224aad1
commit 122acb2254
5 changed files with 16 additions and 13 deletions

View file

@ -6,6 +6,6 @@ class Public::ProjectsController < ApplicationController
layout 'public'
def index
@projects = Project.where(public: true)
@projects = Project.public
end
end

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -3,7 +3,7 @@
%small Read-Only Access
%hr
%ul.well-list
%ul.unstyled
- @projects.each do |project|
%li.clearfix
%h5