Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-04 11:33:25 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-04 11:33:25 +0400
commitd986aea3f085daafc52f4a8d8de8618eeaf01df4 (patch)
tree1ec0409feed41f401f77e61a4acd199208808334 /app
parent9e924c70f3bc1d173eb89149c369ca7e502e225b (diff)
parent18b1f171bd0b9700e73c37c23150bea9fb251b3e (diff)
Merge branch 'upgrade_to_rails_4.1' into 'master'
Upgrade to rails 4.1
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/controllers/snippets_controller.rb12
-rw-r--r--app/models/snippet.rb4
-rw-r--r--app/views/snippets/current_user_index.html.haml12
4 files changed, 15 insertions, 15 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index b9af36a0c7e..9e14af62048 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -211,6 +211,6 @@ class ProjectsController < ApplicationController
end
def sorted(users)
- users.uniq.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } }
+ users.uniq.to_a.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } }
end
end
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 0dd941a48e2..4fe98f804dc 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -14,7 +14,7 @@ class SnippetsController < ApplicationController
layout 'navless'
def index
- @snippets = Snippet.public.fresh.non_expired.page(params[:page]).per(20)
+ @snippets = Snippet.are_public.fresh.non_expired.page(params[:page]).per(20)
end
def user_index
@@ -26,15 +26,15 @@ class SnippetsController < ApplicationController
if @user == current_user
@snippets = case params[:scope]
- when 'public' then
- @snippets.public
- when 'private' then
- @snippets.private
+ when 'are_public' then
+ @snippets.are_public
+ when 'are_private' then
+ @snippets.are_private
else
@snippets
end
else
- @snippets = @snippets.public
+ @snippets = @snippets.are_public
end
@snippets = @snippets.page(params[:page]).per(20)
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 720accd73dc..9e4409daa1a 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -34,8 +34,8 @@ class Snippet < ActiveRecord::Base
validates :content, presence: true
# Scopes
- scope :public, -> { where(private: false) }
- scope :private, -> { where(private: true) }
+ scope :are_public, -> { where(private: false) }
+ scope :are_private, -> { where(private: true) }
scope :fresh, -> { order("created_at DESC") }
scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) }
scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) }
diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml
index 90ddc7198f6..e3edd856983 100644
--- a/app/views/snippets/current_user_index.html.haml
+++ b/app/views/snippets/current_user_index.html.haml
@@ -18,16 +18,16 @@
All
%span.pull-right
= @user.snippets.count
- = nav_tab :scope, 'private' do
- = link_to user_snippets_path(@user, scope: 'private') do
+ = nav_tab :scope, 'are_private' do
+ = link_to user_snippets_path(@user, scope: 'are_private') do
Private
%span.pull-right
- = @user.snippets.private.count
- = nav_tab :scope, 'public' do
- = link_to user_snippets_path(@user, scope: 'public') do
+ = @user.snippets.are_private.count
+ = nav_tab :scope, 'are_public' do
+ = link_to user_snippets_path(@user, scope: 'are_public') do
Public
%span.pull-right
- = @user.snippets.public.count
+ = @user.snippets.are_public.count
.col-md-9.my-snippets
= render 'snippets'