Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

Commit

Permalink
fix(): remove jsfiddle from edit example options #101
Browse files Browse the repository at this point in the history
  • Loading branch information
m7r committed Aug 26, 2014
1 parent e0b7b05 commit 22870f1
Showing 1 changed file with 3 additions and 54 deletions.
57 changes: 3 additions & 54 deletions src/templates/js/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,10 @@ docsApp.directive.code = function() {

docsApp.directive.sourceEdit = function(getEmbeddedTemplate) {
return NG_DOCS.editExample ? {
template: '<div class="btn-group pull-right">' +
'<a class="btn dropdown-toggle btn-primary" data-toggle="dropdown" href>' +
' <i class="icon-pencil icon-white"></i> Edit <span class="caret"></span>' +
'</a>' +
'<ul class="dropdown-menu">' +
' <li><a ng-click="plunkr($event)" href="">In Plunkr</a></li>' +
' <li><a ng-click="fiddle($event)" href="">In JsFiddle</a></li>' +
'</ul>' +
'</div>',
template: '<a class="btn pull-right" ng-click="plunkr($event)" href>' +
'<i class="icon-pencil"></i> Edit in Plunkr</a>',
scope: true,
controller: function($scope, $attrs, openJsFiddle, openPlunkr) {
controller: function($scope, $attrs, openPlunkr) {
var sources = {
module: $attrs.sourceEdit,
deps: read($attrs.sourceEditDeps),
Expand All @@ -99,10 +92,6 @@ docsApp.directive.sourceEdit = function(getEmbeddedTemplate) {
unit: read($attrs.sourceEditUnit),
scenario: read($attrs.sourceEditScenario)
};
$scope.fiddle = function(e) {
e.stopPropagation();
openJsFiddle(sources);
};
$scope.plunkr = function(e) {
e.stopPropagation();
openPlunkr(sources);
Expand Down Expand Up @@ -204,46 +193,6 @@ docsApp.serviceFactory.openPlunkr = function(templateMerge, formPostData, loaded
};
};

docsApp.serviceFactory.openJsFiddle = function(templateMerge, formPostData, loadedUrls) {

var HTML = '<div ng-app=\"{{module}}\">\n{{html:2}}</div>',
SCRIPT_CACHE = '\n\n<!-- {{name}} -->\n<script type="text/ng-template" id="{{name}}">\n{{content:2}}</script>';

return function(content) {
var prop = {
module: content.module,
html: '',
css: '',
script: ''
};

angular.forEach(content.html, function(file, index) {
if (index) {
prop.html += templateMerge(SCRIPT_CACHE, file);
} else {
prop.html += file.content;
}
});

angular.forEach(content.js, function(file, index) {
prop.script += file.content;
});

angular.forEach(content.css, function(file, index) {
prop.css += file.content;
});

formPostData("http://jsfiddle.net/api/post/library/pure/dependencies/more/", {
title: 'AngularJS Example',
html: templateMerge(HTML, prop),
js: prop.script,
css: prop.css,
resources: loadedUrls.base.join(','),
wrap: 'b'
});
};
};


docsApp.serviceFactory.sections = function serviceFactory() {
var sections = {
Expand Down

0 comments on commit 22870f1

Please sign in to comment.