routing

how to set the routing translation based on annotation?

送分小仙女□ 提交于 2019-12-07 11:50:32
问题 All the routing of my website is realized based on the annotations. Now, I want to translate my routing. To realize that, I tried to use the bundle JMSI18nRoutingBundle. Nevetheless, the documentation does not give any example how to specify the route for each locale. This is an action with its routing, how to translate it? /** * @Route("/welcome", name="welcome") * @Template() */ public function welcomeAction() { return array(); } Thanks, Question after being edited /** * @Route("/welcome",

Route value with dashes

强颜欢笑 提交于 2019-12-07 11:34:27
问题 I have this route: routes.MapRoute( "News", "News/{id}-{alias}", new { controller = "News", action = "Show" }, new { id = @"^[0-9]+$" }, namespaces: new[] { "Site.Controllers" } ); This route working for url's like this: http://localhost:54010/News/6-news But not working for url's like this: http://localhost:54010/News/6-nice-news How use dashes in my route value "alias"? EDITED Route like this: "News/{id}_{alias}" works for both url's: http://localhost:54010/News/6_news http://localhost

ASP.NET MVC: Uri to usable route data

╄→尐↘猪︶ㄣ 提交于 2019-12-07 11:28:48
问题 My problem is pretty simple. I've got a Uri and I want to figure out which route it maps to so I can do some checks on the various pieces of the route: controller, action, etc. How do I go from Uri to RouteData or Route? 回答1: Based on @tvanfosson's direction, I came up with a class that does what I need. Note that the GetRouteData actually looks at the AppRelativeCurrentExecutionFilePath and the PathInfo properties on the RequestContextBase class, not the Url property. public class RouteInfo

I18n in EmberJS (routing and in general)

依然范特西╮ 提交于 2019-12-07 11:07:00
问题 Does EmberJS support translated routes for internationalized apps? Or does it at least make it easy to extend it to support i18n routes? Anybody with experience with this? E.g. can the route string be somehow set dynamically from locale files? Also it would be cool when using Ember with Rails routing would not have to be specified twice... is that so? I'm new to Ember (currently evaluating js frameworks) but I assume in general with Rails one would simply specify very basic routes from within

Why does Kademlia structure its routing table how it does?

╄→гoц情女王★ 提交于 2019-12-07 09:23:19
问题 I understand that the Kademlia routing table is made up of 160 buckets. Nodes are put into buckets 0-159, depending on their prefix length (which is the number of leading unset bits in the XOR of the local node key and the node). Why is this so, is there any performance benefits involved (other than the fact that iterating through 160*20 nodes to find the closest is infeasible)?. 回答1: Kademlia uses the XOR of 2 node IDs as a measure of their distance apart. The idea with the routing table

ASP.NET MVC One Way Route

僤鯓⒐⒋嵵緔 提交于 2019-12-07 08:23:16
问题 Is it possible to define a route in the RouteCollection of Asp.net MVC, so that it just does the "URL rewriting" part and ignore the URL generation with Html.Actionlink(...)? In fact I want to add a keyword between controller and action (controller/..keyword.../action) for certain very special requests. The generated URLs on the pages, however, should remain using the default routes. (controller/action) 回答1: Yes you can do what you are asking. You would just create your own route that

Route all requests through PageController except existing controllers (Zend Framework)

旧时模样 提交于 2019-12-07 08:21:58
问题 For a new CMS i've developed a Pages module that allows me to manage the site's tree structure. Each page is reachable from the url http://www.example.com/pageslug/ where pageslug identifies the page being called. What I want to achieve now is a route that allows me to route all incoming requests to a single PagesController unless it's a request to an existing controller (like images for example). It's easy enough to catch all requests to the Pages Controller but how to exclude existing

How-to: Devise after_sign_up_redirect?

半世苍凉 提交于 2019-12-07 08:17:02
问题 I tried to follow the instructions here (GitHub Devise Wiki) but it's not working for me. I'm trying to get Devise to redirect to /welcome after user signs up. I created a Registrations controller but it's never going into the view. What am I doing wrong here? Ruby 1.9.2 Rails 3.1.0.rc4 Devise 1.4.2 Thank you UPDATE: For some reason after_sign_up_path_for is not triggered but after_sign_in_path_for is triggered. I would still like to get after_sign_up_path_for to work though _app/controllers

Rails - Failing Routes in deployment

早过忘川 提交于 2019-12-07 08:10:35
问题 I have an app that has the following in the routes file: namespace "admin" do # ADMINISTRATIVE ROUTES ONLY root :to => 'home#index' resources :comments do member do get :approve get :reject end end resources :users do member do get :block get :unblock end end end When browing to /admin locally, I am greeted by the appropriate page. On the same URL on the heroku version I get a 404. The route shows correctly in 'heroku rake routes' Logs are showing: ActionController::RoutingError (wrong

Weird routing error in Rails 3.0

好久不见. 提交于 2019-12-07 07:05:08
问题 I've been converting my Rails 2.3.9 application to Rails 3.0 and everything has been going well. I've created a lot of routes with the new system so I feel like I know how to do this. However, I recently got a routing error I can't solve. I have a users resource defined like this: resources :users do member do get 'activate' get 'edit_password' post 'update_password' end collection do get 'forgot_password' post 'send_reset_instructions' end end The failing route is update_password. If I