diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Controllers/AdminController.cs index 0b4066ca7..2dd12e5cb 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Controllers/AdminController.cs @@ -1,10 +1,17 @@ using System.Web.Mvc; +using Orchard.Dashboards.Services; +using Orchard.Mvc; namespace Orchard.Dashboards.Controllers { public class AdminController : Controller { + private readonly IDashboardService _dashboardService; + public AdminController(IDashboardService dashboardService) { + _dashboardService = dashboardService; + } public ActionResult Index() { - return View(); + var shape = _dashboardService.GetDashboardShape(); + return new ShapeResult(this, shape); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Elements/DashboardSiteSettingsPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Drivers/DashboardSiteSettingsPartDriver.cs similarity index 97% rename from src/Orchard.Web/Modules/Orchard.Dashboards/Elements/DashboardSiteSettingsPartDriver.cs rename to src/Orchard.Web/Modules/Orchard.Dashboards/Drivers/DashboardSiteSettingsPartDriver.cs index 2f0c86cce..63421ddde 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Elements/DashboardSiteSettingsPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Drivers/DashboardSiteSettingsPartDriver.cs @@ -5,7 +5,7 @@ using Orchard.ContentManagement.Drivers; using Orchard.Dashboards.Models; using Orchard.Dashboards.ViewModels; -namespace Orchard.Dashboards.Elements { +namespace Orchard.Dashboards.Drivers { public class DashboardSiteSettingsPartDriver : ContentPartDriver { private readonly IContentManager _contentManager; @@ -20,7 +20,7 @@ namespace Orchard.Dashboards.Elements { protected override DriverResult Editor(DashboardSiteSettingsPart part, IUpdateModel updater, dynamic shapeHelper) { return ContentShape("Parts_DashboardSettings", () => { var viewModel = new DashboardSiteSettingsViewModel { - SelectedDashboardId = part.DefaultDashboardId.ToString(), + SelectedDashboardId = part.DefaultDashboardId.ToString() }; if (updater != null) { diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs index 0d55e3635..ba25a3e3b 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs @@ -1,20 +1,15 @@ using Orchard.ContentManagement.MetaData; -using Orchard.Core.Contents.Extensions; using Orchard.Data.Migration; namespace Orchard.Dashboards { public class Migrations : DataMigrationImpl { public int Create() { - ContentDefinitionManager.AlterPartDefinition("DashboardPart", part => part - .WithDescription("Turns your content type into an admin Dashboard.")); - ContentDefinitionManager.AlterTypeDefinition("Dashboard", type => type .WithPart("CommonPart") .WithPart("IdentityPart") .WithPart("TitlePart") .WithPart("LayoutPart", p => p - .WithSetting("LayoutTypePartSettings.DefaultLayoutData", "{\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Canvas\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Grid\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Row\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eGet+up+and+running%3c%2fh2%3e%0d%0a%3cp%3eStart+by+exploring+the+menu+on+the+left+and+familiarize+yourself+with+Orchard.+As+for+the+basics%2c+we+suggest+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fThemes%22%3echanging+the+theme%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fContents%2fCreate%2fPage%22%3eadding+some+pages%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fBlogs%2fCreate%22%3esetup+up+a+blog%3c%2fa%3e%2c+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fSettings%2fIndex%22%3econfiguring+basic+settings%3c%2fa%3e.%3c%2fp%3e&Content=%3ch2%3eGet+up+and+running%3c%2fh2%3e%0d%0a%3cp%3eStart+by+exploring+the+menu+on+the+left+and+familiarize+yourself+with+Orchard.+As+for+the+basics%2c+we+suggest+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fThemes%22%3echanging+the+theme%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fContents%2fCreate%2fPage%22%3eadding+some+pages%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fBlogs%2fCreate%22%3esetup+up+a+blog%3c%2fa%3e%2c+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fSettings%2fIndex%22%3econfiguring+basic+settings%3c%2fa%3e.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":1,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eGet+more+goodies%3c%2fh2%3e%0d%0a%3cp%3eChange+the+way+your+site+works+and+looks+with+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fThemes%22%3ethemes%3c%2fa%3e+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fModules%22%3emodules%3c%2fa%3e.+There%26rsquo%3bs+plenty+to+choose+from+in+the+%3ca+href%3d%22http%3a%2f%2fgallery.orchardproject.net%2f%22%3eOrchard+Gallery%3c%2fa%3e.+We%26rsquo%3bre+always+adding+things%2c+so+be+sure+to+check+back+often+to+see+what%26rsquo%3bs+new.%3c%2fp%3e&Content=%3ch2%3eGet+more+goodies%3c%2fh2%3e%0d%0a%3cp%3eChange+the+way+your+site+works+and+looks+with+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fThemes%22%3ethemes%3c%2fa%3e+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fModules%22%3emodules%3c%2fa%3e.+There%26rsquo%3bs+plenty+to+choose+from+in+the+%3ca+href%3d%22http%3a%2f%2fgallery.orchardproject.net%2f%22%3eOrchard+Gallery%3c%2fa%3e.+We%26rsquo%3bre+always+adding+things%2c+so+be+sure+to+check+back+often+to+see+what%26rsquo%3bs+new.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":2,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eRead+the+docs%3c%2fh2%3e%0d%0a%3cp%3eAre+you+ready+to+go+deeper+and+become+an+Orchard+expert%3f+Take+a+look+at+the+%3ca+href%3d%22http%3a%2f%2fdocs.orchardproject.net%2f%22%3eOrchard+Documentation%3c%2fa%3e+to+learn+about+how+everything+connects+together+and+what+makes+Orchard+tick.%3c%2fp%3e&Content=%3ch2%3eRead+the+docs%3c%2fh2%3e%0d%0a%3cp%3eAre+you+ready+to+go+deeper+and+become+an+Orchard+expert%3f+Take+a+look+at+the+%3ca+href%3d%22http%3a%2f%2fdocs.orchardproject.net%2f%22%3eOrchard+Documentation%3c%2fa%3e+to+learn+about+how+everything+connects+together+and+what+makes+Orchard+tick.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":3,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eMake+friends%3c%2fh2%3e%0d%0a%3cp%3eFind+friends+that+share+your+interest+of+Orchard.+There+are+a+couple+ways+that+you+can+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fdiscussions%22%3ediscuss+and+get+connected%3c%2fa%3e+to+the+project+including+mailing+lists%2c+forums+and+IRC.%3c%2fp%3e&Content=%3ch2%3eMake+friends%3c%2fh2%3e%0d%0a%3cp%3eFind+friends+that+share+your+interest+of+Orchard.+There+are+a+couple+ways+that+you+can+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fdiscussions%22%3ediscuss+and+get+connected%3c%2fa%3e+to+the+project+including+mailing+lists%2c+forums+and+IRC.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":4,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eContribute+back%3c%2fh2%3e%0d%0a%3cp%3eHelp+grow+Orchard.+We+encourage+contributions+of+all+sorts%2c+including+code+submissions%2c+documentation%2c+translations%2c+feature+recommendations%2c+and+more.+Here+are+some+ways+to+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fcontribution%22%3egive+back+to+the+project%3c%2fa%3e.%3c%2fp%3e&Content=%3ch2%3eContribute+back%3c%2fh2%3e%0d%0a%3cp%3eHelp+grow+Orchard.+We+encourage+contributions+of+all+sorts%2c+including+code+submissions%2c+documentation%2c+translations%2c+feature+recommendations%2c+and+more.+Here+are+some+ways+to+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fcontribution%22%3egive+back+to+the+project%3c%2fa%3e.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":5,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eStay+up+to+date%3c%2fh2%3e%0d%0a%3cp%3e%3ciframe+width%3d%22100%25%22+height%3d%22100%25%22+scrolling%3d%22no%22+frameborder%3d%220%22+src%3d%22http%3a%2f%2fwww.orchardproject.net%2fadvisory%22+id%3d%22advisory%22%3e%0d%0a+%26lt%3bp%26gt%3bYour+browser+does+not+support+iframes.+You+can%27t+see+advisory+messages.%26lt%3b%2fp%26gt%3b%3c%2fiframe%3e%3c%2fp%3e&Content=%3ch2%3eStay+up+to+date%3c%2fh2%3e%0d%0a%3cp%3e%3ciframe+width%3d%22100%25%22+height%3d%22100%25%22+scrolling%3d%22no%22+frameborder%3d%220%22+src%3d%22http%3a%2f%2fwww.orchardproject.net%2fadvisory%22+id%3d%22advisory%22%3e%0d%0a+%26lt%3bp%26gt%3bYour+browser+does+not+support+iframes.+You+can%27t+see+advisory+messages.%26lt%3b%2fp%26gt%3b%3c%2fiframe%3e%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":\"\",\"htmlClass\":\"\",\"htmlStyle\":\"\",\"rule\":\"\"}]}")) - .WithPart("DashboardPart")); + .WithSetting("LayoutTypePartSettings.DefaultLayoutData", "{\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Canvas\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Grid\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Row\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eGet+up+and+running%3c%2fh2%3e%0d%0a%3cp%3eStart+by+exploring+the+menu+on+the+left+and+familiarize+yourself+with+Orchard.+As+for+the+basics%2c+we+suggest+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fThemes%22%3echanging+the+theme%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fContents%2fCreate%2fPage%22%3eadding+some+pages%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fBlogs%2fCreate%22%3esetup+up+a+blog%3c%2fa%3e%2c+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fSettings%2fIndex%22%3econfiguring+basic+settings%3c%2fa%3e.%3c%2fp%3e&Content=%3ch2%3eGet+up+and+running%3c%2fh2%3e%0d%0a%3cp%3eStart+by+exploring+the+menu+on+the+left+and+familiarize+yourself+with+Orchard.+As+for+the+basics%2c+we+suggest+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fThemes%22%3echanging+the+theme%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fContents%2fCreate%2fPage%22%3eadding+some+pages%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fBlogs%2fCreate%22%3esetup+up+a+blog%3c%2fa%3e%2c+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fSettings%2fIndex%22%3econfiguring+basic+settings%3c%2fa%3e.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":1,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eGet+more+goodies%3c%2fh2%3e%0d%0a%3cp%3eChange+the+way+your+site+works+and+looks+with+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fThemes%22%3ethemes%3c%2fa%3e+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fModules%22%3emodules%3c%2fa%3e.+There%26rsquo%3bs+plenty+to+choose+from+in+the+%3ca+href%3d%22http%3a%2f%2fgallery.orchardproject.net%2f%22%3eOrchard+Gallery%3c%2fa%3e.+We%26rsquo%3bre+always+adding+things%2c+so+be+sure+to+check+back+often+to+see+what%26rsquo%3bs+new.%3c%2fp%3e&Content=%3ch2%3eGet+more+goodies%3c%2fh2%3e%0d%0a%3cp%3eChange+the+way+your+site+works+and+looks+with+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fThemes%22%3ethemes%3c%2fa%3e+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fModules%22%3emodules%3c%2fa%3e.+There%26rsquo%3bs+plenty+to+choose+from+in+the+%3ca+href%3d%22http%3a%2f%2fgallery.orchardproject.net%2f%22%3eOrchard+Gallery%3c%2fa%3e.+We%26rsquo%3bre+always+adding+things%2c+so+be+sure+to+check+back+often+to+see+what%26rsquo%3bs+new.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":2,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eRead+the+docs%3c%2fh2%3e%0d%0a%3cp%3eAre+you+ready+to+go+deeper+and+become+an+Orchard+expert%3f+Take+a+look+at+the+%3ca+href%3d%22http%3a%2f%2fdocs.orchardproject.net%2f%22%3eOrchard+Documentation%3c%2fa%3e+to+learn+about+how+everything+connects+together+and+what+makes+Orchard+tick.%3c%2fp%3e&Content=%3ch2%3eRead+the+docs%3c%2fh2%3e%0d%0a%3cp%3eAre+you+ready+to+go+deeper+and+become+an+Orchard+expert%3f+Take+a+look+at+the+%3ca+href%3d%22http%3a%2f%2fdocs.orchardproject.net%2f%22%3eOrchard+Documentation%3c%2fa%3e+to+learn+about+how+everything+connects+together+and+what+makes+Orchard+tick.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":3,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eMake+friends%3c%2fh2%3e%0d%0a%3cp%3eFind+friends+that+share+your+interest+of+Orchard.+There+are+a+couple+ways+that+you+can+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fdiscussions%22%3ediscuss+and+get+connected%3c%2fa%3e+to+the+project+including+mailing+lists%2c+forums+and+IRC.%3c%2fp%3e&Content=%3ch2%3eMake+friends%3c%2fh2%3e%0d%0a%3cp%3eFind+friends+that+share+your+interest+of+Orchard.+There+are+a+couple+ways+that+you+can+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fdiscussions%22%3ediscuss+and+get+connected%3c%2fa%3e+to+the+project+including+mailing+lists%2c+forums+and+IRC.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":4,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eContribute+back%3c%2fh2%3e%0d%0a%3cp%3eHelp+grow+Orchard.+We+encourage+contributions+of+all+sorts%2c+including+code+submissions%2c+documentation%2c+translations%2c+feature+recommendations%2c+and+more.+Here+are+some+ways+to+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fcontribution%22%3egive+back+to+the+project%3c%2fa%3e.%3c%2fp%3e&Content=%3ch2%3eContribute+back%3c%2fh2%3e%0d%0a%3cp%3eHelp+grow+Orchard.+We+encourage+contributions+of+all+sorts%2c+including+code+submissions%2c+documentation%2c+translations%2c+feature+recommendations%2c+and+more.+Here+are+some+ways+to+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fcontribution%22%3egive+back+to+the+project%3c%2fa%3e.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":5,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eStay+up+to+date%3c%2fh2%3e%0d%0a%3cp%3e%3ciframe+width%3d%22100%25%22+height%3d%22100%25%22+scrolling%3d%22no%22+frameborder%3d%220%22+src%3d%22http%3a%2f%2fwww.orchardproject.net%2fadvisory%22+id%3d%22advisory%22%3e%0d%0a+%26lt%3bp%26gt%3bYour+browser+does+not+support+iframes.+You+can%27t+see+advisory+messages.%26lt%3b%2fp%26gt%3b%3c%2fiframe%3e%3c%2fp%3e&Content=%3ch2%3eStay+up+to+date%3c%2fh2%3e%0d%0a%3cp%3e%3ciframe+width%3d%22100%25%22+height%3d%22100%25%22+scrolling%3d%22no%22+frameborder%3d%220%22+src%3d%22http%3a%2f%2fwww.orchardproject.net%2fadvisory%22+id%3d%22advisory%22%3e%0d%0a+%26lt%3bp%26gt%3bYour+browser+does+not+support+iframes.+You+can%27t+see+advisory+messages.%26lt%3b%2fp%26gt%3b%3c%2fiframe%3e%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":\"\",\"htmlClass\":\"\",\"htmlStyle\":\"\",\"rule\":\"\"}]}"))); return 1; } diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj b/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj index 211001a18..375e48870 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj @@ -68,12 +68,15 @@ + + + @@ -89,21 +92,19 @@ - + + - + - - - - + 10.0 diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Placement.info b/src/Orchard.Web/Modules/Orchard.Dashboards/Placement.info index e93ed5019..2494529e8 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Placement.info +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Placement.info @@ -1,3 +1,9 @@  + + + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardDescriptor.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardDescriptor.cs new file mode 100644 index 000000000..f4f5d3b9a --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardDescriptor.cs @@ -0,0 +1,8 @@ +using System; + +namespace Orchard.Dashboards.Services { + public class DashboardDescriptor { + public int Priority { get; set; } + public Func DashboardFactory { get; set; } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardSelectorResult.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardSelectorResult.cs deleted file mode 100644 index 9345c8ebd..000000000 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardSelectorResult.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Orchard.ContentManagement; - -namespace Orchard.Dashboards.Services { - public class DashboardSelectorResult { - public int Priority { get; set; } - public IContent Dashboard { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DefaultDashboardSelector.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DefaultDashboardSelector.cs index 314fde30c..de756065e 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DefaultDashboardSelector.cs +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DefaultDashboardSelector.cs @@ -1,5 +1,4 @@ -using System; -using Orchard.ContentManagement; +using Orchard.ContentManagement; using Orchard.Dashboards.Models; namespace Orchard.Dashboards.Services { @@ -9,10 +8,18 @@ namespace Orchard.Dashboards.Services { _services = services; } - public DashboardSelectorResult GetDashboard() { + public DashboardDescriptor GetDashboardDescriptor() { var settings = _services.WorkContext.CurrentSite.As(); var dashboardId = settings.DefaultDashboardId; var dashboard = dashboardId != null ? _services.ContentManager.Get(dashboardId.Value) : default(ContentItem); + var descriptor = new DashboardDescriptor { Priority = -10 }; + + if (dashboard == null) + descriptor.DashboardFactory = shapeFactory => shapeFactory.StaticDashboard(); + else + descriptor.DashboardFactory = shapeFactory => _services.ContentManager.BuildDisplay(dashboard, displayType: "Dashboard"); + + return descriptor; } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardSelector.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardSelector.cs index 2bb524b6b..f19450a74 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardSelector.cs +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardSelector.cs @@ -1,5 +1,5 @@ namespace Orchard.Dashboards.Services { public interface IDashboardSelector : IDependency { - DashboardSelectorResult GetDashboard(); + DashboardDescriptor GetDashboardDescriptor(); } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardService.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardService.cs new file mode 100644 index 000000000..36067710b --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardService.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Orchard.DisplayManagement; + +namespace Orchard.Dashboards.Services { + public interface IDashboardService : IDependency { + dynamic GetDashboardShape(); + } + + public class DashboardService : IDashboardService { + private readonly Lazy> _selectors; + private readonly IShapeFactory _shapeFactory; + + public DashboardService(Lazy> selectors, IShapeFactory shapeFactory) { + _selectors = selectors; + _shapeFactory = shapeFactory; + } + + public dynamic GetDashboardShape() { + var selectorQuery = + from selector in _selectors.Value + let descriptor = selector.GetDashboardDescriptor() + orderby descriptor.Priority descending + select descriptor; + + var result = selectorQuery.First(); + var factory = result.DashboardFactory ?? (shapeFactory => shapeFactory.StaticDashboard()); + var shape = factory(_shapeFactory); + + return shape; + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Styles/Dashboard.css b/src/Orchard.Web/Modules/Orchard.Dashboards/Styles/Dashboard.css new file mode 100644 index 000000000..2dfa8b191 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Styles/Dashboard.css @@ -0,0 +1,6 @@ +.dashboard h2 { + font-size: 16px; + background: #f1f1f2; + line-height: 2em; + padding: 0 20px; +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Content.Dashboard.cshtml b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Content.Dashboard.cshtml new file mode 100644 index 000000000..f171ec400 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Content.Dashboard.cshtml @@ -0,0 +1,13 @@ +@using Orchard.ContentManagement +@{ + Style.Include("Dashboard.css"); +} +@{ + var contentItem = (ContentItem)Model.ContentItem; + var title = Html.ItemDisplayText(contentItem); + + Layout.Title = title; +} +
+ @Display(Model.Content) +
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Views/EditorTemplates/Parts.DashboardSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/EditorTemplates/Parts.DashboardSettings.cshtml index d6771bd77..65805bf38 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Views/EditorTemplates/Parts.DashboardSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/EditorTemplates/Parts.DashboardSettings.cshtml @@ -8,7 +8,7 @@ @Display.ContentPicker_Edit( DisplayName: T("Default Dashboard").Text, SelectedItemsFieldName: Html.FieldNameFor(m => m.SelectedDashboardId), - ContentItems: Model.SelectedDashboard != null ? new[] { Model.SelectedDashboard } : Enumerable.Empty(), + ContentItems: Model.SelectedDashboard != null ? new[] {Model.SelectedDashboard} : Enumerable.Empty(), Hint: T("Select the content item to use as the dashboard.").Text) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/StaticDashboard.cshtml similarity index 96% rename from src/Orchard.Web/Modules/Orchard.Dashboards/Views/Admin/Index.cshtml rename to src/Orchard.Web/Modules/Orchard.Dashboards/Views/StaticDashboard.cshtml index 369ded8ff..c1b38df78 100644 --- a/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Admin/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/StaticDashboard.cshtml @@ -1,5 +1,4 @@ -@model dynamic -@{ Layout.Title = T("Welcome to my Custom Dashboard").ToString(); } +@{ Layout.Title = T("Welcome to Orchard").ToString(); }

@T("Get up and running")