Ensures all stylesheet usages in RTE are working as expected

This commit is contained in:
Shannon
2015-01-15 12:40:09 +11:00
parent 8abf6fc2b5
commit 19037ee1ba
7 changed files with 12 additions and 49 deletions

View File

@@ -65,6 +65,9 @@ angular.module("umbraco.directives")
r.inline = "span";
r.classes = rule.selector.substring(1);
}else if (rule.selector[0] === "#") {
//Even though this will render in the style drop down, it will not actually be applied
// to the elements, don't think TinyMCE even supports this and it doesn't really make much sense
// since only one element can have one id.
r.inline = "span";
r.attributes = { id: rule.selector.substring(1) };
}else {

View File

@@ -38,35 +38,6 @@ function stylesheetResource($q, $http, umbRequestHelper) {
'Failed to retrieve stylesheets ');
},
/**
* @ngdoc method
* @name umbraco.resources.stylesheetResource#getRules
* @methodOf umbraco.resources.stylesheetResource
*
* @description
* Returns all defined child rules for a stylesheet with a given ID
*
* ##usage
* <pre>
* stylesheetResource.getRules(2345)
* .then(function(rules) {
* alert('its here!');
* });
* </pre>
*
* @returns {Promise} resourcePromise object containing the rules.
*
*/
getRules: function (id) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"stylesheetApiBaseUrl",
"GetRules",
[{ id: id }])),
'Failed to retrieve stylesheets ');
},
/**
* @ngdoc method
* @name umbraco.resources.stylesheetResource#getRulesByName

View File

@@ -175,8 +175,11 @@ function contentPickerController($scope, dialogService, entityResource, editorSt
return d.id == id;
});
if (entity) {
entity.icon = iconHelper.convertFromLegacyIcon(entity.icon);
$scope.renderModel.push({ name: entity.name, id: entity.id, icon: entity.icon });
}
});

View File

@@ -11,6 +11,7 @@ using System.Web.Http;
using System.Web.Services.Description;
using Newtonsoft.Json.Linq;
using umbraco.cms.businesslogic.web;
using Umbraco.Core;
using Umbraco.Core.IO;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
@@ -31,23 +32,13 @@ namespace Umbraco.Web.Editors
.Select(x =>
new Stylesheet() {
Name = x.Alias,
Id = x.Id,
Path = x.VirtualPath
});
}
//public IEnumerable<StylesheetRule> GetRules(string name)
//{
// var css = Services.FileService.GetStylesheetByName(name);
// if (css == null)
// return Enumerable.Empty<StylesheetRule>();
// return css.Properties.Select(x => new StylesheetRule() { Name = x.Name, Selector = x.Alias });
//}
public IEnumerable<StylesheetRule> GetRulesByName(string name)
{
var css = Services.FileService.GetStylesheetByName(name);
var css = Services.FileService.GetStylesheetByName(name.EnsureEndsWith(".css"));
if (css == null)
return Enumerable.Empty<StylesheetRule>();

View File

@@ -14,8 +14,5 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "path")]
public string Path { get; set; }
[DataMember(Name = "id")]
public int Id { get; set; }
}
}

View File

@@ -16,7 +16,5 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "selector")]
public string Selector { get; set; }
//[DataMember(Name = "id")]
//public int Id { get; set; }
}
}

View File

@@ -22,7 +22,7 @@ namespace umbraco
var stylesheetName = AdditionalValues["nodeId"].ToString();
var s = Umbraco.Core.ApplicationContext.Current.Services.FileService.GetStylesheetByName(stylesheetName.EnsureEndsWith(".css"));
s.AddProperty(new StylesheetProperty(Alias, "#" + Alias, ""));
s.AddProperty(new StylesheetProperty(Alias, "." + Alias.ToSafeAlias(), ""));
Umbraco.Core.ApplicationContext.Current.Services.FileService.SaveStylesheet(s);
_returnUrl = string.Format("settings/stylesheet/property/EditStyleSheetProperty.aspx?id={0}&prop={1}", s.Name, Alias);