Sha256: 5904512e72f3a69903f3191b94cea542cb3190b1c01bc46ae8f58456d0421c8e
Contents?: true
Size: 1.07 KB
Versions: 8
Compression:
Stored size: 1.07 KB
Contents
Dune.Dune ?= {} Dune.Dune.Admin ?= {} Dune.Dune.Admin.Modules ?= {} Dune.Dune.Admin.Modules.Sort = Backbone.View.extend el: ".admin" events: "click [data-sort]": "sort" initialize: -> @form = @$("form") @table = @$(".data-table") @selectSorting() if @table.length > 1 getSorting: -> sortField = @form.find("[name=order_by]") sort = sortField.val().split(" ") field: sort[0] order: sort[1] selectSorting: -> link = @$("a[data-sort=\"" + @getSorting().field + "\"]") sortOrder = link.siblings("span.sort-order") # Clean old sort orders @$("[data-sort]").siblings("span.sort-order").html "" # Add sorting order to header if @getSorting().order is "DESC" sortOrder.html "(desc)" else sortOrder.html "(asc)" sort: (event) -> link = $(event.target) sortField = @form.find("[name=order_by]") # Put sorting data in hidden field and select sorting sortField.val link.data("sort") + " " + ((if @getSorting().order is "ASC" then "DESC" else "ASC")) @selectSorting() @form.submit() false
Version data entries
8 entries across 8 versions & 1 rubygems