controller

Edit page to display all category names with edit inputs on each

◇◆丶佛笑我妖孽 提交于 2019-12-13 01:09:03
问题 I have categories nested inside of guides. I'm building an app to learn rails better and I'm trying to make a page that will display all categories that belong to a guide and have edit inputs under them and a save button next to it so the user can edit the names of the categories they want to change. Bit stuck on how exactly how get this done. here is the category_item_keys controller def edit @guide = Guide.friendly.find(params[:guide_id]) @category = Category.friendly.find(params[:category

How to expand row in a grid using rowexpander plugin Extjs 4.1.1

最后都变了- 提交于 2019-12-13 00:35:06
问题 How to expand row in a grid using rowexpander plugin? I am using the following code in my controller 'editbasicinfotitlegrid gridview' : { afterrender:this.expandAll } expandAll: function(){ var titlesGrid = Ext.getCmp('editBasicInfoTitleGrid'); var expander = titlesGrid.getPlugin('myRowExpander'); console.log(titlesGrid.plugins[0]); expander.toggleRow(0); } But this code gives me the following error Uncaught TypeError: Cannot call method 'down' of null 回答1: So I have found its solution.The

Moving business rules into model

别说谁变了你拦得住时间么 提交于 2019-12-13 00:29:24
问题 I asked a question earlier which elicited some great responses. Here's the earlier question On the back of some advice given there, I've tried moving the following controller logic if params[:concept][:consulted_legal] == 0 && params[:concept][:consulted_marketing] == 1 @concept.attributes = {:status => 'Awaiting Compliance Approval'} elsif params[:concept][:consulted_marketing] == 0 && params[:concept][:consulted_legal] == 1 @concept.attributes = {:status => 'Awaiting Marketing Approval'}

Grails call Controller method from View

爱⌒轻易说出口 提交于 2019-12-13 00:25:54
问题 I have a quick question for grails. I have a view page that iterates over an array of objects to display them. The HTML/Grails tag code looks like this: <g:each in="${ICFList}" status="i" var="icf"> <tr> <td>${icf.printName?.encodeAsHTML()}</td> <td>${icf.activeNote?.encodeAsHTML()}</td> </tr> </g:each> This code works and displays what I need. However, I don't want to store a printName variable inside my icf object anymore. the object also contains a one character code to identify it, and I

Propagating view's dirty state to the containing form

丶灬走出姿态 提交于 2019-12-13 00:15:24
问题 I have a main form with the following markup <tabset vertical="true" type="pills"> <tab ng-repeat="tab in tabsViews" select="selectView(tab.name, tab.index)" ng-show="tab.isVisible" class=" {{tabsViews[tab.index-1]['invalid'] ? 'invalid-tab': 'valid-tab' }}"> <tab-heading>{{tab.title}}</tab-heading> </tab> </tabset> and the selectView method in my controller is the following: $scope.previousIndex = null; $scope.selectView = function (viewName, viewIndex) { $scope.selections

Controller Path in ASP.NET-MVC

给你一囗甜甜゛ 提交于 2019-12-12 20:17:52
问题 How do I get the path of a controller? For example, I can get the path of a HtmlHelper like this: private static string GetVirtualPath(HtmlHelper htmlhelper) { string virtualPath = null; TemplateControl tc = htmlhelper.ViewDataContainer as TemplateControl; if (tc != null) { virtualPath = tc.AppRelativeVirtualPath; } return virtualPath; } 回答1: Edit: The following will give the path to the assembly with the controller and the type name of the class with the controller action. Maybe a

Take a param in controller, convert string type, and save

给你一囗甜甜゛ 提交于 2019-12-12 18:36:39
问题 I have an ajax post to create a new Meeting . I want to convert the string meeting_time into a datetime format in the controller before save. I have tried this, but it is still saving meeting_time as a string: def create requestor = current_user @meeting_with_params = meeting_params @meeting_time = @meeting_with_params[:meeting_time] @meeting_time = @meeting_time.to_datetime @meeting_with_params[:meeting_time] = @meeting_time #@meeting_with_params @meeting = Meeting.new(@meeting_with_params)

Declare ViewBag on controller

孤者浪人 提交于 2019-12-12 18:07:42
问题 I'm using ViewBag.Message with the same message several times into the methods on the controller. It is possible to declare ViewBag.Message on the top of the class, so can be used in the whole controller without repeat the code? 回答1: Assuming Razor syntax you can achieve this with. @{string pageMessage = ViewBag.Message.ToString();} then pageMessage is a local variable available to the page, for example: <h1>@pageMessage</h1> EDIT ViewBag is a dynamic object which is a member of the

Angular - how can I watch a filter result array for changes from the controller

旧巷老猫 提交于 2019-12-12 18:02:32
问题 I have a filter that filters with some criteria through a ng-repeat list. How could I watch the RESULTING array that is made by the filtering service for changes INSIDE the controller? The full Question and description is here Angular factory filter - Can't get data passed to the filter in the first answer. 回答1: What about piping your data through a local method like this ? <li ng-repeat="item in catchData((items|cut:max))">...</li> I plunked a full example here http://plnkr.co/edit

Should I use .erb or .rhtml files for a Rails app in which all Controller logic exists in Views?

人盡茶涼 提交于 2019-12-12 15:20:29
问题 I'm just starting to learn Rails. I created an empty Rails app. And instead of writing a Controller, I want to put all of my Controller logic in my Views instead of in separate Controller classes. To do this, should I use .erb files or .rhtml files and what's the difference? 回答1: First of all, they are virtually the same thing but you should use the new standard naming format of .html.erb Second of all, stop what you are doing and reconsider everything!!!!! The whole point of MVC is to