Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated files.

  • Loading branch information...
commit 747b5e0be79eb9e856b7514330fdd31cb3e5a274 1 parent dfba372
Francis Hwang authored
View
22 _site/quick_start.html
@@ -31,11 +31,13 @@
<div class='note'>
This document assumes you are highly familiar with Ruby and Rails; if you are a beginning Rails user you might want to start with our <a href='/admin_assistant/tutorial.html'>tutorial</a>.
</div>
-<p>1) Add the gem to your Gemfile, and install it with <code>bundle install</code>.</p>
+<h3 id='add_the_gem_to_your_gemfile'>Add the gem to your Gemfile</h3>
<pre><code>gem &#39;admin_assistant&#39;</code></pre>
-<p>2) admin_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You&#8217;ll also need to make sure to include jquery, if you&#8217;re not including it already.</p>
+<h3 id='include_admin_assistants_css_and_javascript_in_your_layout'>Include admin_assistant&#8217;s CSS and Javascript in your layout</h3>
+
+<p>admin_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You&#8217;ll also need to make sure to include jquery, if you&#8217;re not including it already.</p>
<pre><code>&lt;html&gt;
&lt;head&gt;
@@ -45,7 +47,21 @@
...
&lt;/html&gt;</code></pre>
-<p>3) Setup an admin controller by attaching it to a model and using the admin layout:</p>
+<p>If you&#8217;re using Sprockets, which is the default in Rails 3.1, you should include the CSS and Javascript assets in the manifest files that you use for your admin layout.</p>
+
+<p>Javascript:</p>
+
+<pre><code>//= require admin_assistant
+//= require jquery.tokeninput.js</code></pre>
+
+<p>CSS:</p>
+
+<pre><code>//= require admin_assistant
+//= require token-input</code></pre>
+
+<h3 id='setup_an_admin_controller'>Setup an admin controller</h3>
+
+<p>Use the admin layout, and call <code>admin_assistant_for</code> with the model class.</p>
<pre><code>class Admin::BlogPostsController &lt; ApplicationController
layout &#39;admin&#39;
View
56 _site/tutorial.html
@@ -31,20 +31,26 @@
<div class='note'>
This document assumes you are a beginning Rails user; if you are familiar with Rails you might want to check out our <a href='/admin_assistant/quick_start.html'>quick start</a>.
</div>
-<p>1) Add the gem to <code>Gemfile</code> in the root of your Rails project.</p>
+<h3 id='add_the_gem_to_your_gemfile'>Add the gem to your Gemfile</h3>
+
+<p>This is found at <code>Gemfile</code> in the root of your Rails project.</p>
<pre><code>gem &#39;admin_assistant&#39;</code></pre>
-<p>2) Install the gem locally.</p>
+<h3 id='install_the_gem_locally'>Install the gem locally</h3>
<pre><code>$ bundle install</code></pre>
-<p>3) admin_assistant uses jQuery. You may already have jQuery installed for your project, but if not, you can get it like so:</p>
+<h3 id='install_jquery_if_you_need_to'>Install jQuery if you need to</h3>
+
+<p>admin_assistant uses jQuery. You may already have jQuery installed for your project (it&#8217;s the standard starting with Rails 3.1), but if not, you can get it like so:</p>
<pre><code>$ curl http://code.jquery.com/jquery-1.6.2.min.js &gt; \
public/javascripts/jquery-1.6.2.min.js</code></pre>
-<p>4) If you don&#8217;t have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called <code>app/views/layouts/admin.html.erb</code> like this:</p>
+<h3 id='create_a_separate_admin_layout_without_sprockets'>Create a separate admin layout (without Sprockets)</h3>
+
+<p>If you don&#8217;t have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called <code>app/views/layouts/admin.html.erb</code> like this:</p>
<pre><code>&lt;html&gt;
&lt;head&gt;
@@ -58,11 +64,41 @@
<p>If you&#8217;ve already created an admin layout, you should add the javascript references, and the call to <code>admin_assistant_includes</code>. This includes the standard CSS and Javascript that are packed with admin_assistant.</p>
-<p>5) Create your new admin controller for a pre-existing model. We&#8217;ll be using a BlogPost as an example but you should be able to use any model in your Rails app.</p>
+<h3 id='create_a_separate_admin_layout_with_sprockets'>Create a separate admin layout (with Sprockets)</h3>
+
+<p>Rails 3.1 recommends Sprockets as the default asset packager. If you&#8217;re using Sprockets, you&#8217;ll probably want to create separate <code>admin.js</code> and <code>admin.css</code> manifest files. <code>app/views/layouts/admin.html.erb</code> will look like this:</p>
+
+<pre><code>&lt;html&gt;
+ &lt;head&gt;
+ &lt;%= javascript_include_tag &quot;admin&quot; %&gt;
+ &lt;%= stylesheet_link_tag &quot;admin&quot; %&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;%= yield %&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</code></pre>
+
+<p>And you will add admin_assistant&#8217;s assets to the manifest files, which you will most likely put at <code>app/assets/javascripts/admin.js</code> and <code>app/assets/stylesheets/admin.css</code>.</p>
+
+<p>Javascript:</p>
+
+<pre><code>//= require admin_assistant
+//= require jquery.tokeninput.js</code></pre>
+
+<p>CSS:</p>
+
+<pre><code>//= require admin_assistant
+//= require token-input</code></pre>
+
+<h3 id='create_an_admin_controller'>Create an admin controller</h3>
+
+<p>Create your new admin controller for a pre-existing model. We&#8217;ll be using a BlogPost as an example but you should be able to use any model in your Rails app.</p>
<pre><code>./script/generate controller admin/blog_posts</code></pre>
-<p>6) Open <code>app/controllers/admin/blog_posts_controller.rb</code> and set it up to use the admin layout and to use admin_assistant for the BlogPost model:</p>
+<h3 id='edit_your_admin_controller'>Edit your admin controller</h3>
+
+<p>Open <code>app/controllers/admin/blog_posts_controller.rb</code> and set it up to use the admin layout and to use admin_assistant for the BlogPost model:</p>
<pre><code>class Admin::BlogPostsController &lt; ApplicationController
layout &#39;admin&#39;
@@ -70,9 +106,13 @@
admin_assistant_for BlogPost
end</code></pre>
-<p>7) If you were already running your Rails app with <code>./script/server</code> etc, you should restart it.</p>
+<h3 id='restart_your_rails_app'>Restart your Rails app</h3>
+
+<p>If you were already running your Rails app with <code>./script/server</code> etc, you should restart it.</p>
+
+<h3 id='check_out_the_controller'>Check out the controller</h3>
-<p>8) Visit <code>/admin/blog_posts</code> in your browser and you&#8217;ll see something like this:</p>
+<p>Visit <code>/admin/blog_posts</code> in your browser and you&#8217;ll see something like this:</p>
<p><img src='/admin_assistant/img/blog_posts-index.png' alt='index' /></p>
View
23 quick_start.markdown
@@ -7,11 +7,13 @@ title: Quick start
This document assumes you are highly familiar with Ruby and Rails; if you are a beginning Rails user you might want to start with our <a href="/admin_assistant/tutorial.html">tutorial</a>.
</div>
-1) Add the gem to your Gemfile, and install it with `bundle install`.
+### Add the gem to your Gemfile
gem 'admin_assistant'
-2) admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include jquery, if you're not including it already.
+### Include admin\_assistant's CSS and Javascript in your layout
+
+admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include jquery, if you're not including it already.
<html>
<head>
@@ -20,8 +22,23 @@ This document assumes you are highly familiar with Ruby and Rails; if you are a
</head>
...
</html>
+
+If you're using Sprockets, which is the default in Rails 3.1, you should include the CSS and Javascript assets in the manifest files that you use for your admin layout.
-3) Setup an admin controller by attaching it to a model and using the admin layout:
+Javascript:
+
+ //= require admin_assistant
+ //= require jquery.tokeninput.js
+
+CSS:
+
+ //= require admin_assistant
+ //= require token-input
+
+
+### Setup an admin controller
+
+Use the admin layout, and call `admin_assistant_for` with the model class.
class Admin::BlogPostsController < ApplicationController
layout 'admin'
View
14 quick_start.markdown~
@@ -7,23 +7,21 @@ title: Quick start
This document assumes you are highly familiar with Ruby and Rails; if you are a beginning Rails user you might want to start with our <a href="/admin_assistant/tutorial.html">tutorial</a>.
</div>
-1) First, install the plugin from Github.
+1) Add the gem to your Gemfile, and install it with `bundle install`.
- ./script/plugin install git://github.com/fhwang/admin_assistant.git
+ gem 'admin_assistant'
-2) If you don't have the popular will\_paginate gem, you'll need that too. See [http://wiki.github.com/mislav/will_paginate/installation](http://wiki.github.com/mislav/will_paginate/installation) for more info.
-
-3) admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include prototype.js, effects.js, and controls.js, if you're not including them already.
+2) admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include jquery, if you're not including it already.
<html>
<head>
- <%= javascript_include_tag("prototype", "effects", "controls") %>
+ <%= javascript_include_tag("jquery-1.6.2.min") %>
<%= admin_assistant_includes %>
</head>
...
</html>
-4) Setup an admin controller by attaching it to a model and using the admin layout:
+3) Setup an admin controller by attaching it to a model and using the admin layout:
class Admin::BlogPostsController < ApplicationController
layout 'admin'
@@ -42,5 +40,5 @@ Depending on the model you're using, you might notice a few things:
* There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
* If you have more than 10 pages of a given model, the pagination at the bottom includes a jump form to let you automatically jump to a page you enter.
-For more, check out the [API reference](./api/).
+For more, check out the [API reference](/admin_assistant/api/).
View
58 tutorial.markdown
@@ -7,20 +7,26 @@ title: Tutorial
This document assumes you are a beginning Rails user; if you are familiar with Rails you might want to check out our <a href="/admin_assistant/quick_start.html">quick start</a>.
</div>
-1) Add the gem to `Gemfile` in the root of your Rails project.
+### Add the gem to your Gemfile
+
+This is found at `Gemfile` in the root of your Rails project.
gem 'admin_assistant'
-2) Install the gem locally.
+### Install the gem locally
$ bundle install
-3) admin\_assistant uses jQuery. You may already have jQuery installed for your project, but if not, you can get it like so:
+### Install jQuery if you need to
+
+admin\_assistant uses jQuery. You may already have jQuery installed for your project (it's the standard starting with Rails 3.1), but if not, you can get it like so:
$ curl http://code.jquery.com/jquery-1.6.2.min.js > \
public/javascripts/jquery-1.6.2.min.js
-4) If you don't have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called `app/views/layouts/admin.html.erb` like this:
+### Create a separate admin layout (without Sprockets)
+
+If you don't have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called `app/views/layouts/admin.html.erb` like this:
<html>
<head>
@@ -33,12 +39,42 @@ This document assumes you are a beginning Rails user; if you are familiar with R
</html>
If you've already created an admin layout, you should add the javascript references, and the call to `admin_assistant_includes`. This includes the standard CSS and Javascript that are packed with admin\_assistant.
-
-5) Create your new admin controller for a pre-existing model. We'll be using a BlogPost as an example but you should be able to use any model in your Rails app.
+
+### Create a separate admin layout (with Sprockets)
+
+Rails 3.1 recommends Sprockets as the default asset packager. If you're using Sprockets, you'll probably want to create separate `admin.js` and `admin.css` manifest files. `app/views/layouts/admin.html.erb` will look like this:
+
+ <html>
+ <head>
+ <%= javascript_include_tag "admin" %>
+ <%= stylesheet_link_tag "admin" %>
+ </head>
+ <body>
+ <%= yield %>
+ </body>
+ </html>
+
+And you will add admin\_assistant's assets to the manifest files, which you will most likely put at `app/assets/javascripts/admin.js` and `app/assets/stylesheets/admin.css`.
+
+Javascript:
+
+ //= require admin_assistant
+ //= require jquery.tokeninput.js
+
+CSS:
+
+ //= require admin_assistant
+ //= require token-input
+
+### Create an admin controller
+
+Create your new admin controller for a pre-existing model. We'll be using a BlogPost as an example but you should be able to use any model in your Rails app.
./script/generate controller admin/blog_posts
+
+### Edit your admin controller
-6) Open `app/controllers/admin/blog_posts_controller.rb` and set it up to use the admin layout and to use admin\_assistant for the BlogPost model:
+Open `app/controllers/admin/blog_posts_controller.rb` and set it up to use the admin layout and to use admin\_assistant for the BlogPost model:
class Admin::BlogPostsController < ApplicationController
layout 'admin'
@@ -46,9 +82,13 @@ If you've already created an admin layout, you should add the javascript referen
admin_assistant_for BlogPost
end
-7) If you were already running your Rails app with `./script/server` etc, you should restart it.
+### Restart your Rails app
+
+If you were already running your Rails app with `./script/server` etc, you should restart it.
+
+### Check out the controller
-8) Visit `/admin/blog_posts` in your browser and you'll see something like this:
+Visit `/admin/blog_posts` in your browser and you'll see something like this:
![index](/admin_assistant/img/blog_posts-index.png)
View
35 tutorial.markdown~
@@ -3,33 +3,42 @@ layout: default
title: Tutorial
---
-*This document assumes you are a beginning Rails user; if you are very familiar with Rails you might want to check out our [quick start](./quick_start.html).*
+<div class="note">
+This document assumes you are a beginning Rails user; if you are familiar with Rails you might want to check out our <a href="/admin_assistant/quick_start.html">quick start</a>.
+</div>
-1) First, install the plugin from Github.
+1) Add the gem to `Gemfile` in the root of your Rails project.
- ./script/plugin install git://github.com/fhwang/admin_assistant.git
+ gem 'admin_assistant'
+
+2) Install the gem locally.
+
+ $ bundle install
+
+3) admin\_assistant uses jQuery. You may already have jQuery installed for your project, but if not, you can get it like so:
-2) If you don't have the popular will\_paginate gem, you'll need that too. See [http://wiki.github.com/mislav/will_paginate/installation](http://wiki.github.com/mislav/will_paginate/installation) for more info.
+ $ curl http://code.jquery.com/jquery-1.6.2.min.js > \
+ public/javascripts/jquery-1.6.2.min.js
-3) If you don't have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called `app/views/layouts/admin.html.erb` like this:
+4) If you don't have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called `app/views/layouts/admin.html.erb` like this:
<html>
<head>
- <%= javascript_include_tag("prototype", "effects", "controls") %>
+ <%= javascript_include_tag("jquery-1.6.2.min") %>
<%= admin_assistant_includes %>
</head>
<body>
- <%=yield %>
+ <%= yield %>
</body>
</html>
If you've already created an admin layout, you should add the javascript references, and the call to `admin_assistant_includes`. This includes the standard CSS and Javascript that are packed with admin\_assistant.
-4) Create your new admin controller for a pre-existing model. We'll be using a BlogPost as an example but you should be able to use any model in your Rails app.
+5) Create your new admin controller for a pre-existing model. We'll be using a BlogPost as an example but you should be able to use any model in your Rails app.
./script/generate controller admin/blog_posts
-5) Open `app/controllers/admin/blog_posts_controller.rb` and set it up to use the admin layout and to use admin\_assistant for the BlogPost model:
+6) Open `app/controllers/admin/blog_posts_controller.rb` and set it up to use the admin layout and to use admin\_assistant for the BlogPost model:
class Admin::BlogPostsController < ApplicationController
layout 'admin'
@@ -37,11 +46,11 @@ If you've already created an admin layout, you should add the javascript referen
admin_assistant_for BlogPost
end
-6) If you were already running your Rails app with `./script/server` etc, you should restart it.
+7) If you were already running your Rails app with `./script/server` etc, you should restart it.
-7) Visit `/admin/blog_posts` in your browser and you'll see something like this:
+8) Visit `/admin/blog_posts` in your browser and you'll see something like this:
-![index](./img/blog_posts-index.png)
+![index](/admin_assistant/img/blog_posts-index.png)
You can now search, paginate, create, and edit blog posts.
@@ -52,5 +61,5 @@ Depending on the model you're using, you might notice a few things:
* There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
* If you have more than 10 pages of a given model, the pagination at the bottom includes a jump form to let you automatically jump to a page you enter.
-For more, check out the [API reference](./api/).
+For more, check out the [API reference](/admin_assistant/api/).
Please sign in to comment.
Something went wrong with that request. Please try again.