more work on link picker, added dialog service and views
This commit is contained in:
@@ -372,6 +372,35 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
'Failed to retreive data for empty content item type ' + alias);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentResource#getNiceUrl
|
||||
* @methodOf umbraco.resources.contentResource
|
||||
*
|
||||
* @description
|
||||
* Returns a url, given a node ID
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* contentResource.getNiceUrl()
|
||||
* .then(function(stylesheets) {
|
||||
* alert('its here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id Id of node to return the public url to
|
||||
* @returns {Promise} resourcePromise object containing the url.
|
||||
*
|
||||
*/
|
||||
getNiceUrl: function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentApiBaseUrl",
|
||||
"GetNiceUrl",[{id: id}])),
|
||||
'Failed to retrieve url for id:' + id);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentResource#getChildren
|
||||
|
||||
@@ -12,34 +12,7 @@ function publishedContentResource($q, $http, umbRequestHelper) {
|
||||
//the factory object returned
|
||||
return {
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.publishedContentResource#getUrl
|
||||
* @methodOf umbraco.resources.publishedContentResource
|
||||
*
|
||||
* @description
|
||||
* Returns a url, given a node ID
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* publishedContentResource.getUrl()
|
||||
* .then(function(stylesheets) {
|
||||
* alert('its here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id Id of node to return the public url to
|
||||
* @returns {Promise} resourcePromise object containing the url.
|
||||
*
|
||||
*/
|
||||
getUrl: function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"publishedContentApiBaseUrl",
|
||||
"GetUrl",[{id: id}])),
|
||||
'Failed to retreive url for id:' + id);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -318,6 +318,24 @@ angular.module('umbraco.services')
|
||||
return openDialog(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.dialogService#linkPicker
|
||||
* @methodOf umbraco.services.dialogService
|
||||
*
|
||||
* @description
|
||||
* Opens a link picker tree in a modal, the callback returns a single link
|
||||
* @param {Object} options content picker dialog options object
|
||||
* @param {$scope} options.scope dialog scope
|
||||
* @param {Function} options.callback callback function
|
||||
* @returns {Object} modal object
|
||||
*/
|
||||
linkPicker: function (options) {
|
||||
options.template = 'views/common/dialogs/linkPicker.html';
|
||||
options.show = true;
|
||||
return openDialog(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.dialogService#macroPicker
|
||||
|
||||
@@ -102,6 +102,38 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.tinyMceService#createLinkPicker
|
||||
* @methodOf umbraco.services.tinyMceService
|
||||
*
|
||||
* @description
|
||||
* Creates the umbrco insert link tinymce plugin
|
||||
*
|
||||
* @param {Object} editor the TinyMCE editor instance
|
||||
* @param {Object} $scope the current controller scope
|
||||
*/
|
||||
createLinkPicker: function (editor, $scope) {
|
||||
editor.addButton('link', {
|
||||
icon: 'custom icon-link',
|
||||
tooltip: 'Link Picker',
|
||||
onclick: function () {
|
||||
dialogService.linkPicker({
|
||||
scope: $scope, callback: function (link) {
|
||||
if (link) {
|
||||
var data = {
|
||||
title: "Some description",
|
||||
href: "",
|
||||
id: '__mcenew'
|
||||
};
|
||||
editor.insertContent(editor.dom.createHTML('a', data));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.tinyMceService#createUmbracoMacro
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
//used for the media picker dialog
|
||||
angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController",
|
||||
function ($scope, eventsService, $log) {
|
||||
function ($scope, eventsService, contentResource, $log) {
|
||||
var dialogOptions = $scope.$parent.dialogOptions;
|
||||
|
||||
$scope.dialogTreeEventHandler = $({});
|
||||
$scope.target = {};
|
||||
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeSelect", function(ev, args){
|
||||
args.event.preventDefault();
|
||||
@@ -15,11 +17,19 @@ angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController",
|
||||
$scope.selectedEl.find("i.umb-tree-icon").show();
|
||||
}
|
||||
|
||||
c.find("i.umb-tree-icon").hide()
|
||||
.after("<i class='icon umb-tree-icon sprTree icon-check blue temporary'></i>");
|
||||
c.find("i.umb-tree-icon")
|
||||
.hide()
|
||||
.after("<i class='icon umb-tree-icon sprTree icon-check blue temporary'></i>");
|
||||
|
||||
$scope.target = args.node;
|
||||
$scope.selectedEl = c;
|
||||
$scope.target = args.node;
|
||||
$scope.target.title = args.node.name;
|
||||
|
||||
if(args.node.id < 0){
|
||||
$scope.target.url = "/";
|
||||
}else{
|
||||
$scope.target.url = contentResource.getNiceUrl(args.node.id);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="umb-panel" ng-controller="Umbraco.Dialogs.LinkPickerController">
|
||||
<div class="umb-panel-body no-header">
|
||||
<div class="umb-panel-body no-header with-footer">
|
||||
<umb-pane>
|
||||
<umb-control-group label="Title">
|
||||
<input type="text"
|
||||
@@ -15,18 +15,18 @@
|
||||
</umb-control-group>
|
||||
</umb-pane>
|
||||
|
||||
<umb-pane>
|
||||
<umb-tree
|
||||
section="content"
|
||||
cachekey="contentpickerDialog"
|
||||
cachekey="linkpickerDialog"
|
||||
showheader="true"
|
||||
showoptions="false"
|
||||
eventhandler="dialogTreeEventHandler">
|
||||
</umb-tree>
|
||||
</umb-pane>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="umb-panel-footer" ng-show="multipicker">
|
||||
<div class="umb-panel-footer">
|
||||
<div class="umb-el-wrap umb-panel-buttons">
|
||||
<div class="btn-toolbar umb-btn-toolbar">
|
||||
<input type="button" ng-click="submit(dialogData)" class="btn btn-primary" value="select" />
|
||||
|
||||
@@ -75,9 +75,12 @@ angular.module("umbraco")
|
||||
//Create the insert media plugin
|
||||
tinyMceService.createMediaPicker(editor, $scope);
|
||||
|
||||
//Create the insert icon plugin
|
||||
//Create the embedded plugin
|
||||
tinyMceService.createInsertEmbeddedMedia(editor, $scope);
|
||||
|
||||
//Create the insert link plugin
|
||||
tinyMceService.createLinkPicker(editor, $scope);
|
||||
|
||||
//Create the insert macro plugin
|
||||
tinyMceService.createInsertMacro(editor, $scope);
|
||||
}
|
||||
|
||||
@@ -257,6 +257,10 @@
|
||||
<Project>{89C09045-1064-466B-B94A-DB3AFE2A5853}</Project>
|
||||
<Name>umbraco.MacroEngines</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\umbraco.macroRenderings\umbraco.macroRenderings.csproj">
|
||||
<Project>{52AB8F1F-FB76-4E8C-885F-0747B6CE71EC}</Project>
|
||||
<Name>umbraco.macroRenderings</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\umbraco.controls\umbraco.controls.csproj">
|
||||
<Project>{6EDD2061-82F2-461B-BB6E-879245A832DE}</Project>
|
||||
<Name>umbraco.controls</Name>
|
||||
@@ -618,6 +622,7 @@
|
||||
<None Include="Config\404handlers.Release.config">
|
||||
<DependentUpon>404handlers.config</DependentUpon>
|
||||
</None>
|
||||
<Content Include="Config\appSettings.Release.config" />
|
||||
<None Include="Config\ClientDependency.Release.config">
|
||||
<DependentUpon>ClientDependency.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -628,14 +633,7 @@
|
||||
<None Include="Config\BaseRestExtensions.Release.config">
|
||||
<DependentUpon>BaseRestExtensions.config</DependentUpon>
|
||||
</None>
|
||||
<Content Include="Config\appSettings.config" />
|
||||
<Content Include="Config\appSettings.Release.config">
|
||||
<DependentUpon>appSettings.config</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Config\connectionStrings.config" />
|
||||
<Content Include="Config\connectionStrings.Release.config">
|
||||
<DependentUpon>connectionStrings.config</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Config\connectionStrings.Release.config" />
|
||||
<None Include="Config\log4net.Release.config">
|
||||
<DependentUpon>log4net.config</DependentUpon>
|
||||
</None>
|
||||
@@ -2124,6 +2122,8 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\Web.config.transform" />
|
||||
<None Include="Web.Debug.config.transformed" />
|
||||
<None Include="Web.Release.config.transformed" />
|
||||
<None Include="web.Template.Debug.config">
|
||||
<DependentUpon>Web.Template.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -2533,7 +2533,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Config\metablogConfig.config" />
|
||||
<Content Include="Config\tinyMceConfig.config" />
|
||||
<Content Include="Config\tinyMceConfig.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Config\umbracoSettings.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
@@ -2597,13 +2599,6 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
|
||||
<Target Name="BeforeBuild">
|
||||
<!-- Create web.config file from Template if it doesn't exist -->
|
||||
<Copy SourceFiles="$(ProjectDir)web.Template.config" DestinationFiles="$(ProjectDir)Web.config" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" Condition="!Exists('$(ProjectDir)Web.config')" />
|
||||
|
||||
<!-- Create appSettings.config file from Template if it doesn't exist -->
|
||||
<Copy SourceFiles="$(ProjectDir)config\appSettings.release.config" DestinationFiles="$(ProjectDir)config\appSettings.config" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" Condition="!Exists('$(ProjectDir)config\appSettings.config')" />
|
||||
|
||||
<!-- Create connectionStrings.config file from Template if it doesn't exist -->
|
||||
<Copy SourceFiles="$(ProjectDir)config\connectionStrings.release.config" DestinationFiles="$(ProjectDir)config\connectionStrings.config" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" Condition="!Exists('$(ProjectDir)config\connectionStrings.config')" />
|
||||
|
||||
<!-- Transform the local Web.config file in Visual Studio -->
|
||||
<TransformXml Source="$(ProjectDir)Web.config" Transform="$(ProjectDir)web.Template.$(Configuration).config" Destination="$(ProjectDir)Web.$(Configuration).config.transformed" Condition="$(BuildingInsideVisualStudio) == true" />
|
||||
<!-- Always transform the Template file when not in VS (ie: build.bat) -->
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace Umbraco.Web.Editors
|
||||
{"logApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<LogController>("GetEntityLog")},
|
||||
{"memberApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<MemberController>("GetByLogin")},
|
||||
{"rteApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<RichTextPreValueController>("GetConfiguration")},
|
||||
{"stylesheetApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<StylesheetController>("GetAll")},
|
||||
{"publishedContentApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<PublishedContentController>("GetUrl")}
|
||||
{"stylesheetApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<StylesheetController>("GetAll")}
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -108,7 +108,17 @@ namespace Umbraco.Web.Editors
|
||||
var emptyContent = new Content("", parentId, contentType);
|
||||
return Mapper.Map<IContent, ContentItemDisplay>(emptyContent);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Url for a given node ID
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public string GetNiceUrl(int id)
|
||||
{
|
||||
return Umbraco.NiceUrl(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the children for the content id passed in
|
||||
/// </summary>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
|
||||
//TODO: Why do we have this ? If we want a URL why isn't it just on the content controller ?
|
||||
|
||||
[PluginController("UmbracoApi")]
|
||||
public class PublishedContentController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
|
||||
public string GetNiceUrl(int id)
|
||||
{
|
||||
return Umbraco.NiceUrl(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,6 @@
|
||||
<Compile Include="Editors\DataTypeValidateAttribute.cs" />
|
||||
<Compile Include="Editors\LogController.cs" />
|
||||
<Compile Include="Editors\MacroController.cs" />
|
||||
<Compile Include="Editors\PublishedContentController.cs" />
|
||||
<Compile Include="Models\ContentEditing\StyleSheet.cs" />
|
||||
<Compile Include="Editors\StylesheetController.cs" />
|
||||
<Compile Include="Models\ContentEditing\AuditLog.cs" />
|
||||
|
||||
Reference in New Issue
Block a user