diff --git a/zero.Core/Api/MediaApi.cs b/zero.Core/Api/MediaApi.cs index df132db5..b1a463e9 100644 --- a/zero.Core/Api/MediaApi.cs +++ b/zero.Core/Api/MediaApi.cs @@ -1,42 +1,108 @@ using Raven.Client.Documents; using Raven.Client.Documents.Session; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; +using zero.Core.Database.Indexes; using zero.Core.Entities; using zero.Core.Extensions; using zero.Core.Validation; namespace zero.Core.Api { - public class MediaApi : ApiBase, IMediaApi + public class MediaApi : IMediaApi { - public MediaApi(IDocumentStore raven, IMediaUpload media) : base(raven, media) { } + protected IAppAwareBackofficeStore Backoffice { get; private set; } + + + public MediaApi(IAppAwareBackofficeStore backoffice) + { + Backoffice = backoffice; + } + + + /// + public async Task GetById(string id) + { + return await Backoffice.GetById(id); + } + + + /// + public async Task> GetByQuery(MediaListQuery query) + { + query.SearchFor(entity => entity.Name); + + using (IAsyncDocumentSession session = Backoffice.Raven.OpenAsyncSession()) + { + return await session.Query() + .ForApp(Backoffice.AppId) + .WhereIf(x => x.FolderId == query.Filter.FolderId, query.Filter != null && !query.Filter.FolderId.IsNullOrEmpty()) + .ToQueriedListAsync(query); + } + } + + + /// + public async Task> Save(Media model) + { + return await Backoffice.Save(model); + } + + + /// + public async Task> Delete(string id) + { + return await Backoffice.DeleteById(id); + } /// public async Task> GetFolders(string parentId = null) { - using (IAsyncDocumentSession session = Raven.OpenAsyncSession()) + using (IAsyncDocumentSession session = Backoffice.Raven.OpenAsyncSession()) { return await session.Query() + .ForApp(Backoffice.AppId) + .WhereIf(x => x.ParentId == parentId, !parentId.IsNullOrEmpty(), x => x.ParentId == null) .OrderByDescending(x => x.Name) - .WhereIf(x => x.ParentId == parentId, !parentId.IsNullOrEmpty()) .ToListAsync(); } } + /// + public async Task> GetFolderHierarchy(string id) + { + using (IAsyncDocumentSession session = Backoffice.Raven.OpenAsyncSession()) + { + MediaFolder_ByHierarchy.Result result = await session.Query() + .ProjectInto() + .Include(x => x.Path.Select(p => p.Id)) + .ForApp(Backoffice.AppId) + .FirstOrDefaultAsync(x => x.Id == id); + + if (result == null) + { + return new List(); + } + + return (await session.LoadAsync(result.Path.Select(x => x.Id))).Select(x => x.Value).ToList(); + } + } + + /// public async Task> SaveFolder(MediaFolder model) { - return await Save(model, new MediaFolderValidator()); + return await Backoffice.Save(model, new MediaFolderValidator()); } /// public async Task> DeleteFolder(string id) { - return await DeleteById(id); + return await Backoffice.DeleteById(id); } @@ -50,6 +116,31 @@ namespace zero.Core.Api public interface IMediaApi { + /// + /// Get application by Id + /// + Task GetById(string id); + + /// + /// Get all available media items (with query) + /// + Task> GetByQuery(MediaListQuery query); + + /// + /// Creates or updates a application + /// + Task> Save(Media model); + + /// + /// Deletes a application by Id + /// + Task> Delete(string id); + + /// + /// Get hierarchy for a folder + /// + Task> GetFolderHierarchy(string id); + /// /// Get all folders with the specified parent or on root /// diff --git a/zero.Core/Api/SetupApi.cs b/zero.Core/Api/SetupApi.cs index f527e185..16f2712f 100644 --- a/zero.Core/Api/SetupApi.cs +++ b/zero.Core/Api/SetupApi.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Threading.Tasks; using zero.Core.Entities; using zero.Core.Entities.Setup; +using zero.Core.Extensions; using zero.Core.Identity; using zero.Core.Options; using zero.Core.Validation; @@ -55,12 +56,16 @@ namespace zero.Core.Api Database = model.Database.Name }; + raven.Conventions.IdentityPartsSeparator = "."; raven.Conventions.FindCollectionName = type => { return Constants.Database.CollectionPrefix + DocumentConventions.DefaultGetCollectionName(type); }; + raven.Conventions.TransformTypeCollectionNameToDocumentIdPrefix = name => + { + return name.Replace(Constants.Database.CollectionPrefix, Constants.Database.CollectionPrefix + raven.Conventions.IdentityPartsSeparator).ToCamelCaseId(); + }; - raven.Conventions.IdentityPartsSeparator = "."; raven.Initialize(); @@ -97,6 +102,7 @@ namespace zero.Core.Api IsDefault = true }; + // TODO UserManager uses the DI resolved IDocumentStore instance which should not be available at this point?? IdentityResult result = await UserManager.CreateAsync(user, model.User.Password); // user creation failed diff --git a/zero.Core/Constants.cs b/zero.Core/Constants.cs index 5063dc28..6e10304d 100644 --- a/zero.Core/Constants.cs +++ b/zero.Core/Constants.cs @@ -29,7 +29,7 @@ public static class Database { public const string SharedAppId = "shared"; - public const string CollectionPrefix = "zero."; + public const string CollectionPrefix = "zero"; // TODO initially we had a dot (zero.) suffix here, but that did not work out anymore when it comes to index creation public const string ReservationPrefix = "zero."; public const string Expires = Raven.Client.Constants.Documents.Metadata.Expires; } diff --git a/zero.Core/Database/Indexes/MediaFolder_ByHierarchy.cs b/zero.Core/Database/Indexes/MediaFolder_ByHierarchy.cs new file mode 100644 index 00000000..7dd67c27 --- /dev/null +++ b/zero.Core/Database/Indexes/MediaFolder_ByHierarchy.cs @@ -0,0 +1,53 @@ +using Raven.Client.Documents.Indexes; +using System; +using System.Collections.Generic; +using System.Linq; +using zero.Core.Entities; + +namespace zero.Core.Database.Indexes +{ + public class MediaFolder_ByHierarchy : AbstractIndexCreationTask + { + public class Result : IZeroIdEntity, IAppAwareEntity, IZeroDbConventions + { + public string Id { get; set; } + + public string AppId { get; set; } + + public string Name { get; set; } + + public List Path { get; set; } = new List(); + } + + + public class PathResult + { + public string Id { get; set; } + + public string Name { get; set; } + } + + + public MediaFolder_ByHierarchy() + { + Map = items => items.Select(item => new Result + { + Id = item.Id, + Name = item.Name, + AppId = item.AppId, + Path = Recurse(item, x => LoadDocument(x.ParentId)) + .Where(x => x != null && x.Id != null && x.Id != item.Id) + .Reverse() + .Select(current => new PathResult() + { + Id = current.Id, + Name = current.Name + }) + .ToList() + }); + + StoreAllFields(FieldStorage.Yes); + //Index(x => x.ChannelId, FieldIndexing.Exact); + } + } +} diff --git a/zero.Core/Entities/Applications/Application.cs b/zero.Core/Entities/Applications/Application.cs index 6f6dd923..e3d433e3 100644 --- a/zero.Core/Entities/Applications/Application.cs +++ b/zero.Core/Entities/Applications/Application.cs @@ -20,12 +20,12 @@ namespace zero.Core.Entities /// /// Image of the application /// - public Media Image { get; set; } + public string ImageId { get; set; } /// /// Simple image of the application (used as favicon) /// - public Media Icon { get; set; } + public string IconId { get; set; } /// /// All assigned domains for this application diff --git a/zero.Core/Entities/Media/MediaListQuery.cs b/zero.Core/Entities/Media/MediaListQuery.cs new file mode 100644 index 00000000..1aed4be7 --- /dev/null +++ b/zero.Core/Entities/Media/MediaListQuery.cs @@ -0,0 +1,13 @@ +namespace zero.Core.Entities +{ + public class MediaListQuery : ListQuery + { + + } + + + public class MediaListFilter : IListSpecificQuery + { + public string FolderId { get; set; } + } +} diff --git a/zero.Core/Entities/User/User.cs b/zero.Core/Entities/User/User.cs index 938bce62..eea1b3c2 100644 --- a/zero.Core/Entities/User/User.cs +++ b/zero.Core/Entities/User/User.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace zero.Core.Entities { - public class User : ZeroEntity, IUser + public class User : ZeroEntity, IUser, IZeroDbConventions { /// public string AppId { get; set; } diff --git a/zero.Core/Entities/User/UserRole.cs b/zero.Core/Entities/User/UserRole.cs index aab6e533..9032a70f 100644 --- a/zero.Core/Entities/User/UserRole.cs +++ b/zero.Core/Entities/User/UserRole.cs @@ -2,7 +2,7 @@ namespace zero.Core.Entities { - public class UserRole : ZeroEntity, IUserRole + public class UserRole : ZeroEntity, IUserRole, IZeroDbConventions { /// public string AppId { get; set; } diff --git a/zero.Core/Extensions/QueryableExtensions.cs b/zero.Core/Extensions/QueryableExtensions.cs index 7b3725a7..f0ad947c 100644 --- a/zero.Core/Extensions/QueryableExtensions.cs +++ b/zero.Core/Extensions/QueryableExtensions.cs @@ -57,7 +57,7 @@ namespace zero.Core.Extensions } - public static IQueryable WhereIf(this IQueryable source, Expression> predicate, bool condition, Expression> elsePredicate = null) + public static IRavenQueryable WhereIf(this IRavenQueryable source, Expression> predicate, bool condition, Expression> elsePredicate = null) { if (!condition) { diff --git a/zero.Core/Extensions/RavenQueryableExtensions.cs b/zero.Core/Extensions/RavenQueryableExtensions.cs index f87960e0..cf449b96 100644 --- a/zero.Core/Extensions/RavenQueryableExtensions.cs +++ b/zero.Core/Extensions/RavenQueryableExtensions.cs @@ -68,5 +68,45 @@ namespace zero.Core.Extensions return new ListResult(items, stats.TotalResults, query.Page, query.PageSize); } + + + /// + /// + /// + public static async Task> ToQueriedListAsync(this IRavenQueryable queryable, ListQuery query) where TFilter : IListSpecificQuery + { + queryable = queryable.Statistics(out QueryStatistics stats); + + IQueryable rawQuery = queryable; + + if (query != null) + { + if (!query.Search.IsNullOrEmpty() && query.SearchSelector != null) + { + rawQuery = rawQuery.SearchIf(query.SearchSelector, query.Search, "*", "*"); + } + if (!query.Search.IsNullOrEmpty() && query.SearchSelectors.Length > 0) + { + foreach (var selector in query.SearchSelectors) + { + rawQuery = rawQuery.SearchIf(selector, query.Search, "*", "*", Raven.Client.Documents.Queries.SearchOperator.Or); + } + } + + if (!query.OrderBy.IsNullOrEmpty()) + { + rawQuery = rawQuery.OrderBy(query.OrderBy, query.OrderIsDescending, query.OrderType == ListQueryOrderType.String ? OrderingType.String : OrderingType.Double); + } + + if (query.PageSize > 0) + { + rawQuery = rawQuery.Paging(query.Page, query.PageSize); + } + } + + List items = await rawQuery.ToListAsync(); + + return new ListResult(items, stats.TotalResults, query.Page, query.PageSize); + } } } diff --git a/zero.Debug/Resources/Countries/countries.de-de.json b/zero.Debug/Resources/Countries/countries.de-de.json new file mode 100644 index 00000000..78384674 --- /dev/null +++ b/zero.Debug/Resources/Countries/countries.de-de.json @@ -0,0 +1,257 @@ +{ + "AF": "Afghanistan", + "EG": "\u00c4gypten", + "AX": "\u00c5landinseln", + "AL": "Albanien", + "DZ": "Algerien", + "AS": "Amerikanisch-Samoa", + "VI": "Amerikanische Jungferninseln", + "UM": "Amerikanische \u00dcberseeinseln", + "AD": "Andorra", + "AO": "Angola", + "AI": "Anguilla", + "AQ": "Antarktis", + "AG": "Antigua und Barbuda", + "GQ": "\u00c4quatorialguinea", + "AR": "Argentinien", + "AM": "Armenien", + "AW": "Aruba", + "AC": "Ascension", + "AZ": "Aserbaidschan", + "ET": "\u00c4thiopien", + "AU": "Australien", + "BS": "Bahamas", + "BH": "Bahrain", + "BD": "Bangladesch", + "BB": "Barbados", + "BY": "Belarus", + "BE": "Belgien", + "BZ": "Belize", + "BJ": "Benin", + "BM": "Bermuda", + "BT": "Bhutan", + "BO": "Bolivien", + "BQ": "Bonaire, Sint Eustatius und Saba", + "BA": "Bosnien und Herzegowina", + "BW": "Botsuana", + "BR": "Brasilien", + "VG": "Britische Jungferninseln", + "IO": "Britisches Territorium im Indischen Ozean", + "BN": "Brunei Darussalam", + "BG": "Bulgarien", + "BF": "Burkina Faso", + "BI": "Burundi", + "CV": "Cabo Verde", + "EA": "Ceuta und Melilla", + "CL": "Chile", + "CN": "China", + "CK": "Cookinseln", + "CR": "Costa Rica", + "CI": "C\u00f4te d\u2019Ivoire", + "CW": "Cura\u00e7ao", + "DK": "D\u00e4nemark", + "DE": "Deutschland", + "DG": "Diego Garcia", + "DM": "Dominica", + "DO": "Dominikanische Republik", + "DJ": "Dschibuti", + "EC": "Ecuador", + "SV": "El Salvador", + "ER": "Eritrea", + "EE": "Estland", + "FK": "Falklandinseln", + "FO": "F\u00e4r\u00f6er", + "FJ": "Fidschi", + "FI": "Finnland", + "FR": "Frankreich", + "GF": "Franz\u00f6sisch-Guayana", + "PF": "Franz\u00f6sisch-Polynesien", + "TF": "Franz\u00f6sische S\u00fcd- und Antarktisgebiete", + "GA": "Gabun", + "GM": "Gambia", + "GE": "Georgien", + "GH": "Ghana", + "GI": "Gibraltar", + "GD": "Grenada", + "GR": "Griechenland", + "GL": "Gr\u00f6nland", + "GP": "Guadeloupe", + "GU": "Guam", + "GT": "Guatemala", + "GG": "Guernsey", + "GN": "Guinea", + "GW": "Guinea-Bissau", + "GY": "Guyana", + "HT": "Haiti", + "HN": "Honduras", + "IN": "Indien", + "ID": "Indonesien", + "IQ": "Irak", + "IR": "Iran", + "IE": "Irland", + "IS": "Island", + "IM": "Isle of Man", + "IL": "Israel", + "IT": "Italien", + "JM": "Jamaika", + "JP": "Japan", + "YE": "Jemen", + "JE": "Jersey", + "JO": "Jordanien", + "KY": "Kaimaninseln", + "KH": "Kambodscha", + "CM": "Kamerun", + "CA": "Kanada", + "IC": "Kanarische Inseln", + "KZ": "Kasachstan", + "QA": "Katar", + "KE": "Kenia", + "KG": "Kirgisistan", + "KI": "Kiribati", + "CC": "Kokosinseln", + "CO": "Kolumbien", + "KM": "Komoren", + "CG": "Kongo-Brazzaville", + "CD": "Kongo-Kinshasa", + "XK": "Kosovo", + "HR": "Kroatien", + "CU": "Kuba", + "KW": "Kuwait", + "LA": "Laos", + "LS": "Lesotho", + "LV": "Lettland", + "LB": "Libanon", + "LR": "Liberia", + "LY": "Libyen", + "LI": "Liechtenstein", + "LT": "Litauen", + "LU": "Luxemburg", + "MG": "Madagaskar", + "MW": "Malawi", + "MY": "Malaysia", + "MV": "Malediven", + "ML": "Mali", + "MT": "Malta", + "MA": "Marokko", + "MH": "Marshallinseln", + "MQ": "Martinique", + "MR": "Mauretanien", + "MU": "Mauritius", + "YT": "Mayotte", + "MX": "Mexiko", + "FM": "Mikronesien", + "MC": "Monaco", + "MN": "Mongolei", + "ME": "Montenegro", + "MS": "Montserrat", + "MZ": "Mosambik", + "MM": "Myanmar", + "NA": "Namibia", + "NR": "Nauru", + "NP": "Nepal", + "NC": "Neukaledonien", + "NZ": "Neuseeland", + "NI": "Nicaragua", + "NL": "Niederlande", + "NE": "Niger", + "NG": "Nigeria", + "NU": "Niue", + "KP": "Nordkorea", + "MP": "N\u00f6rdliche Marianen", + "MK": "Nordmazedonien", + "NF": "Norfolkinsel", + "NO": "Norwegen", + "OM": "Oman", + "AT": "\u00d6sterreich", + "PK": "Pakistan", + "PS": "Pal\u00e4stinensische Autonomiegebiete", + "PW": "Palau", + "PA": "Panama", + "PG": "Papua-Neuguinea", + "PY": "Paraguay", + "PE": "Peru", + "PH": "Philippinen", + "PN": "Pitcairninseln", + "PL": "Polen", + "PT": "Portugal", + "XA": "Pseudo-Accents", + "XB": "Pseudo-Bidi", + "PR": "Puerto Rico", + "MD": "Republik Moldau", + "RE": "R\u00e9union", + "RW": "Ruanda", + "RO": "Rum\u00e4nien", + "RU": "Russland", + "SB": "Salomonen", + "ZM": "Sambia", + "WS": "Samoa", + "SM": "San Marino", + "ST": "S\u00e3o Tom\u00e9 und Pr\u00edncipe", + "SA": "Saudi-Arabien", + "SE": "Schweden", + "CH": "Schweiz", + "SN": "Senegal", + "RS": "Serbien", + "SC": "Seychellen", + "SL": "Sierra Leone", + "ZW": "Simbabwe", + "SG": "Singapur", + "SX": "Sint Maarten", + "SK": "Slowakei", + "SI": "Slowenien", + "SO": "Somalia", + "HK": "Sonderverwaltungsregion Hongkong", + "MO": "Sonderverwaltungsregion Macau", + "ES": "Spanien", + "SJ": "Spitzbergen und Jan Mayen", + "LK": "Sri Lanka", + "BL": "St. Barth\u00e9lemy", + "SH": "St. Helena", + "KN": "St. Kitts und Nevis", + "LC": "St. Lucia", + "MF": "St. Martin", + "PM": "St. Pierre und Miquelon", + "VC": "St. Vincent und die Grenadinen", + "ZA": "S\u00fcdafrika", + "SD": "Sudan", + "GS": "S\u00fcdgeorgien und die S\u00fcdlichen Sandwichinseln", + "KR": "S\u00fcdkorea", + "SS": "S\u00fcdsudan", + "SR": "Suriname", + "SZ": "Swasiland", + "SY": "Syrien", + "TJ": "Tadschikistan", + "TW": "Taiwan", + "TZ": "Tansania", + "TH": "Thailand", + "TL": "Timor-Leste", + "TG": "Togo", + "TK": "Tokelau", + "TO": "Tonga", + "TT": "Trinidad und Tobago", + "TA": "Tristan da Cunha", + "TD": "Tschad", + "CZ": "Tschechien", + "TN": "Tunesien", + "TR": "T\u00fcrkei", + "TM": "Turkmenistan", + "TC": "Turks- und Caicosinseln", + "TV": "Tuvalu", + "UG": "Uganda", + "UA": "Ukraine", + "HU": "Ungarn", + "UY": "Uruguay", + "UZ": "Usbekistan", + "VU": "Vanuatu", + "VA": "Vatikanstadt", + "VE": "Venezuela", + "AE": "Vereinigte Arabische Emirate", + "US": "Vereinigte Staaten", + "GB": "Vereinigtes K\u00f6nigreich", + "VN": "Vietnam", + "WF": "Wallis und Futuna", + "CX": "Weihnachtsinsel", + "EH": "Westsahara", + "CF": "Zentralafrikanische Republik", + "CY": "Zypern" +} \ No newline at end of file diff --git a/zero.Debug/Resources/Countries/countries.en-us.json b/zero.Debug/Resources/Countries/countries.en-us.json new file mode 100644 index 00000000..81dd1733 --- /dev/null +++ b/zero.Debug/Resources/Countries/countries.en-us.json @@ -0,0 +1,257 @@ +{ + "AF": "Afghanistan", + "AX": "\u00c5land Islands", + "AL": "Albania", + "DZ": "Algeria", + "AS": "American Samoa", + "AD": "Andorra", + "AO": "Angola", + "AI": "Anguilla", + "AQ": "Antarctica", + "AG": "Antigua & Barbuda", + "AR": "Argentina", + "AM": "Armenia", + "AW": "Aruba", + "AC": "Ascension Island", + "AU": "Australia", + "AT": "Austria", + "AZ": "Azerbaijan", + "BS": "Bahamas", + "BH": "Bahrain", + "BD": "Bangladesh", + "BB": "Barbados", + "BY": "Belarus", + "BE": "Belgium", + "BZ": "Belize", + "BJ": "Benin", + "BM": "Bermuda", + "BT": "Bhutan", + "BO": "Bolivia", + "BA": "Bosnia & Herzegovina", + "BW": "Botswana", + "BR": "Brazil", + "IO": "British Indian Ocean Territory", + "VG": "British Virgin Islands", + "BN": "Brunei", + "BG": "Bulgaria", + "BF": "Burkina Faso", + "BI": "Burundi", + "KH": "Cambodia", + "CM": "Cameroon", + "CA": "Canada", + "IC": "Canary Islands", + "CV": "Cape Verde", + "BQ": "Caribbean Netherlands", + "KY": "Cayman Islands", + "CF": "Central African Republic", + "EA": "Ceuta & Melilla", + "TD": "Chad", + "CL": "Chile", + "CN": "China", + "CX": "Christmas Island", + "CC": "Cocos (Keeling) Islands", + "CO": "Colombia", + "KM": "Comoros", + "CG": "Congo - Brazzaville", + "CD": "Congo - Kinshasa", + "CK": "Cook Islands", + "CR": "Costa Rica", + "CI": "C\u00f4te d\u2019Ivoire", + "HR": "Croatia", + "CU": "Cuba", + "CW": "Cura\u00e7ao", + "CY": "Cyprus", + "CZ": "Czechia", + "DK": "Denmark", + "DG": "Diego Garcia", + "DJ": "Djibouti", + "DM": "Dominica", + "DO": "Dominican Republic", + "EC": "Ecuador", + "EG": "Egypt", + "SV": "El Salvador", + "GQ": "Equatorial Guinea", + "ER": "Eritrea", + "EE": "Estonia", + "SZ": "Eswatini", + "ET": "Ethiopia", + "FK": "Falkland Islands", + "FO": "Faroe Islands", + "FJ": "Fiji", + "FI": "Finland", + "FR": "France", + "GF": "French Guiana", + "PF": "French Polynesia", + "TF": "French Southern Territories", + "GA": "Gabon", + "GM": "Gambia", + "GE": "Georgia", + "DE": "Germany", + "GH": "Ghana", + "GI": "Gibraltar", + "GR": "Greece", + "GL": "Greenland", + "GD": "Grenada", + "GP": "Guadeloupe", + "GU": "Guam", + "GT": "Guatemala", + "GG": "Guernsey", + "GN": "Guinea", + "GW": "Guinea-Bissau", + "GY": "Guyana", + "HT": "Haiti", + "HN": "Honduras", + "HK": "Hong Kong SAR China", + "HU": "Hungary", + "IS": "Iceland", + "IN": "India", + "ID": "Indonesia", + "IR": "Iran", + "IQ": "Iraq", + "IE": "Ireland", + "IM": "Isle of Man", + "IL": "Israel", + "IT": "Italy", + "JM": "Jamaica", + "JP": "Japan", + "JE": "Jersey", + "JO": "Jordan", + "KZ": "Kazakhstan", + "KE": "Kenya", + "KI": "Kiribati", + "XK": "Kosovo", + "KW": "Kuwait", + "KG": "Kyrgyzstan", + "LA": "Laos", + "LV": "Latvia", + "LB": "Lebanon", + "LS": "Lesotho", + "LR": "Liberia", + "LY": "Libya", + "LI": "Liechtenstein", + "LT": "Lithuania", + "LU": "Luxembourg", + "MO": "Macao SAR China", + "MG": "Madagascar", + "MW": "Malawi", + "MY": "Malaysia", + "MV": "Maldives", + "ML": "Mali", + "MT": "Malta", + "MH": "Marshall Islands", + "MQ": "Martinique", + "MR": "Mauritania", + "MU": "Mauritius", + "YT": "Mayotte", + "MX": "Mexico", + "FM": "Micronesia", + "MD": "Moldova", + "MC": "Monaco", + "MN": "Mongolia", + "ME": "Montenegro", + "MS": "Montserrat", + "MA": "Morocco", + "MZ": "Mozambique", + "MM": "Myanmar (Burma)", + "NA": "Namibia", + "NR": "Nauru", + "NP": "Nepal", + "NL": "Netherlands", + "NC": "New Caledonia", + "NZ": "New Zealand", + "NI": "Nicaragua", + "NE": "Niger", + "NG": "Nigeria", + "NU": "Niue", + "NF": "Norfolk Island", + "KP": "North Korea", + "MK": "North Macedonia", + "MP": "Northern Mariana Islands", + "NO": "Norway", + "OM": "Oman", + "PK": "Pakistan", + "PW": "Palau", + "PS": "Palestinian Territories", + "PA": "Panama", + "PG": "Papua New Guinea", + "PY": "Paraguay", + "PE": "Peru", + "PH": "Philippines", + "PN": "Pitcairn Islands", + "PL": "Poland", + "PT": "Portugal", + "XA": "Pseudo-Accents", + "XB": "Pseudo-Bidi", + "PR": "Puerto Rico", + "QA": "Qatar", + "RE": "R\u00e9union", + "RO": "Romania", + "RU": "Russia", + "RW": "Rwanda", + "WS": "Samoa", + "SM": "San Marino", + "ST": "S\u00e3o Tom\u00e9 & Pr\u00edncipe", + "SA": "Saudi Arabia", + "SN": "Senegal", + "RS": "Serbia", + "SC": "Seychelles", + "SL": "Sierra Leone", + "SG": "Singapore", + "SX": "Sint Maarten", + "SK": "Slovakia", + "SI": "Slovenia", + "SB": "Solomon Islands", + "SO": "Somalia", + "ZA": "South Africa", + "GS": "South Georgia & South Sandwich Islands", + "KR": "South Korea", + "SS": "South Sudan", + "ES": "Spain", + "LK": "Sri Lanka", + "BL": "St. Barth\u00e9lemy", + "SH": "St. Helena", + "KN": "St. Kitts & Nevis", + "LC": "St. Lucia", + "MF": "St. Martin", + "PM": "St. Pierre & Miquelon", + "VC": "St. Vincent & Grenadines", + "SD": "Sudan", + "SR": "Suriname", + "SJ": "Svalbard & Jan Mayen", + "SE": "Sweden", + "CH": "Switzerland", + "SY": "Syria", + "TW": "Taiwan", + "TJ": "Tajikistan", + "TZ": "Tanzania", + "TH": "Thailand", + "TL": "Timor-Leste", + "TG": "Togo", + "TK": "Tokelau", + "TO": "Tonga", + "TT": "Trinidad & Tobago", + "TA": "Tristan da Cunha", + "TN": "Tunisia", + "TR": "Turkey", + "TM": "Turkmenistan", + "TC": "Turks & Caicos Islands", + "TV": "Tuvalu", + "UM": "U.S. Outlying Islands", + "VI": "U.S. Virgin Islands", + "UG": "Uganda", + "UA": "Ukraine", + "AE": "United Arab Emirates", + "GB": "United Kingdom", + "US": "United States", + "UY": "Uruguay", + "UZ": "Uzbekistan", + "VU": "Vanuatu", + "VA": "Vatican City", + "VE": "Venezuela", + "VN": "Vietnam", + "WF": "Wallis & Futuna", + "EH": "Western Sahara", + "YE": "Yemen", + "ZM": "Zambia", + "ZW": "Zimbabwe" +} \ No newline at end of file diff --git a/zero.Web.UI/App/components/pickers/mediaPicker/mediapicker.vue b/zero.Web.UI/App/components/pickers/mediaPicker/mediapicker.vue index fb78d5a8..2f027046 100644 --- a/zero.Web.UI/App/components/pickers/mediaPicker/mediapicker.vue +++ b/zero.Web.UI/App/components/pickers/mediaPicker/mediapicker.vue @@ -70,6 +70,11 @@ }, + created() + { + + }, + methods: { onChange(value) @@ -92,6 +97,7 @@ component: PickMediaOverlay, model: this.value, theme: 'dark', + width: 520 }, typeof this.config === 'object' ? this.config : {}); return Overlay.open(options).then(value => diff --git a/zero.Web.UI/App/components/pickers/mediaPicker/overlay.vue b/zero.Web.UI/App/components/pickers/mediaPicker/overlay.vue index 1069a1a4..57cdacc1 100644 --- a/zero.Web.UI/App/components/pickers/mediaPicker/overlay.vue +++ b/zero.Web.UI/App/components/pickers/mediaPicker/overlay.vue @@ -1,6 +1,31 @@ - - + + Select or upload media + + + + + {{item.name}} + + + + + + + + Upload media + + + + + + + + {{item.name}} + {{item.size}} + + +
+ Upload media +
+ {{item.name}} + {{item.size}} +