Search Results

Search found 2030 results on 82 pages for 'controllers'.

Page 4/82 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Should frontend and backend handled by different controllers?

    - by DR
    In my previous learning projects I always used a single controller, but know I wonder if that is good practice or even always possible. In all RESTful Rails tutorials the controllers have a show, an edit and an index view. If an authorized user is logged on, the edit view becomes available and the index view shows additional data manipulation controls, like a delete button or a link to the edit view. Now I have a Rails application which falls exactly into this pattern, but the index view is not reusable: The normal user sees a flashy index page with lots of pictures, complex layout, no Javascript requirement, ... The Admin user index has a completly different minimalistic design, jQuery table and lots of additional data, ... Now I'm not sure how to handle this case. I can think of the following: Single controller, single view: The view is split into two large blocks/partials using an if statement. Single controller, two views: index and index_admin. Two different controllers: BookController and BookAdminController None of this solutions seems perfect, but for now I'm inclined to use the 3rd option. What's the preferred way to do this?

    Read the article

  • Passing Values to Controllers

    - by Dru
    I'm trying to allow users to 'favorite' links (that is, create a new Favorite record with their user_id and the link_id) This is what I have so far.. When I click favorite (as a user), the new record is assigned to the user_id but the link_id field is nil. How can I pass the link_id into my FavoritesController? My View Code Added Link Model Code class FavoritesController < ApplicationController def create @user = User.find(session[:user_id]) @favorite = @user.favorites.create :link_id => params[:id] redirect_to :back end end The Favorite model belongs to :user and :link Note: I've also tried this but when I click 'favorite', there's an error "Couldn't find Link without an ID." Update <%= link_to "Favorite", :controller => :favorites, :action => :create, :link_id => link.id %> with class FavoritesController < ApplicationController def create @user = User.find(session[:user_id]) @favorite = @user.favorites.create :link_id => :params[:link_id] redirect_to :back end end Returns "can't convert Symbol into Integer" app/controllers/favorites_controller.rb:4:in [] app/controllers/favorites_controller.rb:4:in create I've tried forcing it into an Integer several ways with .to_i

    Read the article

  • Server side aggregation using Spring MVC Controllers

    - by Venu
    Hi! We have a web site with multiple pages each with lot of AJAX calls. All the Ajax calls go to a data proxy layer written in Spring 3 MVC application. In order to reduce the load on the server we are planning to aggregate calls on the client and send to the proxy layer. For ex: we have two calls /controller1/action1 and /controller2/action2 in different controllers. I want to write an aggregate controller and call it from the client instead of making two calls to the individual controllers. Something like /aggregatecontroller/aggregate (and we will post the information regarding which calls are being aggregated and required parameters). Is there any way we can call another controller/action from a controller/action and get output? The flow will be something like this: a. Call /aggregatecontroller/aggregate with info regd call1 and call2 b. aggregate action understands that it needs to aggregate call1 and call2 c. it calls /controller1/action1 and gets the response d. it calls /controller2/action2 and gets the response e. it merges both in a json response and sends it back to browser. Please let me know if you have any suggestion regd how to do this or if you think there is a better approach to do the server side aggregation. Thanks for your time.

    Read the article

  • Frame sizing of tableview within nested child controllers/subviews

    - by jwoww
    I'm a bit confused by the proper frame sizing of a table view to fit within my screen. Here's my setup of view controllers within view controllers: UITabBarController UINavigationController as one of the tab bar viewcontrollers; title bar hidden ViewController - a container view controller because I need the option to place some controls beneath the UITableView, sometimes (but not in the current scenario) UITableViewController Now, my question is what the proper frame dimensions of the UITableview should be. Here's what I've got in the ViewController viewDidLoad method. I used subtracted 49.0 (the size of the tab bar) from 480.0. However, this leaves a black bar at the bottom. 20.0 appears to do it (coincidentally?) the size of the status bar, but I don't understand why that would be. Wouldn't the true pixel dimensions of the tableview be 480-49? // MessageTableViewController is my subclass of UITableViewController MessagesTableViewController *vcMessagesTable = [[MessagesTableViewController alloc] init]; CGRect tableViewFrame = CGRectMake(0, 0, 320.0, 480.0 - 49.0); [[vcMessagesTable view] setFrame:tableViewFrame]; self.tableViewController = vcMessagesTable; [self addChildViewController:vcMessagesTable]; [[self view] addSubview:vcMessagesTable.view]; Here's how it looks:

    Read the article

  • DNS Settings in Cisco Wireless Lan Controllers

    - by Braden
    The WLC is a 2100 series and I have looked back and forth through the entire web interface. Originally the idea was that the gateway should be the DNS controler and the WLC pointed directly at the gateway. For some reason, random clients are having DNS specific issues when it comes to seeing certain shares around the network. The problems are also very intermittent. Aside from going to each box and implementing a static DNS is there ACTUALLY a DNS setting lodged into the WLC settings (and I am being a numpty and can't find them) or am I stuck with performing the config 1 by 1?

    Read the article

  • Read Only Domain Controllers and DNS zone updates

    - by Mike M
    I have a Windows 2003 domain and just added a new DC that runs 2008 R2. I updated the schema accordingly for both forest and domain levels. I also made sure to run /rodcprep at the time I did this. I have a branch office with a 2008 R2 file/print server that is a read-only domain controller (DC). The one problem I have been having is with AD-integrated DNS records updates. In the data center, we had to make an IP address change on a particular server. All our other sites' DCs (2003) updated the record fine. The 2008 R2 DC in the data center also updates its record fine. However, the RODC in the branch office does not. So if I nslookup the target server on a 2003 DC, the IP address is correct. Same with the 2008 R2 DC in the data center. But an nslookup on the branch office RODC still pulls in the old IP address. Moreover, any new records we've created (e.g., just added a new terminal server) do not get updated on the branch RODC either. Is there something simple I'm missing? How do I get the RODC to sync its AD-integrated DNS records with the rest of my world? Thank you in advance for your responses. Mike

    Read the article

  • Regarding AD Domain controllers and remote branch offices

    - by Alex
    We have central HQ building and a lot of small branch offices connecting via VPN and want to implement AD (If you can believe we still haven't). We want everyone to log in using domain accounts and be policed centrally. We are OK with having a RODC in a branch office with like 10 computers. But we have these small branches with two to four PCs only. Some of these branches connect to HQ via IPSec site-to-site VPN, some via remote access (client-based) VPN. So there is no problem with ones that have local RODC or connecting to HQ DCs via VPN router. But how about small branches? We don't really want to set up a machine there, neither we want to invest into Windows Server licenses or fancy network equipment. Also, the problem is that we cannot access HQ DCs via VPN because we are not logged in and connected to HQ internal network yet, so DCs aren't reachable. What is typically done in that situation if it is needed to have central management over policies on those PCs? Or is it better to let 'em loose and use local policies and accounts in this situation?

    Read the article

  • Wireless controllers vs wireless usb hub

    - by David Jensen
    For my htpc i currently only have a steerin wheel as a controller. This is wired and it looks really bad having extended usb wires from the tv to the table. However im thinking of bying some new Gamepads and now comes the question. Should i buy wireless ones or wired and connect them to a wireless usb hub? Having a wireless hub would let me manage my gamepads easily from the couch. A wireless hub also allows me to connect other things that are not input devices from the couch. However im wondering if wireless usb hubs may not be made for input devices in the way that they may not have 100% uptime and probably some delay. Am i right about this?

    Read the article

  • Deploying MVC2 application to IIS7.5 - Ninject asked to provide controllers for content files

    - by Rune Jacobsen
    I have an application that started life as an MVC (1.0) app in Visual Studio 2008 Sp1 with a bunch of Silverlight 3 projects as part of the site. Nothing fancy at all. Using Ninject for dependency injection (first version 2 beta, now the released version 2 with the MVC extensions). With the release of .Net 4.0, VS2010, MVC2 etc., we decided to move the application to the newest platform. The conversion wizard in VS2010 apparently took care of everything, with one exception - it didn't change references to mvc1 to now point to mvc2, so I had to do that manually. Of course, this makes me think about other MVC2 things that could be missing from my app, that would be there if I did File - New Project... But that is not the focus of this question. When I deploy this application to the IIS 7.5 server (running on Win2008 R2 x64), the application as such works. However, images, scripts and other static content doesn't seem to exist. Of course they are there on disk on the server, but they don't show up in the client web browser. I am fairly new to IIS, so the only trick I knew is to try to open the web page in a browser on the server, as that could give me more information. And here, finally, we meet our enemy. If I try to go directly to the URL of one of the images (http://server/Content/someimage.jpg for instance), I get the following error in the browser: The IControllerFactory 'Ninject.Web.Mvc.NinjectControllerFactory' did not return a controller for a controller named 'Content'. Aha. The web server tries to feed this request to MVC, who with its' default routing setup assumes Content to be a controller, and fails. How can I get it to treat Content/ and Scripts/ (among others) as non-controllers and just pass through the static content? This of course works with Cassini on my developer machine, but as soon as I deploy, this problem hits. I am using the last version of Ninject MVC 2 where the IoC tool should pass missing controllers to the base controller factory, but this has apparently not helped. I have also tried to add ignore routes for Content etc., but this apparently has no effect either. I am not even sure I am addressing the problem on the right level. Does anyone know where to look to get this app going? I have full control of the web server so I can more or less do whatever I want to it, as long as it starts working. Thanks!

    Read the article

  • Problem dismissing multiple modal view controllers

    - by Sheehan Alam
    I am having trouble getting my modal view controllers to display properly. I have a parent view controller that is the delegate for modal view A. In modal view A I am presenting modal view B, and having the delegate dimiss modal view A. When modal view B appears it seems to display but the screen dims, and the UI locks up, but the app doesn't crash. I set animation settings to NO and I am still getting the same issue.

    Read the article

  • Help organising controllers logically

    - by kenny99
    Hi guys, I'm working on a site which i'm developing using an MVC structure. My models will represent all of data in the site, but i'm struggling a bit to decide on a good controller structure. The site will allow users to login/register and see personal data on a number of pages, but also still have access to public pages, e.g FAQs, Contact page etc. This is what I have at the moment... A Template Controller which handles main template display. The basic template for the site will remain the same whether or not you are logged in. A main Website Controller which extends the Template Controller and handles basic authentication. If the user is logged in, a User::control_panel() method is called from the constructor and this builds the control panel which will be present throughout the authenticated session. If user is not logged in, then a different view is loaded instead of the control panel, e.g with a login form. All protected/public page related controllers will extend the website controller. The user homepage has a number of widgets I want to display, which I'm doing via a Home Controller which extends the Website Controller. This controller generates these widgets via the following static calls: $this->template->content->featured_pet = Pet::featured(); $this->template->content->popular_names = Pet::most_popular(); $this->template->content->owner_map = User::generate_map(); $this->template->content->news = News::snippet(); I suppose the first thing I'm unsure about is if the above static calls to controllers (e.g Pet and User) are ok to remain static - these static methods will return views which are loaded into the main template. This is the way I've done things in the past but I'm curious to find out if this is a sensible approach. Other protected pages for signed in users will be similar to the Home Controller. Static pages will be handled by a Page Controller which will also extend the Website Controller, so that it will know whether or not the user control panel or login form should be shown on the left hand side of the template. The protected member only pages will not be routed to the Page Controller, this controller will only handle publicly available pages. One problem I have at the moment, is that if both public and protected pages extend the Website Controller, how do I avoid an infinite loop - for example, the idea is that the website controller should handle authentication then redirect to the requested controller (URL), but this will cause an infinite redirect loop, so i need to come up with a better way of dealing with this. All in all, does this setup make any sense?! Grateful for any feedback.

    Read the article

  • How do I test controllers and views?

    - by ryeguy
    I'm using rails for the first time, and I love how test-oriented it is and how it encourages you to write tests. I'm just having a hard time figuring out what I should be testing when I test controllers and views. I know that you should test redirects and authorization in the controller tests, but what else? And what should go in view tests? If I'm "following the rules" and only putting loops, conditionals, and echoes in my views, then what is there left to test?

    Read the article

  • Composite Views and View Controllers

    - by BillyK
    Hi, I'm somewhat new to Android and am in the process of designing an application with a couple fairly complex views. One of the views is intended to involve a complex view displaying information associated with model objects and segregated into several different views; the navigation of which is meant to be achieved using sliding effects (i.e. sliding one's finger across the screen to traverse from one screen to the next, etc). The view itself will be used to host multiple sets of views for varying types of model objects, but with a general structure that is reused between them all. As a rough example, the view might come up to display information about a person (the model object), displaying several details views: a view for general information, a view displaying a list of hobbies, and a view displaying a list of other individuals associated with their social network. The same general view, when given a model object representing a particular car would give several different views: A general view with details, A view containing photo images for that vehicle, a view representing locations which it could be purchased from, and a view providing a list of related cars. (NOTE: This is not the real data involved, but is representative of the general intent for the view). The subviews will NOT cover the entire screen real-estate and other features within the view should be both visible and able to be interacted with by the user. The idea here is that there is a general view structure that is reusable and which will manage a set of subviews dynamically generated based upon the type of model object handed to the view. I'm trying to determine the appropriate way to leverage the Android framework in order to best achieve this without violating the integrity of the framework. Basically, I'm trying to determine how to componentize this larger view into reusable units (i.e. general view, model-specific sub-view controllers, and individual detail views). To be more specific, I'm trying to determine if this view is best designed as a composite of several custom View classes or a composite of several Activity classes. I've seen several examples of custom composite views, but they typically are used to compose simple views without complex controllers and without attention to the general Activity lifecycle (i.e. storing and retrieving data related to the model objects, as appropriate). On the other hand, the only real example I've seen regarding a view comprised of a composite of Activities is the TabActivity itself, and that isn't customizable in the fashion that would be necessary for this. Does anyone have any suggestions as to the appropriate way to structure my view to achieve the application framework I'm looking for? Views? Activities? Something else? Any guidance would be appreciated. Thanks in advance.

    Read the article

  • CodeIgniter helper inside controllers

    - by kapitanluffy
    can i call helper functions inside controller classes? let's say i have this controller with the _open_form method class User extends Controller { function _open_form($action){ print_r(form_open($action)); } } i tried echoing out the result of form_open() but it returns null. it seems that helper functions can't be called inside controllers if your wondering why i need to use it inside the controller instead in the view because we are required to use the given template parser xD

    Read the article

  • Zend Framework - routes - all requests to one controller except requests for existing controllers

    - by se_pavel
    How to create route that accept all requests for unexsting controllers, but leave requests for existing. This code catch all routes $route = new Zend_Controller_Router_Route_Regex('(\w+)', array('controller' = 'index', 'action' = 'index')); $router-addRoute('index', $route); how should I specify route requests like /admin/* or /feedback/* to existing adminController or feedbackController?

    Read the article

  • Dataflow in Controllers & Layouts in Zend Framework

    - by favo
    I use a basic setup which uses a layout.phtml for the HTML Layout and view scripts for the content part. I want to control some variables in the layout in my controllers, i.e. the title of my site. How can I access my layout to output variables from within the controller? Thanks for your feedback!

    Read the article

  • First Call to a Controller, Constant is defined, Second call, "uninitialized constant Oauth"?

    - by viatropos
    I am trying to get the OAuth gem to work with Rails 3 and I'm running into this weird problem... (independent of the gem, I think I've run into this once before) I have a controller called "OauthTestController", and a model called "ConsumerToken". The model looks like this. require 'oauth/models/consumers/token' class ConsumerToken < ActiveRecord::Base include Oauth::Models::Consumers::Token end When I go to "/oauth_test/twitter", it loads the Oauth::Models::Consumers::Token module and I'm able to connect to twitter no problem. But the second time I try it (just refresh the /oauth_test/twitter url), it gives me this error: NameError (uninitialized constant Oauth): app/models/consumer_token.rb:4 app/models/twitter_token.rb:2 app/controllers/oauth_test_controller.rb:66:in `load_consumer' Why is that? It has something to do with load paths or being in development mode maybe?

    Read the article

  • ACL suggestions needed for a small light framework developed

    - by Sai
    Hello all, I've developed a small framework that was needed for the firm that I work. The problem is I've not made a full level framework, as developers are finding tough time to understand what is what, So I made a simple structure with app/controllers, app/models, app/views so that they can clearly separate the code and can get used to higher frameworks later. All other things like components/modules/helpers are just coded for now in a file called app_functions.php. The above framework is derived from cakePHP, not all, but just the framework uses a modified code of dispatcher of cake. The models all work with normal sqls, and views with pure html using a template engine. Now I'm trying to develop a small application over it, it cameout well, but ACL is something which many versions of it have not proved that satisfactory. Can anybody suggest a good ACL. I've checked phpGACL(too heavy), Zend_ACL likely won't be compatible, Cakephp's ACL which wont fit in the structure,as we are not using cake's SQLs, as there too many queries hitting the database for one page display.

    Read the article

  • How to test controllers with CodeIgniter PART 2?

    - by Jeff
    I am having difficulties testing Controllers in Codeigniter: I use Toast but when I invoke my Home Controller class I get an exception that "db" is not defined. Has anybody an idea how to test this 1-1? Thanks class Home_tests extends Toast { function __construct() { parent::__construct(__FILE__); // Load any models, libraries etc. you need here } function test_select_user() { $controller = new Home(); $controller->getDbUser('[email protected]','password'); assert($query->num_rows() == 0 ); } }

    Read the article

  • best-practices for displaying new view controllers ( iPhone )

    - by Tristan
    I need to display a couple of view controllers (eg, login screen, registration screen etc). What's the best way to bring each screen up? Currently for each screen that I'd like to display, I call a different method in the app delegate like this: Code: - (void) registerScreen { RegistrationViewController *reg = [[RegistrationViewController alloc] initWithNibName:@"RegistrationViewController" bundle:nil]; [window addSubview:reg.view]; } - (void) LoginScreen { LoginViewController *log = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; [window addSubview:log.view]; } It works, but I cant imagine it being the best way.

    Read the article

  • testing SpringMVC controllers

    - by Don
    Hi, I'm unit-testing my SpringMVC (v. 2.5) controllers using code like the following: public void testParamValidation() { MyController controller = new MyController(); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("foo", "bar"); request.addParameter("bar", baz"); ModelAndView mav = controller .handleRequest(request, new MockHttpServletResponse()); // Do some assertions on mav } This controller is a subclass of AbstractCommandController, so the parameters are bound to a command bean, and any binding or validation errors are stored in an object that implements the Errors interface. I can't seem to find any way to access this Errors from within the test, is this possible? Thanks, Don

    Read the article

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

    - by ChrisRamakers
    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 controllers? This is my module bootstrap. How can i achieve this in the most preferrable way <?php class Default_Bootstrap extends Zend_Application_Module_Bootstrap { protected function _initRoute() { $this->bootstrap('frontController'); /* @var $frontcontroller Zend_Controller_Front */ $frontcontroller = $this->getResource('frontController'); $router = $frontcontroller->getRouter(); $router->addRoute( 'all', new Zend_Controller_Router_Route('*', array('controller' => 'pages', 'action' => 'view') ) ); } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >