Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
34d79c9c
Commit
34d79c9c
authored
Oct 05, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gopeter-user-preferences-layout-option'
parents
3eef0e18
3d90560c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
35 additions
and
2 deletions
+35
-2
CHANGELOG
CHANGELOG
+1
-0
app/controllers/profiles/preferences_controller.rb
app/controllers/profiles/preferences_controller.rb
+1
-0
app/helpers/page_layout_helper.rb
app/helpers/page_layout_helper.rb
+1
-1
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+7
-0
app/models/user.rb
app/models/user.rb
+4
-0
app/views/profiles/preferences/show.html.haml
app/views/profiles/preferences/show.html.haml
+7
-0
app/views/profiles/preferences/update.js.erb
app/views/profiles/preferences/update.js.erb
+7
-0
db/migrate/20151005150751_add_layout_option_for_users.rb
db/migrate/20151005150751_add_layout_option_for_users.rb
+5
-0
db/schema.rb
db/schema.rb
+2
-1
No files found.
CHANGELOG
View file @
34d79c9c
...
...
@@ -32,6 +32,7 @@ v 8.1.0 (unreleased)
- Fix anchors to comments in diffs
- Move CI web hooks page to project settings area
- Fix User Identities API. It now allows you to properly create or update user's identities.
- Add user preference to change layout width (Peter Göbel)
v 8.0.3
- Fix URL shown in Slack notifications
...
...
app/controllers/profiles/preferences_controller.rb
View file @
34d79c9c
...
...
@@ -31,6 +31,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController
def
preferences_params
params
.
require
(
:user
).
permit
(
:color_scheme_id
,
:layout
,
:dashboard
,
:project_view
,
:theme_id
...
...
app/helpers/page_layout_helper.rb
View file @
34d79c9c
...
...
@@ -26,7 +26,7 @@ module PageLayoutHelper
def
fluid_layout
(
enabled
=
false
)
if
@fluid_layout
.
nil?
@fluid_layout
=
enabled
@fluid_layout
=
(
current_user
&&
current_user
.
layout
==
"fluid"
)
||
enabled
else
@fluid_layout
end
...
...
app/helpers/preferences_helper.rb
View file @
34d79c9c
# Helper methods for per-User preferences
module
PreferencesHelper
def
layout_choices
[
[
'Fixed'
,
:fixed
],
[
'Fluid'
,
:fluid
]
]
end
# Maps `dashboard` values to more user-friendly option text
DASHBOARD_CHOICES
=
{
projects:
'Your Projects (default)'
,
...
...
app/models/user.rb
View file @
34d79c9c
...
...
@@ -54,6 +54,7 @@
# public_email :string(255) default(""), not null
# dashboard :integer default(0)
# project_view :integer default(0)
# layout :integer default(0)
#
require
'carrierwave/orm/activerecord'
...
...
@@ -172,6 +173,9 @@ class User < ActiveRecord::Base
after_create
:post_create_hook
after_destroy
:post_destroy_hook
# User's Layout preference
enum
layout:
[
:fixed
,
:fluid
]
# User's Dashboard preference
# Note: When adding an option, it MUST go on the end of the array.
enum
dashboard:
[
:projects
,
:stars
,
:project_activity
,
:starred_project_activity
]
...
...
app/views/profiles/preferences/show.html.haml
View file @
34d79c9c
...
...
@@ -32,6 +32,13 @@
.panel-heading
Behavior
.panel-body
.form-group
=
f
.
label
:layout
,
class:
'control-label'
do
Layout width
.col-sm-10
=
f
.
select
:layout
,
layout_choices
,
{},
class:
'form-control'
.help-block
Choose between fixed (max. 1200px) and fluid (100%) application layout
.form-group
=
f
.
label
:dashboard
,
class:
'control-label'
do
Default Dashboard
...
...
app/views/profiles/preferences/update.js.erb
View file @
34d79c9c
...
...
@@ -2,6 +2,13 @@
$('body').removeClass('
<%=
Gitlab
::
Themes
.
body_classes
%>
')
$('body').addClass('
<%=
user_application_theme
%>
')
// Toggle container-fluid class
if ('
<%=
current_user
.
layout
%>
' === 'fluid') {
$('.content-wrapper').find('.container-fluid').removeClass('container-limited')
} else {
$('.content-wrapper').find('.container-fluid').addClass('container-limited')
}
// Re-enable the "Save" button
$('input[type=submit]').enable()
...
...
db/migrate/20151005150751_add_layout_option_for_users.rb
0 → 100644
View file @
34d79c9c
class
AddLayoutOptionForUsers
<
ActiveRecord
::
Migration
def
change
add_column
:users
,
:layout
,
:integer
,
default:
0
end
end
\ No newline at end of file
db/schema.rb
View file @
34d79c9c
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20151005
075649
)
do
ActiveRecord
::
Schema
.
define
(
version:
20151005
150751
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -758,6 +758,7 @@ ActiveRecord::Schema.define(version: 20151005075649) do
t
.
integer
"dashboard"
,
default:
0
t
.
integer
"project_view"
,
default:
0
t
.
integer
"consumed_timestep"
t
.
integer
"layout"
,
default:
0
end
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment