Skip to content

Commit

Permalink
Now with online demo!!
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdrane committed Apr 9, 2009
1 parent a680a86 commit 56875ec
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 114 deletions.
64 changes: 37 additions & 27 deletions README
Expand Up @@ -2,55 +2,64 @@ BOOKMARKER PLUGIN FOR RAILS.
GENERATE A BOOKMARKING TOOL FOR YOUR RAILS APP!

=== WHAT IS IT?
Bookmark webpages to your application, save the url, title and description into
a model on your site.
Brings a pop-over window to the any webpage you are visiting, and saves the
result to your rails application. Currently convigured to save the url, title
and description to your site.

It uses a standard browser bookmark to add javascript to an external page.
it can be used to save information to your site from any other site out there.
Works with the restful_authentication plugin so you controll who is using it.

=== HOW IT WORKS
./script/generate bookmark Bookmark to create controller, views, model migration and test
for saving the bookmarks. That's it! You can name the class whatever you want,
Favorites and Pages were two others make sense.
Bookmark loads a script file into the head of the current document and executes
it. To setup, just run the generator: ./script/generate bookmark Bookmark to
create controller, views, model migration and tests for saving the bookmarks.
That's it! You can name the class whatever you want, Favorites and Pages were
two others make sense.

The bookmark part simply 'injects' a .js file into the page, by adding it to
the HEAD element. This brings up a pop-over window with an iframe that goes to your
site. Your users will put it in their toolbar, and click on it when
the HEAD element. This brings up a pop-over window with an iframe that goes to
your site. Your users will put it in their toolbar, and click on it when
they want to use it.

=== WHAT CAN IT DO?
Short answer: Bookmark webpages to your application, save the url, title and description into
a model on your site.
Short answer: Bookmark webpages to your application, save the url, title and
description into a model on your site.

The long answer: Anything you want! You can go ahead and add functionality to
parse the page DOM with HPRICOT or anything else.

=== ONLINE DEMO
Coming soon!
Try it out HERE
http://www.chefscompass.com/bookmarks

=== INSTALLATION
First, you must have a restful_authentication user model. Install restful_authentication
and generate it. You should read more about this, but this is the simple version:
First, you must have a restful_authentication user model. Install
restful_authentication and generate a user and session.
You should read more about this, but this is the simple version:
1) ./script/plugin install git://github.com/technoweenie/restful-authentication.git
2) ./script/generate authenticated user sessions
3) rake db:migrate
Add the line following line to your
include AuthenticatedSystem
to your ApplicationController class in the file app/controllers/application.rb
Start up your server and create a user account and login before proceeding. To create a user, go to users/new and create a username and password.
Start up your server and create a user account and login before proceeding.
To create a user, go to users/new and create a username and password.

Then you can generate your bookmarking model! I'll call this one Bookmark, you can call it
Page, Favorite or anything else you want.
Then you can generate your bookmarking model! I'll call this one Bookmark, you
can call it Page, Favorite or anything else you want.
1) ./script/plugin install git://github.com/andrewdrane/bookmarker.git
2) ./script/generate bookmark Bookmark
3) rake db:migrate

Now, fire up your local server, or restart it if you were allready running.
Then, point your browser to localhost:3000/bookmarks (or pages, or favorites, it's the
plural of whatever you called your bookmarker). You will see a link to the bookmark tool.
If you are using FireFox, DRAG the link to the top of your screen. This will be your bookmark.
Then, open another page, and click the bookmark. YOu should see the bookmarker tool appear!
Then, point your browser to localhost:3000/bookmarks (or pages, or favorites,
it's the plural of whatever you called your bookmarker). You will see a link to
the bookmark tool.

If you are using FireFox, DRAG the link to the top of your screen. This will be
your bookmark. Then, open another page, and click the bookmark. You should see
the bookmarker tool appear!


=== NOTES
Expand All @@ -63,22 +72,23 @@ render :file => "#{RAILS_ROOT}/public/adder.js"

=== THE BOOKMARK
The bookmark itself is simply a javascript href. Here is an example that's
broken up and commented for easy reading. (NOTE spaces MUST be replaced with %20)
broken up and commented for easy reading.
(NOTE spaces MUST be replaced with %20)

javascript:( #just like any other javascript href
function() { #start the function call

var x=document.getElementsByTagName('head').item(0); #Grab HEAD element
var so=document.createElement('script'); #Create SCRIPT element

var s='http://www.yoursite.com/bookmarks/script/'; #URL for the JS file
if(typeof so !='object') #Make sure you can add it
so=document.standardCreateElement('script'); #Create script element
so.setAttribute('src',s); #Set src to your site
so.setAttribute('type','text/javascript'); #Set proper type
x.appendChild(so); #Append it to the HEAD
var s='http://www.yoursite.com/bookmarks/script/'; #URL for the JS file
if(typeof so !='object') #Make sure you can add it
so=document.standardCreateElement('script'); #Create script element
so.setAttribute('src',s); #Set src to your site
so.setAttribute('type','text/javascript'); #Set proper type
x.appendChild(so); #Append it to the HEAD
}
)(); #Execute the function
)(); #Execute the function

and the whole shebang uninterrupted
javascript:(function()%20{var%20x=document.getElementsByTagName('head').item(0);var%20so=document.createElement('script');var%20s='http://www.yoursite.com/bookmarks/script/';if(typeof%20so%20!='object')%20so=document.standardCreateElement('script');so.setAttribute('src',s);so.setAttribute('type','text/javascript');x.appendChild(so);})();
Expand Down
87 changes: 0 additions & 87 deletions README~

This file was deleted.

0 comments on commit 56875ec

Please sign in to comment.