From 696cc68191011f1c5b045372d94a580ef0ed6613 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 1 Jun 2012 15:26:21 -0700 Subject: [PATCH] Adding multiple content item selection in ContentPickerField --HG-- branch : 1.x --- .hgsubstate | 4 ++-- src/Orchard.Profile/profiling-setup-commands.txt | 2 +- src/Orchard.Specs/Bindings/OrchardSiteFactory.cs | 2 +- src/Orchard.Specs/Setup.feature | 2 +- src/Orchard.Specs/Setup.feature.cs | 4 ++-- .../Parts.ContentMenuItem.Edit.cshtml | 15 ++++++--------- .../Modules/Orchard.Setup/Recipes/blog.recipe.xml | 2 +- .../Orchard.Setup/Recipes/default.recipe.xml | 2 +- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.hgsubstate b/.hgsubstate index 879e18105..9e6557632 100644 --- a/.hgsubstate +++ b/.hgsubstate @@ -1,6 +1,6 @@ fdaecfbb0eab3673a3074313f5adcedc6a678506 src/Orchard.Web/Modules/Orchard.AntiSpam bf20391f8fe1ba5d67cadc0643d79ad9fe892d4e src/Orchard.Web/Modules/Orchard.Autoroute -da175731d643b675472e893689641066db827a7c src/Orchard.Web/Modules/Orchard.ContentPicker +5457a8b7a343395b7dc874cd418f81f267358d55 src/Orchard.Web/Modules/Orchard.ContentPicker 37b71cc2949b792b8da48ee4b5450684e3f8b4cf src/Orchard.Web/Modules/Orchard.CustomForms b8e23b1daab66d46b6d2196f87aceb91aed2f582 src/Orchard.Web/Modules/Orchard.Forms cfc264d41c1d299c104d76c5032d8ffee3047dcd src/Orchard.Web/Modules/Orchard.Rules @@ -9,4 +9,4 @@ cfc264d41c1d299c104d76c5032d8ffee3047dcd src/Orchard.Web/Modules/Orchard.Rules f6fecd1702066225a84a482ac029e3e6daff38f3 src/Orchard.Web/Modules/Orchard.ViewPermissions 4ed51e0e76c2aacc2de90ce9984fd00cfdfae2ce src/orchard.web/Modules/Orchard.Alias 29857523c5275b8566ee3a6f4ba2a3d641e7fa0c src/orchard.web/Modules/Orchard.Projections -dd54e3ffe5199d162cad97772ce40dccaf613c3f src/orchard.web/modules/Orchard.Fields +e8d6ad7df228083093e57d5b5d489a949bd68cfb src/orchard.web/modules/Orchard.Fields diff --git a/src/Orchard.Profile/profiling-setup-commands.txt b/src/Orchard.Profile/profiling-setup-commands.txt index ffa999dd5..80ec2e2d0 100644 --- a/src/Orchard.Profile/profiling-setup-commands.txt +++ b/src/Orchard.Profile/profiling-setup-commands.txt @@ -1 +1 @@ -setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,Navigation,Reports,Scheduling,Settings,Shapes,Title,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.Media,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine,Orchard.Tokens,Orchard.Alias,Orchard.Autoroute +setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,Navigation,Reports,Scheduling,Settings,Shapes,Title,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.Media,Orchard.ContentPicker,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine,Orchard.Tokens,Orchard.Alias,Orchard.Autoroute diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs index e61fe4635..5adf0da2b 100644 --- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs +++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs @@ -23,7 +23,7 @@ namespace Orchard.Specs.Bindings { webApp.GivenIHaveACleanSiteWith( virtualDirectory, TableData( - new { extension = "Module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields" }, + new { extension = "Module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields" }, new { extension = "Core", names = "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title" }, new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" })); diff --git a/src/Orchard.Specs/Setup.feature b/src/Orchard.Specs/Setup.feature index 6102f140e..b91619c4a 100644 --- a/src/Orchard.Specs/Setup.feature +++ b/src/Orchard.Specs/Setup.feature @@ -39,7 +39,7 @@ Scenario: Some of the initial form values are required Scenario: Calling setup on a brand new install Given I have a clean site with | extension | names | - | Module | Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields | + | Module | Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields | | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title | | Theme | SafeMode, TheAdmin, TheThemeMachine | And I am on "/Setup" diff --git a/src/Orchard.Specs/Setup.feature.cs b/src/Orchard.Specs/Setup.feature.cs index 9f2f23e2c..29b5a399e 100644 --- a/src/Orchard.Specs/Setup.feature.cs +++ b/src/Orchard.Specs/Setup.feature.cs @@ -3,7 +3,7 @@ // This code was generated by SpecFlow (http://www.specflow.org/). // SpecFlow Version:1.8.1.0 // SpecFlow Generator Version:1.8.0.0 -// Runtime Version:4.0.30319.239 +// Runtime Version:4.0.30319.269 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -188,7 +188,7 @@ this.ScenarioSetup(scenarioInfo); "names"}); table4.AddRow(new string[] { "Module", - @"Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields"}); + @"Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields"}); table4.AddRow(new string[] { "Core", "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," + diff --git a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml index ca9defb2c..206f72376 100644 --- a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml +++ b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.ContentMenuItem.Edit.cshtml @@ -19,17 +19,14 @@ jQuery('#btn-@Html.FieldIdFor(m => m.ContentItemId)').trigger("orchard-admin-contentpicker-open", { callback: function(data) { - var id = data.id; - jQuery('#@Html.FieldIdFor(m => m.ContentItemId)').val(id); + jQuery('#@Html.FieldIdFor(m => m.ContentItemId)').val(data.id); - var title = data.title; - if (title && title.length > 0) { - jQuery('#title-@Html.FieldIdFor(m => m.ContentItemId)').text(title); + jQuery('#title-@Html.FieldIdFor(m => m.ContentItemId)').text(data.displayText); - var menuText = jQuery('#MenuText'); - if (menuText.length > 0) { - menuText.val(title); - } + // define the menu text if it's empty + var menuText = jQuery('#MenuText'); + if (menuText.val().length == 0) { + menuText.val(data.displayText); } } }); diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Recipes/blog.recipe.xml b/src/Orchard.Web/Modules/Orchard.Setup/Recipes/blog.recipe.xml index 74373aa63..7b0588011 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Recipes/blog.recipe.xml +++ b/src/Orchard.Web/Modules/Orchard.Setup/Recipes/blog.recipe.xml @@ -10,7 +10,7 @@