-
+
@@ -61,8 +61,16 @@
}
}
};
- }
+ },
+
+ add()
+ {
+ this.$router.push({
+ name: 'space-create',
+ params: { alias: this.space.alias }
+ });
+ }
}
}
\ No newline at end of file
diff --git a/zero.Web.UI/Sass/Core/_settings.scss b/zero.Web.UI/Sass/Core/_settings.scss
index acf21d62..10abaa97 100644
--- a/zero.Web.UI/Sass/Core/_settings.scss
+++ b/zero.Web.UI/Sass/Core/_settings.scss
@@ -102,8 +102,8 @@
:root
{
// accent colors
- --color-primary: #fdd330; // #fdd330; //linear-gradient(75deg, #48da9c, #3eb8ad); //#484c5b; // #292b2c; // #00aea2
- --color-primary-fg: #191e25;
+ --color-primary: #18a471; // #fdd330; //linear-gradient(75deg, #48da9c, #3eb8ad); //#484c5b; // #292b2c; // #00aea2
+ --color-primary-fg: #fff;
--color-primary-low: rgba(229, 225, 221, 0.3);
--color-primary-two: #e5e4df;
--color-primary-line: #e0dfda;
diff --git a/zero.Web/Controllers/SpacesController.cs b/zero.Web/Controllers/SpacesController.cs
index ac656b98..e34a1ae4 100644
--- a/zero.Web/Controllers/SpacesController.cs
+++ b/zero.Web/Controllers/SpacesController.cs
@@ -1,12 +1,12 @@
using Microsoft.AspNetCore.Mvc;
-using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using zero.Core.Api;
using zero.Core.Entities;
+using zero.Core.Extensions;
using zero.Core.Identity;
-using zero.Web.Models;
namespace zero.Web.Controllers
{
@@ -14,12 +14,10 @@ namespace zero.Web.Controllers
public class SpacesController : BackofficeController
{
ISpacesApi Api;
- IAuthenticationApi AuthenticationApi;
- public SpacesController(ISpacesApi api, IAuthenticationApi authenticationApi)
+ public SpacesController(ISpacesApi api)
{
Api = api;
- AuthenticationApi = authenticationApi;
}
@@ -50,7 +48,7 @@ namespace zero.Web.Controllers
///
/// Get list items in a space
///
- public async Task GetList([FromQuery] string alias, [FromQuery] ListQuery query = null)
+ public async Task GetList([FromQuery] string alias, [FromQuery] ListQuery query = null)
{
if (!CanReadSpace(alias))
{
@@ -64,44 +62,46 @@ namespace zero.Web.Controllers
///
/// Get list items in a space
///
- public IActionResult GetContent([FromQuery] string alias, [FromQuery] string contentId = null)
+ public async Task GetContent([FromQuery] string alias, [FromQuery] string contentId = null)
{
if (!CanReadSpace(alias))
{
return new StatusCodeResult(403);
}
- //TeamMember model = new TeamMember();
+ Space space = Api.GetByAlias(alias);
+ ISpaceContent model;
- //if (!contentId.IsNullOrEmpty())
- //{
- // model = await Api.GetItem(alias, contentId);
- //}
-
- JsonSerializerSettings settings = JsonConvert.DefaultSettings();
- settings.TypeNameHandling = TypeNameHandling.Objects;
-
- return Json(new SpaceContentEditModel()
+ if (space == null)
{
- //Id = model.Id,
- Alias = alias,
- //Model = model,
- //Config = Api.GetEditorConfig(alias)
- }, settings);
+ return new StatusCodeResult(404);
+ }
+
+ if (space.View != SpaceView.List || !contentId.IsNullOrEmpty())
+ {
+ model = await Api.GetItem(alias, contentId);
+ }
+ else
+ {
+ model = Activator.CreateInstance(space.Type) as SpaceContent;
+ model.SpaceAlias = space.Alias;
+ }
+
+ return Edit(model);
}
///
/// Save content item
///
- public async Task Save([FromBody] SpaceContentEditModel model)
+ public async Task Save([FromBody] ISpaceContent model)
{
- if (!CanWriteSpace(model.Alias))
+ if (!CanWriteSpace(model.SpaceAlias))
{
return new StatusCodeResult(403);
}
- return Json(await Api.Save(model.Alias, model.Model));
+ return Json(await Api.Save(model.SpaceAlias, model));
}
diff --git a/zero.Web/Resources/Localization/zero.en-us.json b/zero.Web/Resources/Localization/zero.en-us.json
index 85c5b8ef..c8ce0c64 100644
--- a/zero.Web/Resources/Localization/zero.en-us.json
+++ b/zero.Web/Resources/Localization/zero.en-us.json
@@ -493,6 +493,11 @@
}
},
+ "space": {
+ "list": "Spaces",
+ "name": "Space"
+ },
+
"_test": {
"fields": {
"name": "Name",