Skip to content

Commit

Permalink
vendor: Installed jQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
data-miner00 committed Mar 2, 2024
1 parent f21e60a commit 9957353
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,7 @@ coveragereport/
dist/

# MVC Bootstrap Icon source
bootstrap-icon/
bootstrap-icon/

# jQuery from node
jquery/
15 changes: 14 additions & 1 deletion src/Linker.Mvc/Views/Article/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
</select>
<span asp-validation-for="Rating" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Tags" class="control-label"></label>
<div id="tags-container" class="flex flex-wrap">
<input asp-for="Tags" class="form-control" placeholder="compsci" />
<button id="add-tag-btn" type="button">Add</button>
</div>
<span asp-validation-for="Tags" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Year" class="control-label"></label>
<input asp-for="Year" class="form-control" value="2022" />
Expand Down Expand Up @@ -90,5 +98,10 @@
</div>

@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
@{await Html.RenderPartialAsync("_SomeScriptsPartial");}
<script type="text/javascript">
window.jQuery(($) => {
$('#add-tag-btn').on('click', () => console.log('button clicked'))
});
</script>
}
2 changes: 2 additions & 0 deletions src/Linker.Mvc/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@

<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)

<!-- Even though libraries like jQuery are included here, it is not available for other individual pages to use, which is weird. -->
<partial name="_SomeScriptsPartial" />
</body>
</html>
1 change: 1 addition & 0 deletions src/Linker.Mvc/Views/Shared/_SomeScriptsPartial.cshtml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<script src="~/lib/loaded.js"></script>
<script src="~/lib/jquery/jquery.min.js"></script>
4 changes: 3 additions & 1 deletion src/Linker.Mvc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"watch:css": "tailwindcss -i ./wwwroot/lib/tailwindcss/index.css -o ./wwwroot/lib/tailwindcss/dist/styles.css --watch",
"build:css": "tailwindcss -i ./wwwroot/lib/tailwindcss/index.css -o ./wwwroot/lib/tailwindcss/dist/styles.css",
"release:css": "tailwindcss -i ./wwwroot/lib/tailwindcss/index.css -o ./wwwroot/lib/tailwindcss/dist/styles.css --minify",
"copy:bicon": "./Scripts/Copy-FolderItems.ps1 -SourceFolder ./node_modules/bootstrap-icons/font/* -DestinationFolder ./wwwroot/lib/bootstrap-icon/"
"copy:bicon": "./Scripts/Copy-FolderItems.ps1 -SourceFolder ./node_modules/bootstrap-icons/font/* -DestinationFolder ./wwwroot/lib/bootstrap-icon/",
"copy:jquery": "./Scripts/Copy-FolderItems.ps1 -SourceFolder ./node_modules/jquery/dist/* -DestinationFolder ./wwwroot/lib/jquery/"
},
"keywords": [],
"author": "Shaun Chong <[email protected]>",
"license": "WTFPL",
"devDependencies": {
"bootstrap-icons": "^1.11.3",
"jquery": "^3.7.1",
"tailwindcss": "^3.4.1"
}
}
7 changes: 7 additions & 0 deletions src/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9957353

Please sign in to comment.