Questions tagged [partials]

0

votes
0

answer
5

Views

Do partial variables override helper methods?

I have some helper method that called current_language and sometimes I send current_language in the local_assigns. So I want to assign my partial variable by the local_assigns's current_language in case if it's sent. But I found something weird, in the following code: In line 3 when debugging curren...
Ahmed Salah
1

votes
1

answer
56

Views

On Octobercms inject CSS from Partial

I try to inject Javascript and Css from partial using this: function onStart() { $this->addCss('assets/css/style1.css'); $this->addCss('assets/css/style2.css'); $this->addJs('assets/js/javascript1.js'); $this->addJs('assets/js/javascript2.js'); } On my layout i'm using {% styes %} and {% scripts %},...
Haral
1

votes
1

answer
90

Views

TYPO3 Partials rendering does not work properly

The problem is the following. I made an extension where i have a list view and detail view. The list view works fine. The problem appears when i am going on the detail view and try to render a Partial through the Show.html. The problem will be explained in detail after the structure. This is the str...
Aristeidis Karavas
1

votes
0

answer
41

Views

Webpack 4 - HTML partials

I'm working on Webpack/Gulp enviroment, and I wanna add function to include HTML partials like header and footer inside other page views. The best solution for this will be like in PHP, include file and it's fine. I used html-webpack-plugin, html-loader and gulp-file-include but this not working for...
fen
1

votes
0

answer
55

Views

Gulp WATCH does not listen to any changes in newly added .scss partial

I have a problem with gulp watch task. To be precise, it doesn't work with .scss partials which I add. It starts to work only when I run the task again. There's my gulpfile: const gulp = require('gulp'), plugins = require('gulp-load-plugins')({ lazy: true, }), browserSync = require('browser-sync...
Michał Dziadkowiec
1

votes
2

answer
3.4k

Views

Asp.Net MVC. Updating user control (Shopping Cart) with Ajax

I want to implement a user control which represents a list of the current items in a user's shopping cart, and which is included from within the a master page. I want to add a product to the shopping cart; the shopping cart should be automatically updated with an asynchronous call (JavaScript framew...
1

votes
1

answer
1.1k

Views

Ruby/Rails 1&2: collection problem

Hey, I just began to learn ruby/rails. At the moment, I try to do an example of a german book 'Praxiswissen Ruby on Rails', which is pretty old and written for Ruby on Rails 1. Anyway, I tried to do the examples with Rails 2. Now I have had problem for over a week. According to the book (Rails 1) I...
27leaves
1

votes
2

answer
596

Views

Using Ajax to Replace A Page Element Based on an Onclick Event

I'm reformulating this question as I'm understanding the issue better now. I have an application with four models: Users, Products, Varieties and Seasons. User has_many :seasons has_many :products, :through => :seasons has_many :varieties, :through => :seasons Product has_many :seasons has_many...
1

votes
2

answer
901

Views

Rails Views: How do you pass a variable to a partial layout?

In one of my views I apply a layout to a block of code: # In app/views/sessions/new.html.erb 'home/shadow_box' do %> #... code for sign in form here The layout is a div that has png shadows on all four sides. Since I use this layout all over my site, I want to pass a variable to the layout that sp...
telecasterrok
1

votes
1

answer
362

Views

Is there a way to “bind” a Rails partial view to the controller?

What I want to do is to do some init coding in the controller before showing the contents of the partial view. For example, if the partial view is passed an ID of the object, it would be wise to get the object itself and then send it to the view. You can easily do it with ASP.NET MVC. However in Rai...
Alex
1

votes
2

answer
902

Views

Ruby on rails: how to update an div with partial without making an ajax call to server

I want to update an div with contents of a partial when a user clicks on a radio button. Now the contents of that partial are static html (a form may be). So because I do not have any data to fetch from the server I am reluctant to make an ajax call to server just to fetch that partial and update th...
Shaunak
1

votes
1

answer
63

Views

Including partials in Rails

Simple question, is it better to do # application.html.haml (...) %body = render :partial => 'layouts/edit_user_sidebar' if params[:controller] in ['Users', 'some_other_controller'] = render :partial => 'layouts/default_sidebar' unless params[:controller] == 'Home' - if params[:controller] == 'Home'...
methyl
1

votes
1

answer
118

Views

Trouble with locals and partials with Rails

I have the following in my js.erb file: $('#menu').after($(' @board, :templates => @templates, :types => @types)%>') So I try to pass some locals to my partial In my _customize.html.erb type.id), :remote => true %> templates %> I get the following error: undefined local variable or methodboard' fo...
chell
1

votes
1

answer
2k

Views

Collection and Partials in Rails 3

This my first time asking a question so please go easy one me :-p I am following the examples on http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials (Section 3.4.5 Rendering Collections) for rendering collections using partials. The code looks simple, but clearly I am missing som...
Danny Dover
1

votes
1

answer
111

Views

Not able to Pass customer_id Value in the form to a partial as hidden field value in ruby on rails

I have this in the Main form 'Select Customer'}, :style => 'width:205px;' %> {:text_1 => :customer_id} %> /* rest of code */ And i have this in my customer_bill_line_items Partial :text_1 %> /*rest of code*/ But i am not Able to capture the selected customer id in the partial. The value of hidden fi...
bharath
1

votes
1

answer
520

Views

Rendering arrays with elements of different types without using default partial?

I get an array of search results from tire, containing objects of various activemodel types, and I need to render each to a string. Currently, I am doing this with a loop over these results calling render_to_string(result) on each. This uses the default partial for that activemodel object. However,...
Jords
1

votes
1

answer
386

Views

Is there a way to load mustache partials automatically in express + consolidate

I'm using express + consolidate + mustache as template engine and I was wondering if there's a way to teach express to automatically load partials with matching filenames which I have not explicitly defined. Example: head.html: --- index.html: --- {{> head}} {{content}} {{> foot}} foot.html: --- app...
Manuel Bieh
1

votes
1

answer
265

Views

AngularJS - does everything need to loaded on initial page load?

I am diving into JavaScript MVC with Angular and as I understand it, along with the initial shell page, all your scripts must be loaded on the initial page load. However, and correct me if I'm wrong, that would mean that a majority of your scripts being loaded could be entirely useless (i.e. you hav...
jstacks
1

votes
1

answer
393

Views

undefined local variable current_tab - Rails Views Book Ch 1

I'm currently going through the Rails Views book, Ch 1 - Layouts, and can't figure out why I keep getting the following error message: undefined local variable or method `current_tab' for #` Extracted source (around line #4): 1: 2: 3: 4: 5: 6: 7: app/views/layouts/_main_n...
JStandard
1

votes
1

answer
770

Views

Dust.js using the same partial many times on the same page

I have a parent template that receives the following context: { users: [ { userId: '18288128', group: 'User 1 Group Name', userVideos: [{ id: 1, name: 'Video1'}, { id: 2, name: 'Video2'}, { id: 3, name: 'Video3'}] }, { userId: '1232412', group: 'User 2 Group Name', userVideos: [{ id: 4, name: 'Vide...
Rodrigo Reis
1

votes
1

answer
570

Views

rspec-rails: testing a controller action that renders a partial

I have a UsersController that has index and new actions. I use haml, the index haml file contains the following code: = link_to 'Add User', new_user_path, { :remote => true, 'data-toggle' => 'modal', 'data-target' => '#modal-window', 'class' => 'btn btn-primary pull-right' } So when the user click...
jcm
1

votes
1

answer
1.2k

Views

Trouble displaying data from multiple nested tables in rails 4

I'm new to rails. I've searched and been stuck on this problem for a couple days now. I am building a site where there are users, bands (that users can join), tours (that belong to bands), and stops (stops on the tours). I have tables for each, as well as additional tables that link them together...
user3155441
1

votes
1

answer
831

Views

AngularJS - iterate all cached partials

I have routing set up via $routeProvider, something like $routeProvider.when('/page/:id', {templateUrl: 'partials/public/view/page.html', controller: XYZ}); On first page load, I'd like to iterate through cached partials and remove them. Initially I've tried: $templateCache.removeAll() called when...
ladar
1

votes
1

answer
136

Views

Local variable not displaying correctly in foundation's reveal partials

I have the following code in my view: and this in my partial: Flag However, the local variable 'comment' is not being set correct. If i put into the partial, I get the same id '9' every time I click the 'Flag' link in my view. I'm using Zurb's foundation to create the 'reveal', in case that has any...
jfdimark
1

votes
1

answer
186

Views

ServiceStack.Razor PartialViewResult equivalent?

Is there a way to return the ASP.NET MVC equivalent of a PartialViewResult (stand-alone partial) in ServiceStack.Razor? In my service, I would like to return the response DTO as a rendered Partial as opposed to a complete View; again, I just need some rendered HTML snippets for this service. The use...
Abe
1

votes
2

answer
1.8k

Views

Rails 4 rendering partials (undefined local variable or method)

I am trying to pass two local variables to my partial but I am getting this undefined local variable or method `row' for # when using it in the partial. Render ` Partial
dgolman
1

votes
1

answer
231

Views

Service Stack 4.0.15: Razor Partial not outputted inside @section

Summary: Razor Partials don't get rendered inside a @section in ServiceStack 4. This seems to be a bug in ServiceStack.Razor. Version: ServiceStack 4.0.15 Affected Package: ServiceStack.Razor Razor partials inside a section does not get rendered. Example Inside _Layout.cshtml @RenderSection('Javascr...
Abe
1

votes
1

answer
52

Views

Render a partial in a controller

I want to render a partial with locals from a controller. I can't find the syntax for this anywhere (neither Rails docs on partials / views or googling). I could have this action's view only contain a partial, but that sounds like an extra layer of complexity that I'd like to avoid. Using (controll...
Don P
1

votes
2

answer
107

Views

how to use angularJs var to an html attribute

I'm including a script tag in an angular partial, where I load a js-widget. The widget has an attribute data-title, where I can pass the title. In my case, the title is stored in an angular js view variable. How can I pass the title? if I try e.g. , the title of the widget results in {{ title }} EDI...
3x14159265
1

votes
1

answer
391

Views

Rendering partial that belongs to another controller

I've got a menu controller, which is set as my root controller in routes.rb. In my menu view, i try and render the _lights.slim partial with = render :partial => 'lights/lights' but i get the following error: undefined method `lights' for nil:NilClass MenuController: class MenuController < Applicati...
Chris
1

votes
2

answer
103

Views

Conditional partials when using Rails STI

I have a clients table with 2 types: person and company. I want to be able to render a different partial (with different no. of fields) depending on what type of client I'm creating. Any help? Thanks!
Bogdan Popa
1

votes
2

answer
68

Views

How to Pass Selected Parameters to Partial

I am newer to Rails and am building a CMS, and need to allow the user to select a certain restaurant they own, whereby that selection will then be passed to a partial and the partial will display the campaigns that belong to that restaurnat. In short, the data model I have created is as such: class...
Sauron
1

votes
1

answer
113

Views

How to make sure I load the JS file just once in my partial?

I have a partial _dial_pad.html_erb which is being loaded through Ajax calls more than once at the same view, using something like: $('#some_div').html(''); The dial_pad partial contains: 1 2 The dial_pad.js.coffee looks something like: jQuery -> $(document).keydown (e) -> key = String.fromChar...
Eki Eqbal
1

votes
2

answer
1k

Views

is it possible to append a partial template to exsiting file? [chef cookbook]

I'm looking to add configurations to a conf file that is extracted from a tar file. Currently the cookbook is using a template to overwrite the whole file instead I need to use the original file as a template and add to it. Partial templates seem to do the task but I haven't been able to find an...
david
1

votes
1

answer
1.2k

Views

rails render partial template with collection not working

Found some similar answers, but no one seems to fit. I also read http://guides.rubyonrails.org/layouts_and_rendering.html, chapter 3.4.5, Rendering collections. I'd like to render the following partial: (users/_user_append.html.erb) :delete, remote: true, :data => { :confirm => t('.confirm', :defaul...
Phipsen
1

votes
1

answer
228

Views

HTML snippet in Angular partial missing in view

I have a block of HTML in an Angular partial that's not making it into the view for some reason. Every other line of HTML in the partial (including other lines with data-binding and references to my service and its methods) are making it in. Had a hard time locating previously asked questions that a...
Tyler Reitz
1

votes
1

answer
31

Views

Edit a model in the show route using enable/disable

Noob here, just finished the ROR getting started tutorial, Also, full disclosure, this question is similar to mine: In Rails, is it possible to use the show view as an edit view? but does not answer my question I'm trying to figure out how to use the show route to show a model, but if the user clic...
slackbot39243
1

votes
1

answer
78

Views

Is it bad practice to put elements below the </body></html> tags?

Sure the following looks stupid: A css file linked here... First piece of content blah after html ...and could easily be fixed by moving the blah after html into the body. Turns out the browser does that for you, and appends this to the end of the body. (Not a good reason to do this stupid thing) I...
Max
1

votes
2

answer
436

Views

How to create more than one index page in Ruby on Rails

I have two different plans (plan with an ID of 1 and plan with an ID of 2). I've created a partial for each to show on the home page based on which plan the user is logged in as. I would like to create two different index pages for each plan to be directed to. Plan ID 1 users need to be directed to...
Kim
1

votes
1

answer
354

Views

How do I render a partial in a Text Area in a Rails form?

I am trying to create a email app that will use a template to create and send automated emails using an email template. This is what I have tried to use... 'emails/templates/consignment' %> I just want the new email to be prepopulated with the html in my template.
Sebhastien

View additional questions