Search Results

Search found 1167 results on 47 pages for 'h1 visa'.

Page 6/47 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • [PHP, CSS, & ?] fixed width div, resizing text on the fly based on length

    - by Andrew Heath
    Let's say you've got a simple fixed-width layout that pulls a title from a MySQL database. CSS: #wrapper { width: 800px; } h1 { width: 100%; } HTML: <html> <body> <div id="wrapper"> <h1> $titleString </h1> </div> </body> </html> But the catch is, the length of the title string pulled from your MySQL database varies wildly. Sometimes it might be 10 characters, sometimes it might be 80. It's possible to establish a min & max character count. How, if at all possible, do I get the text-size of my <h1>$titleString</h1> to enlarge/decrease on-the-fly such that the string is only ever on one line and best fit to that line length? I've seen a lot of questions about resizing the div - but in my case the div must always be 100% (800px) and I want to best-fit the title. Obviously a maximum text-size value would have to be set so 5 character strings don't become gargantuan. Does anyone have a suggestion? I'm only using PHP/MySQL/CSS on this page at the moment, but incorporation of another language is fine if it means I can solve the problem. The only thing I can think of is a bruteforce approach whereby through trial and error I establish acceptable string character count ranges matched with CSS em sizes, but that'd be a pretty ugly implementation from the code side.

    Read the article

  • HTML5 - Need explanation about outline

    - by RhymeGuy
    So, lets say that I have the following structure: <doctype html> <header> <h1>Header</h1> <article><h2>Article</h2></article> <article><h2>Article</h2></article> </header> <main> <h1>Main content</h1> <article><h2>Article</h2></article> <article><h2>Article</h2></article> <article><h2>Article</h2></article> <article><h2>Article</h2></article> </main> <section> <h1>Sidebar</h1> </section> If i check outline using http://gsnedders.html5.org/outliner/ (or any other), I'll get outline like this: 1. Main content 1. Header 1. Article 2. Article 2. Article 3. Article 4. Article 5. Article 6. Sidebar Which (from my understanding) is not correct. I have thought that it should look like this: 1. Header 1. Article 2. Article 2. Main content 1. Article 2. Article 3. Article 4. Article 3. Sidebar Why this happens? I can get desired outline if I use section element. But id there is main element in HTML structure, then everything breaks (at least for me - it's not how I understood it). Can I achieve desired outline using main element?

    Read the article

  • ASP.NET: I'm getting strange output when styling a Label control...

    - by pkiyan
    .labelOne { border-width:thin; border-style:solid; border-color:Red; background-color:Silver; } <asp:Label ID="Label1" runat="server" CssClass="labelOne"> <h1>Hello world</h1> </asp:Label> <br /><br /> <asp:Label ID="Label2" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="Silver"> <h1>Hello world</h1> </asp:Label> Hello. In the code sample above I have 2 Label controls with their contents set to an h1 header tag. The first Label is styled using css, and the second with the Label's inline properties (both Labels have identical styling). But the first Label doesn't output properly, it's border is broken. If I replace the first Label's markup with plain "Hello world" text it renders properly, but it breaks again when I use markup. Can someone explain why this is happening?

    Read the article

  • Copying the contents of an H2 tag on a page to a series of spans inside a div

    - by mmsa
    I have an H1 tag on a page with an ID of "Topic Name <h1 id="topicName"><a href="/link here">News You Can Use</a></h1> I need to copy the text inside the H1 and apply it to a series of span tags which are inside a div. <div class="post"> <h2>{tag_postdate} <span class="topicName2"> </span></h2></div> I need to get "News you can Use" and copy it inside each instance of .topicName2 Any help would be appreciated!

    Read the article

  • View Source and Chrome Developer Tools showing different output

    - by patricksweeney
    I have a page located here. Viewing it in Chrome and Firefox show a really small h1 title, and also it changes color as if it is a link. The template that generates everything looks exactly how it should be. When diagnosing the issue, the relevant section of code looks like this when I go to view source: <div class="page-heading"> <h1>Title Here</h1> </div> However, when I go to view it in Chrome's Developer tools, it is throwing in extraneous malformed anchor tags, which is obviously causing the hovering behavior. This is what it looks like to the dev tools: <div class="page-heading"> <h1> <a style="font-family: arial; font-size: 9px" <="" a="">Title Here</a> </h1> </div> In addition, when viewing a local copy of the site, the output shown in the dev tools is the same as viewing the source and they both render correctly locally. Oddly enough, all version of IE render it correctly. The current version of both Chrome and Firefox both render it weirdly. Initially I thought it may be a user agent stylesheet problem, but if anything the CSS is fine, it's the HTML that is malformed.

    Read the article

  • Append before parent after getSelection()

    - by sanceray3
    Hi all, I have one question. I try to develop a little WYSIWYG editor. I would like create a <h1> button which allows me to generate a <h1> title (by clicking on button after text selection in <p> element). I obtain the selection with window.getSelection().... But now, I would like to put my append("<h1>my text selected</h1>") just before the <p>. It’s my problem, because my <p> elements don’t have id or class. So do you know a means to put my append just before the <p> where my text has been selected? I don’t know if with my bad English you’ll understand me! Thanks very much for your help.

    Read the article

  • Use javascript to extend a DOM Range to cover partially selected nodes

    - by ko-dos
    I'm working on a rich text editor like web application, basically a XML editor written in javascript. My javascript code needs to wrap a selection of nodes from the contentEditable div container. I'm using the methods described at MDC. But since I need to synchronize the div containers content to my XML DOM I would like to avoid partial selections as described in w3c ranges: <BODY><H1>Title</H1><P>Blah xyz.</P></BODY ............^----------------^............ This selection starts inside H1 and ends inside P, I'd like it to include H1,P completely. Is there an easy way to extend the selection to cover partially selected children completely? (The code doesn't need to work with opera/IE)

    Read the article

  • jQuery prevUntil() include start selector and end selecter

    - by Globalz
    I would like to select the start and end selector for the prevUntil() or nextUntil() jQuery selector methods. If i implement these methods now, it grabs everything between the two selectors given. i.e. $('p').prevUntil('h1') will not include the p and h1 element, only those between them. How could I also select the p and h1 elements as well as though between? Thanks!

    Read the article

  • Jquery load() loading more than I want...

    - by Probocop
    Hi, I am trying to load just the contents of a <div> into another <div> on the same page using a jquery function. But when the function triggers, it loads the entire <HTML> document into the specified <div>. Any idea why it would be doing this? My code is as follows: Jquery: function button1() { $('#sidebar-content').fadeOut(function() { $(this).load('#button1').fadeIn(); }); } function button2() { $('#sidebar-content').fadeOut(function() { $(this).load('#button2').fadeIn(); }); } HTML: <div id="content-holder"> <div id="main-content" class="float-holder"> <div id="inner"> <h1>BRAND TRUTH</h1> <div id="flashcontent"> <div id="button1"> <div id="content"> <h1>Brand Truth</h1> <p>What this basically means is our way of working, the process involved by both ourselves and our client.</p> <p>When the truth wheel process is followed, the end result is so much stronger.</p> </div> </div> <div id="button2"> <div id="content"> <h1>Button 2 Content</h1> <p>Some other content</p> <p>Some other content x2</p> </div> </div> </div> <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("working.swf", "working", "400", "400", "9", "#FFFFFF"); so.write("flashcontent"); // ]]> </script> </div> <div id="sidebar"> <div id="sidebar-content"> Replace Content Here! </div> </div> </div><!-- end #main-content --> </div><!-- end #content-holder -->

    Read the article

  • Apache sends plain-text response when accessing SSL-enabled site without HTTPS

    - by animuson
    I've never encountered something such as this before. I was attempting to simply redirect the page to the HTTPS version if it determined that HTTPS was off, but instead it's displaying an HTML page rather than actually redirecting; and even odder, it's displaying it as text/plain! The VirtualHost Declaration (Sort of): ServerAdmin [email protected] DocumentRoot "/path/to/files" ServerName example.com SSLEngine On SSLCertificateFile /etc/ssh/certify/example.com.crt SSLCertificateKeyFile /etc/ssh/certify/example.com.key SSLCertificateChainFile /etc/ssh/certify/sub.class1.server.ca.pem <Directory "/path/to/files/"> AllowOverride All Options +FollowSymLinks DirectoryIndex index.php Order allow,deny Allow from all </Directory> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule .* https://example.com:6161 [R=301] The Page Output: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="https://example.com:6161">here</a>.</p> <hr> <address>Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e DAV/2 Server at example.com Port 443</address> </body></html> I've tried moving the Rewrite stuff up above the SSL stuff hoping it'd do something and nothing happens. If I view the page with via HTTPS, it displays fine like it should. It's obviously detecting that I'm trying to rewrite the path, but it's not acting. The Apache error log does not indicate anything to me that might have gone wrong. When I remove the RewriteRules: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> Reason: You're speaking plain HTTP to an SSL-enabled server port.<br /> Instead use the HTTPS scheme to access this URL, please.<br /> <blockquote>Hint: <a href="https://example.com/"><b>https://example.com/</b></a></blockquote></p> <p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p> <hr> <address>Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e DAV/2 Server at example.com Port 443</address> </body></html> I get the standard "you can't do this because you're not using SSL" response, which is also provided in text/plain rather than being rendered as HTML. This would make sense, it should only work for HTTPS-enabled connections, but I still want to redirect them to the HTTPS connection when it determines that it is not enabled. Thinking I could circumvent the system: I tried adding a ErrorDocument 400 https://example.com:6161 to the config file instead of using RewriteRules, and that just gave me a new message, still no cheese. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="https://example.com:6161">here</a>.</p> <hr> <address>Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e DAV/2 Server at example.com Port 443</address> </body></html> How can I force Apache to actually redirect rather than displaying a "301" page that shows HTML in plain-text format?

    Read the article

  • Using real fonts in HTML 5 & CSS 3 pages

    - by nikolaosk
    This is going to be the fifth post in a series of posts regarding HTML 5. You can find the other posts here, here , here and here.In this post I will provide a hands-on example on how to use real fonts in HTML 5 pages with the use of CSS 3.Font issues have been appearing in all websites and caused all sorts of problems for web designers.The real problem with fonts for web developers until now was that they were forced to use only a handful of fonts.CSS 3 allows web designers not to use only web-safe fonts.These fonts are in wide use in most user's operating systems.Some designers (when they wanted to make their site stand out) resorted in various techniques like using images instead of fonts. That solution is not very accessible-friendly and definitely less SEO friendly.CSS (through CSS3's Fonts module) 3 allows web developers to embed fonts directly on a web page.First we need to define the font and then attach the font to elements.Obviously we have various formats for fonts. Some are supported by all modern browsers and some are not.The most common formats are, Embedded OpenType (EOT),TrueType(TTF),OpenType(OTF). I will use the @font-face declaration to define the font used in this page.  Before you download fonts (in any format) make sure you have understood all the licensing issues. Please note that all these real fonts will be downloaded in the client's computer.A great resource on the web (maybe the best) is http://www.typekit.com/.They have an abundance of web fonts for use. Please note that they sell those fonts.Another free (best things in life a free, aren't they?) resource is the http://www.google.com/webfonts website. I have visited the website and downloaded the Aladin webfont.When you download any font you like make sure you read the license first. Aladin webfont is released under the Open Font License (OFL) license. Before I go on with the actual demo I will use the (http://www.caniuse.com) to see the support for web fonts from the latest versions of modern browsers.Please have a look at the picture below. We see that all the latest versions of modern browsers support this feature. In order to be absolutely clear this is not (and could not be) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School.Another excellent resource is HTML 5 Doctor.Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr.In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here.I create a simple HTML 5 page. The markup follows and it is very easy to use and understand<!DOCTYPE html><html lang="en">  <head>    <title>HTML 5, CSS3 and JQuery</title>    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >    <link rel="stylesheet" type="text/css" href="style.css">       </head>  <body>      <div id="header">      <h1>Learn cutting edge technologies</h1>      <p>HTML 5, JQuery, CSS3</p>    </div>        <div id="main">          <h2>HTML 5</h2>                        <p>            HTML5 is the latest version of HTML and XHTML. The HTML standard defines a single language that can be written in HTML and XML. It attempts to solve issues found in previous iterations of HTML and addresses the needs of Web Applications, an area previously not adequately covered by HTML.          </p>      </div>             </body>  </html> Then I create the style.css file.<style type="text/css">@font-face{font-family:Aladin;src: url('Aladin-Regular.ttf')}h1{font-family:Aladin,Georgia,serif;}</style> As you can see we want to style the h1 tag in our HTML 5 markup.I just use the @font-face property,specifying the font-family and the source of the web font. Then I just use the name in the font-family property to style the h1 tag.Have a look below to see my page in IE10. Make sure you open this page in all your browsers installed in your machine. Make sure you have downloaded the latest versions. Now we can make our site stand out with web fonts and give it a really unique look and feel. Hope it helps!!!  

    Read the article

  • How is font-size not working here?

    - by markvgti
    Following advice in The 6 Most Important CSS Techniques You Need To Know, I set my body's font-size to 62.5%, the container div's font-size to 1.4 em (slight variation from the article). p.tags and p.published's font-size is set to 1em. However, this doesn't work for me. Both the normal text and text in p.tags and p.published comes out to be the same size (16.8px as computed by Firebug). Can you explain why my code isn't working? I am testing in Firefox 3.6.3. The sample page shown by the author works just fine in the very same browser. I've reproduced the entire page below—apologies for the length of it, but I thought it better to not leave out anything. <html> <head> <title>Title</title> <style type="text/css"> body { font-family: Georgia, "Century Schoolbook", "Times New Roman", Serif; font-size: 62.5%; background-color: #2B3856; /* Dark slate blue */ } h1, h2, h3, h4, h5, h6 { font-family: Verdana, Helvetica, Tahoma, "Sans Serif"; color: #2B3856; margin-top: 2px; } h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { text-decoration: none; color: #2B3856; } h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover { text-decoration: underline; } div#container { width: 800px; font-size: 1.4em; margin: 5px auto; background-color: #E3E4FA; /* Lavender */ } #sidebar { width: 200px; float: right; margin: 0px; padding: 0px; } #sidebar div { padding: 0 5px 5px; } #sidebar div.shadowbox { margin-right: 5px; } #content { width: 600px; float: left; margin: 0px; padding: 0px; } #header { /*background-color: white;*/ background-color: #2B3856; /* #E3E4FA; Lavender */ margin-bottom: 5px; height: 100px; } #header h1 { color: #B93B8F; /* Plum */ line-height: 100px; text-align: center; font-size: 45px; } #description { color: #7D1B7E /* Dark Orchid */ } a { text-decoration: underline; color: #153E7E; } a:hover { text-decoration: none; } div#posts { padding: 0px; font-size: 1.2em; margin: 0px; } div#posts div.post { padding: 5px; margin: 0px 5px 15px 5px; } p.tags, p.published { font-size: 1em; } .shadowbox { background: repeat 0 0 url('http://www.jawsalgorhythmics.com/images/darkness-100x100-10pct.png'); } .justifycenter { text-align: center; } .floatright { float:right; } .floatleft { float: left; } .clearright { clear: right; } .clearleft { clear:left; } .clearboth { clear: both; } .halfsidebarwidth { width: 82px; } </style> </head> <body> <div id="container"> <div id="header"> <h1>Odds 'n Ends</h1> </div> <!-- header --> <div id="sidebar"> <div class="shadowbox"> <br /><p class="justifycenter"><img width="64" height="64" src="{PortraitURL-64}" /></p> <div class="floatleft halfsidebarwidth"><a href="/archive" class="archive">Archives</a></div> <div class="floatleft halfsidebarwidth"><a href="{RSS}" class="rss">RSS</a></div> <div class="clearboth"></div> </div> </div> <!-- sidebar --> <div id="content"> <div id="posts"> <div class="post shadowbox"> <span class="quote"> "It does not matter how slow you go so long as you do not stop." <div class="source">Wisdom of <a href="#" title="http://en.wikipedia.org/wiki/Confucius">Confucius</a></div> </span> <p class="tags">Tags: #<a href="#" title="http://demo.tumblr.com/tagged/wisdom">wisdom</a>&nbsp; </p> <p class="published">Posted: Nov 08, 2006 at 2:27 pm &nbsp;&nbsp;<a href="#" title="http://demo.tumblr.com/post/236/it-does-not-matter-how-slow-you-go-so-long-as-you">Permalink</a>&nbsp;&nbsp; <a href="#" title="http://tumblr.com/xr06k">Short URL</a></p> </div> </div> <!-- posts --> </div> <!-- content --> <div class="clearboth"></div> <div id="footer" style="text-align: justify;"> <h1>The footer</h1> </div> </div> <!-- container --> </body> </html>

    Read the article

  • Read from params[] in Rails

    - by Adnan
    Hi, I use: <%= select( "payment", "id", { "Visa" => "1", "Mastercard" => "2"}) %> and I get this in HTML <select id="payment_id" name="payment[id]"><option value="2">Mastercard</option> <option value="1">Visa</option></select> now how can I read the payment[id] with params[], if I use params[payment[id]] I get an error.

    Read the article

  • z index background issue in IE

    - by Michael
    I have a jQuery tools scroller set up with controls managing two separate divs of info - one images, the other related text that needs to sit over the top of the images with a transparent bg image. I am using z-indexing to achieve this and am aware of IE's issues with this but am unable to sort it (tested in IE6-8). Image of the issue below: http://test.shakingpaper.com.au/not_working.png It seems that the overlayed div is taking on the containers white. Try as I might, I can't resolve this. HTML/CSS code below: <div id="content"> <div id="nav"></div> <div class="s4 slideshow"> <div> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/hero_1_white.jpg" width="770" height="367" /> </div> <div> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/hero_1_white.jpg" width="770" height="367" /> </div> <div> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/hero_1_white.jpg" width="770" height="367" /> </div> </div> <div id="overlay_bg"></div> <div class="s4 information"> <div> <h1>Support</h1> <p>Quisque lacus quam, egestas ac tincidunt a, lacinia vel velit. Aenean facilisis nulla vitae.</p> <p><a href="#">Support Us</a></p> </div> <div> <h1>Events</h1> <p>Quisque lacegestas ac tincidunt a, lacinia vel velit. Aenean facilisis nulla vitae.</p> <p><a href="#">Read More</a></p> </div> <div> <h1>Regional</h1> <p>Quisque lacus quam, egestas ac tincidunt a, lacinia vel velit. Aenean facilisis nulla vitae.</p> <p><a href="#">Support Us</a></p> </div> </div> </div> <!-- end of content --> #content { height: auto; min-height: 300px !important; overflow: hidden; position:relative; margin-left: 27px; width: 770px; padding-bottom: 43px; } #nav { width: 60px; z-index: 10000; position: absolute; top:340px; left: 28px; } .s4 { width: 770px; height: 370px; overflow: hidden; } #nav a { background-color: transparent; background-image: url(images/transition.png); background-position: 0 0; text-indent: -1000em; width: 10px; height: 10px; display: block; float: left; margin-right: 5px; } #nav a.activeSlide { background-position: 0 -10px; } #overlay_bg { background: url(images/soild_block.png) no-repeat; width: 318px; height: 339px; z-index: 5000; position: absolute; top: 28px; } .information { position: absolute; top: 60px; left: 28px; z-index: 16000; width: 290px; height: 260px; color: #FFF; } .information h1 { font-size: 50px; font-style: italic; text-transform: uppercase; } .information p { font-size: 17px; line-height: 27px; margin-top: 37px; } .information a { font-size: 13px; padding-bottom: 2px; border-bottom: 1px solid; color: #FFF; text-transform: uppercase; font-style: italic; } .information a:hover { color: #000; } Any help would be greatly appreciated.

    Read the article

  • Failing rspec Rails Tutorial Chapter 9.3

    - by greyghost24
    I am failing 3 tests and I have found numerous examples on here and on on the internet in general but I can't seem to find where I'm going wrong. Thanks for any help. 1) User pages signup with valid information edit page Failure/Error: before { visit edit_user_path(user) } ActionView::Template::Error: undefined method `model_name' for NilClass:Class # ./app/views/users/edit.html.erb:6:in `_app_views_users_edit_html_erb___4113112884365867193_70232486166220' # ./spec/requests/user_pages_spec.rb:96:in `block (5 levels) in <top (required)>' 2) User pages signup with valid information edit page Failure/Error: before { visit edit_user_path(user) } ActionView::Template::Error: undefined method `model_name' for NilClass:Class # ./app/views/users/edit.html.erb:6:in `_app_views_users_edit_html_erb___4113112884365867193_70232486166220' # ./spec/requests/user_pages_spec.rb:96:in `block (5 levels) in <top (required)>' 3) User pages signup with valid information edit page Failure/Error: before { visit edit_user_path(user) } ActionView::Template::Error: undefined method `model_name' for NilClass:Class # ./app/views/users/edit.html.erb:6:in `_app_views_users_edit_html_erb___4113112884365867193_70232486166220' # ./spec/requests/user_pages_spec.rb:96:in `block (5 levels) in <top (required)>' Finished in 0.26515 seconds 3 examples, 3 failures Failed examples: rspec ./spec/requests/user_pages_spec.rb:100 # User pages signup with valid information edit page rspec ./spec/requests/user_pages_spec.rb:99 # User pages signup with valid information edit page rspec ./spec/requests/user_pages_spec.rb:101 # User pages signup with valid information edit page authentication_pages_spec.rb require 'spec_helper' describe "Authentication" do subject { page } describe "signin page" do before { visit signin_path } it { should have_selector('h1', text: 'Sign in') } it { should have_selector('title', text: 'Sign in') } end describe "signin" do before { visit signin_path } describe "with invalid information" do before { click_button "Sign in" } it { should have_selector('title', text: 'Sign in') } it { should have_selector('div.alert.alert-error', text: 'Invalid') } describe "after visiting another page" do before { click_link "Home" } it { should_not have_selector('div.alert.alert-error') } end end describe "with valid information" do let(:user) { FactoryGirl.create(:user) } before do fill_in "Email", with: user.email fill_in "Password", with: user.password click_button "Sign in" end it { should have_selector('title', text: user.name) } it { should have_link('Profile', href: user_path(user)) } it { should have_link('Sign out', href: signout_path) } it { should_not have_link('Sign in', href: signin_path) } describe "followed by signout" do before { click_link "Sign out" } it { should have_link('Sign in') } end end end end Here is the users_controller: class UsersController < ApplicationController def show @user = User.find(params[:id]) end def new @user = User.new end def create @user = User.new(params[:user]) if @user.save sign_in @user flash[:success] = "Welcome to the Sample App!" redirect_to @user else render 'new' end end end def edit @user = User.find(params[:id]) end edit.html.erb: <% provide(:title, "Edit user") %> <h1>Update your profile</h1> <div class="row"> <div class="span6 offset3"> <%= form_for(@user) do |f| %> <%= render 'shared/error_messages' %> <%= f.label :name %> <%= f.text_field :name %> <%= f.label :email %> <%= f.text_field :email %> <%= f.label :password %> <%= f.password_field :password %> <%= f.label :password_confirmation, "Confirm Password" %> <%= f.password_field :password_confirmation %> <%= f.submit "Save changes", class: "btn btn-large btn-primary" %> <% end %> <%= gravatar_for @user %> <a href="http://gravatar.com/emails">change</a> </div> here is the user_pages_spec: require 'spec_helper' describe "User pages" do subject { page } describe "profile page" do let(:user) { FactoryGirl.create(:user) } before { visit user_path(user) } it { should have_selector('h1', text: user.name) } it { should have_selector('title', text: user.name) } end describe "signup page" do before { visit signup_path } it { should have_selector('h1', text: 'Sign up') } it { should have_selector('title', text: full_title('Sign up')) } end describe "signup" do before { visit signup_path } describe "with invalid information" do it "should not create a user" do expect { click_button "Create my account" }.not_to change(User, :count) end describe "error messages" do before { click_button "Create my account" } it { should have_selector('title', text: 'Sign up') } it { should have_content('error') } end end describe "with valid information" do before do fill_in "Name", with: "Example User" fill_in "Email", with: "[email protected]" fill_in "Password", with: "foobar" fill_in "Confirmation", with: "foobar" end it "should create a user" do expect do click_button "Create my account" end.to change(User, :count).by(1) end describe "after saving the user" do before { click_button "Create my account" } let(:user) { User.find_by_email('[email protected]') } it { should have_selector('title', text: user.name) } it { should have_selector('div.alert.alert-success', text: 'Welcome') } it { should have_link('Sign out') } end end end describe "signup page" do before { visit signup_path } it { should have_selector('h1', text: 'Sign up') } it { should have_selector('title', text: full_title('Sign up')) } end describe "signup" do before { visit signup_path } let(:submit) { "Create my account" } describe "with invalid information" do it "should not create a user" do expect { click_button submit }.not_to change(User, :count) end end describe "with valid information" do before do fill_in "Name", with: "Example User" fill_in "Email", with: "[email protected]" fill_in "Password", with: "foobar" fill_in "Confirmation", with: "foobar" end it "should create a user" do expect { click_button submit }.to change(User, :count).by(1) end describe "edit" do let(:user) { FactoryGirl.create(:user) } before { visit edit_user_path(user) } describe "page" do it { should have_selector('h1', text: "Update your profile") } it { should have_selector('title', text: "Edit user") } it { should have_link('change', href: 'http://gravatar.com/emails') } end describe "with invalid information" do before { click_button "Save changes" } it { should have_content('error') } end end end end end edit: users_controllers.rb was formatted incorrectly. It should look like this: class UsersController < ApplicationController def show @user = User.find(params[:id]) end def new @user = User.new end def create @user = User.new(params[:user]) if @user.save sign_in @user flash[:success] = "Welcome to the Sample App!" redirect_to @user else render 'new' end end def edit @user = User.find(params[:id]) end end

    Read the article

  • What are your most useful textexander (or similar) snippets?

    - by P.Bjorklund
    Textexpander is a program that aims to save you time by auto-replacing snippets of text with the content of your choice, or to quote their Web site: "Save yourself time and effort by typing short abbreviations for frequently-used text and images." So for instance when you type ,h1 it will change it to <h1></h1> with the cursor placed between the <. After some searching I have yet to find a resource/forum-thread/whatnot that discuss the uses of this marvelous program. I am therefor looking for your best snippets or a link to a resource where I can find this. Oh and one thing I can think of right away is sigw, sigp for my work/personal email signature.

    Read the article

  • What are your most useful textexpander (or similar) snippets?

    - by P.Bjorklund
    Textexpander is a program that aims to save you time by auto-replacing snippets of text with the content of your choice, or to quote their Web site: "Save yourself time and effort by typing short abbreviations for frequently-used text and images." So for instance when you type ,h1 it will change it to <h1></h1> with the cursor placed between the <. After some searching I have yet to find a resource/forum-thread/whatnot that discuss the uses of this marvelous program. I am therefore looking for your best snippets or a link to a resource where I can find this. Oh and one thing I can think of right away is sigw, sigp for my work/personal email signature.

    Read the article

  • How to retrieve multiple anchors URLs with jQuery ?

    - by pierre-guillaume-degans
    Hello, I would like to create a javascript playlist with Jplayer. This is a nice and easy tool, however I never coded with javascript. Look at the javascript used in this demo. It uses a list to store MP3 and Ogg files : var myPlayList = [ {name:"Tempered Song",mp3:"http://www.miaowmusic.com/mp3/Miaow-01-Tempered-song.mp3",ogg:"http://www.miaowmusic.com/ogg/Miaow-01-Tempered-song.ogg"}, {name:"Hidden",mp3:"http://www.miaowmusic.com/mp3/Miaow-02-Hidden.mp3",ogg:"http://www.miaowmusic.com/ogg/Miaow-02-Hidden.ogg"}, {name:"Lentement",mp3:"http://www.miaowmusic.com/mp3/Miaow-03-Lentement.mp3",ogg:"http://www.miaowmusic.com/ogg/Miaow-03-Lentement.ogg"}, {name:"Lismore",mp3:"http://www.miaowmusic.com/mp3/Miaow-04-Lismore.mp3",ogg:"http://www.miaowmusic.com/ogg/Miaow-04-Lismore.ogg"}, {name:"The Separation",mp3:"http://www.miaowmusic.com/mp3/Miaow-05-The-separation.mp3",ogg:"http://www.miaowmusic.com/ogg/Miaow-05-The-separation.ogg"}, {name:"Beside Me",mp3:"http://www.miaowmusic.com/mp3/Miaow-06-Beside-me.mp3",ogg:"http://www.miaowmusic.com/ogg/Miaow-06-Beside-me.ogg"}, ]; So for now, I just use a django template (but it could be another template engine) to create this variable. However I would like to create this list (myPlayList) dynamically with a javascript function which would retrieve the MP3 urls and the Ogg vorbis URLs from the HTML code. Thus, from this HTML code...: <body> <article id="track-0"> <h1>lorem ipsum</h1> <ul> <li><a href="...">Mp3</a></li> <li><a href="...">Vorbis</a></li> <li><a href="...">Flac</a></li> </ul> </article> <article id="track-1"> <h1>lorem ipsum</h1> <ul> <li><a href="...">Mp3</a></li> <li><a href="...">Vorbis</a></li> <li><a href="...">Flac</a></li> </ul> </article> <article id="track-2"> <h1>lorem ipsum</h1> <ul> <li><a href="...">Mp3</a></li> <li><a href="...">Vorbis</a></li> <li><a href="...">Flac</a></li> </ul> </article> </body> ... I need to build a javascript list like this (where each index of the list represents the track-ID in the HTML: var files = [ {mp3:"...", ogg:"..."}, {mp3:"...", ogg:"..."}, {mp3:"...", ogg:"..."}, ]; Please excuse me for my ugly english. If you need more informations just tell me. Thank you. :-)

    Read the article

  • Aliasing a route causes rails to expect paths that don't exist

    - by DJTripleThreat
    ok here's some code: prompt>rails my_app prompt>cd my_app prompt>script/generate scaffold service_type title:string time_allotment:integer prompt>rake db:migrate then edit these files to look like this: #routes.rb: ActionController::Routing::Routes.draw do |map| map.resources :services, :controller => :service_types map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end which produces these routes: prompt>rake routes services GET /services(.:format) {:controller=>"service_types", :action=>"index"} POST /services(.:format) {:controller=>"service_types", :action=>"create"} new_service GET /services/new(.:format) {:controller=>"service_types", :action=>"new"} edit_service GET /services/:id/edit(.:format) {:controller=>"service_types", :action=>"edit"} service GET /services/:id(.:format) {:controller=>"service_types", :action=>"show"} PUT /services/:id(.:format) {:controller=>"service_types", :action=>"update"} DELETE /services/:id(.:format) {:controller=>"service_types", :action=>"destroy"} /:controller/:action/:id /:controller/:action/:id(.:format) _ #my_app/app/views/service_types/index.html.erb <h1>Listing service_types</h1> <table> <tr> <th>Title</th> <th>Time allotment</th> </tr> <% @service_types.each do |service_type| %> <tr> <td><%=h service_type.title %></td> <td><%=h service_type.time_allotment %></td> <td><%= link_to 'Show', service_type %></td> <td><%= link_to 'Edit', edit_service_path(service_type) %></td> <td><%= link_to 'Destroy', service_type, :confirm => 'Are you sure?', :method => :delete %></td> </tr> <% end %> </table> <br /> <%= link_to 'New service_type', new_service_path %> - #my_app/app/views/service_types/new.html.erb <h1>New service_type</h1> <% form_for(@service_type) do |f| %> <%= f.error_messages %> <p> <%= f.label :title %><br /> <%= f.text_field :title %> </p> <p> <%= f.label :time_allotment %><br /> <%= f.text_field :time_allotment %> </p> <p> <%= f.submit 'Create' %> </p> <% end %> <%= link_to 'Back', services_path %> when you try to access http://localhost:3000/services/new you get the following error: undefined method `service_types_path' for #<ActionView::Base:0xb7199a80> Extracted source (around line #3): 1: <h1>New service_type</h1> 2: 3: <% form_for(@service_type) do |f| %> 4: <%= f.error_messages %> 5: 6: <p> Application Trace: /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/polymorphic_routes.rb:107:in `__send__' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/polymorphic_routes.rb:107:in `polymorphic_url' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/polymorphic_routes.rb:114:in `polymorphic_path' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/form_helper.rb:298:in `apply_form_for_options!' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/form_helper.rb:277:in `form_for' /home/aaron/NetBeansProjects/my_app/app/views/service_types/new.html.erb:3:in `_run_erb_app47views47service_types47new46html46erb' /home/aaron/NetBeansProjects/my_app/app/controllers/service_types_controller.rb:29:in `new' Anyone have any idea why it believes that service_types_path is in my code when it's not?

    Read the article

  • Very different font sizes across browsers

    - by Yang
    Chrome/WebKit and Firefox have different rendering engines which render fonts differently, in particular with differing dimensions. This isn't too surprising, but what's surprising is the magnitude of some of the differences. I can always tweak individual elements on a page to be more similar, but that's tedious, to say the least. I've been searching for more systematic solutions, but many resources (e.g. SO answers) simply say "use a reset package." While I'm sure this fixes a bunch of other things like padding and spacing, it doesn't seem to make any difference for font dimensions. For instance, if I take the reset package from http://html5reset.org/, I can show pretty big differences (note the layout dimensions shown in the inspectors). [The images below are actually higher res than shown/resized in this answer.] <h1 style="font-size:64px; background-color: #eee;">Article Header</h1> With Helvetica, Chrome is has the shorter height instead. <h1 style="font-size:64px; background-color: #eee; font-family: Helvetica">Article Header</h1> Using a different font, Chrome again renders a much taller font, but additionally the letter spacing goes haywire (probably due to the boldification of the font): <style> @font-face { font-family: "MyriadProRegular"; src: url("fonts/myriadpro-regular-webfont.eot"); src: local("?"), url("fonts/myriadpro-regular-webfont.woff") format("woff"), url("fonts/myriadpro-regular-webfont.ttf") format("truetype"), url("fonts/myriadpro-regular-webfont.svg#webfonteknRmz0m") format("svg"); font-weight: normal; font-style: normal; } @font-face { font-family: "MyriadProLight"; src: url("fonts/myriadpro-light-webfont.eot"); src: local("?"), url("fonts/myriadpro-light-webfont.woff") format("woff"), url("fonts/myriadpro-light-webfont.ttf") format("truetype"), url("fonts/myriadpro-light-webfont.svg#webfont2SBUkD9p") format("svg"); font-weight: normal; font-style: normal; } @font-face { font-family: "MyriadProSemibold"; src: url("fonts/myriadpro-semibold-webfont.eot"); src: local("?"), url("fonts/myriadpro-semibold-webfont.woff") format("woff"), url("fonts/myriadpro-semibold-webfont.ttf") format("truetype"), url("fonts/myriadpro-semibold-webfont.svg#webfontM3ufnW4Z") format("svg"); font-weight: normal; font-style: normal; } </style> ... <h1 style="font-size:64px; background-color: #eee; font-family: Helvetica">Article Header</h1> I've tried a few resets/normalize packages to no avail. I just wanted to confirm here that this is indeed a fact of life (even omitting the more glaring offenders like IE and mobile) and I'm not missing some super-awesome solution to this mess.

    Read the article

  • IE7 rendering bug: Heading before a floated list

    - by Tomalak
    Can somebody please explain this IE7 bug to me? It occurs in Standards and Quirks mode rendering, it does not occur in Firefox, Chrome or IE8 (though switching the rendering engine via IE8 developer tools will provoke it). Here's the HTML to reproduce the behavior: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Test</title> <style type="text/css"> /* h1 { margin: 0px; } */ ul { padding: 0; margin: 0; list-style-type: none; } ul li { float: left; width: 140px; padding: 3px; } div { clear: left; padding: 3px; } div, li { background-color: OrangeRed; } /* ul { border: 1px solid blue; } */ </style> </head> <body> <h1>Heading 1</h1> <ul class="t"> <li>bla 1</li><li>bla 2</li><li>bla 3</li> </ul> <div>yada</div> </body> </html> This renders a floated <ul> above a <div> (supposed to be a tabbed user interface). There's an unexplained gap between the <div> and the <ul>. Now do one of the following: Uncomment the CSS rule for <h1>. The gap disappears and the list is rendered tight to the <div>, but also very close to the <h1>. Alternatively, uncomment the CSS rule for <ul>. Now a narrow blue border is rendered above the <ul>, but the gap disappears. My questions: How can the <h1> margin (I suppose any block level element with a defined margin will do) affect the space below the list? Can I prevent this from happening without having to set header margins to 0 or messing with the <ul> borders (setting border-width: 0; does not work BTW)? I suppose it is connected to the <ul> having no width because it has only floated children. Maybe someone with more insight into IE7 peculiarities than I have can explain what the rendering engine is doing here. Thanks!

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >