GitHub PullRequestReviewCommentEvent at 2014-11-18 00:57:26
Repository: Mvc
Actor: yishaigalatzer
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/20478886","id":20478886,"diff_hunk":"@@ -0,0 +1,113 @@\n+﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.\n+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n+\n+using System.IO;\n+using Microsoft.AspNet.FileSystems;\n+using Microsoft.AspNet.Hosting;\n+using Microsoft.AspNet.Mvc.Rendering;\n+using Microsoft.AspNet.Razor.Runtime.TagHelpers;\n+using Microsoft.AspNet.Razor.TagHelpers;\n+using Microsoft.Framework.OptionsModel;\n+\n+namespace Microsoft.AspNet.Mvc.TagHelpers\n+{\n+    /// <summary>\n+    /// <see cref=\"ITagHelper\"/> implementation targeting &lt;script&gt; elements.\n+    /// </summary>\n+    public class ScriptTagHelper : TagHelper\n+    {\n+        // Protected to ensure subclasses are correctly activated. Internal for ease of use when testing.\n+        [Activate]\n+        protected internal ViewContext ViewContext { get; set; }\n+\n+        // Protected to ensure subclasses are correctly activated. Internal for ease of use when testing.\n+        [Activate]\n+        protected internal IHostingEnvironment HostingEnvironment { get; set; }\n+\n+        // Protected to ensure subclasses are correctly activated. Internal for ease of use when testing.\n+        [Activate]\n+        protected internal IOptions<ScriptTagHelperOptions> Options { get; set; }\n+\n+        /// <summary>\n+        /// The file extension of minified JavaScript files.\n+        /// Set to <see cref=\"string.Empty\"/> to disable min file replacement.\n+        /// Defaults to \".min.js\".\n+        /// </summary>\n+        [HtmlAttributeName(\"min-extension\")]\n+        public string MinExtension { get; set; }\n+\n+        /// <inheritdoc />\n+        public override void Process(TagHelperContext context, TagHelperOutput output)\n+        {\n+            if (!output.Attributes.ContainsKey(\"src\") || (MinExtension != null && MinExtension.Trim() == string.Empty))\n+            {\n+                // No src or minfied file replacement disabled, do nothing\n+                return;\n+            }\n+\n+            var minFileSrc = MinFileSrc(output.Attributes[\"src\"], MinExtension ?? Options.Options.MinExtension);\n+            if (!string.IsNullOrEmpty(minFileSrc))\n+            {\n+                output.Attributes[\"src\"] = minFileSrc;\n+            }\n+        }\n+\n+        private string MinFileSrc(string src, string minExtension)\n+        {\n+            if (string.IsNullOrWhiteSpace(minExtension))\n+            {\n+                return null;\n+            }\n+\n+            src = src.Trim();\n+\n+            string srcPath;\n+\n+            if (src.StartsWith(\"/\"))\n+            {\n+                // Site root absolute path, resolve from webroot\n+                var srcPathString = new Http.PathString(src);","path":"src/Microsoft.AspNet.Mvc.TagHelpers/ScriptTagHelper .cs","position":69,"original_position":69,"commit_id":"614dbccaf8d32fd6e0fbebd0b88e0831fb3e1313","original_commit_id":"614dbccaf8d32fd6e0fbebd0b88e0831fb3e1313","user":{"login":"yishaigalatzer","id":1238711,"avatar_url":"https://avatars.githubusercontent.com/u/1238711?v=3","gravatar_id":"","url":"https://api.github.com/users/yishaigalatzer","html_url":"https://github.com/yishaigalatzer","followers_url":"https://api.github.com/users/yishaigalatzer/followers","following_url":"https://api.github.com/users/yishaigalatzer/following{/other_user}","gists_url":"https://api.github.com/users/yishaigalatzer/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaigalatzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaigalatzer/subscriptions","organizations_url":"https://api.github.com/users/yishaigalatzer/orgs","repos_url":"https://api.github.com/users/yishaigalatzer/repos","events_url":"https://api.github.com/users/yishaigalatzer/events{/privacy}","received_events_url":"https://api.github.com/users/yishaigalatzer/received_events","type":"User","site_admin":false},"body":"Can we add a using statement?","created_at":"2014-11-18T00:57:26Z","updated_at":"2014-11-18T00:57:26Z","html_url":"https://github.com/aspnet/Mvc/pull/1551#discussion_r20478886","pull_request_url":"https://api.github.com/repos/aspnet/Mvc/pulls/1551","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/20478886"},"html":{"href":"https://github.com/aspnet/Mvc/pull/1551#discussion_r20478886"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1551"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Mvc/pulls/1551","id":24341651,"html_url":"https://github.com/aspnet/Mvc/pull/1551","diff_url":"https://github.com/aspnet/Mvc/pull/1551.diff","patch_url":"https://github.com/aspnet/Mvc/pull/1551.patch","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/1551","number":1551,"state":"open","locked":false,"title":"Propsed ScriptTagHelper","user":{"login":"DamianEdwards","id":249088,"avatar_url":"https://avatars.githubusercontent.com/u/249088?v=3","gravatar_id":"","url":"https://api.github.com/users/DamianEdwards","html_url":"https://github.com/DamianEdwards","followers_url":"https://api.github.com/users/DamianEdwards/followers","following_url":"https://api.github.com/users/DamianEdwards/following{/other_user}","gists_url":"https://api.github.com/users/DamianEdwards/gists{/gist_id}","starred_url":"https://api.github.com/users/DamianEdwards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DamianEdwards/subscriptions","organizations_url":"https://api.github.com/users/DamianEdwards/orgs","repos_url":"https://api.github.com/users/DamianEdwards/repos","events_url":"https://api.github.com/users/DamianEdwards/events{/privacy}","received_events_url":"https://api.github.com/users/DamianEdwards/received_events","type":"User","site_admin":false},"body":"- ScriptTagHelper added that changes src attribute to minified file name if it exists\r\n- Changed the TagHelperSample.Web to support self-host (k web)\r\n- Added Tag Helper projects to Mvc.NoFun.sln\r\n- #1524","created_at":"2014-11-13T02:14:43Z","updated_at":"2014-11-18T00:57:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10f408e27a0e72c4c07d4dcd9483c87d35f49216","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Mvc/pulls/1551/commits","review_comments_url":"https://api.github.com/repos/aspnet/Mvc/pulls/1551/comments","review_comment_url":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/{number}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/1551/comments","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/614dbccaf8d32fd6e0fbebd0b88e0831fb3e1313","head":{"label":"aspnet:feature-script-tag-helper","ref":"feature-script-tag-helper","sha":"614dbccaf8d32fd6e0fbebd0b88e0831fb3e1313","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15126429,"name":"Mvc","full_name":"aspnet/Mvc","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Mvc","description":"Model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor.","fork":false,"url":"https://api.github.com/repos/aspnet/Mvc","forks_url":"https://api.github.com/repos/aspnet/Mvc/forks","keys_url":"https://api.github.com/repos/aspnet/Mvc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Mvc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Mvc/teams","hooks_url":"https://api.github.com/repos/aspnet/Mvc/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Mvc/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Mvc/events","assignees_url":"https://api.github.com/repos/aspnet/Mvc/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Mvc/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Mvc/tags","blobs_url":"https://api.github.com/repos/aspnet/Mvc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Mvc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Mvc/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Mvc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Mvc/languages","stargazers_url":"https://api.github.com/repos/aspnet/Mvc/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Mvc/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Mvc/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Mvc/subscription","commits_url":"https://api.github.com/repos/aspnet/Mvc/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Mvc/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Mvc/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/Mvc/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Mvc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Mvc/merges","archive_url":"https://api.github.com/repos/aspnet/Mvc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Mvc/downloads","issues_url":"https://api.github.com/repos/aspnet/Mvc/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Mvc/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Mvc/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Mvc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Mvc/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Mvc/releases{/id}","created_at":"2013-12-12T03:54:00Z","updated_at":"2014-11-17T21:22:49Z","pushed_at":"2014-11-17T23:39:50Z","git_url":"git://github.com/aspnet/Mvc.git","ssh_url":"git@github.com:aspnet/Mvc.git","clone_url":"https://github.com/aspnet/Mvc.git","svn_url":"https://github.com/aspnet/Mvc","homepage":"","size":58413,"stargazers_count":963,"watchers_count":963,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":239,"mirror_url":null,"open_issues_count":284,"forks":239,"open_issues":284,"watchers":963,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"47d0afbe38573c2b8667657eb740154611a8a217","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15126429,"name":"Mvc","full_name":"aspnet/Mvc","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Mvc","description":"Model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor.","fork":false,"url":"https://api.github.com/repos/aspnet/Mvc","forks_url":"https://api.github.com/repos/aspnet/Mvc/forks","keys_url":"https://api.github.com/repos/aspnet/Mvc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Mvc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Mvc/teams","hooks_url":"https://api.github.com/repos/aspnet/Mvc/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Mvc/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Mvc/events","assignees_url":"https://api.github.com/repos/aspnet/Mvc/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Mvc/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Mvc/tags","blobs_url":"https://api.github.com/repos/aspnet/Mvc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Mvc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Mvc/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Mvc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Mvc/languages","stargazers_url":"https://api.github.com/repos/aspnet/Mvc/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Mvc/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Mvc/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Mvc/subscription","commits_url":"https://api.github.com/repos/aspnet/Mvc/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Mvc/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Mvc/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/Mvc/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Mvc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Mvc/merges","archive_url":"https://api.github.com/repos/aspnet/Mvc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Mvc/downloads","issues_url":"https://api.github.com/repos/aspnet/Mvc/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Mvc/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Mvc/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Mvc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Mvc/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Mvc/releases{/id}","created_at":"2013-12-12T03:54:00Z","updated_at":"2014-11-17T21:22:49Z","pushed_at":"2014-11-17T23:39:50Z","git_url":"git://github.com/aspnet/Mvc.git","ssh_url":"git@github.com:aspnet/Mvc.git","clone_url":"https://github.com/aspnet/Mvc.git","svn_url":"https://github.com/aspnet/Mvc","homepage":"","size":58413,"stargazers_count":963,"watchers_count":963,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":239,"mirror_url":null,"open_issues_count":284,"forks":239,"open_issues":284,"watchers":963,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1551"},"html":{"href":"https://github.com/aspnet/Mvc/pull/1551"},"issue":{"href":"https://api.github.com/repos/aspnet/Mvc/issues/1551"},"comments":{"href":"https://api.github.com/repos/aspnet/Mvc/issues/1551/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1551/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/1551/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Mvc/statuses/614dbccaf8d32fd6e0fbebd0b88e0831fb3e1313"}}}}