Browse Source

Merge branch 'rel-3.2' into dev

pull/5764/head
Halil İbrahim Kalkan 6 years ago
parent
commit
59fd31b028
  1. 23
      docs/en/Settings.md
  2. 3
      docs/en/UI/Angular/Settings.md
  3. 2
      docs/en/UI/AspNetCore/JavaScript-API/Index.md
  4. 33
      docs/en/UI/AspNetCore/JavaScript-API/Settings.md
  5. 3
      docs/en/UI/Blazor/Settings.md
  6. 4
      docs/en/docs-nav.json

23
docs/en/Settings.md

@ -2,7 +2,7 @@
[Configuration system](Configuration.md) is a good way to configure the application on startup. In addition to the configurations, ABP provides another way to set and get some application settings. [Configuration system](Configuration.md) is a good way to configure the application on startup. In addition to the configurations, ABP provides another way to set and get some application settings.
A setting is a name-value pair stored in a dynamic data source, generally in a database. Setting system is extensible and there are pre-built provides for a user, a tenant, global and default. A setting is a name-value pair stored in a dynamic data source, generally in a database. Setting system is extensible and there are pre-built providers for a user, a tenant, global and default.
## Defining Settings ## Defining Settings
@ -67,7 +67,7 @@ public class MySettingDefinitionProvider : SettingDefinitionProvider
> Using constants for the setting names is a good practice and ABP packages do it. `Abp.Mailing.Smtp.Host` setting name is a constant defined by the `EmailSettingNames` class (in the `Volo.Abp.Emailing` namespace). > Using constants for the setting names is a good practice and ABP packages do it. `Abp.Mailing.Smtp.Host` setting name is a constant defined by the `EmailSettingNames` class (in the `Volo.Abp.Emailing` namespace).
## Reading Setting Values ## Reading the Setting Values
### ISettingProvider ### ISettingProvider
@ -108,24 +108,15 @@ public class MyService
} }
```` ````
> `ISettingProvider` is a very common service and some base classes (like `IApplicationService`) already property-inject it. You can directly use the `SettingProvider` in such cases. > `ISettingProvider` is a very common service and some base classes (like `IApplicationService`) already property-inject it. You can directly use the `SettingProvider` property in such cases.
### Reading Setting Values on the Client Side ### Reading Setting Values on the Client Side
If a setting is allowed to be visible on the client side, current value of the setting can also be read from the JavaScript code. Examples: If a setting is allowed to be visible on the client side, current value of the setting can also be read from the client code. See the following documents to understand how to get the setting values in different UI types;
````js * [MVC / Razor Pages](UI/AspNetCore/JavaScript-API/Settings.md)
//Gets a value as string. * [Angular](UI/Angular/Settings.md)
var language = abp.setting.get('Abp.Localization.DefaultLanguage'); * [Blazor](UI/Blazor/Settings.md)
//Gets an integer value.
var requiredLength = abp.setting.getInt('Abp.Identity.Password.RequiredLength');
//Gets a boolean value.
var requireDigit = abp.setting.getBoolean('Abp.Identity.Password.RequireDigit');
````
In addition, use `abp.setting.values` to get a dictionary of all the setting values.
## Setting Value Providers ## Setting Value Providers

3
docs/en/UI/Angular/Settings.md

@ -0,0 +1,3 @@
# Angular UI: Settings
> This document explains how to get setting values in an Angular application. See the [settings document](../../Settings.md) to learn the setting system.

2
docs/en/UI/AspNetCore/JavaScript-API/Index.md

@ -16,7 +16,7 @@ ABP provides a set of JavaScript APIs for ASP.NET Core MVC / Razor Pages applica
* abp.ModalManager * abp.ModalManager
* [abp.notify](Notify.md) * [abp.notify](Notify.md)
* abp.security * abp.security
* abp.setting * [abp.setting](Settings.md)
* abp.ui * abp.ui
* abp.utils * abp.utils
* abp.ResourceLoader * abp.ResourceLoader

33
docs/en/UI/AspNetCore/JavaScript-API/Settings.md

@ -0,0 +1,33 @@
# ASP.NET Core MVC / Razor Pages UI: JavaScript Setting API
Localization API allows you to get the values of the settings on the client side. You can read the current value of a setting in the client side only if it is allowed by the setting definition (on the server side).
> This document only explains the JavaScript API. See the [settings document](../../../Settings.md) to understand the ABP setting system.
## Basic Usage
````js
//Gets a value as string.
var language = abp.setting.get('Abp.Localization.DefaultLanguage');
//Gets an integer value.
var requiredLength = abp.setting.getInt('Abp.Identity.Password.RequiredLength');
//Gets a boolean value.
var requireDigit = abp.setting.getBoolean('Abp.Identity.Password.RequireDigit');
````
## All Values
`abp.setting.values` can be used to obtain all the setting values as an object where the object properties are setting names and property values are the setting values.
An example value of this object is shown below:
````js
{
Abp.Localization.DefaultLanguage: "en",
Abp.Timing.TimeZone: "UTC",
...
}
````

3
docs/en/UI/Blazor/Settings.md

@ -0,0 +1,3 @@
# Blazor UI: Settings
Blazor applications can reuse the same `ISettingProvider` service that is explained in the [settings document](../../Settings.md).

4
docs/en/docs-nav.json

@ -455,6 +455,10 @@
"text": "Localization", "text": "Localization",
"path": "UI/AspNetCore/JavaScript-API/Localization.md" "path": "UI/AspNetCore/JavaScript-API/Localization.md"
}, },
{
"text": "Settings",
"path": "UI/AspNetCore/JavaScript-API/Settings.md"
},
{ {
"text": "AJAX", "text": "AJAX",
"path": "UI/AspNetCore/JavaScript-API/Ajax.md" "path": "UI/AspNetCore/JavaScript-API/Ajax.md"

Loading…
Cancel
Save