|
|
Currenlty i've installed the Contrib mobile module and fixed an bug but can't find any codeplex project or any other site where this project is maintained. So a call to James Restall. Please contact me or copy paste the following null ref fix:
var groups = _deviceGroupService.Get(VersionOptions.Latest);
group.Position = groups.Any() ? groups.Max(x => x.Position) + 1 : 0;
|
|
Aug 27, 2012 at 8:57 PM
Edited Aug 27, 2012 at 8:57 PM
|
Hey, just tried the module and it looks promising, however, I get the following error when creating a device group upon clicking the save button:
An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back
Sequence contains no elements
System.InvalidOperationException: Sequence contains no elements at System.Linq.Enumerable.Max(IEnumerable`1 source) at Contrib.Mobile.Controllers.ThemesAdminController.CreatePOST() at lambda_method(Closure , ControllerBase , Object[]
) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func`1 continuation)
The fix you mentioned up there, is that the fix fir this error? If so, where do I add apply this fix?
|
|
|
|
found it. It's in the \Modules\Contrib.Mobile\Controllers\ThemesAdminController.cs line 78
[HttpPost, ActionName("Create")]
public ActionResult CreatePOST()
{
if (!Services.Authorizer.Authorize(Permissions.ManageMobileThemes, T("Cannot manage mobile themes")))
return new HttpUnauthorizedResult();
var group = Services.ContentManager.New<DeviceGroupPart>("DeviceGroup");
group.Enabled = true;
// OLD CODE: group.Position = _deviceGroupService.Get(VersionOptions.Latest).Max(x => x.Position) + 1;
var groups = _deviceGroupService.Get(VersionOptions.Latest);
group.Position = groups.Any() ? groups.Max(x => x.Position) + 1 : 0;
Services.ContentManager.Create(group, VersionOptions.Draft);
dynamic model = Services.ContentManager.UpdateEditor(group, this);
if (!ModelState.IsValid)
{
_transactionManager.Cancel();
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
return View((object)model);
}
Services.ContentManager.Publish(group.ContentItem);
return Redirect("List");
}
|
|
|
|
Glad you've found it. Unfortunately the author never contacted me and I can't find where's hosted the source. That's really a shame because the module is very nice!
|
|
|
|
Really nice module, Znowman, thank's a lot!
|
|
|
|
module is indeed nice.
I'm using the following query to filter out phones as tablet render the site quiet well:
isMobileDevice(true) && is_tablet(false)
My next orchard site however is based on a bootstrap theme, started from a them from wrapbootstrap.com. Hereby I avoid 2 different theme's for desktop or mobile
Every step I go further in the development I evaluate if it still looks good on different form factors. So far so good and it just sounds better to have one theme for all devices.
|
|
|
|
Yes in some scenario's is a responsive theme a nice solution but in some circumstances it's not enough. For example when you want totally different content (without loading unused data) or structure.
|
|