diff --git a/zero.Core/Api/CountriesApi.cs b/zero.Core/Api/CountriesApi.cs index 76fc1997..3516bc45 100644 --- a/zero.Core/Api/CountriesApi.cs +++ b/zero.Core/Api/CountriesApi.cs @@ -1,4 +1,5 @@ using Raven.Client.Documents; +using Raven.Client.Documents.Linq; using Raven.Client.Documents.Session; using System.Collections.Generic; using System.Threading.Tasks; @@ -18,11 +19,15 @@ namespace zero.Core.Api /// - public async Task> GetAll() + public async Task> GetAll(string languageId) { using (IAsyncDocumentSession session = Raven.OpenAsyncSession()) { - return await session.Query().ToListAsync(); + return await session.Query() + .Where(x => x.LanguageId == languageId) + .OrderByDescending(x => x.IsPreferred) + .ThenBy(x => x.Name) + .ToListAsync(); } } } @@ -33,6 +38,6 @@ namespace zero.Core.Api /// /// Get all available countries /// - Task> GetAll(); + Task> GetAll(string languageId); } } diff --git a/zero.Core/Api/SetupApi.cs b/zero.Core/Api/SetupApi.cs index 5260bcae..a55c2d18 100644 --- a/zero.Core/Api/SetupApi.cs +++ b/zero.Core/Api/SetupApi.cs @@ -168,7 +168,7 @@ namespace zero.Core.Api { CreatedDate = DateTimeOffset.Now, IsActive = true, - Alias = Alias.Generate(model.AppName), + Alias = Alias.Generate(country.Key), LanguageId = languageISO, Code = country.Key, Name = country.Value diff --git a/zero.Web/App/Components/Tables/table-filter.vue b/zero.Web/App/Components/Tables/table-filter.vue index 8a5ab7f3..97cd1aa3 100644 --- a/zero.Web/App/Components/Tables/table-filter.vue +++ b/zero.Web/App/Components/Tables/table-filter.vue @@ -1,7 +1,7 @@  @@ -11,7 +11,14 @@ name: 'uiTableFilter', props: { - + filter: { + type: Boolean, + default: true + }, + search: { + type: Boolean, + default: true + } }, data: () => ({ diff --git a/zero.Web/App/Components/Tables/table.vue b/zero.Web/App/Components/Tables/table.vue index bebc4caa..a12377e5 100644 --- a/zero.Web/App/Components/Tables/table.vue +++ b/zero.Web/App/Components/Tables/table.vue @@ -2,7 +2,7 @@
-
+
{{ column.label | localize }}
-
+
@@ -108,9 +108,10 @@ } this.columns.push(_extend(data, { - label: column.label || (this.configuration.labelPrefix + key), + label: data.label || (this.configuration.labelPrefix + key), field: key, - canSort: typeof column.sort === 'boolean' ? column.sort : this.configuration.sort + canSort: typeof data.sort === 'boolean' ? data.sort : this.configuration.sort, + flex: data.width ? { 'flex': '0 1 ' + data.width + 'px' } : {} })); }); }, @@ -226,7 +227,7 @@ { display: inline-block; align-items: center; - flex: 1 0 5%; + flex: 1 1 5%; position: relative; text-align: left; padding: 18px 20px 17px 20px; diff --git a/zero.Web/App/pages/settings/countries.vue b/zero.Web/App/pages/settings/countries.vue new file mode 100644 index 00000000..60d986b2 --- /dev/null +++ b/zero.Web/App/pages/settings/countries.vue @@ -0,0 +1,101 @@ + + + + \ No newline at end of file diff --git a/zero.Web/App/resources/countries.js b/zero.Web/App/resources/countries.js new file mode 100644 index 00000000..c4c7bcd6 --- /dev/null +++ b/zero.Web/App/resources/countries.js @@ -0,0 +1,10 @@ +import Axios from 'axios'; + +export default { + + // get all countries + getAll() + { + return Axios.get('countries/getAll').then(res => Promise.resolve(res.data)); + } +}; \ No newline at end of file diff --git a/zero.Web/Controllers/CountriesController.cs b/zero.Web/Controllers/CountriesController.cs new file mode 100644 index 00000000..cc00c270 --- /dev/null +++ b/zero.Web/Controllers/CountriesController.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using zero.Core; +using zero.Core.Api; + +namespace zero.Web.Controllers +{ + [AllowAnonymous] + public class CountriesController : BackofficeController + { + private ICountriesApi Api { get; set; } + + public CountriesController(IZeroConfiguration config, ICountriesApi api) : base(config) + { + Api = api; + } + + + public async Task GetAll() + { + return Json(await Api.GetAll("en-US")); + } + } +} diff --git a/zero.Web/Resources/Localization/zero.en-us.json b/zero.Web/Resources/Localization/zero.en-us.json index df8e5688..6ce9dd0e 100644 --- a/zero.Web/Resources/Localization/zero.en-us.json +++ b/zero.Web/Resources/Localization/zero.en-us.json @@ -10,6 +10,7 @@ "close": "Close", "confirm": "Confirm", "createdDate": "Created at", + "active": "Published", "pagination": { "xofy": "Page {x} of {y}", "next": "Next page", @@ -135,5 +136,12 @@ "history_text": "View page editing history" } } + }, + + "country": { + "fields": { + "name": "Name", + "code": "ISO" + } } } \ No newline at end of file diff --git a/zero.Web/Startup.cs b/zero.Web/Startup.cs index 8bcbe3ef..abb4ffc4 100644 --- a/zero.Web/Startup.cs +++ b/zero.Web/Startup.cs @@ -139,6 +139,7 @@ namespace zero.Web services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } ///