public override void HandleRequest(string jsonString, AjaxBase ajax) { if (!User.IsAdminLoggedIn(ajax)) { ajax.Unauthorized(); return; } AdminMangaFilterResponse response = new AdminMangaFilterResponse(); response.collections = Collection.GetAllCollectionNames(); response.tags = Manga.GetAllTags(); response.authors = MangaMeta.GetAuthors(); ajax.ReturnJson(response); }
public void FilterRequestSuccess(AdminMangaFilterResponse response) { Show(); jQueryObject select = jQuery.Select("#admin-manga-filter-collection"); string value = select.GetValue(); select.Children().Remove(); jQuery.FromHtml("<option></option>").AppendTo(select).Value("").Text(Strings.Get("All")); foreach (string collection in response.collections) { jQuery.FromHtml("<option></option>").AppendTo(select).Text(collection); } select.Value(value); select = jQuery.Select("#admin-manga-filter-tag"); value = select.GetValue(); select.Children().Remove(); jQuery.FromHtml("<option></option>").AppendTo(select).Value("").Text(Strings.Get("All")); foreach (string tag in response.tags) { jQuery.FromHtml("<option></option>").AppendTo(select).Text(tag); } select.Value(value); select = jQuery.Select("#admin-manga-filter-author"); value = select.GetValue(); select.Children().Remove(); jQuery.FromHtml("<option></option>").AppendTo(select).Value("").Text(Strings.Get("All")); foreach (string author in response.authors) { jQuery.FromHtml("<option></option>").AppendTo(select).Text(author); } select.Value(value); }