Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
EIP
Project Forum
Project Forum
Commits
db6c2e1d
Verified
Commit
db6c2e1d
authored
Nov 26, 2022
by
Martin Mladenov
Browse files
Rename ConfigurationParameter to SystemConfigurationParameter
parent
809f1568
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/controllers/admin/administration_controller.rb
View file @
db6c2e1d
...
...
@@ -16,14 +16,14 @@ module Admin
def
set_banner
banner_content
=
params
[
:content
]
ConfigurationParameter
.
set!
(
ConfigurationParameter
::
BANNER_CONTENT_KEY
,
banner_content
)
ConfigurationParameter
.
set!
(
ConfigurationParameter
::
BANNER_ENABLE_KEY
,
'true'
)
System
ConfigurationParameter
.
set!
(
System
ConfigurationParameter
::
BANNER_CONTENT_KEY
,
banner_content
)
System
ConfigurationParameter
.
set!
(
System
ConfigurationParameter
::
BANNER_ENABLE_KEY
,
'true'
)
flash
[
:success
]
=
'Successfully enabled banner'
redirect_to
admin_administration_path
end
def
disable_banner
ConfigurationParameter
.
set!
(
ConfigurationParameter
::
BANNER_ENABLE_KEY
,
'false'
)
System
ConfigurationParameter
.
set!
(
System
ConfigurationParameter
::
BANNER_ENABLE_KEY
,
'false'
)
flash
[
:success
]
=
'Successfully disabled banner'
redirect_to
admin_administration_path
end
...
...
app/models/configuration_parameter.rb
→
app/models/
system_
configuration_parameter.rb
View file @
db6c2e1d
class
ConfigurationParameter
<
ApplicationRecord
class
System
ConfigurationParameter
<
ApplicationRecord
validates
:key
,
presence:
true
,
length:
{
maximum:
64
}
# ===========================================================================
...
...
@@ -11,11 +11,11 @@ class ConfigurationParameter < ApplicationRecord
# Methods
# ===========================================================================
def
self
.
get
(
key
)
ConfigurationParameter
.
find_by
(
key:
key
)
&
.
value
System
ConfigurationParameter
.
find_by
(
key:
key
)
&
.
value
end
def
self
.
set!
(
key
,
value
)
param
=
ConfigurationParameter
.
find_or_initialize_by
(
key:
key
)
param
=
System
ConfigurationParameter
.
find_or_initialize_by
(
key:
key
)
param
.
value
=
value
param
.
save!
end
...
...
app/views/admin/administration/index/_banner.html.erb
View file @
db6c2e1d
<%
enabled
=
ConfigurationParameter
.
get
(
ConfigurationParameter
::
BANNER_ENABLE_KEY
)
===
'true'
%>
<%
enabled
=
System
ConfigurationParameter
.
get
(
System
ConfigurationParameter
::
BANNER_ENABLE_KEY
)
===
'true'
%>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
...
...
@@ -9,7 +9,7 @@
<form
action=
"
<%=
admin_administration_set_banner_path
%>
"
method=
"post"
id=
"banner-form"
>
<%=
hidden_field_tag
:authenticity_token
,
form_authenticity_token
%>
<%=
text_area_tag
:content
,
ConfigurationParameter
.
get
(
ConfigurationParameter
::
BANNER_CONTENT_KEY
),
System
ConfigurationParameter
.
get
(
System
ConfigurationParameter
::
BANNER_CONTENT_KEY
),
class:
'toastui-editor-init'
,
'data-height'
:
'300px'
%>
</form>
<div
class=
"pull-right mtm"
>
...
...
app/views/layouts/_top_banner.html.erb
View file @
db6c2e1d
<%
enabled
=
ConfigurationParameter
.
get
(
ConfigurationParameter
::
BANNER_ENABLE_KEY
)
===
'true'
%>
<%
enabled
=
System
ConfigurationParameter
.
get
(
System
ConfigurationParameter
::
BANNER_ENABLE_KEY
)
===
'true'
%>
<%
if
enabled
%>
<%
content
=
ConfigurationParameter
.
get
(
ConfigurationParameter
::
BANNER_CONTENT_KEY
)
%>
<%
content
=
System
ConfigurationParameter
.
get
(
System
ConfigurationParameter
::
BANNER_CONTENT_KEY
)
%>
<%=
content_tag
:div
,
class:
controller
.
class
.
module_parent
==
Admin
?
'alert alert-warning ptm pbz mam'
:
...
...
app/views/layouts/admin/_navigation_items.html.erb
View file @
db6c2e1d
...
...
@@ -41,7 +41,7 @@
url:
admin_administration_path
,
icon: :'wrench'
,
label:
'Administration'
,
resources:
[
ConfigurationParameter
]
resources:
[
System
ConfigurationParameter
]
}
}.
each
do
|
name
,
data
|
%>
<%=
render
'layouts/navigation_item'
,
name:
name
,
data:
data
%>
...
...
db/migrate/20221120155522_add_configuration_parameters.rb
→
db/migrate/20221120155522_add_
system_
configuration_parameters.rb
View file @
db6c2e1d
class
AddConfigurationParameters
<
ActiveRecord
::
Migration
[
6.1
]
class
Add
System
ConfigurationParameters
<
ActiveRecord
::
Migration
[
6.1
]
def
change
create_table
:configuration_parameters
do
|
t
|
create_table
:
system_
configuration_parameters
do
|
t
|
t
.
string
:key
,
null:
false
,
limit:
64
t
.
text
:value
t
.
datetime
"created_at"
,
null:
false
...
...
db/schema.rb
View file @
db6c2e1d
...
...
@@ -99,7 +99,7 @@ ActiveRecord::Schema.define(version: 2022_11_20_155522) do
t
.
index
[
"company_id"
],
name:
"index_company_user_email_suffixes_on_company_id"
end
create_table
"configuration_parameters"
,
force: :cascade
do
|
t
|
create_table
"
system_
configuration_parameters"
,
force: :cascade
do
|
t
|
t
.
string
"key"
,
limit:
64
,
null:
false
t
.
text
"value"
t
.
datetime
"created_at"
,
null:
false
...
...
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