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>2015-04-03 04:22:54 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-22 18:17:43 +0300
commit4a63573b21dedaebaf0722b819926c5a468bcc5d (patch)
treea2c067fb640bf7cb7c3c66edd8b2c46824f3cd07 /app
parent27919e25e8059c644a79ef8b1f5f04d213999295 (diff)
Start applying new layout to snippets pages
Diffstat (limited to 'app')
-rw-r--r--app/controllers/snippets_controller.rb40
-rw-r--r--app/views/layouts/nav/_snippets.html.haml11
-rw-r--r--app/views/layouts/snippets.html.haml6
-rw-r--r--app/views/snippets/current_user_index.html.haml49
-rw-r--r--app/views/snippets/index.html.haml1
5 files changed, 58 insertions, 49 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index cd52556b203..6c84dbbb998 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -1,10 +1,6 @@
class SnippetsController < ApplicationController
before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw]
-
- # Allow modify snippet
before_filter :authorize_modify_snippet!, only: [:edit, :update]
-
- # Allow destroy snippet
before_filter :authorize_admin_snippet!, only: [:destroy]
before_filter :set_title
@@ -16,24 +12,24 @@ class SnippetsController < ApplicationController
layout :determine_layout
def index
- @snippets = SnippetsFinder.new.execute(current_user, filter: :all).page(params[:page]).per(PER_PAGE)
- end
-
- def user_index
- @user = User.find_by(username: params[:username])
-
- render_404 and return unless @user
-
- @snippets = SnippetsFinder.new.execute(current_user, {
- filter: :by_user,
- user: @user,
- scope: params[:scope] }).
- page(params[:page]).per(PER_PAGE)
-
- if @user == current_user
- render 'current_user_index'
+ if params[:username].present?
+ @user = User.find_by(username: params[:username])
+
+ render_404 and return unless @user
+
+ @snippets = SnippetsFinder.new.execute(current_user, {
+ filter: :by_user,
+ user: @user,
+ scope: params[:scope] }).
+ page(params[:page]).per(PER_PAGE)
+
+ if @user == current_user
+ render 'current_user_index'
+ else
+ render 'user_index'
+ end
else
- render 'user_index'
+ @snippets = SnippetsFinder.new.execute(current_user, filter: :all).page(params[:page]).per(PER_PAGE)
end
end
@@ -108,6 +104,6 @@ class SnippetsController < ApplicationController
end
def determine_layout
- current_user ? 'navless' : 'public_users'
+ current_user ? 'snippets' : 'public_users'
end
end
diff --git a/app/views/layouts/nav/_snippets.html.haml b/app/views/layouts/nav/_snippets.html.haml
new file mode 100644
index 00000000000..1c5d376a76d
--- /dev/null
+++ b/app/views/layouts/nav/_snippets.html.haml
@@ -0,0 +1,11 @@
+%ul.nav.nav-sidebar
+ = nav_link(path: user_snippets_path(current_user), html_options: {class: 'home'}) do
+ = link_to user_snippets_path(current_user) do
+ %i.fa.fa-dashboard
+ %span
+ My Snippets
+ = nav_link(path: snippets_path) do
+ = link_to snippets_path, title: 'Discover snippets' do
+ %i.fa.fa-globe
+ %span
+ Discover Snippets
diff --git a/app/views/layouts/snippets.html.haml b/app/views/layouts/snippets.html.haml
new file mode 100644
index 00000000000..fbd29eb23a7
--- /dev/null
+++ b/app/views/layouts/snippets.html.haml
@@ -0,0 +1,6 @@
+!!! 5
+%html{ lang: "en"}
+ = render "layouts/head", title: "Dashboard"
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page }
+ = render "layouts/head_panel", title: link_to("Snippets", snippets_path)
+ = render 'layouts/page', sidebar: 'layouts/nav/snippets'
diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml
index 0df5ade500d..4a273557953 100644
--- a/app/views/snippets/current_user_index.html.haml
+++ b/app/views/snippets/current_user_index.html.haml
@@ -8,32 +8,29 @@
%p.light
Share code pastes with others out of git repository
-%hr
-.row
- .col-md-3
- %ul.nav.nav-pills.nav-stacked
- = nav_tab :scope, nil do
- = link_to user_snippets_path(@user) do
- All
- %span.pull-right
- = @user.snippets.count
- = nav_tab :scope, 'are_private' do
- = link_to user_snippets_path(@user, scope: 'are_private') do
- Private
- %span.pull-right
- = @user.snippets.are_private.count
- = nav_tab :scope, 'are_internal' do
- = link_to user_snippets_path(@user, scope: 'are_internal') do
- Internal
- %span.pull-right
- = @user.snippets.are_internal.count
- = nav_tab :scope, 'are_public' do
- = link_to user_snippets_path(@user, scope: 'are_public') do
- Public
- %span.pull-right
- = @user.snippets.are_public.count
+%ul.nav.nav-tabs
+ = nav_tab :scope, nil do
+ = link_to user_snippets_path(@user) do
+ All
+ %span.badge
+ = @user.snippets.count
+ = nav_tab :scope, 'are_private' do
+ = link_to user_snippets_path(@user, scope: 'are_private') do
+ Private
+ %span.badge
+ = @user.snippets.are_private.count
+ = nav_tab :scope, 'are_internal' do
+ = link_to user_snippets_path(@user, scope: 'are_internal') do
+ Internal
+ %span.badge
+ = @user.snippets.are_internal.count
+ = nav_tab :scope, 'are_public' do
+ = link_to user_snippets_path(@user, scope: 'are_public') do
+ Public
+ %span.badge
+ = @user.snippets.are_public.count
- .col-md-9.my-snippets
- = render 'snippets'
+.my-snippets
+ = render 'snippets'
diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml
index 5cd8ae26cf9..108dd0cca3e 100644
--- a/app/views/snippets/index.html.haml
+++ b/app/views/snippets/index.html.haml
@@ -2,7 +2,6 @@
Public snippets
.pull-right
-
- if current_user
= link_to new_snippet_path, class: "btn btn-new btn-grouped", title: "New Snippet" do
Add new snippet