Skip to content

Commit 41b5bd3

Browse files
committed
Implemented 'Preview Mode' for Themes & Stores (IMPORTANT: downgrade the EF Migrations to 'NewRes' prior starting the app)
1 parent 229cfe0 commit 41b5bd3

45 files changed

Lines changed: 1274 additions & 613 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- No cumbersome return View("Very.Long.View.Identifier") anymore
1010
- Views in plugin source folders can be edited during debug. The changes are reflected without plugin recompilation.
1111
* (Developer) *Theme inheritance*: create derived child themes with minimum effort by overriding only small parts (static files and even variables).
12+
* *Preview Mode*: virtually test themes and stores more easily
1213
* New payment plugin *Pay with Amazon*
1314
* (Developer) Model binding for plugin tab views: models from plugin tabs get automatically materialized and bound to TabbableModel.CustomProperties[MyKey]. Extended the SmartModelBinder for this.
1415
* (Developer) New event _ModelBoundEvent_. Consume this in plugins to persist plugin specific models.

src/Libraries/SmartStore.Core/IStoreContext.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,34 @@ namespace SmartStore.Core
1212
/// </summary>
1313
public interface IStoreContext
1414
{
15+
/// <summary>
16+
/// Sets a store override to be used for the current request
17+
/// </summary>
18+
/// <param name="storeId">The store override or <c>null</c> to remove the override</param>
19+
void SetRequestStore(int? storeId);
20+
21+
/// <summary>
22+
/// Sets a store override to be used for the current user's session (e.g. for preview mode)
23+
/// </summary>
24+
/// <param name="storeId">The store override or <c>null</c> to remove the override</param>
25+
void SetPreviewStore(int? storeId);
26+
27+
/// <summary>
28+
/// Gets the store override for the current request
29+
/// </summary>
30+
/// <returns>The store override or <c>null</c></returns>
31+
int? GetRequestStore();
32+
33+
/// <summary>
34+
/// Gets the store override for the current session
35+
/// </summary>
36+
/// <returns>The store override or <c>null</c></returns>
37+
int? GetPreviewStore();
38+
1539
/// <summary>
1640
/// Gets or sets the current store
1741
/// </summary>
18-
Store CurrentStore { get; set; }
42+
Store CurrentStore { get; }
1943

2044
/// <summary>
2145
/// IsSingleStoreMode ? 0 : CurrentStore.Id

src/Libraries/SmartStore.Core/Utilities/ActionDisposable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace SmartStore.Utilities
66
/// <summary>
77
/// Allows action to be executed when it is disposed
88
/// </summary>
9-
internal struct ActionDisposable : IDisposable
9+
public struct ActionDisposable : IDisposable
1010
{
1111
readonly Action _action;
1212

src/Libraries/SmartStore.Data/Migrations/201411071645389_V21Final.resx

Lines changed: 0 additions & 126 deletions
This file was deleted.

src/Libraries/SmartStore.Data/Migrations/201411182201537_EuEsd.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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace SmartStore.Data.Migrations
2+
{
3+
using System;
4+
using System.Data.Entity.Migrations;
5+
6+
public partial class EuEsd : DbMigration
7+
{
8+
public override void Up()
9+
{
10+
AddColumn("dbo.Product", "IsEsd", c => c.Boolean(nullable: false));
11+
}
12+
13+
public override void Down()
14+
{
15+
DropColumn("dbo.Product", "IsEsd");
16+
}
17+
}
18+
}

src/Libraries/SmartStore.Data/Migrations/201411182201537_EuEsd.resx

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

src/Libraries/SmartStore.Data/Migrations/201411071645389_V21Final.Designer.cs renamed to src/Libraries/SmartStore.Data/Migrations/201411182202431_V21Final.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Libraries/SmartStore.Data/Migrations/201411071645389_V21Final.cs renamed to src/Libraries/SmartStore.Data/Migrations/201411182202431_V21Final.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
namespace SmartStore.Data.Migrations
22
{
3-
using System;
4-
using System.Data.Entity.Migrations;
3+
using System;
4+
using System.Data.Entity.Migrations;
55
using SmartStore.Data.Setup;
66

77
public partial class V21Final : DbMigration, ILocaleResourcesProvider, IDataSeeder<SmartObjectContext>
8-
{
8+
{
99
public override void Up()
1010
{
11-
AddColumn("dbo.Product", "IsEsd", c => c.Boolean(nullable: false));
1211
}
1312

1413
public override void Down()
1514
{
16-
DropColumn("dbo.Product", "IsEsd");
1715
}
1816

1917
public bool RollbackOnFailure
@@ -77,6 +75,22 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
7775
"Reload themes",
7876
"Themes aktualisieren");
7977

78+
// Theme Preview
79+
builder.AddOrUpdate("Admin.Configuration.Themes.Preview",
80+
"Preview",
81+
"Vorschau");
82+
builder.AddOrUpdate("Admin.Configuration.Themes.Theme",
83+
"Theme",
84+
"Theme");
85+
builder.AddOrUpdate("Admin.Configuration.Themes.PreviewMode",
86+
"Preview Mode",
87+
"Vorschaumodus");
88+
builder.AddOrUpdate("Admin.Configuration.Themes.ExitPreviewMode",
89+
"Exit preview mode",
90+
"Vorschau beenden");
91+
92+
builder.AddOrUpdate("Common.Apply", "Apply", "Übernehmen");
93+
8094
builder.AddOrUpdate("Common.Reload", "Reload", "Neu laden");
8195
builder.AddOrUpdate("Common.Refresh", "Refresh", "Aktualisieren");
8296

src/Libraries/SmartStore.Data/Migrations/201411182202431_V21Final.resx

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

0 commit comments

Comments
 (0)