public static string AdviceLink2(this HtmlHelper helper, Advice advice) { return(helper.ActionLink <CenterController>( sc => sc.Advice(advice.AdviceID, Linguistics.UrlTranslite(advice.Name)), advice.Name).ToString()); }
public ActionResult News() { var news = NewsService.GetAll().IsActive().OrderByDescending(n => n.PublishDate) .Take(CommonConst.NewsCount); var feed = new SyndicationFeed("Новости www.specialist.ru", "Новости www.specialist.ru", Request.Url, "newsfeed", news.First().PublishDate); var items = new List <SyndicationItem>(); foreach (var newsItem in news) { var href = RootUrl + Url.Action <SiteNewsController>(c => c.Details(newsItem.NewsID, Linguistics.UrlTranslite(newsItem.Title))) + GetRssUtmPart("news"); var item = new SyndicationItem(newsItem.Title, newsItem.ShortDescription, new Uri(href), newsItem.NewsID.ToString(), newsItem.PublishDate); items.Add(item); } feed.Items = items; return(FeedOrChrome(feed)); }
public static TagDiv Tabs(List <Tuple <string, object> > items) { var head = H.ul[items.Select((x, i) => H.li[H.Anchor("#" + Linguistics.UrlTranslite(x.Item1), x.Item1) .Data("toggle", "tab")].Class(i == 0 ? "active" : ""))].Class("nav nav-tabs"); var body = H.Div("tab-content")[items.Select((x, i) => H.Div("tab-pane" + (i == 0 ? " active" : "")).Id(Linguistics.UrlTranslite(x.Item1))[x.Item2])]; return(H.div[head, body]); }
public static object Tabs(IEnumerable <string> names, params object[] contents) { var ids = names.Select(s => "tab-" + Linguistics.UrlTranslite(s) + Guid.NewGuid().ToString("N")).ToList(); return(div.Class("ui-tab-control")[ ul[names.Select((x, i) => li[a.Href("#" + ids[i])[x]])], contents.Select((x, i) => ids.Count > i ? div.Id(ids[i])[x] : null)]); }
public static TagA NewsAnchor(this UrlHelper url, News news, string title = null) { if (title.IsEmpty()) { title = news.Title ?? "Читать новость"; } return(url.Link <SiteNewsController>( sc => sc.Details(news.NewsID, Linguistics.UrlTranslite(news.Title)), title)); }
public static string Tabs(IEnumerable <string> names, object [] contents, bool useHash = false, int tabContentType = 0, int?activeTab = null) { var isScript = !activeTab.HasValue; var result = "<div class='block_chamfered_content'>" + ChamBegin() + "<div class='{1} {0}'>" .FormatWith(useHash ? "use-hash" : "", isScript ? "tabs-control" : ""); var tabs = "<ul class='bookmarks'>"; var nameList = names.ToList(); for (int i = 0; i < nameList.Count; i++) { var name = nameList[i]; if (name == null) { continue; } string link; if (isScript) { var translit = Linguistics.UrlTranslite(name); link = "<a href='#{0}' rel='tab-{0}'>{1}</a>".FormatWith(translit, name); } else { link = name; } var tab = "<li class='{0}'>{1}</li>" .FormatWith(!isScript && i == activeTab ? "active" : "", link); tabs += tab; } tabs += "</ul>"; result += tabs; names.ForEach((name, i) => { var translit = Linguistics.UrlTranslite(name); result += "<div class='tab-{0} tab_content{2}' {1}>" .FormatWith(translit, Htmls.DisplayNone(!IsIe6() && isScript), tabContentType == 0 ? "" : tabContentType.ToString()); if (i < contents.Length) { result += contents[i]; } result += "</div>"; }); return(result + "</div>" + BlockEnd() + "</div>"); }
public ActionResult Details(int?newsID, string title) { if (newsID == null) { return(null); } var news = NewsService.GetByPK(newsID); if (news == null || !news.IsActive) { return(null); } var currentTitle = Linguistics.UrlTranslite(news.Title); if (title != currentTitle) { return(new RedirectResult(Url .Action <SiteNewsController>( c => c.Details(newsID, currentTitle)), true)); } GroupRepository.LoadWith(x => x.GroupCalc); var seminar = GroupRepository.GetAll() .SeminarsFilter() .OrderByDescending(x => x.DateBeg) .FirstOrDefault(x => x.UrlName == "/news/" + newsID); if (seminar != null) { seminar.Complex = seminar.Complex_TC.GetOrDefault(x => ComplexService.List()[x]); } var model = new NewsVM { News = news, Seminar = seminar }; return(MView(Views.SiteNews.Details, model)); }
private List <string> GetUrls(UrlHelper urlHelper) { var root = RootUrl; var context = new SpecialistDataContext(); var webcontext = new SpecialistWebDataContext(); var urls = new List <string>(); urls.AddRange( context.Courses.IsActive().Where(x => x.UrlName != null).Where(x => x.IsTrack != true) .OrderByDescending(c => c.Course_ID).Select(x => x.UrlName).ToList() .Select(x => root + urlHelper.Action <CourseController>(c => c.Details(x))) ); urls.AddRange( webcontext.News.IsActive().OrderByDescending(n => n.PublishDate).Take(50) .Select(x => new { x.NewsID, x.Title }).ToList() .Select(x => root + urlHelper .Action <SiteNewsController>(c => c.Details(x.NewsID , Linguistics.UrlTranslite(x.Title)))) ); urls.AddRange( webcontext.Sections.IsActive().Select(x => x.UrlName).ToList() .Select(x => root + urlHelper.Action <SectionController>(c => c.Details(x))) ); if (!CommonConst.IsMobile) { urls.AddRange( context.Vendors.IsActive().Select(x => x.UrlName).ToList() .Select(x => root + SimplePages.FullUrls.Vendor + x) ); urls.AddRange( context.Professions.IsActive().Select(x => x.UrlName).ToList() .Select(x => root + urlHelper.Action <ProfessionController>(c => c.Details(x))) ); urls.AddRange( webcontext.Products.IsActive().Select(x => x.UrlName + UrlName.ProductPostfix).ToList() .Select(x => root + urlHelper.Action <ProductController>(c => c.Details(x))) ); urls.AddRange( webcontext.SiteTerms.IsActive().Select(x => x.UrlName).ToList() .Select(x => root + urlHelper.Action <DictionaryController>(c => c.Definition(x))) ); urls.AddRange( webcontext.SimplePages.ToList().Select(x => x.Url) .Select(x => root + x) ); urls.AddRange( context.Certifications.IsActive().Select(x => x.UrlName).ToList() .Select(x => root + urlHelper.Action <CertificationController>( c => c.Details(x))) ); urls.AddRange( context.Exams.Where(x => x.Available).Select(x => x.Exam_TC).ToList() .Select(x => root + urlHelper.Action <ExamController>(c => c.Details(x))) ); } return(urls); }
public static TagA VideoLink(this UrlHelper helper, Video video) { return(helper.Center().Video(video.VideoID, Linguistics.UrlTranslite(video.Name), video.Name)); }
private TagA NewsAnchor(News n, string title = null) { title = title ?? n.Title; return(Anchor("/news/" + n.NewsID + "/" + Linguistics.UrlTranslite(n.Title), title).AbsoluteHref()); }
public ActionResult Advices() { var advices = AdviceService.GetAll().IsActive() .OrderByDescending(n => n.AdviceID) .Take(CommonConst.AdviceCount); var url = RootUrl + Url.Action <RssController>(c => c.Advices()); var feed = new SyndicationFeed("Советы www.specialist.ru", "Советы www.specialist.ru", new Uri(url), "advicesfeed", advices.FirstOrDefault() .GetOrDefault(x => x.CreateDate)); var items = new List <SyndicationItem>(); foreach (var advice in advices) { var item = new SyndicationItem(advice.Name, StringUtils.GetShortText(advice.Description), new Uri(RootUrl + Url.Action <CenterController>(c => c.Advice(advice.AdviceID, Linguistics.UrlTranslite(advice.Name)))), advice.AdviceID.ToString(), advice.CreateDate); items.Add(item); } feed.Items = items; return(FeedOrChrome(feed)); }
public static string LinkAddFragmentCyrillic(this string html, string fragment) { return(html.LinkAddFragment(Linguistics.UrlTranslite(fragment))); }