controller

Ember.js controller variables reseting after page refresh

浪尽此生 提交于 2019-12-25 14:40:03
问题 Using Ember.js: I have a Route App.QueryDataRoute = Ember.Route.extend({ model: function(params) { return Ember.RSVP.hash({ propertyObject: this.controllerFor("cres").get("properties").findBy('title', params.propertytype_title), nrOfOffers: this.controllerFor("queryData").get("nrOfOffers"), deal: this.controllerFor("queryData").get("deal"), price: this.controllerFor("queryData").get("price"), surface: this.controllerFor("queryData").get("surface"), }); } }); All those .get(' [variable name] '

Ember.js controller variables reseting after page refresh

时光毁灭记忆、已成空白 提交于 2019-12-25 14:39:54
问题 Using Ember.js: I have a Route App.QueryDataRoute = Ember.Route.extend({ model: function(params) { return Ember.RSVP.hash({ propertyObject: this.controllerFor("cres").get("properties").findBy('title', params.propertytype_title), nrOfOffers: this.controllerFor("queryData").get("nrOfOffers"), deal: this.controllerFor("queryData").get("deal"), price: this.controllerFor("queryData").get("price"), surface: this.controllerFor("queryData").get("surface"), }); } }); All those .get(' [variable name] '

Pygame Get Value of Button

我与影子孤独终老i 提交于 2019-12-25 09:19:44
问题 I've got this problem with Pygame that I cannot seem to find a solution too. I'm trying to use a PS4 controller to control an RC car. I've got connecting to the controller to the program and seeing how many buttons it has, but I'm unable to get the value of a pushed button in a useable form. Basically, I want to be able to get all of the values of the buttons on the controller. When a button is pressed, the program updates the value of that button and allows me to execute code based on the

Adding more than one string to a controller find condition?

别来无恙 提交于 2019-12-25 09:01:14
问题 I have the following code in one of my Rails (3.1) controllers: @count = Call.where(:destination => current_user.destination_id).count @count_day = Call.where('created_at > ?', 1.days.ago).count @count_month = Call.where('created_at > ?', 30.days.ago).count They are all working as expected, but I am trying to somehow merge two of them together so it shows the count of calls created in the last 1 day, but only for calls with a destination that matches the current users destination_id value. I

best_in_place gem, view not displaying updated edit without page reload

霸气de小男生 提交于 2019-12-25 08:49:49
问题 I added the best_in_place gem to my project and the update does NOT take effect until a page reload has happened. I can see it flash in my show view but it requires a page reload. Why is this? My Lists controller: respond_to :html, :xml, :js def update @list = List.find(params[:id]) @list.update_attributes(params[:list]) respond_with(@list, :location => list_url(@list)) end My Lists show view- <h2 class="page-header"><%= best_in_place @list, :name %></h2> <h2 class="lead"><%= best_in_place

Show and hide based on user role in rails

大城市里の小女人 提交于 2019-12-25 08:48:15
问题 I have the following code in my home.html.erb file; <!-- if seeker is logged in show button "Grab it" --> <% if user_signed_in? %> <div class="grabit alignright"> <small>want to work on this?</small> <!-- if seeker is not logged in, show him the output text of "Sign in to work on this job" --> <% else %> <small>are you a guru? want to work on this? Sign up.</small> <% end %> </div> Now as you can see I'm trying to have Seeker as a user role. Depending if that type of user with that type of

How to get the current module/controller/action from a view script in Zend Framework 2?

淺唱寂寞╮ 提交于 2019-12-25 07:51:35
问题 Is it possible to get the current module/controller/action name from a view script? How can I do it? 回答1: You could retrieve it in your controller using the MvcEvent object and then assign it to the ViewModel so you can retrieve it in the view: public function indexAction() { return new ViewModel( array( 'controller' => $this->getEvent()->getRouteMatch()->getParam('controller'), 'action' => $this->getEvent()->getRouteMatch()->getParam('action') ) ); } The module name is a bit trickier, but

Unpermitted parameter in Rails 4 when submitted nested attributes, has_many associated form

人盡茶涼 提交于 2019-12-25 07:39:33
问题 I have two models ( lead which has_many :quote_metals and accepts_nested_attributes_for :quote_metals and quote_metal which belongs_to :lead ). I am trying to write the information submitted in the form to the different datatables. There should just be one lead and multiple (no exact number) of quote_metals. I am receiving an error saying that Unpermitted parameter: quote_metal . Here are the parameters: Processing by LeadsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity

Using a function from a model in a controller/view in Laravel

。_饼干妹妹 提交于 2019-12-25 07:37:26
问题 I am trying to access data from a query that I have placed within a function in a model. I am trying to call the function within a controller, and then send along that data to a view. So far, I have been unsuccessful. Here is the code: Model: Fanartist.php public function fan_likes() { $fan_likes = DB::table('fanartists') ->join('artists', 'fanartists.fan_id', '=', 'artists.id') ->where('fanartists.fan_id', '=', Auth::user()->id) ->select('artists.id', 'artists.stage_name', 'artists.city',

Passing a List/model from a View to a controller

心已入冬 提交于 2019-12-25 07:16:28
问题 I need to pass a model data from a view to a controller. My app works like this: 1. Search for products and return the list of products in a view. 2. Now after user on a product in a list I want to pass that model which contains the list of the products back into a different controller for further processing. As well as the name of the product that the user has clicked on. How can I do this? ViewModel public class ProductViewModel { public ProductViewModel() { products = new List