Открыть боковую панель
nt_test133
nt_project_uxpg8lvcuq8w
Коммиты
e2c5d08e
Коммит
e2c5d08e
создал
Окт 05, 2015
по автору
Peter Göbel
Просмотр файлов
added user preference to change layout width
владелец
144eef38
Изменения
9
Скрыть пробелы
Построчно
Рядом
CHANGELOG
Просмотр файла @
e2c5d08e
...
...
@@ -31,6 +31,7 @@ v 8.1.0 (unreleased)
- Hide password in the service settings form
- Fix anchors to comments in diffs
- Move CI web hooks page to project settings area
- 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
Просмотр файла @
e2c5d08e
...
...
@@ -31,6 +31,7 @@ def user
def
preferences_params
params
.
require
(
:user
).
permit
(
:color_scheme_id
,
:layout
,
:dashboard
,
:project_view
,
:theme_id
...
...
app/helpers/page_layout_helper.rb
Просмотр файла @
e2c5d08e
...
...
@@ -26,7 +26,7 @@ def sidebar(name = nil)
def
fluid_layout
(
enabled
=
false
)
if
@fluid_layout
.
nil?
@fluid_layout
=
enabled
@fluid_layout
=
(
current_user
&&
current_user
.
layout
==
"wide"
)
||
enabled
else
@fluid_layout
end
...
...
app/helpers/preferences_helper.rb
Просмотр файла @
e2c5d08e
# Helper methods for per-User preferences
module
PreferencesHelper
def
layout_choices
[
[
'Small'
,
:small
],
[
'Wide'
,
:wide
]
]
end
# Maps `dashboard` values to more user-friendly option text
DASHBOARD_CHOICES
=
{
projects:
'Your Projects (default)'
,
...
...
app/models/user.rb
Просмотр файла @
e2c5d08e
...
...
@@ -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'
...
...
@@ -171,6 +172,9 @@ class User < ActiveRecord::Base
after_create
:post_create_hook
after_destroy
:post_destroy_hook
# User's Layout preference
enum
layout:
[
:small
,
:wide
]
# 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
Просмотр файла @
e2c5d08e
...
...
@@ -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 small (max. 1200px) and wide (100%) application layout
.form-group
=
f
.
label
:dashboard
,
class:
'control-label'
do
Default Dashboard
...
...
app/views/profiles/preferences/update.js.erb
Просмотр файла @
e2c5d08e
...
...
@@ -2,6 +2,13 @@
$('body').removeClass('
<%=
Gitlab
::
Themes
.
body_classes
%>
')
$('body').addClass('
<%=
user_application_theme
%>
')
// Toggle container-fluid class
if ('
<%=
current_user
.
layout
%>
' === 'wide') {
$('.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
Просмотр файла @
e2c5d08e
class
AddLayoutOptionForUsers
<
ActiveRecord
::
Migration
def
change
add_column
:users
,
:layout
,
:integer
,
:default
=>
0
end
end
\ Нет новой строки в конце файла
db/schema.rb
Просмотр файла @
e2c5d08e
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2015
0930095736
)
do
ActiveRecord
::
Schema
.
define
(
version:
2015
1005150751
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -753,6 +753,7 @@
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
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать