How to pass value captured in URL to middleman page - ruby-on-rails

I want to send emails to prospects with a link to highly customised middleman landing page.
I'll have a spreadsheet with the following columns:
name, company logo, position, etc.
I want my homepage to display the name of the recipient, the logo of the company and other values.
I know that I can create specific url that will pass those values to the landing page but I'm not sure how to do it.
Thanks a lot for guiding me :)

Related

Generate dynamic URL pages basis filter options in Rails

We have a rails app at remote.tools and if you see the product pages (see this page), there are a set of tags associated with each product. I am planning on having filtered search basis these tags on category pages (see this page). Now, I have already tried doing this with the 'Acts-as-taggable' gem and 'Simple-form' (basis this blog).
I am fine with having a page refresh on hitting 'search' or doing it in place (able to do both right now). However, I want to have unique URLs to be created basis the combination of filters applied by the user. For example, if the user selects 'Video communication tools' as the category and 'free trial' and 'easy-to-use' as the tags, the page URL should be '/video-communication-tools-with-free-trial-that-are-easy-to-use'. Currently, the filter options are passed as params i.e. '/search?category=xx&tags=yy'.
Having separate URLs for filter combinations will allow me create unique pages for indexing and add content contextually as well.
How should I go about doing this?
You can use jquery to achieve that,
Something like this.
<script>
$('#search_button').on('click', function(){
window.location = "" + $('#tag1').val()+"-"+$('#tag2').val();
});
</script>
Make sure to add id in your search button. Hope this works for you.

How to redirect back to Listing page?

I've got some pages going on. Each page shows Listings of items that users wish to sell, along with their prices and descriptions. At the bottom of the page is a link for creating a new listing.
What I want to do is have the back button return the user to the page they created he listing on -- NOT the index of all listings.
I can't just change the back button to
link_to 'Back', pages_universityofconnecticut_path
because it will link to the University of Connecticut even when used on Harvard's page. I hope that makes sense. How do I go about doing this?
I have used this line in my view to display only the listings where the school matches the page.
here's the solution of your problem, an excellent way by ryan
http://railscasts.com/episodes/131-going-back

Navigate in timeline to a specific year/month AND post (facebookID) with a single url

I noticed that with a URL of the format
facebook.com/username/timeline/2013/4
we move to the end of the specified month of the year.
Now I need to use an url to navigate a user in my timeline to a specific post (facebookID) in a way that he can still move up and down on timeline from this point of time (anchor).
Any clues?
On a Facebook page, each post's HTML element has its own unique HTML id.
You can make use of this fact to directly link to a post within a page on Facebook by identifying the post's id and using it as the fragment identifier in the URL.
To find a post's HTML element id, right click the particular post in your browser [I'm assuming Chrome], then click "inspect element". In the opened development environment, find an enclosing div of the inspected element which contains an id HTML attribute.
For example, a link to a particular post on Disney's March 2013 Facebook timeline is the following:
https://www.facebook.com/Disney/timeline/2013/02/#tl_unit_6154529015953642023

A href URL with div ID wildcard

Is there a way to open a page and jump to a div ID when only part of the ID is known?
eg: http://wp-site.com/webpage.php#div-id-name-xxxx
where 'xxxx' is a set of numbers that are impossible to know until after the page has loaded.
I'm using a shortcode which generates a page element within a div where the beginning of the ID is standard (eg: tabs-bottom, contact-form, etc) followed by a unique number that is randomly generated each time the page loads.
I want to be able to link to the div on that page from another page, but with part of the ID being dynamic, I'm having trouble doing so. I thought passing a wildcard in the URL might be the way to go...
Any ideas?
ps: the pages are part of a Wordpress based site, if that helps.

How to implement a search page which shows results on the same page?

I'm using ASP.NET MVC 2 for the first time on a project at work and am feeling like a bit of a noob.
I have a page with a customer search control/partial view. The control is a textbox and a button. You enter a customer id into the textbox and hit search. The page then "refreshes" and shows the customer details on the same page. In other words, the customer details appear below the customer search control.
This is so that if the customer isn't the right one, the user can search again without hitting back in the browser. Or, perhaps they mistyped the customer id and need to try again.
I want the URL to look like this:
/Customer/Search/1
Obviously, this follows the default route in the project.
Now, if I type the URL above directly into my browser, it works fine. However, when I then use the search control on that page to search for say customer 2, the page refreshes with the correct customer details but the URL does not change! It stays as
/Customer/Search/1
When I want it to be
/Customer/Search/2
How can I get it to change to the correct URL?
I am only using the default route in Global.asax.
My Search method looks like this:
<AcceptVerbs(HttpVerbs.Get)> _
Function Search(ByVal id As String) As ActionResult
Dim customer As Customer = New CustomerRepository().GetById(id)
Return View("SearchResult", customer)
End Function
A good place to start might be NerdDinner if you havn't already.
In the mean time though The approach I'd use is to have a page that has my search box on it.
Then I'd have a <div> that I name "SearchResults". This will ultimately hold my results to the search.
I then have a PartialView which takes a model that has all the search results and renders them.
So when I click the button I do a call out to a jQuery action that takes the search parameter, performs the search and then returns my PartialView as rendered HTML.
Back in the client side I take that rendered HTML and replace the contents of my div with the HTML.
The keywords to google, or SO, are RenderPartial. This is back end code to render a partial view and give you html.
Also jQuery postbacks so that you can call an action in your controller.
use RedirectToRoute action result
link

Resources