controller

In rails controllers, how to prevent double submit (when user double-clic submit button or hit enter twice)?

倾然丶 夕夏残阳落幕 提交于 2019-12-09 02:32:38
问题 Well, everything's in the title but I'll explain a little more :-) My rails app contain many forms (Ajaxified or not). To prevent users to submit twice or more some forms, I use Javascript. There's my scenario for a Ajaxified form : the user submit the form (clic or enter) the javascript disable the submit button the rails controller do things (like a Soap request or an insert in a DB) the rails controller update the page and enable the submit button if necessary (in case of errors) Now I

Ember.js How to get controller in needs which is nested controllerName

久未见 提交于 2019-12-09 00:27:16
问题 I want to use this.get('controllers.pack.query'); to get App.PackQueryController in App.PackController , but failed. I think the problem is Ember use pack not pack.query as controllerName when it tries to get the controller. Although I can get the controller by this.controllerFor('pack.query') , but Ember says it is deprecated, please use needs instead My router map likes below and I've defined needs: ['pack.query'] in App.PackController App.Router.map(function () { this.resource('pack',

How do I activate an Iron Router route without changing the path?

旧巷老猫 提交于 2019-12-08 21:00:30
In my Meteor app, I'm trying to pass data from my Iron Router controller to a template that's a partial in my app. How do I activate a route without changing the path? I don't want to switch pages, only render the partial with my data (if that makes sense). Here's how the app works: Right now, the route is activated when I click a dropdown link in my navbar Template.navbar.events 'click #threads-link': (event)-> Router.go 'allThreads' This renders the template with my data as long as I have a path in my route. But since I don't want the path to change, I tried leaving the path--and then the

Getting the URL of the calling page Java

血红的双手。 提交于 2019-12-08 17:37:51
问题 To put you in the picture, we're using a custom server based on Tomcat 6.0.29. We're developing using Java and Spring. Let's say I have a link which takes you from http://localhost/display to http://localhost/save. In the controller of http://localhost/save, can I get http://localhost/display from the request parameter somehow? request.getRequestURL() seems to get the url of the current page. 回答1: This should give you the referring page (is most cases) request.getHeader("referer"); See here

data on laravel got retrieve 2 times

旧时模样 提交于 2019-12-08 12:13:48
问题 Hello so I have system that showing comment data per post in admin dashboard but I got problem here, So I already showing the data in dashboard but my comment data got retrieve 2 times and I don't know why here is my function in controller public function getCommentPost($id){ $user = Auth::user(); $compalls = $user->posts; foreach ($compalls as $key => $value) { $compalls[$key]->comment_all = Idea::where('id_post', $id)->get(); } return view('admin.comment_all', compact('compalls')); } this

post viewmodel with IList to controller post method

爱⌒轻易说出口 提交于 2019-12-08 11:48:34
问题 I have a view model with a IList: public class MyMaintenanceListViewModel { public IList<MyMaintenance> MyMaintenanceList { get; set; } [Display(Name = "Network User Name:")] public string NetworkUserName { get; set; } [Display(Name = "Password:")] public string Password { get; set; } } I have a view whose model is set to the viewmodel: @model EMMS.ViewModels.MyMaintenanceListViewModel @using (Html.BeginForm("SubmitMaintenance", "Maintenance")) { <table id="searchtable" class="MyMaintenance">

AngularJS - Changing a query param term within $routeProvider?

安稳与你 提交于 2019-12-08 11:03:17
问题 I am creating a navigation, where when on the active 'link', a feed loads but with a different searched term. Basically, the all the links are the same, the only difference is the term set in the .factory parameter. Since everything is the same (even the .controller, is it possible to set the query term inside of the routeProvider, where I can specify the term that needs to be searched? Or will the only way is to create a new controller for each link, and set the term inside of there? Keeping

RSpec controller test fails for simple route

寵の児 提交于 2019-12-08 09:12:52
问题 This is probably a very basic error, but I am still learing. =) My routes.rb consists only of WebPortal::Application.routes.draw do resources :categories end If I understand this correctly, this should (among others) map /categories to CategoriesController.index . This controller looks like class CategoriesController < ApplicationController def index end end The corresponding view file exists, and rails server serves this page fine. But my RSpec test describe CategoriesController do describe

Set global variables for all controllers in Kohana 2.3.4

不问归期 提交于 2019-12-08 09:07:32
问题 Is the proper way to make a few variables available to all my controllers to add a MY_Controller.php file in my /application/libraries/ folder (shown in the docs here)? I'm working in Kohana 2.3.4 and wondering if there are any better ways to do it, or is this the only recommended method? Being new to OOP, can you link me to any examples? I've heard the right answer is to add the vars to your $config[] , trying to get more details. 回答1: The proper way is to make a custom config file

Symfony2 reusable functions in controllers

ぐ巨炮叔叔 提交于 2019-12-08 08:56:02
问题 After some time without knowing how to do this properly, and avoid duplicating code in several controllers, I searched and again to seek, but can not find a clear answer. One case in particular, need to calculate several statistics data completed of an entity. This calculation will use in 3 different controllers. In two of them, I'll show broken down into different layouts, and on the third, I will use this data to make a global calculation. business logic for each calculation, involves more