search for: page_title

Displaying 20 results from an estimated 46 matches for "page_title".

2006 Mar 28
1
simple output string
...to know how I can print an easy string-line. I wanted to generate a dynamic title for my blog articles made with "typo": The first part of the html-title stays the same: <title>softrockcookie</title> if it is not the mainpage ("softrockcookie") it shall add the page_title, so: <title>softrockcookie <%= page_title unless page_title == "softrockcookie" %></title> it worked so far... and now, to seperate the two parts i wanted a double-doublepoint ("::"), but couldn''t implement it yet. however, I tried it that way and...
2008 Jun 02
1
Looking for help on two issues with Rails 2.1 and RSpec 1.14
...any association issue: in helper specs, instance variables don''t get set unless the HelperModule is included. Using the preferred helper.<method> I can''t seem to find a way to check that an instance variable is set: I have several specs that used to look like: it "page_title should assign @browser_title" do page_title("foo") @browser_title.should == "foo" end Now changed to: it "page_title should assign @browser_title" do helper.page_title("foo") helper.assigns[:browser_title].should == "foo"...
2011 Sep 04
4
same html elements rendering twice on page
hey all, My index.html.haml: - wrap do - page_title "Teams List View" application_helper.rb: def page_title(title) content_tag :h1, title end def wrap(&block) concat(content_tag(:div, capture(&block), :class => "generic_header")) end I load in browser and get: <div class="generic_header&quo...
2006 Apr 27
7
HTML Title
Hi there, If I have an application.rhtml template what''s the best way to set the contents of title element in the html -> head area of the template to something set in the view for action in a controller. I want to just have one template which renders the basic layout for all pages and I''ve been scratching my head over this one for a couple of hours now. Any help
2010 Aug 21
4
No route matches?
...I''m using rails 3.0 and the setting for the environment is "development". # routes.rb Site::Application.routes.draw do get "home/index" root :to => "home#index" end # home_controller.rb class HomeController < ApplicationController def index @page_title = "Home" end def view @page_title = "View page" end end and I have two view files in app/views/home: index.html.erb view.html.erb -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this gro...
2007 Dec 02
3
Better way for select list for belongs_to?
...doing all of this just to have a drop-down list of Courses for a particular student: ===== edit template ===== <%= f.select :course, @courses, :selected => @student.course.id %> =================== ===== students controller ===== def edit @student = Student.find(params[:id]) @page_title = "Edit #{@student.full_name}" @courses = Course.find(:all).collect { |c| [ c.name, c.id ] } end def update @student = Student.find(params[:id]) @student.attributes = params[:student] @student.course = Course.find(params[:student][:course]) respond_to do |format|...
2005 Mar 10
7
Order of Processing
It seems odd to me that the layout is processesed after the view. When I set a variable inside the view it does not have an impact on the layout file. But when I set it in the controller it does. Is this the way it works or is it possible that I am doing something wrong?
2007 Jun 19
1
javascript_tag replacing whitespaces w/ '%20'
...een changed then a confirm box will ask if the user wants to have the title changed. The problem is if the person hits cancel, all white spaces in the title get replaced w/ ''%20''. Here''s the code I was using: <%=javascript_tag( "function confirmSubmit(){ var page_title_before= ''#{u @page.title}''; var page_title_on_submit = escape($(''page_title'').value); if( page_title_before != page_title_on_submit ){...
2006 Jan 04
7
variables in layouts
...n. I could do something like @session[:username] but I would rather encapsulate that into a single variable so that I can change the key in the session map if I want without having to goto each page that uses it. It seems that a better way would be to use an instance variable like I have seen @page_title a lot. I dont want to set this in each and every action so is there a way that I can set it in the super class controller? Maybe in after_filter? What do you guys do? Thanks Gareth -- Posted via http://www.ruby-forum.com/.
2009 Dec 07
1
Cucumber and general Ruby question
Hello, I have this cucumber step definition: Given /^the site has pages "(.+)" and "(.+)"$/ do | page_1, page_2 | Page.create :title => page_1 if Page.find_by_title(page_1).nil? Page.create :title => page_2 if Page.find_by_title(page_2).nil? end This works, but obviously I would like to DRY it up. I was thinking along the lines. Given /^the site has pages
2012 Mar 16
0
Rails tests failing
...''h1'', content: ''View'') } it { should have_selector(''title'', content: full_title(''View Snippets'')) } end end [/code] I can''t understand why my tests is not working Here is the helper: [code] def full_title(page_title) base_title = "Sample App" if page_title.empty? base_title else page_title end end [/code] http://stackoverflow.com/questions/9728983/rails-tests-failing/9730133#9730133 -- You received this message because you are subscribed to the Google Groups "Ru...
2008 Jan 24
3
Help to spec a rails helper method that uses content_for
Hi guys, I am a Rspec newbie and am having problems creating a spec for a RoR helper method. I have in fact already implemented the helper method and am trying to create retrospective specs. I know its the wrong way to do it but I am still learning Rspec. In my view I have a call to a helper method. <% body_class "users" %> which sets a CSS class declaration in the content_for
2006 Feb 07
3
Newbie help ..
Hi .. I am new to Rails and it is not clear to me why I am getting the following error. Any help appreciated. -m. $cat app/views/admin/new.rhtml <% @page_title = "New member..." -%> <%= start_form_tag( :action => ''create'' ) %> <table> <tr> <td> First Name: </td> <td> <%= text_field( "member", "first_name", size => 40 %> </td> </tr&...
2006 May 23
11
adding layouts within layouts
Hi, I want to be able to have several layouts within each other so that I don''t have to keep repeating the layout code for one, in another. An example would be having a layout for the title of your web page and then having an embedded layout for the body portion in which the HTML for whatever view gets displayed. Is this possible? Thanks. -------------- next part -------------- An
2007 Mar 22
1
Functional test and flash with an error
...rs 6. flash[:notice] = "User #{@user.name} was successfully created." 7. redirect_to :action => ''index'' 8. else 9. # If user couldn''t be saved (due to failing the validations) then the new page is rendered again. 10. @page_title = ''Create new user'' 11. render :action => ''new'' 12. end 13. end application.rb 1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2. &l...
2009 Apr 10
0
MySql Memory Error
...following code. controller.rb def index @stats = SubscriptionPayment.stats if params[:page].blank? @subscriptions = Subscription.paginate(:include => :account, :page => params[:page], :per_page => 30, :order => ''accounts.name'') end index.html.erb <% @page_title = ''Subscriptions'' %> <% if @stats %> <h1>Revenue Summary</h1> <table id="stats"> <tr> <th>Last Month</th> <td><%= number_to_currency(@stats[:last_month]) %></td> </tr> <tr...
2007 Jul 24
4
spec''ing helpers that use controller
...uces: F 1) NameError in ''ApplicationHelper hmmmm'' undefined local variable or method `controller'' for [RSpec example]:#<Class:0xb70de334> /path/trunk/config/../app/helpers/application_helper.rb:21:in `page_title'' ./spec/helpers/application_helper_spec.rb:6: ./script/spec:4: Finished in 0.024011 seconds 1 example, 1 failure The helper spec doesn''t know about "controller". Would I have to mock the controller? If so, how? If not...
2005 Dec 25
2
[repost] newbie questions
...@cart = find_cart @items = @cart.items if @items.empty? redirect_to_index("There''s nothing in your cart!") else @order = Order.new @address = Address.new end end I also created the following checkout.rhtml file: <% @page_title = "Checkout" -%> <%= error_messages_for(:order) %> <%= start_form_tag(:action => "update_order") %> <table> <%= render(:partial => ''orderitem'', :collection => @items) %> </table> <%= submit_tag "Update&quot...
2007 Jan 09
1
assert_redirected_to not working as expected
I''ve installed the "acts_as_authenticated" plugin and made some modifications to the controller (app/controllers/account_controller.rb) "signup" module as follows: === def signup @page_title = ''Create Account'' @user = User.new(@params[:user]) if request.post? if @user.save session[:user] = User.authenticate(@user.login, @user.password) redirect_to(:controller => ''/home'', :action => ''welcome'')...
2006 May 01
3
using HTML frames with rails
Hi: I''m trying to get a page setup with the left side having a collapsable javascript menu (built from the database) and the right side having more data about each node in the tree... very standard actually. I figured frames would be a good way to go, because as the tree expands as the user dives further in, the frame will add scroll bars without disrupting the left hand side. The