Wires up the help dialog with our and tv feeds

This commit is contained in:
perploug
2013-10-29 21:49:40 +01:00
parent 1860f3f953
commit a7f5576fee
11 changed files with 165 additions and 10 deletions

View File

@@ -0,0 +1,70 @@
angular.module('umbraco.services')
.factory('helpService', function ($http, $q){
var helpTopics = {};
var defaultUrl = "http://our.umbraco.org/rss/help";
var tvUrl = "http://umbraco.tv/feeds/help";
function getCachedHelp(url){
if(helpTopics[url]){
return helpTopics[cacheKey];
}else{
return null;
}
}
function setCachedHelp(url, data){
helpTopics[url] = data;
}
function fetchUrl(url){
var deferred = $q.defer();
var found = getCachedHelp(url);
if(found){
deferred.resolve(found);
}else{
var proxyUrl = "dashboard/feedproxy.aspx?url=" + url;
$http.get(proxyUrl).then(function(data){
var feed = $(data.data);
var topics = [];
$('item', feed).each(function (i, item) {
var topic = {};
topic.thumbnail = $(item).find('thumbnail').attr('url');
topic.title = $("title", item).text();
topic.link = $("guid", item).text();
topic.description = $("description", item).text();
topics.push(topic);
});
setCachedHelp(topics);
deferred.resolve(topics);
});
}
return deferred.promise;
}
var service = {
findHelp: function (args) {
var url = service.getUrl(defaultUrl, args);
return fetchUrl(url);
},
findVideos: function (args) {
var url = service.getUrl(tvUrl, args);
return fetchUrl(url);
},
getUrl: function(url, args){
return url + "?" + $.param(args);
}
};
return service;
});

View File

@@ -65,7 +65,6 @@ h5{
/*BUTTONS */
.thumbnails > li.umb-plus-btn {
margin: 0 10px 10px 0
}

View File

@@ -2,6 +2,15 @@
// Navs
// --------------------------------------------------
.list-icons li{
padding-left: 35px;
}
.list-icons li > i.icon{
margin-left: -25px;
padding-right: 7px;
}
// BASE CLASS
// ----------

View File

@@ -238,10 +238,10 @@ div.has-unpublished-version:before{
}
div.not-allowed > i.icon,div.not-allowed > a{
color: @grayLight;
cursor: not-allowed;
}
// Tree context menu
// -------------------------
.umb-actions {

View File

@@ -1,7 +1,42 @@
angular.module("umbraco")
.controller("Umbraco.Dialogs.HelpController", function ($scope, $location, $routeParams) {
.controller("Umbraco.Dialogs.HelpController", function ($scope, $location, $routeParams, helpService, userService) {
$scope.section = $routeParams.section;
if(!$scope.section){
$scope.section ="content";
}
var rq = {};
rq.section = $scope.section;
userService.getCurrentUser().then(function(user){
rq.usertype = user.userType;
rq.lang = user.locale;
if($routeParams.url){
rq.path = decodeURIComponent($routeParams.url);
if(rq.path.indexOf(Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath) === 0){
rq.path = rq.path.substring(Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath.length);
}
if(rq.path.indexOf(".aspx") > 0){
rq.path = rq.path.substring(0, rq.path.indexOf(".aspx"));
}
}else{
rq.path = rq.section + "/" + $routeParams.tree + "/" + $routeParams.method;
}
helpService.findHelp(rq).then(function(topics){
$scope.topics = topics;
});
helpService.findVideos(rq).then(function(videos){
$scope.videos = videos;
});
});
});

View File

@@ -5,20 +5,54 @@
<div class="umb-panel-body umb-scrollable">
<div class="tab-content umb-control-group">
<div class="umb-pane">
<h5>Help topics for: {{section}}</h5>
<p>
This area will contain manuals, references and tutorials, downloaded from our.umbraco.org...
</p>
<ul class="unstyled list-icons" ng-show="topics">
<li ng-repeat="topic in topics">
<i class="icon icon-help-alt"></i>
<a target="_blank" href="{{topic.link}}" title="{{topic.title}}">
{{topic.title}}
</a>
<small class="umb-detail">{{topic.description}}</small>
</li>
</ul>
<ul class="unstyled list-icons">
<li>
<i class="icon icon-favorite"></i>
<a target="_blank" href="http://our.umbraco.org">
go to our.umbraco.org
</a>
<small class="umb-detail">The friendliest community</small>
</li>
</ul>
</div>
<div class="umb-pane">
<h5>Video chapters for: {{section}}</h5>
<p>
This area will contain relevant videos from umbraco.tv
</p>
<ul class="thumbnails" ng-show="videos">
<li class="span2" ng-repeat="video in videos">
<div class="thumbnail" style="margin-right: 20px">
<a target="_blank" href="{{video.link}}" title="{{video.title}}">
<img ng-src="{{video.thumbnail}}" alt="{{video.title}}">
</a>
</div>
</li>
</ul>
<ul class="unstyled list-icons">
<li>
<i class="icon icon-tv-old"></i>
<a target="_blank" href="http://our.umbraco.org">
go to umbraco.tv
</a>
<small class="umb-detail">The best umbraco video tutorials</small>
</li>
</ul>
</div>
</div>
</div>
</div>

View File

@@ -7,4 +7,5 @@
<allow host="umbraco.com" />
<allow host="umbraco.org" />
<allow host="umbraco.tv" />
<allow host="our.umbraco.org" />
</feedProxy>

View File

@@ -7,4 +7,5 @@
<allow host="umbraco.com" />
<allow host="umbraco.org" />
<allow host="umbraco.tv" />
<allow host="our.umbraco.org" />
</feedProxy>

View File

@@ -56,6 +56,7 @@ namespace Umbraco.Web.Editors
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return Mapper.Map<UserDetail>(user);
}

View File

@@ -20,6 +20,10 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "emailHash")]
public string EmailHash { get; set; }
[DataMember(Name = "userType", IsRequired = true)]
[Required]
public string UserType { get; set; }
/// <summary>
/// Gets/sets the number of seconds for the user's auth ticket to expire
/// </summary>

View File

@@ -13,6 +13,7 @@ namespace Umbraco.Web.Models.Mapping
{
config.CreateMap<IUser, UserDetail>()
.ForMember(detail => detail.UserId, opt => opt.MapFrom(user => GetIntId(user.Id)))
.ForMember(detail => detail.UserType, opt => opt.MapFrom(user => user.UserType.Alias))
.ForMember(
detail => detail.EmailHash,
opt => opt.MapFrom(user => user.Email.ToLowerInvariant().Trim().ToMd5()));