view-helpers

Using helper methods while templating with Angular JS

浪子不回头ぞ 提交于 2019-12-18 03:56:55
问题 Currently in the process of converting a website from its previous templating to Angular. In the previous templating process we were using we were able to call helper methods to display data correctly. For instance: <script type="text/javascript"> $.views.helpers({ parseDate: function (jsonDate) { if (jsonDate != null) { var newDate = Utils.PrettyDate(Utils.ConvertJsonDateToJsDate(jsonDate)); return newDate; } } }); </script> <div class="post-info"> <span class="posted-date">Posted {{ :

zf2 Creation of simple service and access it through viewhelper

青春壹個敷衍的年華 提交于 2019-12-17 17:58:26
问题 I am trying to create a simple service in zf2 which I can access using in viewhelper Step1. I have craeted a class in src/Application/Service/Service1.php as follow namespace Application\Service; use Zend\ServiceManager\ServiceLocatorAwareInterface; use Zend\ServiceManager\ServiceLocatorInterface; class Service1 implements ServiceLocatorAwareInterface { public function __construct() { } public function setServiceLocator(ServiceLocatorInterface $serviceLocator) { } public function

How to use ASP.NET MVC view precompilation with App_Code helpers?

荒凉一梦 提交于 2019-12-14 03:46:23
问题 I am trying to enable view compilation to have my ASP.NET MVC3 web site load faster. My web site is hosted on AppHarbor. However, my views make use of MVC3 view helpers, defined in the App_Code folder. When I try to load my web-site, I get: "The directory '/App_Code/' is not allowed because the application is precompiled." How can I stop the App_Code folder being deployed to the web-server, but still have the App_Code helpers pre-compiled? I've tried changing the helpers to Content=None, but

Issue setting up Cascading drop downs in MVC

末鹿安然 提交于 2019-12-12 23:48:36
问题 I've been trying to implement the code in the answer here Issues are:- Setting up or creation of helper integrating helper onto view to perform CascadingDropDropListFor At 1st I tried making a new class for the helper then I instead moved the code into my existing model for the page but found if I did that it solved the issue 2 just to say I couldn't nest the public static class into my public class StudentViewModel. To solve issue 1 I tried inputing as many "Using" as needed to get all the

Get rails view helper methods inside coffeescript

落花浮王杯 提交于 2019-12-12 11:22:07
问题 I have a view helper, let say (for simplicity's sake) def call_alert return "alert 'this should appear'" end Then I have a coffeescript file some_test_page.js.coffee which renders for an action which is called via ajax. Inside this some_test_page.js.coffee I have: <%= call_alert %> When I do an ajax call to /some_test_page , I usually would expect to get a response with the compiled javascript from the coffeescript file and an alert would occur. However, it seems the view helper I tried to

Routes stopped working when upgrading Rails 3.0 to 3.1

↘锁芯ラ 提交于 2019-12-12 02:06:42
问题 I am using Ruby 1.8.7 with Rails 3.1. My application worked fine in Rails 3.0 but when I bumped it up to Rails 3.1.4, all my url helpers broke! After Googling like a mad man the past 2 days, I have given up and the time has come to seek help. I don't believe the problem is with my routes.rb file but something more on the view/helper side. I have the following in my routes.rb: resources :sessions In my homepage view I have the following link_to, which errors out: <%= link_to "Login", new

How to put a character entity in the value of a formSubmit in ZF2

主宰稳场 提交于 2019-12-11 13:00:03
问题 When I create a submit button in a ZF2 form like this: $this->add(array( 'name' => 'save_closebutton', 'attributes' => array( 'type' => 'submit', 'value' => 'Save & Move On »', 'id' => 'save_closebutton', 'class' => 'btn btn-default' ), )); and then put a formSubmit element in the view like this: echo $this->formSubmit($form->get('save_closebutton')); ZF2 renders the text in the button as Save & Move On » without rendering the character that the code represents. I'm pretty sure that the

Is there a simple MVC4 html helper for collapsible (multi-level) Bootstrap 3 menus?

江枫思渺然 提交于 2019-12-11 02:18:41
问题 I have seen several examples on creating a HTML helper method for active menu items. **Summary:** Simply put, in an MVC project, using the Twitter Bootstrap, I am trying to preserve the open state of a collapsible menu when a child is selected. I am using a collapsible menu, where the parent's css (the selected item) needs to include active open if a child is selected. This will ensure that the menu is open at the right location. With the use of another HTML helper, the active item is already

Emberjs: what's the context the classBinding on {{#view}} helper use?

拟墨画扇 提交于 2019-12-10 23:52:59
问题 The doc's example implies that the context is the instance of a View without a controller . But I can't try this out with latest version, please check this jsfiddle's link. 回答1: Here is the way I would do this: http://jsfiddle.net/arasbm/ACqjt/1/ Just to clarify context of the view is set to it's controller by default. If you want to access a property of view such as flag inside the view template you would use view.flag to refer to it. I prefer to setup view class name bindings inside the

Razor @helper in App_Code cannot be accessed

℡╲_俬逩灬. 提交于 2019-12-09 16:51:29
问题 In my App_code , I have a helper function called FormatTelephone(string number) in Formatter.cshtml . I tried to access it in a partial view by @Formatter.FormatTelephone(number) . When I test it, it says Compiler Error Message: CS0103: The name 'Formatter' does not exist in the current context What is the likely cause of it? Thanks! 回答1: I ran into this exact problem when deploying the site onto another server. Make sure the App_Code/Formatter.cshtml file is actually copied to the server! My