Skip to content

Commit a337f3c

Browse files
committed
Html widgets: added option to create a wrapper around widget content
1 parent 9e428a0 commit a337f3c

14 files changed

Lines changed: 262 additions & 22 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
### New Features
55
* Html to PDF converter: PDF documents are created from regular HTML templates now, therefore radically simplifying PDF output customization.
6+
* Html widgets: added option to create a wrapper around widget content
67
* SEO: added new settings `Canonical host name rule`. Enforces permanent redirection to a single domain name for a better page rank (e.g. myshop.com > www.myshop.com or vice versa)
78
* SEO: added support for `<link hreflang="..." ... />` in multi-language stores. The tags are automatically rendered along with the language switcher.
89
* (Developer) Implemented new HtmlHelper extension `AddLinkPart`: registers `<link>` tags which should be rendered in page's head section

src/AssemblyVersionInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
// by using the '*' as shown below:
1212
[assembly: AssemblyVersion("2.1.0.0")]
1313

14-
[assembly: AssemblyFileVersion("2.1.0.0")]
15-
[assembly: AssemblyInformationalVersion("2.1.0.0")]
14+
[assembly: AssemblyFileVersion("2.1.1.0")]
15+
[assembly: AssemblyInformationalVersion("2.1.1.0")]

src/Libraries/SmartStore.Core/Domain/Topics/Topic.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public partial class Topic : BaseEntity, ILocalizedEntity, IStoreMappingSupporte
7171
/// </summary>
7272
public string WidgetZone { get; set; }
7373

74+
/// <summary>
75+
/// Gets or sets a value indicating whether the content should be surrounded by a topic block wrapper
76+
/// </summary>
77+
public bool? WidgetWrapContent { get; set; }
78+
7479
/// <summary>
7580
/// Gets or sets a value indicating whether the title should be displayed in the widget block
7681
/// </summary>

src/Libraries/SmartStore.Data/Migrations/201501191849483_WidgetWrapContent.Designer.cs

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
namespace SmartStore.Data.Migrations
2+
{
3+
using System;
4+
using System.Data.Entity.Migrations;
5+
using SmartStore.Data.Setup;
6+
7+
public partial class WidgetWrapContent : DbMigration, ILocaleResourcesProvider, IDataSeeder<SmartObjectContext>
8+
{
9+
public override void Up()
10+
{
11+
AddColumn("dbo.Topic", "WidgetWrapContent", c => c.Boolean());
12+
}
13+
14+
public override void Down()
15+
{
16+
DropColumn("dbo.Topic", "WidgetWrapContent");
17+
}
18+
19+
public bool RollbackOnFailure
20+
{
21+
get { return false; }
22+
}
23+
24+
public void Seed(SmartObjectContext context)
25+
{
26+
context.MigrateLocaleResources(MigrateLocaleResources);
27+
}
28+
29+
public void MigrateLocaleResources(LocaleResourcesBuilder builder)
30+
{
31+
builder.AddOrUpdate("Admin.ContentManagement.Topics.Fields.WidgetWrapContent",
32+
"Add wrapper around content",
33+
"Inhalt mit Container umhüllen",
34+
"Adds an HTML wrapper around widget content",
35+
"Umhüllt den Widget Inhalt mit einem HTML-Container");
36+
}
37+
}
38+
}

src/Libraries/SmartStore.Data/Migrations/201501191849483_WidgetWrapContent.resx

Lines changed: 126 additions & 0 deletions
Large diffs are not rendered by default.

src/Libraries/SmartStore.Data/SmartStore.Data.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@
207207
<Compile Include="Migrations\201412081934318_V211.Designer.cs">
208208
<DependentUpon>201412081934318_V211.cs</DependentUpon>
209209
</Compile>
210+
<Compile Include="Migrations\201501191849483_WidgetWrapContent.cs" />
211+
<Compile Include="Migrations\201501191849483_WidgetWrapContent.Designer.cs">
212+
<DependentUpon>201501191849483_WidgetWrapContent.cs</DependentUpon>
213+
</Compile>
210214
<Compile Include="Setup\Builder\SettingsBuilder.cs" />
211215
<Compile Include="Setup\Builder\SettingsMigrator.cs" />
212216
<Compile Include="Setup\DbMigrationContext.cs" />
@@ -417,6 +421,9 @@
417421
<EmbeddedResource Include="Migrations\201412081934318_V211.resx">
418422
<DependentUpon>201412081934318_V211.cs</DependentUpon>
419423
</EmbeddedResource>
424+
<EmbeddedResource Include="Migrations\201501191849483_WidgetWrapContent.resx">
425+
<DependentUpon>201501191849483_WidgetWrapContent.cs</DependentUpon>
426+
</EmbeddedResource>
420427
<EmbeddedResource Include="Sql\Indexes.sql" />
421428
<EmbeddedResource Include="Sql\StoredProcedures.sql" />
422429
</ItemGroup>

src/Presentation/SmartStore.Web/Administration/Controllers/TopicController.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ public ActionResult Create(TopicModel model, bool continueEditing)
183183
return continueEditing ? RedirectToAction("Edit", new { id = topic.Id }) : RedirectToAction("List");
184184
}
185185

186-
//If we got this far, something failed, redisplay form
187-
188-
//Stores
186+
// If we got this far, something failed, redisplay form
189187
PrepareStoresMappingModel(model, null, true);
190188

191189
return View(model);

src/Presentation/SmartStore.Web/Administration/Infrastructure/AutoMapperStartupTask.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public void Execute()
165165
.ForMember(dest => dest.CreatedOnUtc, mo => mo.Ignore());
166166
//topcis
167167
Mapper.CreateMap<Topic, TopicModel>()
168+
.ForMember(dest => dest.WidgetWrapContent, mo => mo.MapFrom(x => x.WidgetWrapContent.HasValue ? x.WidgetWrapContent.Value : true))
168169
.ForMember(dest => dest.Url, mo => mo.Ignore())
169170
.ForMember(dest => dest.Locales, mo => mo.Ignore())
170171
.ForMember(dest => dest.AvailableStores, mo => mo.Ignore())

src/Presentation/SmartStore.Web/Administration/Models/Topics/TopicModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public class TopicModel : EntityModelBase, ILocalizedModel<TopicLocalizedModel>
3131

3232
public TopicModel()
3333
{
34-
Locales = new List<TopicLocalizedModel>();
34+
WidgetWrapContent = true;
35+
Locales = new List<TopicLocalizedModel>();
3536
AvailableStores = new List<StoreModel>();
3637
AvailableWidgetZones = s_widgetZones;
3738
}
@@ -88,6 +89,9 @@ public TopicModel()
8889
[UIHint("WidgetZone")]
8990
public string WidgetZone { get; set; }
9091

92+
[SmartResourceDisplayName("Admin.ContentManagement.Topics.Fields.WidgetWrapContent")]
93+
public bool WidgetWrapContent { get; set; }
94+
9195
[SmartResourceDisplayName("Admin.ContentManagement.Topics.Fields.WidgetShowTitle")]
9296
public bool WidgetShowTitle { get; set; }
9397

0 commit comments

Comments
 (0)