mirror of https://github.com/abpframework/abp.git
19 changed files with 242 additions and 17 deletions
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
public class PageLookupDto : EntityDto<Guid> |
|||
{ |
|||
public string Title { get; set; } |
|||
|
|||
public string Slug { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
var abp = abp || {}; |
|||
$(function () { |
|||
abp.modals.createMenuItem = function () { |
|||
|
|||
var initModal = function (publicApi, args) { |
|||
|
|||
var $pageId = $('#ViewModel_PageId'); |
|||
var $url = $('#ViewModel_Url'); |
|||
var $displayName = $('#ViewModel_DisplayName'); |
|||
var $pageIdClearButton = $('#page-id-clear-button'); |
|||
|
|||
initSelectPageId(); |
|||
|
|||
$pageIdClearButton.hide(); |
|||
|
|||
$pageId.on('change', function (params) { |
|||
$url.prop('disabled', $pageId.val()); |
|||
|
|||
if ($pageId.val()) |
|||
{ |
|||
$pageIdClearButton.show(); |
|||
if (!$displayName.val()){ |
|||
$displayName.val($pageId.text()); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
$pageIdClearButton.hide(); |
|||
} |
|||
}) |
|||
|
|||
$pageIdClearButton.click(function (){ |
|||
$pageId.val(''); |
|||
$pageId.trigger('change'); |
|||
}) |
|||
|
|||
function initSelectPageId() { |
|||
$pageId.data('autocompleteApiUrl', '/api/cms-kit-admin/pages/lookup'); |
|||
$pageId.data('autocompleteDisplayProperty', 'title'); |
|||
$pageId.data('autocompleteValueProperty', 'id'); |
|||
$pageId.data('autocompleteItemsProperty', 'items'); |
|||
$pageId.data('autocompleteFilterParamName', 'filter'); |
|||
|
|||
abp.dom.initializers.initializeAutocompleteSelects($pageId); |
|||
} |
|||
}; |
|||
|
|||
return { |
|||
initModal: initModal |
|||
}; |
|||
}; |
|||
}); |
|||
@ -0,0 +1,52 @@ |
|||
var abp = abp || {}; |
|||
$(function () { |
|||
abp.modals.updateMenuItem = function () { |
|||
|
|||
var initModal = function (publicApi, args) { |
|||
|
|||
var $pageId = $('#ViewModel_PageId'); |
|||
var $url = $('#ViewModel_Url'); |
|||
var $displayName = $('#ViewModel_DisplayName'); |
|||
var $pageIdClearButton = $('#page-id-clear-button'); |
|||
|
|||
initSelectPageId(); |
|||
|
|||
$pageId.on('change', function (params) { |
|||
$url.prop('disabled', $pageId.val()); |
|||
|
|||
if ($pageId.val()) |
|||
{ |
|||
$pageIdClearButton.show(); |
|||
if (!$displayName.val()){ |
|||
$displayName.val($pageId.text()); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
$pageIdClearButton.hide(); |
|||
} |
|||
}) |
|||
|
|||
$pageId.trigger('change'); |
|||
|
|||
$pageIdClearButton.click(function (){ |
|||
$pageId.val(''); |
|||
$pageId.trigger('change'); |
|||
}); |
|||
|
|||
function initSelectPageId() { |
|||
$pageId.data('autocompleteApiUrl', '/api/cms-kit-admin/pages/lookup'); |
|||
$pageId.data('autocompleteDisplayProperty', 'title'); |
|||
$pageId.data('autocompleteValueProperty', 'id'); |
|||
$pageId.data('autocompleteItemsProperty', 'items'); |
|||
$pageId.data('autocompleteFilterParamName', 'filter'); |
|||
|
|||
abp.dom.initializers.initializeAutocompleteSelects($pageId); |
|||
} |
|||
}; |
|||
|
|||
return { |
|||
initModal: initModal |
|||
}; |
|||
}; |
|||
}); |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.CmsKit.Pages; |
|||
|
|||
namespace Volo.CmsKit.Menus |
|||
{ |
|||
public class PageChangedHandler: ILocalEventHandler<EntityCreatedEventData<Page>>, |
|||
ITransientDependency |
|||
{ |
|||
protected IMenuRepository MenuRepository { get; } |
|||
|
|||
public PageChangedHandler(IMenuRepository menuRepository) |
|||
{ |
|||
MenuRepository = menuRepository; |
|||
} |
|||
|
|||
public Task HandleEventAsync(EntityCreatedEventData<Page> eventData) |
|||
{ |
|||
// TODO: Find a way to get affected MenuItems.
|
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue