├── .gitignore ├── LICENSE ├── README.md └── RestApiPlayground ├── PoC ├── README.txt ├── css │ └── style.css ├── index.html ├── js │ └── index.js └── license.txt ├── RestApiPlayground.sln └── TestSite ├── App_Browsers ├── Form.browser └── w3cvalidator.browser ├── App_Data ├── Umbraco.sdf └── umbraco.config ├── App_Plugins └── Grid │ ├── Config │ └── FanoeConfig.txt │ └── Editors │ ├── Render │ ├── embed_videowrapper.cshtml │ ├── media_round.cshtml │ ├── media_text_right.cshtml │ ├── media_wide.cshtml │ └── quote_with_description.cshtml │ └── Views │ ├── media_with_description.html │ └── quote_with_description.html ├── App_Start ├── UmbracoAuthTokenServerExtensions.cs ├── UmbracoCustomOwinStartup.cs └── UmbracoStandardOwinStartup.cs ├── Config ├── 404handlers.config ├── BaseRestExtensions.config ├── ClientDependency.config ├── Dashboard.config ├── EmbeddedMedia.config ├── ExamineIndex.config ├── ExamineSettings.config ├── FileSystemProviders.config ├── Lang │ ├── cs-CZ.user.xml │ ├── da-DK.user.xml │ ├── de-DE.user.xml │ ├── en-GB.user.xml │ ├── en-US.user.xml │ ├── es-ES.user.xml │ ├── fr-FR.user.xml │ ├── he-IL.user.xml │ ├── it-IT.user.xml │ ├── ja-JP.user.xml │ ├── ko-KR.user.xml │ ├── nb-NO.user.xml │ ├── nl-NL.user.xml │ ├── pl-PL.user.xml │ ├── pt-BR.user.xml │ ├── ru-RU.user.xml │ ├── sv-SE.user.xml │ └── zh-CN.user.xml ├── UrlRewriting.config ├── applications.config ├── feedProxy.config ├── grid.editors.config.js ├── log4net.config ├── metablogConfig.config ├── scripting.config ├── splashes │ ├── booting.aspx │ └── noNodes.aspx ├── tinyMceConfig.config ├── trees.config └── umbracoSettings.config ├── Global.asax ├── Properties └── AssemblyInfo.cs ├── TestSite.csproj ├── Views ├── BlogOverview.cshtml ├── BlogPost.cshtml ├── Home.cshtml ├── Master.cshtml ├── Partials │ ├── BottomNavigation.cshtml │ ├── Grid │ │ ├── Bootstrap2.cshtml │ │ ├── Bootstrap3.cshtml │ │ ├── Editors │ │ │ ├── Base.cshtml │ │ │ ├── Embed.cshtml │ │ │ ├── Macro.cshtml │ │ │ ├── Media.cshtml │ │ │ ├── Rte.cshtml │ │ │ └── Textstring.cshtml │ │ └── Fanoe.cshtml │ └── MainNavigation.cshtml ├── TextPage.cshtml └── Web.config ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── css ├── bootstrap.min.css ├── fanoe.css ├── rte.css └── style.css ├── default.aspx ├── hal-browser ├── MIT-LICENSE.txt ├── README.adoc ├── browser.html ├── js │ ├── hal.js │ └── hal │ │ ├── browser.js │ │ ├── http │ │ └── client.js │ │ ├── resource.js │ │ └── views │ │ ├── browser.js │ │ ├── documentation.js │ │ ├── embedded_resource.js │ │ ├── embedded_resources.js │ │ ├── explorer.js │ │ ├── inspector.js │ │ ├── links.js │ │ ├── location_bar.js │ │ ├── navigation.js │ │ ├── non_safe_request_dialog.js │ │ ├── properties.js │ │ ├── query_uri_dialog.js │ │ ├── request_headers.js │ │ ├── resource.js │ │ ├── response.js │ │ ├── response_body.js │ │ └── response_headers.js ├── login.html ├── styles.css └── vendor │ ├── css │ ├── bootstrap-responsive.css │ └── bootstrap.css │ ├── img │ ├── ajax-loader.gif │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png │ └── js │ ├── URI.min.js │ ├── backbone.js │ ├── bootstrap.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── underscore.js │ └── uritemplates.js ├── js ├── bootstrap.min.js └── jquery.min.js ├── media ├── 1012 │ └── fanoe-denmark.jpg ├── 1013 │ └── 9027510123_92a91b5cf4_b_dark.jpg ├── 1014 │ └── 9017002308_81dfd2c1d5_b_dark.jpg ├── 1015 │ └── 14257753719_2c02b94030_h.jpg ├── 1016 │ └── 14435759945_a2c58e9ed6_h.jpg ├── 1017 │ └── 14359779226_df7329d607_h_dark.jpg ├── 1018 │ └── 10818851674_e375a8751e_b.jpg ├── 1022 │ └── 9686845888_e2d216ce81_b_dark_small.jpg ├── 1023 │ └── form-bg.png ├── 1024 │ └── 14448232381_8f994d2adc_h_dark.jpg ├── 1027 │ └── 14434411872_8e663d6de0_h.jpg ├── 1028 │ └── 14435732345_c9f5b48dfa_h_dark.jpg ├── 1031 │ └── 9026528992_d38fbc2e28_o_dark.jpg ├── 1032 │ └── 9039247947_e15a9d8850_b.jpg ├── 1033 │ └── whole-earth-catalog.jpg ├── 1036 │ └── 1912289_753997844648209_7099291360101379579_o.jpg ├── 1037 │ └── 9015601712_72e44263e4_b.jpg ├── 1038 │ └── screen-shot-2014-12-01-at-121327.png ├── 1042 │ └── logo.jpg ├── 1044 │ └── 14441035391_7ee1d0d166_h_darken.jpg ├── 1046 │ └── 14386124825_d43f359900_h_cropped.jpg ├── 1047 │ └── 9027509991_ff12bd87e4_b_small_cropped.jpg ├── 1048 │ └── sharingiscaring_cropped.jpg └── 1049 │ └── 9027510123_92a91b5cf4_b_dark.jpg ├── packages.config └── scripts └── fanoe.js /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | #*.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | 198 | # Apple 199 | .DS_Store 200 | 201 | # Merge artifacts 202 | *.orig 203 | 204 | # Umbraco 205 | RestApiPlayground/TestSite/App_Data/cache/ 206 | RestApiPlayground/TestSite/App_Data/courier/ 207 | RestApiPlayground/TestSite/App_Data/Logs/ 208 | RestApiPlayground/TestSite/App_Data/NuGetBackup/ 209 | RestApiPlayground/TestSite/App_Data/preview/ 210 | RestApiPlayground/TestSite/App_Data/umbraco.config 211 | RestApiPlayground/TestSite/App_Data/TEMP/ 212 | RestApiPlayground/TestSite/umbraco/ 213 | RestApiPlayground/TestSite/umbraco_client/ 214 | RestApiPlayground/.vs 215 | ood.flag -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Marcin Zajkowski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Umbraco REST API Playground # 2 | 3 | Simple playground and Ionic PoC using Umbraco REST API. App was made as an addition to the article released during the 2015 24days.in Umbraco series: https://24days.in/umbraco-cms/2015/umbraco-rest-api/. 4 | 5 | ## Test Site ## 6 | 7 | Backend credentials: 8 | 9 | * Username: ***admin*** 10 | * Password: ***password*** 11 | 12 | API user credentials: 13 | 14 | * Username: ***api*** 15 | * Password: ***password*** 16 | 17 | HAL Browser URL: ***http://localhost:55368/hal-browser/browser.html*** 18 | 19 | ## References / Helpers ## 20 | 21 | * Umbraco REST API: https://github.com/umbraco/UmbracoRestApi 22 | * HAL-Browser: https://github.com/mikekelly/hal-browser 23 | * Ionic Framework: http://ionicframework.com/ 24 | * Restangular: https://github.com/mgonto/restangular -------------------------------------------------------------------------------- /RestApiPlayground/PoC/README.txt: -------------------------------------------------------------------------------- 1 | A Pen created at CodePen.io. You can find this one at http://codepen.io/ionic/pen/mqolp. 2 | 3 | Example using ion-refresher for the "pull to refresh" effect -------------------------------------------------------------------------------- /RestApiPlayground/PoC/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | cursor: url('http://ionicframework.com/img/finger.png'), auto; 3 | } 4 | 5 | .bar.bar-positive { 6 | border-color: #f37021; 7 | background-color: #f37021; 8 | background-image: none; 9 | } -------------------------------------------------------------------------------- /RestApiPlayground/PoC/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Umbraco REST API PoC 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

Umbraco REST API PoC

18 |
19 | 20 | 21 | 22 | 23 | 24 | {{item.name}} 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /RestApiPlayground/PoC/js/index.js: -------------------------------------------------------------------------------- 1 | var authUrl = 'http://localhost:55368/umbraco/oauth/token'; 2 | var apiBase = 'http://localhost:55368/umbraco/rest/v1/'; 3 | 4 | var ionicApp = angular.module('ionicApp', ['ionic', 'restangular']); 5 | 6 | // Restangular configuration 7 | ionicApp.config(function (RestangularProvider) { 8 | // Set the base url for your API endpoints 9 | RestangularProvider.setBaseUrl(apiBase); 10 | 11 | // You can set some default headers for calling the API 12 | RestangularProvider.setDefaultHeaders( 13 | { 'Accept': 'application/hal+json' }, 14 | { 'Content-Type': 'application/hal+json' } 15 | ); 16 | 17 | // Set an interceptor in order to parse the API response 18 | // when getting a list of resources 19 | RestangularProvider.setResponseInterceptor(function (data, operation, what) { 20 | if (operation == 'getList') { 21 | resp = data._embedded[what]; 22 | resp._links = data._links; 23 | return resp; 24 | } 25 | return data; 26 | }); 27 | 28 | // Using self link for self reference resources 29 | RestangularProvider.setRestangularFields({ 30 | selfLink: 'self.link' 31 | }); 32 | }); 33 | 34 | // My Controller - main 35 | ionicApp.controller('MyCtrl', ['$scope', '$timeout', 'contentResource', 'authResource', 36 | function ($scope, $timeout, contentResource, authResource) { 37 | 38 | $scope.init = function () { 39 | 40 | // Get access token for back office user (can be different for different apps) - Temporary 41 | // Probably will be deprecated regarding to plans of changing the authentication method(s). 42 | // Remember to not expose user credentials in production apps!!! This is just PoC. 43 | var accessTokenResponse = authResource.getAccessToken('password', 'api', 'password'); 44 | accessTokenResponse.then(function (response) { 45 | $scope.tokenResponse = response; 46 | 47 | console.log($scope.tokenResponse); 48 | 49 | $scope.loadRootItems(); 50 | }); 51 | }; 52 | 53 | $scope.loadRootItems = function () { 54 | 55 | // Get root items with passed authorization details to authenticate the request 56 | var rootItems = contentResource.getRootItems($scope.tokenResponse.token_type + ' ' + $scope.tokenResponse.access_token); 57 | rootItems.then(function (response) { 58 | console.log(response); 59 | 60 | $scope.items = response; 61 | }); 62 | 63 | }; 64 | 65 | $scope.doRefresh = function () { 66 | 67 | console.log('Refreshing!'); 68 | $timeout(function () { 69 | 70 | // Re-load root items 71 | $scope.loadRootItems(); 72 | 73 | // Stop the ion-refresher from spinning 74 | $scope.$broadcast('scroll.refreshComplete'); 75 | 76 | }, 1000); 77 | 78 | }; 79 | 80 | $scope.init(); 81 | 82 | }]); 83 | 84 | // Authentication service 85 | ionicApp.factory('authResource', function ($http) { 86 | 87 | var getAccessToken = function (grantType, username, password) { 88 | 89 | var postData = { 90 | grant_type: grantType, 91 | username: username, 92 | password: password 93 | }; 94 | 95 | return $http.post(authUrl, postData, { 96 | headers: { 97 | 'Accept': 'application/json', 98 | 'Content-Type': 'application/x-www-form-urlencoded' 99 | }, 100 | transformRequest: function (obj) { 101 | var str = []; 102 | for (var p in obj) 103 | if (obj.hasOwnProperty(p)) str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); 104 | return str.join("&"); 105 | } 106 | }).then(function (response) { 107 | return response.data; 108 | }); 109 | 110 | }; 111 | 112 | return { 113 | getAccessToken: getAccessToken 114 | } 115 | }); 116 | 117 | // Content service - very basic! 118 | ionicApp.factory('contentResource', function ($http, Restangular) { 119 | 120 | var getRootItems = function (authorization) { 121 | 122 | return Restangular.all("content").getList({}, { 'Authorization': authorization }); 123 | 124 | } 125 | 126 | return { 127 | getRootItems: getRootItems 128 | } 129 | 130 | }); -------------------------------------------------------------------------------- /RestApiPlayground/PoC/license.txt: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /RestApiPlayground/RestApiPlayground.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestSite", "TestSite\TestSite.csproj", "{3072047F-AD7E-4D54-98C8-4EEF8875ADE4}" 7 | EndProject 8 | Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "PoC", "PoC\", "{7080EF0B-7134-464B-823D-3C56E3F7F239}" 9 | ProjectSection(WebsiteProperties) = preProject 10 | TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" 11 | Debug.AspNetCompiler.VirtualPath = "/localhost_62644" 12 | Debug.AspNetCompiler.PhysicalPath = "PoC\" 13 | Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_62644\" 14 | Debug.AspNetCompiler.Updateable = "true" 15 | Debug.AspNetCompiler.ForceOverwrite = "true" 16 | Debug.AspNetCompiler.FixedNames = "false" 17 | Debug.AspNetCompiler.Debug = "True" 18 | Release.AspNetCompiler.VirtualPath = "/localhost_62644" 19 | Release.AspNetCompiler.PhysicalPath = "PoC\" 20 | Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_62644\" 21 | Release.AspNetCompiler.Updateable = "true" 22 | Release.AspNetCompiler.ForceOverwrite = "true" 23 | Release.AspNetCompiler.FixedNames = "false" 24 | Release.AspNetCompiler.Debug = "False" 25 | VWDPort = "62644" 26 | SlnRelativePath = "PoC\" 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|Any CPU = Debug|Any CPU 32 | Release|Any CPU = Release|Any CPU 33 | EndGlobalSection 34 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 35 | {3072047F-AD7E-4D54-98C8-4EEF8875ADE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {3072047F-AD7E-4D54-98C8-4EEF8875ADE4}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {3072047F-AD7E-4D54-98C8-4EEF8875ADE4}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {3072047F-AD7E-4D54-98C8-4EEF8875ADE4}.Release|Any CPU.Build.0 = Release|Any CPU 39 | {7080EF0B-7134-464B-823D-3C56E3F7F239}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 40 | {7080EF0B-7134-464B-823D-3C56E3F7F239}.Debug|Any CPU.Build.0 = Debug|Any CPU 41 | {7080EF0B-7134-464B-823D-3C56E3F7F239}.Release|Any CPU.ActiveCfg = Debug|Any CPU 42 | {7080EF0B-7134-464B-823D-3C56E3F7F239}.Release|Any CPU.Build.0 = Debug|Any CPU 43 | EndGlobalSection 44 | GlobalSection(SolutionProperties) = preSolution 45 | HideSolutionNode = FALSE 46 | EndGlobalSection 47 | EndGlobal 48 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Browsers/Form.browser: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Browsers/w3cvalidator.browser: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Data/Umbraco.sdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzajkowski/umbraco-rest-api-playground/a0d6aa155feb846771f013f50e7bc9beac5466e3/RestApiPlayground/TestSite/App_Data/Umbraco.sdf -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Config/FanoeConfig.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Rich text editor", 4 | "alias": "rte", 5 | "view": "rte", 6 | "icon": "icon-article" 7 | }, 8 | { 9 | "name": "Image", 10 | "alias": "media", 11 | "view": "media", 12 | "icon": "icon-picture" 13 | }, 14 | { 15 | "name": "Image wide", 16 | "alias": "media_wide", 17 | "view": "media", 18 | "render": "/App_Plugins/Grid/Editors/Render/media_wide.cshtml", 19 | "icon": "icon-picture" 20 | }, 21 | { 22 | "name": "Image wide cropped", 23 | "alias": "media_wide_cropped", 24 | "view": "media", 25 | "render": "media", 26 | "icon": "icon-picture", 27 | "config": { 28 | "size": { 29 | "width": 1920, 30 | "height": 700 31 | } 32 | } 33 | }, 34 | { 35 | "name": "Image rounded", 36 | "alias": "media_round", 37 | "view": "media", 38 | "render": "/App_Plugins/Grid/Editors/Render/media_round.cshtml", 39 | "icon": "icon-picture" 40 | }, 41 | { 42 | "name": "Image w/ text right", 43 | "alias": "media_text_right", 44 | "view": "/App_Plugins/Grid/Editors/Views/media_with_description.html", 45 | "render": "/App_Plugins/Grid/Editors/Render/media_text_right.cshtml", 46 | "icon": "icon-picture" 47 | }, 48 | { 49 | "name": "Macro", 50 | "alias": "macro", 51 | "view": "macro", 52 | "icon": "icon-settings-alt" 53 | }, 54 | { 55 | "name": "Embed", 56 | "alias": "embed", 57 | "view": "embed", 58 | "render": "/App_Plugins/Grid/Editors/Render/embed_videowrapper.cshtml", 59 | "icon": "icon-movie-alt" 60 | }, 61 | { 62 | "name": "Banner Headline", 63 | "alias": "banner_headline", 64 | "view": "textstring", 65 | "icon": "icon-coin", 66 | "config": { 67 | "style": "font-size: 36px; line-height: 45px; font-weight: bold; text-align:center", 68 | "markup": "

#value#

" 69 | } 70 | }, 71 | { 72 | "name": "Banner Tagline", 73 | "alias": "banner_tagline", 74 | "view": "textstring", 75 | "icon": "icon-coin", 76 | "config": { 77 | "style": "font-size: 25px; line-height: 35px; font-weight: normal; text-align:center", 78 | "markup": "

#value#

" 79 | } 80 | }, 81 | { 82 | "name": "Headline", 83 | "alias": "headline", 84 | "view": "textstring", 85 | "icon": "icon-coin", 86 | "config": { 87 | "style": "font-size: 36px; line-height: 45px; font-weight: bold", 88 | "markup": "

#value#

" 89 | } 90 | }, 91 | { 92 | "name": "Headline centered", 93 | "alias": "headline_centered", 94 | "view": "textstring", 95 | "icon": "icon-coin", 96 | "config": { 97 | "style": "font-size: 30px; line-height: 45px; font-weight: bold; text-align:center;", 98 | "markup": "

#value#

" 99 | } 100 | }, 101 | { 102 | "name": "Abstract", 103 | "alias": "abstract", 104 | "view": "textstring", 105 | "icon": "icon-coin", 106 | "config": { 107 | "style": "font-size: 16px; line-height: 20px; font-weight: bold;", 108 | "markup": "

#value#

" 109 | } 110 | }, 111 | { 112 | "name": "Paragraph", 113 | "alias": "paragraph", 114 | "view": "textstring", 115 | "icon": "icon-font", 116 | "config": { 117 | "style": "font-size: 16px; line-height: 20px; font-weight: light;", 118 | "markup": "

#value#

" 119 | } 120 | }, 121 | { 122 | "name": "Quote", 123 | "alias": "quote", 124 | "view": "textstring", 125 | "icon": "icon-quote", 126 | "config": { 127 | "style": "border-left: 3px solid #ccc; padding: 10px; color: #ccc; font-family: serif; font-variant: italic; font-size: 18px", 128 | "markup": "
#value#
" 129 | } 130 | }, 131 | { 132 | "name": "Quote with description", 133 | "alias": "quote_D", 134 | "view": "/App_Plugins/Grid/Editors/Views/quote_with_description.html", 135 | "render": "/App_Plugins/Grid/Editors/Render/quote_with_description.cshtml", 136 | "icon": "icon-quote", 137 | "config": { 138 | "style": "border-left: 3px solid #ccc; padding: 10px; color: #ccc; font-family: serif; font-variant: italic; font-size: 18px" 139 | } 140 | }, 141 | { 142 | "name": "Code", 143 | "alias": "code", 144 | "view": "textstring", 145 | "icon": "icon-code", 146 | "config": { 147 | "style": "overflow: auto;padding: 6px 10px;border: 1px solid #ddd;border-radius: 3px;background-color: #f8f8f8;font-size: .9rem;font-family: 'Courier 10 Pitch', Courier, monospace;line-height: 19px;", 148 | "markup": "
#value#
" 149 | } 150 | } 151 | ] -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Editors/Render/embed_videowrapper.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoViewPage 2 | 3 |
4 | @Html.Raw(Model.value) 5 |
-------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Editors/Render/media_round.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoViewPage 2 | 3 | @if (Model.value != null) 4 | { 5 | var url = Model.value.image; 6 | if(Model.editor.config != null && Model.editor.config.size != null){ 7 | url += "?width=" + Model.editor.config.size.width; 8 | url += "&height=" + Model.editor.config.size.height; 9 | 10 | if(Model.value.focalPoint != null){ 11 | url += "¢er=" + Model.value.focalPoint.top +"," + Model.value.focalPoint.left; 12 | url += "&mode=crop"; 13 | } 14 | } 15 | 16 | @Model.value.caption 17 | 18 | if (Model.value.caption != null) 19 | { 20 | @Model.value.caption 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Editors/Render/media_text_right.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoViewPage 2 | 3 | @if (Model.value != null) 4 | { 5 | var url = Model.value.image; 6 | if(Model.editor.config != null && Model.editor.config.size != null){ 7 | url += "?width=" + Model.editor.config.size.width; 8 | url += "&height=" + Model.editor.config.size.height; 9 | 10 | if(Model.value.focalPoint != null){ 11 | url += "¢er=" + Model.value.focalPoint.top +"," + Model.value.focalPoint.left; 12 | url += "&mode=crop"; 13 | } 14 | } 15 | 16 |
17 |
18 |
19 | @Model.value.caption 20 |
21 |
22 | 23 | @if (Model.value.headline != null) 24 | { 25 |
26 |
27 |

28 | @Model.value.headline 29 |
30 | @Model.value.paragraph 31 |

32 |
33 |
34 | } 35 | @if (Model.value.paragraph != null) 36 | { 37 |
38 | 39 |
40 | } 41 |
42 | } 43 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Editors/Render/media_wide.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoViewPage 2 | 3 | @if (Model.value != null) 4 | { 5 | var url = Model.value.image; 6 | if(Model.editor.config != null && Model.editor.config.size != null){ 7 | url += "?width=" + Model.editor.config.size.width; 8 | url += "&height=" + Model.editor.config.size.height; 9 | 10 | if(Model.value.focalPoint != null){ 11 | url += "¢er=" + Model.value.focalPoint.top +"," + Model.value.focalPoint.left; 12 | url += "&mode=crop"; 13 | } 14 | } 15 | 16 | @Model.value.caption 17 | 18 | if (Model.value.caption != null) 19 | { 20 |

@Model.value.caption

21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Editors/Render/quote_with_description.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoViewPage 2 | 3 | @if (Model.editor.config.markup != null) 4 | { 5 | string markup = Model.editor.config.markup.ToString(); 6 | 7 | markup = markup.Replace("#value#", Model.value.ToString()); 8 | markup = markup.Replace("#style#", Model.editor.config.style.ToString()); 9 | 10 | 11 | @Html.Raw(markup) 12 | 13 | } 14 | else 15 | { 16 | 17 |
18 |
19 |
20 |
@Model.value.quote
21 |
22 |
23 |
24 |
25 |

26 | @Model.value.headline 27 |
28 | @Model.value.description 29 |

30 |
31 |
32 |
33 |
34 | } 35 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Editors/Views/media_with_description.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
Click to insert image
6 |
7 | 8 |
9 |
10 | 15 |
16 |
17 | 24 | 30 |
31 |
32 |
33 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Plugins/Grid/Editors/Views/quote_with_description.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 15 | 21 |
22 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Start/UmbracoAuthTokenServerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Owin; 4 | using Microsoft.Owin.Security.OAuth; 5 | using Owin; 6 | using Umbraco.IdentityExtensions; 7 | using Umbraco.Web.Security.Identity; 8 | using TestSite; 9 | 10 | namespace TestSite 11 | { 12 | 13 | /// 14 | /// Extension methods to configure Umbraco for issuing and processing tokens for authentication 15 | /// 16 | public static class UmbracoAuthTokenServerExtensions 17 | { 18 | 19 | /// 20 | /// Configures Umbraco to issue and process authentication tokens 21 | /// 22 | /// 23 | /// 24 | /// 25 | /// This is a very simple implementation of token authentication, the expiry below is for a single day and with 26 | /// this implementation there is no way to force expire tokens on the server however given the code below and the additional 27 | /// callbacks that can be registered for the BackOfficeAuthServerProvider these types of things could be implemented. Additionally the 28 | /// BackOfficeAuthServerProvider could be overridden to include this functionality instead of coding the logic into the callbacks. 29 | /// 30 | /// 31 | /// 32 | /// An example of using this implementation is to use the UmbracoStandardOwinSetup and execute this extension method as follows: 33 | /// 34 | /// 46 | /// 47 | /// Then be sure to read the details in UmbracoStandardOwinSetup on how to configure Owin to startup using it. 48 | /// 49 | public static void UseUmbracoBackOfficeTokenAuth(this IAppBuilder app, BackOfficeAuthServerProviderOptions backofficeAuthServerProviderOptions = null) 50 | { 51 | var oAuthServerOptions = new OAuthAuthorizationServerOptions() 52 | { 53 | //generally you wouldn't allow this unless on SSL! 54 | #if DEBUG 55 | AllowInsecureHttp = true, 56 | #endif 57 | 58 | TokenEndpointPath = new PathString("/umbraco/oauth/token"), 59 | //set as different auth type to not interfere with anyone doing this on the front-end 60 | AuthenticationType = Umbraco.Core.Constants.Security.BackOfficeTokenAuthenticationType, 61 | AccessTokenExpireTimeSpan = TimeSpan.FromDays(1), 62 | Provider = new BackOfficeAuthServerProvider(backofficeAuthServerProviderOptions) 63 | { 64 | OnValidateClientAuthentication = context => 65 | { 66 | // Called to validate that the origin of the request is a registered "client_id", and that the correct credentials for that client are 67 | // present on the request. If the web application accepts Basic authentication credentials, 68 | // context.TryGetBasicCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request header. If the web 69 | // application accepts "client_id" and "client_secret" as form encoded POST parameters, 70 | // context.TryGetFormCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request body. 71 | // If context.Validated is not called the request will not proceed further. 72 | 73 | //** Currently we just accept everything globally 74 | context.Validated(); 75 | return Task.FromResult(0); 76 | 77 | // Example for checking registered clients: 78 | 79 | //** Validate that the data is in the request 80 | //string clientId; 81 | //string clientSecret; 82 | //if (context.TryGetFormCredentials(out clientId, out clientSecret) == false) 83 | //{ 84 | // context.SetError("invalid_client", "Form credentials could not be retrieved."); 85 | // context.Rejected(); 86 | // return Task.FromResult(0); 87 | //} 88 | 89 | //var userManager = context.OwinContext.GetUserManager(); 90 | 91 | //** Check if this client id is allowed/registered 92 | // - lookup in custom table 93 | 94 | //** Verify that the client id and client secret match 95 | //if (client != null && userManager.PasswordHasher.VerifyHashedPassword(client.ClientSecretHash, clientSecret) == PasswordVerificationResult.Success) 96 | //{ 97 | // // Client has been verified. 98 | // context.Validated(clientId); 99 | //} 100 | //else 101 | //{ 102 | // // Client could not be validated. 103 | // context.SetError("invalid_client", "Client credentials are invalid."); 104 | // context.Rejected(); 105 | //} 106 | } 107 | } 108 | }; 109 | 110 | // Token Generation 111 | app.UseOAuthAuthorizationServer(oAuthServerOptions); 112 | app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); 113 | 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Start/UmbracoCustomOwinStartup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | using Umbraco.Core; 4 | using Umbraco.Core.Security; 5 | using Umbraco.Web.Security.Identity; 6 | using Umbraco.IdentityExtensions; 7 | using TestSite; 8 | 9 | //To use this startup class, change the appSetting value in the web.config called 10 | // "owin:appStartup" to be "UmbracoCustomOwinStartup" 11 | 12 | [assembly: OwinStartup("UmbracoCustomOwinStartup", typeof(UmbracoCustomOwinStartup))] 13 | 14 | namespace TestSite 15 | { 16 | /// 17 | /// A custom way to configure OWIN for Umbraco 18 | /// 19 | /// 20 | /// The startup type is specified in appSettings under owin:appStartup - change it to "UmbracoCustomOwinStartup" to use this class 21 | /// 22 | /// This startup class would allow you to customize the Identity IUserStore and/or IUserManager for the Umbraco Backoffice 23 | /// 24 | public class UmbracoCustomOwinStartup 25 | { 26 | public void Configuration(IAppBuilder app) 27 | { 28 | //Configure the Identity user manager for use with Umbraco Back office 29 | 30 | // *** EXPERT: There are several overloads of this method that allow you to specify a custom UserStore or even a custom UserManager! 31 | app.ConfigureUserManagerForUmbracoBackOffice( 32 | ApplicationContext.Current, 33 | //The Umbraco membership provider needs to be specified in order to maintain backwards compatibility with the 34 | // user password formats. The membership provider is not used for authentication, if you require custom logic 35 | // to validate the username/password against an external data source you can create create a custom UserManager 36 | // and override CheckPasswordAsync 37 | global::Umbraco.Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider()); 38 | 39 | //Ensure owin is configured for Umbraco back office authentication 40 | app 41 | .UseUmbracoBackOfficeCookieAuthentication(ApplicationContext.Current) 42 | .UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext.Current); 43 | 44 | /* 45 | * Configure external logins for the back office: 46 | * 47 | * Depending on the authentication sources you would like to enable, you will need to install 48 | * certain Nuget packages. 49 | * 50 | * For Google auth: Install-Package UmbracoCms.IdentityExtensions.Google 51 | * For Facebook auth: Install-Package UmbracoCms.IdentityExtensions.Facebook 52 | * For Microsoft auth: Install-Package UmbracoCms.IdentityExtensions.Microsoft 53 | * For Azure ActiveDirectory auth: Install-Package UmbracoCms.IdentityExtensions.AzureActiveDirectory 54 | * 55 | * There are many more providers such as Twitter, Yahoo, ActiveDirectory, etc... most information can 56 | * be found here: http://www.asp.net/web-api/overview/security/external-authentication-services 57 | * 58 | * For sample code on using external providers with the Umbraco back office, install one of the 59 | * packages listed above to review it's code samples 60 | * 61 | */ 62 | 63 | /* 64 | * To configure a simple auth token server for the back office: 65 | * 66 | * By default the CORS policy is to allow all requests 67 | * 68 | * app.UseUmbracoBackOfficeTokenAuth(new BackOfficeAuthServerProviderOptions()); 69 | * 70 | * If you want to have a custom CORS policy for the token server you can provide 71 | * a custom CORS policy, example: 72 | * 73 | * app.UseUmbracoBackOfficeTokenAuth( 74 | * new BackOfficeAuthServerProviderOptions() 75 | * { 76 | * //Modify the CorsPolicy as required 77 | * CorsPolicy = new CorsPolicy() 78 | * { 79 | * AllowAnyHeader = true, 80 | * AllowAnyMethod = true, 81 | * Origins = { "http://mywebsite.com" } 82 | * } 83 | * }); 84 | */ 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/App_Start/UmbracoStandardOwinStartup.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Cors; 2 | using Microsoft.Owin; 3 | using Owin; 4 | using Umbraco.Web; 5 | using TestSite; 6 | using Umbraco.Core; 7 | using Umbraco.RestApi; 8 | 9 | //To use this startup class, change the appSetting value in the web.config called 10 | // "owin:appStartup" to be "UmbracoStandardOwinStartup" 11 | 12 | [assembly: OwinStartup("UmbracoStandardOwinStartup", typeof(UmbracoStandardOwinStartup))] 13 | 14 | namespace TestSite 15 | { 16 | /// 17 | /// The standard way to configure OWIN for Umbraco 18 | /// 19 | /// 20 | /// The startup type is specified in appSettings under owin:appStartup - change it to "StandardUmbracoStartup" to use this class 21 | /// 22 | public class UmbracoStandardOwinStartup : UmbracoDefaultOwinStartup 23 | { 24 | public override void Configuration(IAppBuilder app) 25 | { 26 | // Ensure the default options are configured 27 | base.Configuration(app); 28 | 29 | // Configuring the Umbraco REST API options 30 | app.ConfigureUmbracoRestApi(new UmbracoRestApiOptions() 31 | { 32 | // Modify the CorsPolicy as required 33 | CorsPolicy = new CorsPolicy() 34 | { 35 | AllowAnyHeader = true, 36 | AllowAnyMethod = true, 37 | AllowAnyOrigin = true 38 | } 39 | }); 40 | 41 | // Enabling the authentication based on Umbraco back office cookie 42 | // Uncomment below line when testing the HAL Browser inside Umbraco webapp 43 | app.UseUmbracoCookieAuthenticationForRestApi(ApplicationContext.Current); 44 | 45 | // Enabling the usage of auth token retrieved by backoffice user / login 46 | // Uncomment below line when testing the PoC website 47 | app.UseUmbracoBackOfficeTokenAuth(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/404handlers.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/BaseRestExtensions.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 13 | 19 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/ClientDependency.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 13 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Dashboard.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | 6 | settings 7 | 8 | 9 | 10 | views/dashboard/settings/settingsdashboardintro.html 11 | 12 | 13 |
14 | 15 |
16 | 17 | forms 18 | 19 | 20 | 21 | views/dashboard/forms/formsdashboardintro.html 22 | 23 | 24 |
25 | 26 |
27 | 28 | developer 29 | 30 | 31 | 32 | views/dashboard/developer/developerdashboardvideos.html 33 | 34 | 35 | 36 | 37 | views/dashboard/developer/examinemanagement.html 38 | 39 | 40 | 41 | 42 | views/dashboard/developer/xmldataintegrityreport.html 43 | 44 | 45 |
46 | 47 |
48 | 49 | media 50 | 51 | 52 | 53 | views/dashboard/media/mediafolderbrowser.html 54 | 55 | 56 | 57 |
58 | 59 |
60 | 61 | translator 62 | 63 | 64 | content 65 | 66 | 67 | 68 | admin 69 | 70 | 71 | 72 | views/dashboard/default/startupdashboardintro.html 73 | 74 | 75 | 76 | 77 | 78 | views/dashboard/ChangePassword.html 79 | 80 | 81 |
82 | 83 |
84 | 85 | member 86 | 87 | 88 | 89 | views/dashboard/members/membersdashboardvideos.html 90 | 91 | 92 |
93 |
94 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/EmbeddedMedia.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | xml 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 1 71 | xml 72 | https 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | xml 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | xml 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/ExamineIndex.config: -------------------------------------------------------------------------------- 1 |  2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/ExamineSettings.config: -------------------------------------------------------------------------------- 1 |  2 | 9 | 10 | 11 | 12 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/FileSystemProviders.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/cs-CZ.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/da-DK.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/de-DE.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/en-GB.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/en-US.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/es-ES.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/fr-FR.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/he-IL.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/it-IT.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/ja-JP.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/ko-KR.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/nb-NO.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/nl-NL.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/pl-PL.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/pt-BR.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/ru-RU.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/sv-SE.user.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/Lang/zh-CN.user.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/UrlRewriting.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/applications.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/feedProxy.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/grid.editors.config.js: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Rich text editor", 4 | "alias": "rte", 5 | "view": "rte", 6 | "icon": "icon-article" 7 | }, 8 | { 9 | "name": "Image", 10 | "alias": "media", 11 | "view": "media", 12 | "icon": "icon-picture" 13 | }, 14 | { 15 | "name": "Image wide", 16 | "alias": "media_wide", 17 | "view": "media", 18 | "render": "/App_Plugins/Grid/Editors/Render/media_wide.cshtml", 19 | "icon": "icon-picture" 20 | }, 21 | { 22 | "name": "Image wide cropped", 23 | "alias": "media_wide_cropped", 24 | "view": "media", 25 | "render": "media", 26 | "icon": "icon-picture", 27 | "config": { 28 | "size": { 29 | "width": 1920, 30 | "height": 700 31 | } 32 | } 33 | }, 34 | { 35 | "name": "Image rounded", 36 | "alias": "media_round", 37 | "view": "media", 38 | "render": "/App_Plugins/Grid/Editors/Render/media_round.cshtml", 39 | "icon": "icon-picture" 40 | }, 41 | { 42 | "name": "Image w/ text right", 43 | "alias": "media_text_right", 44 | "view": "/App_Plugins/Grid/Editors/Views/media_with_description.html", 45 | "render": "/App_Plugins/Grid/Editors/Render/media_text_right.cshtml", 46 | "icon": "icon-picture" 47 | }, 48 | { 49 | "name": "Macro", 50 | "alias": "macro", 51 | "view": "macro", 52 | "icon": "icon-settings-alt" 53 | }, 54 | { 55 | "name": "Embed", 56 | "alias": "embed", 57 | "view": "embed", 58 | "render": "/App_Plugins/Grid/Editors/Render/embed_videowrapper.cshtml", 59 | "icon": "icon-movie-alt" 60 | }, 61 | { 62 | "name": "Banner Headline", 63 | "alias": "banner_headline", 64 | "view": "textstring", 65 | "icon": "icon-coin", 66 | "config": { 67 | "style": "font-size: 36px; line-height: 45px; font-weight: bold; text-align:center", 68 | "markup": "

#value#

" 69 | } 70 | }, 71 | { 72 | "name": "Banner Tagline", 73 | "alias": "banner_tagline", 74 | "view": "textstring", 75 | "icon": "icon-coin", 76 | "config": { 77 | "style": "font-size: 25px; line-height: 35px; font-weight: normal; text-align:center", 78 | "markup": "

#value#

" 79 | } 80 | }, 81 | { 82 | "name": "Headline", 83 | "alias": "headline", 84 | "view": "textstring", 85 | "icon": "icon-coin", 86 | "config": { 87 | "style": "font-size: 36px; line-height: 45px; font-weight: bold", 88 | "markup": "

#value#

" 89 | } 90 | }, 91 | { 92 | "name": "Headline centered", 93 | "alias": "headline_centered", 94 | "view": "textstring", 95 | "icon": "icon-coin", 96 | "config": { 97 | "style": "font-size: 30px; line-height: 45px; font-weight: bold; text-align:center;", 98 | "markup": "

#value#

" 99 | } 100 | }, 101 | { 102 | "name": "Abstract", 103 | "alias": "abstract", 104 | "view": "textstring", 105 | "icon": "icon-coin", 106 | "config": { 107 | "style": "font-size: 16px; line-height: 20px; font-weight: bold;", 108 | "markup": "

#value#

" 109 | } 110 | }, 111 | { 112 | "name": "Paragraph", 113 | "alias": "paragraph", 114 | "view": "textstring", 115 | "icon": "icon-font", 116 | "config": { 117 | "style": "font-size: 16px; line-height: 20px; font-weight: light;", 118 | "markup": "

#value#

" 119 | } 120 | }, 121 | { 122 | "name": "Quote", 123 | "alias": "quote", 124 | "view": "textstring", 125 | "icon": "icon-quote", 126 | "config": { 127 | "style": "border-left: 3px solid #ccc; padding: 10px; color: #ccc; font-family: serif; font-variant: italic; font-size: 18px", 128 | "markup": "
#value#
" 129 | } 130 | }, 131 | { 132 | "name": "Quote with description", 133 | "alias": "quote_D", 134 | "view": "/App_Plugins/Grid/Editors/Views/quote_with_description.html", 135 | "render": "/App_Plugins/Grid/Editors/Render/quote_with_description.cshtml", 136 | "icon": "icon-quote", 137 | "config": { 138 | "style": "border-left: 3px solid #ccc; padding: 10px; color: #ccc; font-family: serif; font-variant: italic; font-size: 18px" 139 | } 140 | }, 141 | { 142 | "name": "Code", 143 | "alias": "code", 144 | "view": "textstring", 145 | "icon": "icon-code", 146 | "config": { 147 | "style": "overflow: auto;padding: 6px 10px;border: 1px solid #ddd;border-radius: 3px;background-color: #f8f8f8;font-size: .9rem;font-family: 'Courier 10 Pitch', Courier, monospace;line-height: 19px;", 148 | "markup": "
#value#
" 149 | } 150 | } 151 | ] -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/log4net.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/metablogConfig.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/scripting.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/splashes/booting.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" %> 2 | 3 | <% 4 | // NH: Adds this inline check to avoid a simple codebehind file in the legacy project! 5 | if (Request["url"].ToLower().Contains("booting.aspx") || !umbraco.cms.helpers.url.ValidateProxyUrl(Request["url"], Request.Url.AbsoluteUri)) 6 | { 7 | throw new ArgumentException("Can't redirect to the requested url - it's not local or an approved proxy url", 8 | "url"); 9 | } 10 | %> 11 | 12 | 13 | 14 | The website is restarting 15 | "> 16 | 17 | 18 |

The website is restarting

19 |

Please wait for 10s while we prepare to serve the page you have requested...

20 | 21 |

22 | You can modify the design of this page by editing /config/splashes/booting.aspx 23 |

24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/splashes/noNodes.aspx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzajkowski/umbraco-rest-api-playground/a0d6aa155feb846771f013f50e7bc9beac5466e3/RestApiPlayground/TestSite/Config/splashes/noNodes.aspx -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/tinyMceConfig.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | code 8 | images/editor/code.gif 9 | code 10 | 1 11 | 12 | 13 | codemirror 14 | images/editor/code.gif 15 | codemirror 16 | 1 17 | 18 | 19 | removeformat 20 | images/editor/removeformat.gif 21 | removeformat 22 | 2 23 | 24 | 25 | 26 | Undo 27 | images/editor/undo.gif 28 | undo 29 | 11 30 | 31 | 32 | Redo 33 | images/editor/redo.gif 34 | redo 35 | 12 36 | 37 | 38 | Cut 39 | images/editor/cut.gif 40 | cut 41 | 13 42 | 43 | 44 | Copy 45 | images/editor/copy.gif 46 | copy 47 | 14 48 | 49 | 50 | 51 | styleselect 52 | images/editor/showStyles.png 53 | styleselect 54 | 20 55 | 56 | 57 | bold 58 | images/editor/bold.gif 59 | bold 60 | 21 61 | 62 | 63 | italic 64 | images/editor/italic.gif 65 | italic 66 | 22 67 | 68 | 69 | Underline 70 | images/editor/underline.gif 71 | underline 72 | 23 73 | 74 | 75 | Strikethrough 76 | images/editor/strikethrough.gif 77 | strikethrough 78 | 24 79 | 80 | 81 | 82 | JustifyLeft 83 | images/editor/justifyleft.gif 84 | justifyleft 85 | 31 86 | 87 | 88 | JustifyCenter 89 | images/editor/justifycenter.gif 90 | justifycenter 91 | 32 92 | 93 | 94 | JustifyRight 95 | images/editor/justifyright.gif 96 | justifyright 97 | 33 98 | 99 | 100 | JustifyFull 101 | images/editor/justifyfull.gif 102 | alignjustify 103 | 34 104 | 105 | 106 | 107 | bullist 108 | images/editor/bullist.gif 109 | bullist 110 | 41 111 | 112 | 113 | numlist 114 | images/editor/numlist.gif 115 | numlist 116 | 42 117 | 118 | 119 | Outdent 120 | images/editor/outdent.gif 121 | outdent 122 | 43 123 | 124 | 125 | Indent 126 | images/editor/indent.gif 127 | indent 128 | 44 129 | 130 | 131 | 132 | mceLink 133 | images/editor/link.gif 134 | link 135 | 51 136 | 137 | 138 | unlink 139 | images/editor/unLink.gif 140 | unlink 141 | 52 142 | 143 | 144 | mceInsertAnchor 145 | images/editor/anchor.gif 146 | anchor 147 | 53 148 | 149 | 150 | 151 | mceImage 152 | images/editor/image.gif 153 | image 154 | 61 155 | 156 | 157 | 158 | umbracomacro 159 | images/editor/insMacro.gif 160 | umbracomacro 161 | 62 162 | 163 | 164 | 165 | 166 | 167 | mceInsertTable 168 | images/editor/table.gif 169 | table 170 | 63 171 | 172 | 173 | 174 | umbracoembed 175 | images/editor/media.gif 176 | umbracoembed 177 | 66 178 | 179 | 180 | inserthorizontalrule 181 | images/editor/hr.gif 182 | hr 183 | 71 184 | 185 | 186 | subscript 187 | images/editor/sub.gif 188 | subscript 189 | 72 190 | 191 | 192 | 193 | superscript 194 | images/editor/sup.gif 195 | superscript 196 | 73 197 | 198 | 199 | 200 | mceCharMap 201 | images/editor/charmap.gif 202 | charmap 203 | 74 204 | 205 | 206 | 207 | 208 | code 209 | codemirror 210 | paste 211 | umbracolink 212 | anchor 213 | charmap 214 | table 215 | lists 216 | 217 | 218 | 230 | 231 | font 232 | 233 | 234 | 235 | 236 | raw 237 | 238 | { 239 | "indentOnInit": false, 240 | "path": "../../../../lib/codemirror", 241 | "config": { 242 | }, 243 | "jsFiles": [ 244 | ], 245 | "cssFiles": [ 246 | ] 247 | } 248 | 249 | 250 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/trees.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Config/umbracoSettings.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 1 15 | 21 | 27 | 28 | 29 | 30 | 31 | your@email.here 32 | 33 | 34 | 35 | text 36 | 37 | 38 | 39 | In Preview Mode - click to end]]> 40 | 41 | 42 | 43 | 1800 44 | 45 | 51 | inline 52 | 53 | 54 | ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,svg,php,htaccess 55 | 56 | 57 | Textstring 58 | 59 | 60 | 61 | 62 | false 63 | 64 | false 65 | 66 | 67 | 68 | 69 | false 70 | 71 | true 72 | 73 | 74 | 75 | 76 | Mvc 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 0 89 | 90 | 94 | 95 | 96 | 97 | 124 | 125 | 126 | 127 | 128 | 155 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("TestSite")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("TestSite")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("c05102fd-5c01-49fe-8a9b-3fbed137f796")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Revision and Build Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.0.0.0")] 34 | [assembly: AssemblyFileVersion("1.0.0.0")] 35 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/BlogOverview.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 2 | @{ 3 | Layout = "Master.cshtml"; 4 | } 5 | 6 |
7 | 8 |
9 |
10 | 11 |
12 | @foreach(var post in CurrentPage.Children) 13 | { 14 | 23 | } 24 |
25 |
26 |
27 | 28 |
-------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/BlogPost.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 2 | @{ 3 | Layout = "Master.cshtml"; 4 | } 5 | 6 | @CurrentPage.GetGridHtml("content", "fanoe") -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Home.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 2 | @{ 3 | Layout = "Master.cshtml"; 4 | } 5 | 6 | @CurrentPage.GetGridHtml("content", "fanoe") -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Master.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 2 | @{ 3 | Layout = null; 4 | var home = @CurrentPage.Site(); 5 | } 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | @CurrentPage.Name | @CurrentPage._siteTitle 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 |
45 |
46 | 51 |
52 |
53 |
54 | 55 |
56 | 57 |
58 |
59 | 60 | @RenderBody() 61 | 62 |
63 |
64 |
65 | 66 | @{ Html.RenderPartial("BottomNavigation"); } 67 | 68 |
69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/BottomNavigation.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 2 | @{ 3 | var home = CurrentPage.Site(); 4 | } 5 | 6 | @if (home.Children.Where("Visible").Any()) 7 | { 8 | @* For each child page under the home node, where the property umbracoNaviHide is not True *@ 9 | foreach (var childPage in home.Children.Where("Visible")) 10 | { 11 |
12 | @if (childPage.Children.Where("Visible").Any()) 13 | { 14 | @childPage.Name 15 | @childPages(childPage.Children) 16 | } 17 |
18 | } 19 | } 20 | 21 |
22 | Find us 23 | 34 |
35 | 36 | @helper childPages(dynamic pages) 37 | { 38 | @* Ensure that we have a collection of pages *@ 39 | if (pages.Any()) 40 | { 41 |
    42 | @foreach (var page in pages.Where("Visible")) 43 | { 44 |
  • 45 | @page.Name 46 |
  • 47 | } 48 |
49 | } 50 | } -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Bootstrap2.cshtml: -------------------------------------------------------------------------------- 1 | @inherits UmbracoViewPage 2 | @using Umbraco.Web.Templates 3 | @using Newtonsoft.Json.Linq 4 | 5 | @if (Model != null && Model.sections != null) 6 | { 7 | var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1; 8 | 9 |
10 | @if (oneColumn) 11 | { 12 | foreach (var section in Model.sections) { 13 |
14 | @foreach (var row in section.rows) { 15 | @renderRow(row, true); 16 | } 17 |
18 | } 19 | }else { 20 |
21 |
22 | @foreach (var s in Model.sections) { 23 |
24 |
25 | @foreach (var row in s.rows) { 26 | @renderRow(row, false); 27 | } 28 |
29 |
30 | } 31 |
32 |
33 | } 34 |
35 | } 36 | 37 | @helper renderRow(dynamic row, bool singleColumn){ 38 |
39 | @Umbraco.If(singleColumn, "
") 40 |
41 | @foreach ( var area in row.areas ) { 42 |
43 |
44 | @foreach (var control in area.controls) { 45 | if (control !=null && control.editor != null && control.editor.view != null ) { 46 | @Html.Partial("grid/editors/base", (object)control) 47 | } 48 | } 49 |
50 |
} 51 |
52 | @Umbraco.If(singleColumn, "
") 53 |
54 | } 55 | 56 | @functions { 57 | public static MvcHtmlString RenderElementAttributes(dynamic contentItem) 58 | { 59 | var attrs = new List(); 60 | JObject cfg = contentItem.config; 61 | 62 | if(cfg != null) 63 | foreach (JProperty property in cfg.Properties()) { 64 | attrs.Add(property.Name + "='" + property.Value.ToString() + "'"); 65 | } 66 | 67 | JObject style = contentItem.styles; 68 | 69 | if (style != null) { 70 | var cssVals = new List(); 71 | foreach (JProperty property in style.Properties()) 72 | cssVals.Add(property.Name + ":" + property.Value.ToString() + ";"); 73 | 74 | if (cssVals.Any()) 75 | attrs.Add("style='" + string.Join(" ", cssVals) + "'"); 76 | } 77 | 78 | return new MvcHtmlString(string.Join(" ", attrs)); 79 | } 80 | } -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Bootstrap3.cshtml: -------------------------------------------------------------------------------- 1 | @inherits UmbracoViewPage 2 | @using Umbraco.Web.Templates 3 | @using Newtonsoft.Json.Linq 4 | 5 | @if (Model != null && Model.sections != null) 6 | { 7 | var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1; 8 | 9 |
10 | @if (oneColumn) 11 | { 12 | foreach (var section in Model.sections) { 13 |
14 | @foreach (var row in section.rows) { 15 | @renderRow(row, true); 16 | } 17 |
18 | } 19 | }else { 20 |
21 |
22 | @foreach (var s in Model.sections) { 23 |
24 |
25 | @foreach (var row in s.rows) { 26 | @renderRow(row, false); 27 | } 28 |
29 |
30 | } 31 |
32 |
33 | } 34 |
35 | } 36 | 37 | @helper renderRow(dynamic row, bool singleColumn){ 38 |
39 | @Umbraco.If(singleColumn, "
") 40 |
41 | @foreach ( var area in row.areas ) { 42 |
43 |
44 | @foreach (var control in area.controls) { 45 | if (control !=null && control.editor != null && control.editor.view != null ) { 46 | @Html.Partial("grid/editors/base", (object)control) 47 | } 48 | } 49 |
50 |
} 51 |
52 | @Umbraco.If(singleColumn, "
") 53 |
54 | } 55 | 56 | @functions { 57 | public static MvcHtmlString RenderElementAttributes(dynamic contentItem) 58 | { 59 | var attrs = new List(); 60 | JObject cfg = contentItem.config; 61 | 62 | if(cfg != null) 63 | foreach (JProperty property in cfg.Properties()) { 64 | attrs.Add(property.Name + "='" + property.Value.ToString() + "'"); 65 | } 66 | 67 | JObject style = contentItem.styles; 68 | 69 | if (style != null) { 70 | var cssVals = new List(); 71 | foreach (JProperty property in style.Properties()) 72 | cssVals.Add(property.Name + ":" + property.Value.ToString() + ";"); 73 | 74 | if (cssVals.Any()) 75 | attrs.Add("style='" + string.Join(" ", cssVals) + "'"); 76 | } 77 | 78 | return new MvcHtmlString(string.Join(" ", attrs)); 79 | } 80 | } -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Editors/Base.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @using Umbraco.Web.Templates 3 | 4 | @functions { 5 | public static string EditorView(dynamic contentItem) 6 | { 7 | string view = contentItem.editor.render != null ? contentItem.editor.render.ToString() : contentItem.editor.view.ToString(); 8 | view = view.ToLower().Replace(".html", ".cshtml"); 9 | 10 | if (!view.Contains("/")) { 11 | view = "grid/editors/" + view; 12 | } 13 | 14 | return view; 15 | } 16 | } 17 | @try 18 | { 19 | string editor = EditorView(Model); 20 | @Html.Partial(editor, (object)Model) 21 | } 22 | catch (Exception ex) { 23 |
@ex.ToString()
24 | } -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Editors/Embed.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @using Umbraco.Web.Templates 3 | 4 | 5 |
6 | @Html.Raw(Model.value) 7 |
8 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Editors/Macro.cshtml: -------------------------------------------------------------------------------- 1 | @inherits UmbracoViewPage 2 | @using Umbraco.Web.Templates 3 | 4 | 5 | @if (Model.value != null) 6 | { 7 | string macroAlias = Model.value.macroAlias.ToString(); 8 | ViewDataDictionary parameters = new ViewDataDictionary(); 9 | foreach (dynamic mpd in Model.value.macroParamsDictionary) 10 | { 11 | parameters.Add(mpd.Name, mpd.Value); 12 | } 13 | 14 | 15 | @Umbraco.RenderMacro(macroAlias, parameters) 16 | 17 | } 18 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Editors/Media.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @using Umbraco.Web.Templates 3 | 4 | @if (Model.value != null) 5 | { 6 | var url = Model.value.image; 7 | if(Model.editor.config != null && Model.editor.config.size != null){ 8 | url += "?width=" + Model.editor.config.size.width; 9 | url += "&height=" + Model.editor.config.size.height; 10 | 11 | if(Model.value.focalPoint != null){ 12 | url += "¢er=" + Model.value.focalPoint.top +"," + Model.value.focalPoint.left; 13 | url += "&mode=crop"; 14 | } 15 | } 16 | 17 | @Model.value.caption 18 | 19 | if (Model.value.caption != null) 20 | { 21 |

@Model.value.caption

22 | } 23 | } 24 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Editors/Rte.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @using Umbraco.Web.Templates 3 | 4 | @Html.Raw(TemplateUtilities.ParseInternalLinks(Model.value.ToString())) 5 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Editors/Textstring.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @using Umbraco.Web.Templates 3 | 4 | @if (Model.editor.config.markup != null) 5 | { 6 | string markup = Model.editor.config.markup.ToString(); 7 | 8 | markup = markup.Replace("#value#", Model.value.ToString()); 9 | markup = markup.Replace("#style#", Model.editor.config.style.ToString()); 10 | 11 | 12 | @Html.Raw(markup) 13 | 14 | } 15 | else 16 | { 17 | 18 |
@Model.value
19 |
20 | } 21 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/Grid/Fanoe.cshtml: -------------------------------------------------------------------------------- 1 | @inherits UmbracoViewPage 2 | @using Umbraco.Web.Templates 3 | @using Newtonsoft.Json.Linq 4 | 5 | @if (Model != null && Model.sections != null) 6 | { 7 | var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1; 8 | 9 |
10 | @if (oneColumn) 11 | { 12 | foreach (var section in Model.sections) 13 | { 14 |
15 | @foreach (var row in section.rows) 16 | { 17 | @renderRow(row, true); 18 | } 19 |
20 | } 21 | } 22 | else 23 | { 24 |
25 |
26 | @foreach (var s in Model.sections) 27 | { 28 |
29 |
30 | @foreach (var row in s.rows) 31 | { 32 | @renderRow(row, false); 33 | } 34 |
35 |
36 | } 37 |
38 |
39 | } 40 |
41 | } 42 | 43 | @helper renderRow(dynamic row, bool singleColumn) 44 | { 45 |
46 | @Umbraco.If(singleColumn, "
") 47 |
48 | @foreach ( var area in row.areas ) { 49 |
50 |
51 | @foreach (var control in area.controls) { 52 | if (control !=null && control.editor != null && control.editor.view != null ) { 53 | @Html.Partial("grid/editors/base", (object)control) 54 | } 55 | } 56 |
57 |
} 58 |
59 | @Umbraco.If(singleColumn, "
") 60 |
61 | } 62 | 63 | @functions 64 | { 65 | public static MvcHtmlString RenderElementAttributes(dynamic contentItem) 66 | { 67 | var attrs = new List(); 68 | JObject cfg = contentItem.config; 69 | 70 | if(cfg != null) 71 | { 72 | foreach (JProperty property in cfg.Properties()) 73 | { 74 | attrs.Add(property.Name + "='" + property.Value.ToString() + "'"); 75 | } 76 | } 77 | 78 | JObject style = contentItem.styles; 79 | 80 | if (style != null) 81 | { 82 | var cssVals = new List(); 83 | foreach (JProperty property in style.Properties()) 84 | { 85 | cssVals.Add(property.Name + ":" + property.Value.ToString() + ";"); 86 | } 87 | 88 | if (cssVals.Any()) 89 | { 90 | attrs.Add("style='" + string.Join(" ", cssVals) + "'"); 91 | } 92 | } 93 | 94 | return new MvcHtmlString(string.Join(" ", attrs)); 95 | } 96 | } -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Partials/MainNavigation.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 2 | @{ var home = CurrentPage.Site(); } 3 | 4 | @if (home.Children.Any()) 5 | { 6 | @* Get the first page in the children *@ 7 | var naviLevel = home.Children.First().Level; 8 | 9 | @* Add in level for a CSS hook *@ 10 |
    11 | @* For each child page under the home node *@ 12 | @foreach (var childPage in home.Children) 13 | { 14 | if (childPage.Children.Any()) 15 | { 16 |
  • 17 | @if(childPage.DocumentTypeAlias == "LandingPage") 18 | { 19 | @childPage.Name 20 | @childPages(childPage.Children) 21 | } else { 22 | @childPage.Name 23 | } 24 |
  • 25 | } 26 | else 27 | { 28 |
  • 29 | @childPage.Name 30 |
  • 31 | } 32 | } 33 |
34 | } 35 | 36 | @helper childPages(dynamic pages) 37 | { 38 | @* Ensure that we have a collection of pages *@ 39 | if (pages.Any()) 40 | { 41 | @* Get the first page in pages and get the level *@ 42 | var naviLevel = pages.First().Level; 43 | 44 | @* Add in level for a CSS hook *@ 45 |
    46 | @foreach (var page in pages) 47 | { 48 |
  • 49 | @page.Name 50 | 51 | @* if the current page has any children *@ 52 | @if (page.Children.Any()) 53 | { 54 | @* Call our helper to display the children *@ 55 | @childPages(page.Children) 56 | } 57 |
  • 58 | } 59 |
60 | } 61 | } -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/TextPage.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 2 | @{ 3 | Layout = "Master.cshtml"; 4 | } 5 | 6 | @CurrentPage.GetGridHtml("content", "fanoe") -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/css/rte.css: -------------------------------------------------------------------------------- 1 | /* EDITOR PROPERTIES - PLEASE DON'T DELETE THIS LINE TO AVOID DUPLICATE PROPERTIES */ 2 | h1 { 3 | font-size: 1.5rem; 4 | } 5 | 6 | blockquote { 7 | font-style: italic; 8 | } 9 | 10 | h2 { 11 | font-size: 1.4rem; 12 | } 13 | 14 | h3 { 15 | font-size: 1.2rem; 16 | } 17 | 18 | h5 { 19 | font-size: 1rem; font-weight: 100; 20 | } 21 | 22 | p { 23 | font-size: 1rem; 24 | } 25 | 26 | 27 | 28 | /**umb_name:Header*/ 29 | #Header{} 30 | 31 | /**umb_name:Header 2*/ 32 | #Header2{} 33 | 34 | /**umb_name:Header 3*/ 35 | #Header3{} 36 | 37 | /**umb_name:Smooth*/ 38 | #Smooth{} 39 | 40 | /**umb_name:Paragraph*/ 41 | #Paragraph{} 42 | 43 | /**umb_name:Blockquote*/ 44 | #Blockquote{} -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/css/style.css: -------------------------------------------------------------------------------- 1 | /* Go crazy with your own styles here */ 2 | /* EDITOR PROPERTIES - PLEASE DON'T DELETE THIS LINE TO AVOID DUPLICATE PROPERTIES */ 3 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="True" Inherits="umbraco.UmbracoDefault" trace="true" validateRequest="false" %> 2 | 3 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Mike Kelly, http://stateless.co/ 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/README.adoc: -------------------------------------------------------------------------------- 1 | = HAL-browser 2 | 3 | An API browser for the hal+json media type 4 | 5 | == Example Usage 6 | 7 | Here is an example of a hal+json API using the browser: 8 | 9 | http://haltalk.herokuapp.com/explorer/browser.html[http://haltalk.herokuapp.com/explorer/browser.html] 10 | 11 | == About HAL 12 | 13 | HAL is a format based on json that establishes conventions for 14 | representing links. For example: 15 | 16 | [source,javascript] 17 | ---- 18 | { 19 | "_links": { 20 | "self": { "href": "/orders" }, 21 | "next": { "href": "/orders?page=2" } 22 | } 23 | } 24 | ---- 25 | 26 | More detail about HAL can be found at 27 | http://stateless.co/hal_specification.html[http://stateless.co/hal_specification.html]. 28 | 29 | == Customizing the POST form 30 | 31 | By default, the HAL Browser can't assume there is any metadata. When you click on the non-GET request button (to create a new resource), the user must enter the JSON document to submit. If your service includes metadata you can access, it's possible to plugin a custom view that makes use of it. 32 | 33 | . Define your custom view. 34 | + 35 | Here is an example that leverages Spring Data REST's JSON Schema metadata found at */{entity}/schema*. 36 | + 37 | [source,javascript] 38 | ---- 39 | var CustomPostForm = Backbone.View.extend({ 40 | initialize: function (opts) { 41 | this.href = opts.href.split('{')[0]; 42 | this.vent = opts.vent; 43 | _.bindAll(this, 'createNewResource'); 44 | }, 45 | 46 | events: { 47 | 'submit form': 'createNewResource' 48 | }, 49 | 50 | className: 'modal fade', 51 | 52 | createNewResource: function (e) { 53 | e.preventDefault(); 54 | 55 | var self = this; 56 | 57 | var data = {} 58 | Object.keys(this.schema.properties).forEach(function(property) { 59 | if (!("format" in self.schema.properties[property])) { 60 | data[property] = self.$('input[name=' + property + ']').val(); 61 | } 62 | }); 63 | 64 | var opts = { 65 | url: this.$('.url').val(), 66 | headers: HAL.parseHeaders(this.$('.headers').val()), 67 | method: this.$('.method').val(), 68 | data: JSON.stringify(data) 69 | }; 70 | 71 | var request = HAL.client.request(opts); 72 | request.done(function (response) { 73 | self.vent.trigger('response', {resource: response, jqxhr: jqxhr}); 74 | }).fail(function (response) { 75 | self.vent.trigger('fail-response', {jqxhr: jqxhr}); 76 | }).always(function () { 77 | self.vent.trigger('response-headers', {jqxhr: jqxhr}); 78 | window.location.hash = 'NON-GET:' + opts.url; 79 | }); 80 | 81 | this.$el.modal('hide'); 82 | }, 83 | 84 | render: function (opts) { 85 | var headers = HAL.client.getHeaders(); 86 | var headersString = ''; 87 | 88 | _.each(headers, function (value, name) { 89 | headersString += name + ': ' + value + '\n'; 90 | }); 91 | 92 | var request = HAL.client.request({ 93 | url: this.href + '/schema', 94 | method: 'GET' 95 | }); 96 | 97 | var self = this; 98 | request.done(function (schema) { 99 | self.schema = schema; 100 | self.$el.html(self.template({ 101 | href: self.href, 102 | schema: self.schema, 103 | user_defined_headers: headersString})); 104 | self.$el.modal(); 105 | }); 106 | 107 | return this; 108 | }, 109 | template: _.template($('#dynamic-request-template').html()) 110 | }); 111 | ---- 112 | + 113 | . Register it by assigning to `HAL.customPostForm` 114 | + 115 | [source,javascript] 116 | ---- 117 | HAL.customPostForm = CustomPostForm; 118 | ---- 119 | + 120 | . Load your custom JavaScript component and define your custom HTML template. 121 | + 122 | [source,html,indent=0] 123 | ---- 124 | 152 | ---- 153 | 154 | NOTE: To load a custom JavaScript module AND a custom HTML template, you will probably need to create a customized version of `browser.html`. 155 | 156 | NOTE: The HAL Browser uses a global `HAL` object, so there is no need to deal with JavaScript packages. 157 | 158 | == Usage Instructions 159 | 160 | All you should need to do is copy the files into your webroot. 161 | It is OK to put it in a subdirectory; it does not need to be in the root. 162 | 163 | All the JS and CSS dependencies come included in the vendor directory. 164 | 165 | == TODO 166 | 167 | * Provide feedback to user when there are issues with response (missing 168 | self link, wrong media type identifier) 169 | * Give 'self' and 'curies' links special treatment -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The HAL Browser 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 34 | 35 |
36 | 37 | 46 | 47 | 111 | 112 | 116 | 117 | 121 | 122 | 137 | 138 | 142 | 143 | 164 | 165 | 166 | 196 | 197 | 200 | 201 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 256 | 257 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var urlRegex = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; 3 | 4 | var HAL = { 5 | Models: {}, 6 | Views: {}, 7 | Http: {}, 8 | currentDocument: {}, 9 | jsonIndent: 2, 10 | isUrl: function(str) { 11 | return str.match(urlRegex) || HAL.isCurie(str); 12 | }, 13 | isCurie: function(string) { 14 | var isCurie = false; 15 | var curieParts = string.split(':'); 16 | var curies = HAL.currentDocument._links.curies; 17 | 18 | if(curieParts.length > 1 && curies) { 19 | 20 | for (var i=0; i 1) { 72 | var name = parts.shift().trim(); 73 | var value = parts.join(':').trim(); 74 | headers[name] = value; 75 | } 76 | }); 77 | return headers; 78 | }, 79 | customPostForm: undefined 80 | }; 81 | 82 | window.HAL = HAL; 83 | })(); 84 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/browser.js: -------------------------------------------------------------------------------- 1 | HAL.Browser = Backbone.Router.extend({ 2 | initialize: function(opts) { 3 | opts = opts || {}; 4 | 5 | var vent = _.extend({}, Backbone.Events), 6 | $container = opts.container || $('#browser'); 7 | 8 | this.entryPoint = opts.entryPoint || '/'; 9 | 10 | // TODO: don't hang currentDoc off namespace 11 | vent.bind('response', function(e) { 12 | window.HAL.currentDocument = e.resource || {}; 13 | }); 14 | 15 | vent.bind('location-go', _.bind(this.loadUrl, this)); 16 | 17 | HAL.client = new HAL.Http.Client({ vent: vent }); 18 | 19 | var browser = new HAL.Views.Browser({ vent: vent, entryPoint: this.entryPoint }); 20 | browser.render() 21 | 22 | $container.html(browser.el); 23 | vent.trigger('app:loaded'); 24 | 25 | if (window.location.hash === '') { 26 | window.location.hash = this.entryPoint; 27 | } 28 | 29 | if(location.hash.slice(1,9) === 'NON-GET:') { 30 | new HAL.Views.NonSafeRequestDialog({ 31 | href: location.hash.slice(9), 32 | vent: vent 33 | }).render({}); 34 | } 35 | }, 36 | 37 | routes: { 38 | '*url': 'resourceRoute' 39 | }, 40 | 41 | loadUrl: function(url) { 42 | if (this.getHash() === url) { 43 | HAL.client.get(url); 44 | } else { 45 | window.location.hash = url; 46 | } 47 | }, 48 | 49 | getHash: function() { 50 | return window.location.hash.slice(1); 51 | }, 52 | 53 | resourceRoute: function() { 54 | url = location.hash.slice(1); 55 | console.log('target url changed to: ' + url); 56 | if (url.slice(0,8) !== 'NON-GET:') { 57 | HAL.client.get(url); 58 | } 59 | } 60 | }); 61 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/http/client.js: -------------------------------------------------------------------------------- 1 | HAL.Http.Client = function(opts) { 2 | this.vent = opts.vent; 3 | this.defaultHeaders = { 'Accept': 'application/hal+json, application/json, */*; q=0.01' }; 4 | cookie = document.cookie.match('(^|;)\\s*' + 'MyHalBrowserToken' + '\\s*=\\s*([^;]+)'); 5 | cookie ? this.defaultHeaders.Authorization = 'Bearer ' + cookie.pop() : ''; 6 | this.headers = this.defaultHeaders; 7 | }; 8 | 9 | HAL.Http.Client.prototype.get = function(url) { 10 | var self = this; 11 | this.vent.trigger('location-change', { url: url }); 12 | var jqxhr = $.ajax({ 13 | url: url, 14 | dataType: 'json', 15 | xhrFields: { 16 | withCredentials: false 17 | }, 18 | headers: this.headers, 19 | success: function(resource, textStatus, jqXHR) { 20 | self.vent.trigger('response', { 21 | resource: resource, 22 | jqxhr: jqXHR, 23 | headers: jqXHR.getAllResponseHeaders() 24 | }); 25 | } 26 | }).error(function() { 27 | self.vent.trigger('fail-response', { jqxhr: jqxhr }); 28 | }); 29 | }; 30 | 31 | HAL.Http.Client.prototype.request = function(opts) { 32 | var self = this; 33 | opts.dataType = 'json'; 34 | opts.xhrFields = opts.xhrFields || {}; 35 | opts.xhrFields.withCredentials = opts.xhrFields.withCredentials || false; 36 | self.vent.trigger('location-change', { url: opts.url }); 37 | return jqxhr = $.ajax(opts); 38 | }; 39 | 40 | HAL.Http.Client.prototype.updateHeaders = function(headers) { 41 | this.headers = headers; 42 | }; 43 | 44 | HAL.Http.Client.prototype.getHeaders = function() { 45 | return this.headers; 46 | }; 47 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/resource.js: -------------------------------------------------------------------------------- 1 | HAL.Models.Resource = Backbone.Model.extend({ 2 | initialize: function(representation) { 3 | representation = representation || {}; 4 | this.links = representation._links; 5 | this.title = representation.title; 6 | if(representation._embedded !== undefined) { 7 | this.embeddedResources = this.buildEmbeddedResources(representation._embedded); 8 | } 9 | this.set(representation); 10 | this.unset('_embedded', { silent: true }); 11 | this.unset('_links', { silent: true }); 12 | }, 13 | 14 | buildEmbeddedResources: function(embeddedResources) { 15 | var result = {}; 16 | _.each(embeddedResources, function(obj, rel) { 17 | if($.isArray(obj)) { 18 | var arr = []; 19 | _.each(obj, function(resource, i) { 20 | var newResource = new HAL.Models.Resource(resource); 21 | newResource.identifier = rel + '[' + i + ']'; 22 | newResource.embed_rel = rel; 23 | arr.push(newResource); 24 | }); 25 | result[rel] = arr; 26 | } else { 27 | var newResource = new HAL.Models.Resource(obj); 28 | newResource.identifier = rel; 29 | newResource.embed_rel = rel; 30 | result[rel] = newResource; 31 | } 32 | }); 33 | return result; 34 | } 35 | }); 36 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/browser.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Browser = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | var self = this; 4 | this.vent = opts.vent; 5 | this.entryPoint = opts.entryPoint; 6 | this.explorerView = new HAL.Views.Explorer({ vent: this.vent }); 7 | this.inspectorView = new HAL.Views.Inspector({ vent: this.vent }); 8 | }, 9 | 10 | className: 'hal-browser row-fluid', 11 | 12 | render: function() { 13 | this.$el.empty(); 14 | 15 | this.inspectorView.render(); 16 | this.explorerView.render(); 17 | 18 | this.$el.html(this.explorerView.el); 19 | this.$el.append(this.inspectorView.el); 20 | 21 | var entryPoint = this.entryPoint; 22 | 23 | $("#entryPointLink").click(function(event) { 24 | event.preventDefault(); 25 | window.location.hash = entryPoint; 26 | }); 27 | return this; 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/documentation.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Documenation = Backbone.View.extend({ 2 | className: 'documentation', 3 | 4 | render: function(url) { 5 | this.$el.html(''); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/embedded_resource.js: -------------------------------------------------------------------------------- 1 | HAL.Views.EmbeddedResource = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | this.resource = opts.resource; 5 | 6 | this.propertiesView = new HAL.Views.Properties({}); 7 | this.linksView = new HAL.Views.Links({ 8 | vent: this.vent 9 | }); 10 | 11 | _.bindAll(this, 'onToggleClick'); 12 | _.bindAll(this, 'onDoxClick'); 13 | }, 14 | 15 | events: { 16 | 'click a.accordion-toggle': 'onToggleClick', 17 | 'click span.dox': 'onDoxClick' 18 | }, 19 | 20 | className: 'embedded-resource accordion-group', 21 | 22 | onToggleClick: function(e) { 23 | e.preventDefault(); 24 | this.$accordionBody.collapse('toggle'); 25 | return false; 26 | }, 27 | 28 | onDoxClick: function(e) { 29 | e.preventDefault(); 30 | this.vent.trigger('show-docs', { 31 | url: $(e.currentTarget).data('href') 32 | }); 33 | return false; 34 | }, 35 | 36 | render: function() { 37 | this.$el.empty(); 38 | 39 | this.propertiesView.render(this.resource.toJSON()); 40 | this.linksView.render(this.resource.links); 41 | 42 | this.$el.append(this.template({ 43 | resource: this.resource 44 | })); 45 | 46 | var $inner = $('
'); 47 | $inner.append(this.propertiesView.el); 48 | $inner.append(this.linksView.el); 49 | 50 | if (this.resource.embeddedResources) { 51 | var embeddedResourcesView = new HAL.Views.EmbeddedResources({ vent: this.vent }); 52 | embeddedResourcesView.render(this.resource.embeddedResources); 53 | $inner.append(embeddedResourcesView.el); 54 | } 55 | 56 | this.$accordionBody = $('
'); 57 | this.$accordionBody.append($inner) 58 | 59 | this.$el.append(this.$accordionBody); 60 | }, 61 | 62 | template: _.template($('#embedded-resource-template').html()) 63 | }); 64 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/embedded_resources.js: -------------------------------------------------------------------------------- 1 | HAL.Views.EmbeddedResources = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | _.bindAll(this, 'render'); 5 | }, 6 | 7 | className: 'embedded-resources accordion', 8 | 9 | render: function(resources) { 10 | var self = this, 11 | resourceViews = [], 12 | buildView = function(resource) { 13 | return new HAL.Views.EmbeddedResource({ 14 | resource: resource, 15 | vent: self.vent 16 | }); 17 | }; 18 | 19 | _.each(resources, function(prop) { 20 | if ($.isArray(prop)) { 21 | _.each(prop, function(resource) { 22 | resourceViews.push(buildView(resource)); 23 | }); 24 | } else { 25 | resourceViews.push(buildView(prop)); 26 | } 27 | }); 28 | 29 | this.$el.html(this.template()); 30 | 31 | _.each(resourceViews, function(view) { 32 | view.render(); 33 | self.$el.append(view.el); 34 | }); 35 | 36 | 37 | return this; 38 | }, 39 | 40 | template: _.template($('#embedded-resources-template').html()) 41 | }); 42 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/explorer.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Explorer = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | var self = this; 4 | this.vent = opts.vent; 5 | this.navigationView = new HAL.Views.Navigation({ vent: this.vent }); 6 | this.resourceView = new HAL.Views.Resource({ vent: this.vent }); 7 | }, 8 | 9 | className: 'explorer span6', 10 | 11 | render: function() { 12 | this.navigationView.render(); 13 | 14 | this.$el.html(this.template()); 15 | 16 | this.$el.append(this.navigationView.el); 17 | this.$el.append(this.resourceView.el); 18 | }, 19 | 20 | template: function() { 21 | return '

Explorer

'; 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/inspector.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Inspector = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | 5 | _.bindAll(this, 'renderDocumentation'); 6 | _.bindAll(this, 'renderResponse'); 7 | 8 | this.vent.bind('show-docs', this.renderDocumentation); 9 | this.vent.bind('response', this.renderResponse); 10 | }, 11 | 12 | className: 'inspector span6', 13 | 14 | render: function() { 15 | this.$el.html(this.template()); 16 | }, 17 | 18 | renderResponse: function(response) { 19 | var responseView = new HAL.Views.Response({ vent: this.vent }); 20 | 21 | this.render(); 22 | responseView.render(response); 23 | 24 | this.$el.append(responseView.el); 25 | }, 26 | 27 | renderDocumentation: function(e) { 28 | var docView = new HAL.Views.Documenation({ vent: this.vent }); 29 | 30 | this.render(); 31 | docView.render(e.url); 32 | 33 | this.$el.append(docView.el); 34 | }, 35 | 36 | template: function() { 37 | return '

Inspector

'; 38 | } 39 | }); 40 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/links.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Links = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | }, 5 | 6 | events: { 7 | 'click .follow': 'followLink', 8 | 'click .non-get': 'showNonSafeRequestDialog', 9 | 'click .query': 'showUriQueryDialog', 10 | 'click .dox': 'showDocs' 11 | }, 12 | 13 | className: 'links', 14 | 15 | followLink: function(e) { 16 | e.preventDefault(); 17 | var $target = $(e.currentTarget); 18 | var uri = $target.attr('href'); 19 | window.location.hash = uri; 20 | }, 21 | 22 | showUriQueryDialog: function(e) { 23 | e.preventDefault(); 24 | 25 | var $target = $(e.currentTarget); 26 | var uri = $target.attr('href'); 27 | 28 | new HAL.Views.QueryUriDialog({ 29 | href: uri 30 | }).render({}); 31 | }, 32 | 33 | showNonSafeRequestDialog: function(e) { 34 | e.preventDefault(); 35 | 36 | var postForm = (HAL.customPostForm !== undefined) ? HAL.customPostForm : HAL.Views.NonSafeRequestDialog; 37 | var d = new postForm({ 38 | href: $(e.currentTarget).attr('href'), 39 | vent: this.vent 40 | }).render({}) 41 | }, 42 | 43 | showDocs: function(e) { 44 | e.preventDefault(); 45 | var $target = $(e.target); 46 | var uri = $target.attr('href') || $target.parent().attr('href'); 47 | this.vent.trigger('show-docs', { url: uri }); 48 | }, 49 | 50 | template: _.template($('#links-template').html()), 51 | 52 | render: function(links) { 53 | this.$el.html(this.template({ links: links })); 54 | } 55 | }); 56 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/location_bar.js: -------------------------------------------------------------------------------- 1 | HAL.Views.LocationBar = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | _.bindAll(this, 'render'); 5 | _.bindAll(this, 'onButtonClick'); 6 | this.vent.bind('location-change', this.render); 7 | this.vent.bind('location-change', _.bind(this.showSpinner, this)); 8 | this.vent.bind('response', _.bind(this.hideSpinner, this)); 9 | }, 10 | 11 | events: { 12 | 'submit form': 'onButtonClick' 13 | }, 14 | 15 | className: 'address', 16 | 17 | render: function(e) { 18 | e = e || { url: '' }; 19 | this.$el.html(this.template(e)); 20 | }, 21 | 22 | onButtonClick: function(e) { 23 | e.preventDefault(); 24 | this.vent.trigger('location-go', this.getLocation()); 25 | }, 26 | 27 | getLocation: function() { 28 | return this.$el.find('input').val(); 29 | }, 30 | 31 | showSpinner: function() { 32 | this.$el.find('.ajax-loader').addClass('visible'); 33 | }, 34 | 35 | hideSpinner: function() { 36 | this.$el.find('.ajax-loader').removeClass('visible'); 37 | }, 38 | 39 | template: _.template($('#location-bar-template').html()) 40 | }); 41 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/navigation.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Navigation = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | this.locationBar = new HAL.Views.LocationBar({ vent: this.vent }); 5 | this.requestHeadersView = new HAL.Views.RequestHeaders({ vent: this.vent }); 6 | }, 7 | 8 | className: 'navigation', 9 | 10 | render: function() { 11 | this.$el.empty(); 12 | 13 | this.locationBar.render(); 14 | this.requestHeadersView.render(); 15 | 16 | this.$el.append(this.locationBar.el); 17 | this.$el.append(this.requestHeadersView.el); 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/non_safe_request_dialog.js: -------------------------------------------------------------------------------- 1 | HAL.Views.NonSafeRequestDialog = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.href = opts.href; 4 | this.vent = opts.vent; 5 | this.uriTemplate = uritemplate(this.href); 6 | _.bindAll(this, 'submitQuery'); 7 | }, 8 | 9 | events: { 10 | 'submit form': 'submitQuery' 11 | }, 12 | 13 | className: 'modal fade', 14 | 15 | submitQuery: function(e) { 16 | e.preventDefault(); 17 | 18 | var self = this, 19 | opts = { 20 | url: this.$('.url').val(), 21 | headers: HAL.parseHeaders(this.$('.headers').val()), 22 | method: this.$('.method').val(), 23 | data: this.$('.body').val() 24 | }; 25 | 26 | var request = HAL.client.request(opts); 27 | request.done(function(response) { 28 | self.vent.trigger('response', { resource: response, jqxhr: jqxhr }); 29 | }).fail(function(response) { 30 | self.vent.trigger('fail-response', { jqxhr: jqxhr }); 31 | }).always(function() { 32 | self.vent.trigger('response-headers', { jqxhr: jqxhr }); 33 | window.location.hash = 'NON-GET:' + opts.url; 34 | }); 35 | 36 | this.$el.modal('hide'); 37 | }, 38 | 39 | render: function(opts) { 40 | var headers = HAL.client.getHeaders(), 41 | headersString = ''; 42 | 43 | _.each(headers, function(value, name) { 44 | headersString += name + ': ' + value + '\n'; 45 | }); 46 | 47 | this.$el.html(this.template({ href: this.href, user_defined_headers: headersString })); 48 | this.$el.modal(); 49 | return this; 50 | }, 51 | 52 | template: _.template($('#non-safe-request-template').html()) 53 | }); 54 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/js/hal/views/properties.js: -------------------------------------------------------------------------------- 1 | HAL.Views.Properties = Backbone.View.extend({ 2 | initialize: function(opts) { 3 | this.vent = opts.vent; 4 | _.bindAll(this, 'render'); 5 | }, 6 | 7 | className: 'properties', 8 | 9 | _mkIndent: function(indent, space) { 10 | var s = ""; 11 | for(var i=0; i"; 65 | } 66 | 67 | if(Array.isArray(value)) { 68 | s += '['; 69 | ++indent; 70 | for(var i=0; i 2 | 3 | 4 | 5 | Sign in - HAL Browser 6 | 7 | 8 | 9 | 38 | 39 | 40 | 63 | 64 | 65 |
66 | 74 |
75 | 76 | 77 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/styles.css: -------------------------------------------------------------------------------- 1 | html, body, #browser, .hal-browser { height: 100%; } 2 | 3 | #browser #location-bar { margin: 10px 0; } 4 | 5 | #browser #location-bar .address { 6 | border: 1px solid #999; 7 | padding: 4px; margin: 0; 8 | } 9 | 10 | #browser #headers-bar { 11 | border: 1px solid #888; 12 | padding: 5px 13 | } 14 | 15 | #request-headers { 16 | border: 0; 17 | outline: none; 18 | padding: 0; 19 | resize: vertical; 20 | width: 100%; 21 | height: 40px; 22 | margin-bottom: 0px; 23 | 24 | -webkit-box-shadow: none; 25 | -moz-box-shadow: none; 26 | box-shadow: none; 27 | } 28 | 29 | .inspector { height: 100%; } 30 | 31 | .documentation { height: 100%; } 32 | .documentation iframe { width: 100%; height: 100%; } 33 | 34 | .modal input, .modal textarea { 35 | width: 90%; 36 | } 37 | 38 | .modal textarea { 39 | height: 100px; 40 | } 41 | 42 | .links .btn { 43 | padding: 2px 5px 2px; 44 | font-size: 12px; 45 | line-height: 14px; 46 | } 47 | 48 | body table.table { 49 | font-size: 11px; 50 | } 51 | 52 | .location-bar-container { 53 | line-height: 30px; 54 | } 55 | 56 | .ajax-loader { 57 | vertical-align: middle; 58 | background-image: url("./vendor/img/ajax-loader.gif"); 59 | background-repeat: no-repeat; 60 | width: 16px; 61 | height: 16px; 62 | margin-left: 6px; 63 | opacity: 0; 64 | display: inline-block; 65 | transition: opacity 1s; 66 | } 67 | .ajax-loader.visible { 68 | opacity: 1; 69 | } 70 | .embedded-resource-title { 71 | font-style: italic; 72 | } 73 | .embedded-resource-title:before { 74 | content: "\""; 75 | } 76 | .embedded-resource-title:after { 77 | content: "\""; 78 | } 79 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/vendor/img/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzajkowski/umbraco-rest-api-playground/a0d6aa155feb846771f013f50e7bc9beac5466e3/RestApiPlayground/TestSite/hal-browser/vendor/img/ajax-loader.gif -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/vendor/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzajkowski/umbraco-rest-api-playground/a0d6aa155feb846771f013f50e7bc9beac5466e3/RestApiPlayground/TestSite/hal-browser/vendor/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/vendor/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzajkowski/umbraco-rest-api-playground/a0d6aa155feb846771f013f50e7bc9beac5466e3/RestApiPlayground/TestSite/hal-browser/vendor/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/hal-browser/vendor/js/uritemplates.js: -------------------------------------------------------------------------------- 1 | /* 2 | UriTemplates Template Processor - Version: @VERSION - Dated: @DATE 3 | (c) marc.portier@gmail.com - 2011-2012 4 | Licensed under ALPv2 5 | */ 6 | 7 | ; 8 | var uritemplate = (function() { 9 | 10 | // Below are the functions we originally used from jQuery. 11 | // The implementations below are often more naive then what is inside jquery, but they suffice for our needs. 12 | 13 | function isFunction(fn) { 14 | return typeof fn == 'function'; 15 | } 16 | 17 | function isEmptyObject (obj) { 18 | for(var name in obj){ 19 | return false; 20 | } 21 | return true; 22 | } 23 | 24 | function extend(base, newprops) { 25 | for (var name in newprops) { 26 | base[name] = newprops[name]; 27 | } 28 | return base; 29 | } 30 | 31 | /** 32 | * Create a runtime cache around retrieved values from the context. 33 | * This allows for dynamic (function) results to be kept the same for multiple 34 | * occuring expansions within one template. 35 | * Note: Uses key-value tupples to be able to cache null values as well. 36 | */ 37 | //TODO move this into prep-processing 38 | function CachingContext(context) { 39 | this.raw = context; 40 | this.cache = {}; 41 | } 42 | CachingContext.prototype.get = function(key) { 43 | var val = this.lookupRaw(key); 44 | var result = val; 45 | 46 | if (isFunction(val)) { // check function-result-cache 47 | var tupple = this.cache[key]; 48 | if (tupple !== null && tupple !== undefined) { 49 | result = tupple.val; 50 | } else { 51 | result = val(this.raw); 52 | this.cache[key] = {key: key, val: result}; 53 | // NOTE: by storing tupples we make sure a null return is validly consistent too in expansions 54 | } 55 | } 56 | return result; 57 | }; 58 | 59 | CachingContext.prototype.lookupRaw = function(key) { 60 | return CachingContext.lookup(this, this.raw, key); 61 | }; 62 | 63 | CachingContext.lookup = function(me, context, key) { 64 | var result = context[key]; 65 | if (result !== undefined) { 66 | return result; 67 | } else { 68 | var keyparts = key.split('.'); 69 | var i = 0, keysplits = keyparts.length - 1; 70 | for (i = 0; i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /RestApiPlayground/TestSite/scripts/fanoe.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 3 | // Making elements equal height 4 | var equalheight = function(container){ 5 | 6 | var currentTallest = 0, 7 | currentRowStart = 0, 8 | rowDivs = new Array(), 9 | $el, 10 | topPosition = 0; 11 | 12 | $(container).find('.equal').each(function() { 13 | 14 | $el = $(this); 15 | $($el).height('auto') 16 | topPostion = $el.position().top; 17 | 18 | if (currentRowStart != topPostion) { 19 | for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 20 | rowDivs[currentDiv].height(currentTallest); 21 | } 22 | rowDivs.length = 0; // empty the array 23 | currentRowStart = topPostion; 24 | currentTallest = $el.height(); 25 | rowDivs.push($el); 26 | } else { 27 | rowDivs.push($el); 28 | currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); 29 | } 30 | for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 31 | rowDivs[currentDiv].height(currentTallest); 32 | } 33 | }); 34 | }; 35 | 36 | // Check for window width before resizing 37 | function equalHeightChecker () { 38 | if ( window.innerWidth > 767 && !heightIsSet ) { 39 | $('.equalizer') 40 | .each(function(){ 41 | equalheight(this); 42 | heightIsSet = true; 43 | }); 44 | } 45 | else if (window.innerWidth<768 && heightIsSet) { 46 | $('.equalizer') 47 | .each(function(){ 48 | $(this).find('.equal').each(function () { 49 | this.style.height = 'auto'; 50 | }); 51 | heightIsSet = false; 52 | }); 53 | } 54 | } 55 | 56 | // Initialize equal height script 57 | var heightIsSet; 58 | 59 | // On load 60 | $(window).load(function() { 61 | equalHeightChecker(); 62 | }); 63 | 64 | // and on resize 65 | $(window).resize(function(){ 66 | equalHeightChecker(); 67 | }); 68 | 69 | // Navigation 70 | $('#toggle').click(function(){ 71 | $('.has-child').removeClass('selected'); 72 | $('nav').toggleClass('open'); 73 | $('.cross').toggleClass('open'); 74 | }); 75 | 76 | $('.has-child').click(function(){ 77 | if ( window.innerWidth < 768 ) { 78 | if ( $( this ).hasClass('selected')){ 79 | $('.has-child').removeClass('selected'); 80 | } else { 81 | $('.has-child').removeClass('selected'); 82 | $(this).toggleClass('selected'); 83 | } 84 | } 85 | }); 86 | 87 | })(jQuery); --------------------------------------------------------------------------------