diff --git a/StockManMVC/Content/Gridmvc.css b/StockManMVC/Content/Gridmvc.css deleted file mode 100644 index d48c4d3..0000000 --- a/StockManMVC/Content/Gridmvc.css +++ /dev/null @@ -1,39 +0,0 @@ -/*** -* Grid.Mvc stylesheet http://gridmvc.codeplex.com/ -* This file contains default styles for Grid.Mvc. -*/ -/* Grid */ -table.grid-table { margin: 0; } - table.grid-table .grid-wrap { padding: 0; position: relative; } - table.grid-table .grid-empty-text { color: #666; } - - /* Grid headers */ - table.grid-table .grid-header { position: relative; } - table.grid-table .grid-header .sorted-asc .grid-sort-arrow:after { content: " \2193"; } - table.grid-table .grid-header .sorted-desc .grid-sort-arrow:after { content: " \2191"; } - table.grid-table .grid-header > .grid-header-title { width: 100%; margin-right: 15px; white-space: nowrap; } - - /* Grid body */ - table.grid-table tr.grid-row-selected td { background: #4888C2 !important; color: white; } - table.grid-table tr.grid-row-selected a { color: white; } - -/* Grid filtering */ -input.grid-filter-input { padding: 4px; font-size: 13px; } -table.grid-table .grid-filter { position: relative; margin-top: 2px; float: right; width: 10px; height: 12px; } -table.grid-table .grid-filter-btn { cursor: pointer; display: block; width: 10px; height: 12px; background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAJFJREFUKFNjkJSU/E8MZvj//78DMRhkoj+6bizYH2SiiIeHx2FjY+P/2DBIDqSGAQSOHTtmYWZm9hldEUgMJAdWBAJAHSzt7e056ApBYiA5qDIIAAoIhIaGroYpArFBYlBpVLB3715DmEIQGyqMCUDWwBRiWIkOYAqhXNwApMjX13c7lIsbgBQBrdWAcqGAgQEAdOGTrvsYKXIAAAAASUVORK5CYII=') no-repeat; } - table.grid-table .grid-filter-btn.filtered { background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAJNJREFUKFNjYGj//58o/P//fwdiMIOkpKQ/VhOQMFgNULWIh4fHYWNj4//YMEgOpIYBBI4dO2ZhZmb2GV0RSAwkB1YEAkAdLO3t7TnoCkFiIDmoMggACgiEhoauhikCsUFiUGlUsHfvXkOYQhAbKowJQNbAFGJYiQ5gCqFc3ACkyNfXdzuUixuAFAGt1YByoYCBAQAUDanUpFB4UQAAAABJRU5ErkJggg==') no-repeat; } -table.grid-table .grid-filter-buttons { padding: 0; } -table.grid-table .grid-filter-datepicker { font-size: 12px; } - table.grid-table .grid-filter-datepicker table td { padding: 1px!important; } - table.grid-table .grid-filter-datepicker .ui-datepicker { width: auto; } -table.grid-table .grid-dropdown-inner ul.menu-list li a.grid-filter-clear { white-space: nowrap; padding-left: 23px; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAARpJREFUKFNjYGj//58o/P//fwdiMIOkpKQ/VhOQMFgNULWIh4fHYWNj4//YMEgOpIYBBI4dO2axOC/396GinP/O+vpwRVbGxl92+vluXm1kuASsEKiD5VB99aG3eTH/HxjL/A/RUPsfrqb6f7e21uutlhbRYEUwAFQskOLmun2+lND/0xxM/7dycXzd6OxoCpVGBduWLjXv4+f/v5WF+f9RbtYvfeysqlApBKhhY2Hcxsy0+xAL038nbe3/m8W4ss/Jcx2GSiPAal6uvGtczP9TFOXBHgGJ7RHlmLGOjy0UrAAGzgT7rn7urP/P3NDgv6+v73aQWAMzM+dqTtbJYAUwsNzeyuhImE8GSBHQYxpQYYYJQCcxMDAwAAB7/bt5uWh9FAAAAABJRU5ErkJggg=='); background-position: 3px center; background-repeat: no-repeat; } -table.grid-table .grid-filter-choose.choose-selected { background-color: white!important; cursor: default; color: #999; } -table.grid-table .grid-popup-additional { padding: 3px 0 0 0; } - -/* POP-UP */ -.grid-dropdown { font-weight: normal; left: -102px; top: 16px!important; min-width: 180px; } -.grid-dropdown-arrow { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAICAYAAADJEc7MAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAl0lEQVQoU42PMQuFMAyE6xN5gpOjjsIb/P9/o3O3zh27dY25kIPq8DBwmLT35WoQkUEVOmGec84CaW2q7+N+AdCD6M9SisQYTei1jsfyCeCu+vjFVGs1AN++94DRfUOfuNLoKUiyRC5y2F5I8NdaM4P/l0EswvBorQTnfxBhLMRih+2pklIy+eEtjQPu6MNZwIBNbwteMBd5X4ZGHcwL3QAAAABJRU5ErkJggg==") no-repeat; height: 8px; left: 99px; position: absolute; top: -8px; width: 14px; } -.grid-dropdown-inner { padding: 5px 7px; } -.grid-dropdown ul.menu-list { list-style-type: none; margin: 3px 0 0 0; padding: 0; } - .grid-dropdown ul.menu-list li a { text-decoration: none; background-position: 6px center; background-repeat: no-repeat; display: block; padding: 4px 5px; } - .grid-dropdown ul.menu-list li a:hover { background-color: #EEE; text-decoration: none; } diff --git a/StockManMVC/Grid.mvc.readme b/StockManMVC/Grid.mvc.readme deleted file mode 100644 index d9b0089..0000000 --- a/StockManMVC/Grid.mvc.readme +++ /dev/null @@ -1,60 +0,0 @@ -http://gridmvc.codeplex.com/ - -Note: Grid.Mvc installer has already made the following changes to your project: -- Views/Shared/_Grid.cshtml, Views/Shared/_GridPager.cshtml - views for grid -- Content/Gridmvc.css - default stylesheet for the grid -- Scripts/gridmvc.js, Scripts/gridmvc.min.js - Grid.Mvc scripts -- Reference GridMvc.dll - -Follow these steps to start use Grid.mvc: - -1. Define a model for display in the grid, like: - - public class Foo - { - public string Title { get; set; } - public string Description { get;set; } - } - - -2. Prepare your model in your controller, like: - - public ActionResult Index() - { - var items = fooRepository.GetAll(); - return View(items); - } - - -3. Render GridMvc in the View: You can use Html helper extenstion: - - Reference Grid.Mvc.Html in your view: - - @using GridMvc.Html - - Render Grid.Mvc: - - @Html.Grid(Model).Columns(columns => - { - columns.Add(foo => foo.Title).Titled("Custom column title").SetWidth(110); - columns.Add(foo => foo.Description).Sortable(true); - }).WithPaging(20) - - -4. Register a grid stylesheet and scripts in your _Layouts.cshtml file: - - - - - -Notes: - -Default layout of Grid.Mvc uses Twitter Bootstrap (css framework). You also need to include stylesheets on your page. You can download it from - http://twitter.github.com/bootstrap/ -like: - - - - -Also you need to ensure that jQuery has registred on the page before gridmvc.min.js script. - -For more documetation, please see: http://gridmvc.codeplex.com/ \ No newline at end of file diff --git a/StockManMVC/Scripts/_references.js b/StockManMVC/Scripts/_references.js index 392763a..d75ee0c 100644 Binary files a/StockManMVC/Scripts/_references.js and b/StockManMVC/Scripts/_references.js differ diff --git a/StockManMVC/Scripts/gridmvc.js b/StockManMVC/Scripts/gridmvc.js deleted file mode 100644 index 2f892f5..0000000 --- a/StockManMVC/Scripts/gridmvc.js +++ /dev/null @@ -1,724 +0,0 @@ -/*** -* Grid.Mvc -* Examples and documentation at: http://gridmvc.codeplex.com -* Version: 3.0.0 -* Requires: window.jQuery v1.3+ -* LGPL license: http://gridmvc.codeplex.com/license -*/ -window.pageGrids = window.pageGrids || {}; -$.fn.extend({ - gridmvc: function () { - var aObj = []; - $(this).each(function () { - if (!$(this).data("gridmvc")) { - var options = { lang: $(this).attr("data-lang"), selectable: $(this).attr("data-selectable") == "true", multiplefilters: $(this).attr("data-multiplefilters") == "true" }; - var grid = new GridMvc(this, options); - var name = $(this).attr("data-gridname"); - if (name.length > 0) - window.pageGrids[$(this).attr("data-gridname")] = grid; - - aObj.push(grid); - $(this).data("gridmvc", grid); - } else { - aObj.push($(this).data("gridmvc")); - } - }); - if (aObj.length == 1) - return aObj[0]; - return aObj; - } -}); - -GridMvc = (function ($) { - function gridMvc(container, options) { - this.jqContainer = $(container); - options = options || {}; - this.options = $.extend({}, this.defaults(), options); - this.init(); - } - - gridMvc.prototype.init = function () { - //load current lang options: - this.lang = GridMvc.lang[this.options.lang]; - if (typeof (this.lang) == 'undefined') - this.lang = GridMvc.lang.en; - this.events = []; - if (this.options.selectable) - this.initGridRowsEvents(); - //Register default filter widgets: - this.filterWidgets = []; - this.addFilterWidget(new TextFilterWidget()); - this.addFilterWidget(new NumberFilterWidget()); - this.addFilterWidget(new DateTimeFilterWidget()); - this.addFilterWidget(new BooleanFilterWidget()); - - this.openedMenuBtn = null; - this.initFilters(); - }; - /*** - * Handle Grid row events - */ - gridMvc.prototype.initGridRowsEvents = function () { - var $this = this; - this.jqContainer.on("click", ".grid-row", function () { - $this.rowClicked.call(this, $this); - }); - }; - /*** - * Trigger on Grid row click - */ - gridMvc.prototype.rowClicked = function ($context) { - if (!$context.options.selectable) - return; - var row = $(this).closest(".grid-row"); - if (row.length <= 0) - return; - var gridRow = {}; - row.find(".grid-cell").each(function () { - var columnName = $(this).attr("data-name"); - if (columnName.length > 0) - gridRow[columnName] = $(this).text(); - }); - var evt = $.Event("RowClicked"); - $context.notifyOnRowSelect(gridRow, evt); - if (!evt.isDefaultPrevented()) - $context.markRowSelected(row); - }; - /*** - * Mark Grid row as selected - */ - gridMvc.prototype.markRowSelected = function (row) { - this.jqContainer.find(".grid-row.grid-row-selected").removeClass("grid-row-selected"); - row.addClass("grid-row-selected"); - }; - /*** - * Default Grid.Mvc options - */ - gridMvc.prototype.defaults = function () { - return { - selectable: true, - multiplefilters: false, - lang: 'en' - }; - }; - /*** - * ============= EVENTS ============= - * Methods that provides functionality for grid events - */ - gridMvc.prototype.onRowSelect = function (func) { - this.events.push({ name: "onRowSelect", callback: func }); - }; - - gridMvc.prototype.notifyOnRowSelect = function (row, e) { - e.row = row; - this.notifyEvent("onRowSelect", e); - }; - - gridMvc.prototype.notifyEvent = function (eventName, e) { - for (var i = 0; i < this.events.length; i++) { - if (this.events[i].name == eventName) - if (!this.events[i].callback(e)) break; - } - }; - /*** - * ============= FILTERS ============= - * Methods that provides functionality for filtering - */ - /*** - * Method search all filter buttons and register 'onclick' event handlers: - */ - gridMvc.prototype.initFilters = function () { - var filterHtml = this.filterMenuHtml(); - var self = this; - this.jqContainer.find(".grid-filter").each(function () { - $(this).click(function () { - return self.openFilterPopup.call(this, self, filterHtml); - }); - }); - }; - /*** - * Shows filter popup window and render filter widget - */ - gridMvc.prototype.openFilterPopup = function (self, html) { - //retrive all column filter parameters from html attrs: - var columnType = $(this).attr("data-type") || ""; - //determine widget - var widget = self.getFilterWidgetForType(columnType); - //if widget for specified column type not found - do nothing - if (widget == null) - return false; - - //if widget allready rendered - just open popup menu: - if (this.hasAttribute("data-rendered")) { - var or = self.openMenuOnClick.call(this, self); - self.setupPopupInitialPosition($(this)); - if (!or && typeof (widget.onShow) != 'undefined') - widget.onShow(); - return or; - } - - var columnName = $(this).attr("data-name") || ""; - var filterData = $(this).attr("data-filterdata") || ""; - var widgetData = $(this).attr("data-widgetdata") || "{}"; - var filterDataObj = self.parseFilterValues(filterData) || {}; - var filterUrl = $(this).attr("data-url") || ""; - - //mark filter as rendered - $(this).attr("data-rendered", "1"); - //append base popup layout: - $(this).append(html); - - //determine widget container: - var widgetContainer = $(this).find(".grid-popup-widget"); - //onRender target widget - if (typeof (widget.onRender) != 'undefined') - widget.onRender(widgetContainer, self.lang, columnType, filterDataObj, function (values) { - self.closeOpenedPopups(); - self.applyFilterValues(filterUrl, columnName, values, false); - }, $.parseJSON(widgetData)); - //adding 'clear filter' button if needed: - if ($(this).find(".grid-filter-btn").hasClass("filtered") && widget.showClearFilterButton()) { - var inner = $(this).find(".grid-popup-additional"); - inner.append(self.getClearFilterButton(filterUrl)); - inner.find(".grid-filter-clear").click(function () { - self.applyFilterValues(filterUrl, columnName, "", true); - }); - } - var openResult = self.openMenuOnClick.call(this, self); - if (typeof (widget.onShow) != 'undefined') - widget.onShow(); - self.setupPopupInitialPosition($(this)); - return openResult; - }; - - gridMvc.prototype.setupPopupInitialPosition = function (popup) { - var drop = popup.find(".grid-dropdown"); - function getInfo() { - var arrow = popup.find(".grid-dropdown-arrow"); - return { arrow: arrow, currentDropLeft: parseInt(drop.css("left")), currentArrowLeft: parseInt(arrow.css("left")) }; - } - var dropLeft = drop.offset().left; - if (dropLeft < 0) { - var info = getInfo(); - info.arrow.css({ left: (info.currentArrowLeft + dropLeft - 10) + "px" }); - drop.css({ left: (info.currentDropLeft - dropLeft + 10) + "px" }); - return; - } - var dropWidth = drop.width(); - var offsetRight = $(window).width() - (dropLeft + dropWidth); - if (offsetRight < 0) { - var info = getInfo(); - info.arrow.css({ left: (info.currentArrowLeft - offsetRight + 10) + "px" }); - drop.css({ left: (info.currentDropLeft + offsetRight - 10) + "px" }); - } - }; - /*** - * Returns layout of filter popup menu - */ - gridMvc.prototype.filterMenuHtml = function () { - return '
'; - }; - /*** - * Returns layout of 'clear filter' button - */ - gridMvc.prototype.getClearFilterButton = function () { - return ''; - }; - /*** - * Register filter widget in widget collection - */ - gridMvc.prototype.addFilterWidget = function (widget) { - this.filterWidgets.push(widget); - }; - /*** - * Parse filter settings from data attribute - */ - gridMvc.prototype.parseFilterValues = function (filterData) { - var opt = $.parseJSON(filterData); - var filters = []; - for (var i = 0; i < opt.length; i++) { - filters.push({ filterValue: this.urldecode(opt[i].FilterValue), filterType: opt[i].FilterType, columnName: opt[i].ColumnName }); - } - return filters; - }; - - gridMvc.prototype.urldecode = function (str) { - return decodeURIComponent((str + '').replace(/\+/g, '%20')); - }; - - /*** - * Return registred widget for specific column type name - */ - gridMvc.prototype.getFilterWidgetForType = function (typeName) { - for (var i = 0; i < this.filterWidgets.length; i++) { - if ($.inArray(typeName, this.filterWidgets[i].getAssociatedTypes()) >= 0) - return this.filterWidgets[i]; - } - return null; - }; - /*** - * Replace existed filter widget - */ - gridMvc.prototype.replaceFilterWidget = function (typeNameToReplace, widget) { - for (var i = 0; i < this.filterWidgets.length; i++) { - if ($.inArray(typeNameToReplace, this.filterWidgets[i].getAssociatedTypes()) >= 0) { - this.filterWidgets.splice(i, 1); - this.addFilterWidget(widget); - return true; - } - } - return false; - }; - /*** - * Applies selected filter value by redirecting to another url: - */ - gridMvc.prototype.applyFilterValues = function (initialUrl, columnName, values, skip) { - var filters = this.jqContainer.find(".grid-filter"); - if (initialUrl.length > 0) - initialUrl += "&"; - - var url = ""; - if (!skip) { - url += this.getFilterQueryData(columnName, values); - } - - if (this.options.multiplefilters) { //multiple filters enabled - for (var i = 0; i < filters.length; i++) { - if ($(filters[i]).attr("data-name") != columnName) { - var filterData = this.parseFilterValues($(filters[i]).attr("data-filterdata")); - if (filterData.length == 0) continue; - if (url.length > 0) url += "&"; - url += this.getFilterQueryData($(filters[i]).attr("data-name"), filterData); - } else { - continue; - } - } - } - - window.location.search = initialUrl + url; - }; - gridMvc.prototype.getFilterQueryData = function (columnName, values) { - var url = ""; - for (var i = 0; i < values.length; i++) { - url += "grid-filter=" + encodeURIComponent(columnName) + "__" + values[i].filterType + "__" + encodeURIComponent(values[i].filterValue); - if (i != values.length - 1) - url += "&"; - } - return url; - }; - /*** - * ============= POPUP MENU ============= - * Methods that provides base functionality for popup menus - */ - gridMvc.prototype.openMenuOnClick = function (self) { - if ($(this).hasClass("clicked")) return true; - self.closeOpenedPopups(); - $(this).addClass("clicked"); - var popup = $(this).find(".dropdown-menu"); - if (popup.length == 0) return true; - popup.show(); - popup.addClass("opened"); - self.openedMenuBtn = $(this); - $(document).bind("click.gridmvc", function (e) { - self.documentCallback(e, self); - }); - return false; - }; - - gridMvc.prototype.documentCallback = function (e, $context) { - e = e || event; - var target = e.target || e.srcElement; - var box = $(".dropdown-menu.opened").get(0); - var html = $("html").get(0); - if (typeof box != "undefined") { - do { - if (box == target) { - // Click occured inside the box, do nothing. - return; - } - if (html == target) { - box.style.display = "none"; - $(box).removeClass("opened"); - } - target = target.parentNode; - } while (target); // Click was outside the box, hide it. - - } - if ($context.openedMenuBtn != null) - $context.openedMenuBtn.removeClass("clicked"); - $(document).unbind("click.gridmvc"); - }; - - gridMvc.prototype.closeOpenedPopups = function () { - var openedPopup = $(".dropdown-menu.opened"); - openedPopup.hide(); - openedPopup.removeClass("opened"); - if (this.openedMenuBtn != null) - this.openedMenuBtn.removeClass("clicked"); - }; - - /* Grid.Mvc clients functions */ - - gridMvc.prototype.selectable = function (enable) { - this.options.selectable = enable; - }; - - return gridMvc; -})(window.jQuery); - -/*** -* ============= LOCALIZATION ============= -* You can localize Grid.Mvc by creating localization files and include it on the page after this script file -* This script file provides localization only for english language. -* For more documentation see: http://gridmvc.codeplex.com/documentation -*/ -if (typeof (GridMvc.lang) == 'undefined') - GridMvc.lang = {}; -GridMvc.lang.en = { - filterTypeLabel: "Type: ", - filterValueLabel: "Value:", - applyFilterButtonText: "Apply", - filterSelectTypes: { - Equals: "Equals", - StartsWith: "StartsWith", - Contains: "Contains", - EndsWith: "EndsWith", - GreaterThan: "Greater than", - LessThan: "Less than" - }, - code: 'en', - boolTrueLabel: "Yes", - boolFalseLabel: "No", - clearFilterLabel: "Clear filter" -}; -/*** -* ============= FILTER WIDGETS ============= -* Filter widget allows onRender custom filter user interface for different columns. -* For example if your added column is of type "DateTime" - widget can onRender calendar for picking filter value. -* This script provider base widget for default .Net types: System.String, System.Int32, System.Decimal etc. -* If you want to provide custom filter functionality - you can assign your own widget type for column and write widget for this types. -* For more documentation see: http://gridmvc.codeplex.com/documentation -*/ - -/*** -* TextFilterWidget - Provides filter interface for text columns (of type "System.String") -* This widget onRenders filter interface with conditions, which specific for text types: contains, starts with etc. -*/ -TextFilterWidget = (function ($) { - function textFilterWidget() { } - /*** - * This method must return type of columns that must be associated with current widget - * If you not specify your own type name for column (see 'SetFilterWidgetType' method), GridMvc setup column type name from .Net type ("System.DateTime etc.) - */ - textFilterWidget.prototype.getAssociatedTypes = function () { return ["System.String"]; }; - /*** - * This method invokes when filter widget was shown on the page - */ - textFilterWidget.prototype.onShow = function () { - var textBox = this.container.find(".grid-filter-input"); - if (textBox.length <= 0) return; - textBox.focus(); - }; - /*** - * This method specify whether onRender 'Clear filter' button for this widget. - */ - textFilterWidget.prototype.showClearFilterButton = function () { return true; }; - /*** - * This method will invoke when user first clicked on filter button. - * container - html element, which must contain widget layout; - * lang - current language settings; - * typeName - current column type (if widget assign to multipile types, see: getAssociatedTypes); - * filterType - current filter type (like equals, starts with etc); - * filterValue - current filter value; - * cb - callback function that must invoked when user want to filter this column. Widget must pass filter type and filter value. - */ - textFilterWidget.prototype.onRender = function (container, lang, typeName, values, cb) { - this.cb = cb; - this.container = container; - this.lang = lang; - this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value - this.renderWidget(); - this.registerEvents(); - }; - /*** - * Internal method that build widget layout and append it to the widget container - */ - textFilterWidget.prototype.renderWidget = function () { - var html = '