Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Made relocatable #4

Merged
merged 3 commits into from

2 participants

Chris Maloney Sebastian Senf
Chris Maloney

Hi, Sebastian,

I made a few very minor modifications -- take a look and see if you agree. The benefit of these is that it allows the static-file version to be served from a directory that is not at the root of a webserver. For example, http://chrisbaloney.com/jqapi/. I am not very familiar with your project, so I can't guarantee I didn't break anything.

Cheers!

Chris Maloney

Oh, and the first commit is one that I needed to get it to build on my Ubuntu machine. I understand that therubyracer is just one of several JS engines, so maybe you don't want it in the Gemfile. I'm new to Ruby, so not sure.

Sebastian Senf mustardamus was assigned
Sebastian Senf
Collaborator

Chris, therubyracer is just fine. I forgot to include it because Node.js was already installed on my system. Thanks!

Sebastian Senf mustardamus merged commit dadfba8 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
5 Gemfile
View
@@ -8,4 +8,7 @@ gem 'sass'
gem 'coffee-script'
gem 'haml'
gem 'sinatra'
-gem 'crack'
+gem 'crack'
+
+gem 'execjs'
+gem 'therubyracer'
7 README.md 100644 → 100755
View
@@ -41,6 +41,13 @@ The GitHub repo of the official docs site will be cloned/updated.
Point your browser to localhost:9292 and there you have the latest jQuery documentation with jQAPI
wrapped around.
+### Generate static files
+
+ thor deploy:generate
+
+Generates index.html, bundle.js, bundle.css, etc., so that the documentation can be
+viewed from a set of static files.
+
## Known Issues - Work in progress
- check if method is deprecated, if so indicate it
- jQuery() documentation is broken
8 app/assets/javascripts/categories.js.coffee 100644 → 100755
View
@@ -2,7 +2,7 @@ class jqapi.Categories
constructor: ->
@el = $ '#categories' # parent ul element
self = @
-
+
jqapi.events.on 'navigation:done', => # call when everything is loaded and generated
@hideLoader() # hide the loader
@@ -14,8 +14,8 @@ class jqapi.Categories
jqapi.events.on 'categories:toggle', (e, catEl) => # on request to toggle a category
@toggleCategory catEl # toggle the category content
-
- $.getJSON '/docs/index.json', (data) => # load the index json data with all categories and entries
+
+ $.getJSON 'docs/index.json', (data) => # load the index json data with all categories and entries
@buildNavigation data # and build from the object when loaded
jqapi.events.trigger 'index:done', [data] # let the app know that the index is loaded
@@ -58,7 +58,7 @@ class jqapi.Categories
if subcats and subcats.length # are there any sub categories?
for subcat in subcats # for each sub category
listEl = $ templates.categoryItem('sub', subcat.name) # get template for category
-
+
if subcat.entries.length # if the sub category has entries
listEl.append @buildEntriesList(subcat.entries) # build and append the entries
listEl.appendTo el # append entries list to category
14 app/assets/javascripts/entry.js.coffee 100644 → 100755
View
@@ -19,7 +19,7 @@ class jqapi.Entry
document.title = "#{entry.title} - jQAPI" # set a new title
loadContent: (slug) ->
- $.getJSON "/docs/entries/#{slug}.json", (data) => # fetch from json file
+ $.getJSON "docs/entries/#{slug}.json", (data) => # fetch from json file
data.slug = slug
@parseEntry data # parse what was received
jqapi.events.trigger 'entry:done', [data] # let the app know that a new entry is loaded
@@ -27,7 +27,7 @@ class jqapi.Entry
parseEntry: (entry) ->
el = $ templates.entry(entry) # generate element from template
-
+
#@insertCategories entry, el # generate and insert categories
@insertEntries entry, el # generate entries and insert
@@ -36,7 +36,7 @@ class jqapi.Entry
@highlightCode()
@adjustCodeHeight() # set equal heights for the code boxes
@fixLinks()
-
+
insertCategories: (entry, el) ->
catsEl = $('#categories', el) # cache categories list
@@ -143,7 +143,7 @@ class jqapi.Entry
playH -= cssEl.height() if cssEl.length
playH += 100 if playH < 100
playH = 130 if playH < 0
-
+
sandboxEl.children('.play').height playH
fixLinks: ->
@@ -161,9 +161,9 @@ class jqapi.Entry
if hrefArr[2] is 'api.jquery.com'
href = hrefArr[hrefArr.length - 1]
href = hrefArr[hrefArr.length - 2] if href.length is 0
-
+
el.attr 'href', "#p=#{href}"
-
+
buildLiveExamples: ->
sandboxEls = $('.sandbox', @el)
@@ -178,5 +178,5 @@ class jqapi.Entry
js : el.find('.js pre').text()
css : el.find('.css pre').text()
external:
- js : ['/assets/jquery.js']
+ js : ['assets/jquery.js']
el : $('.play', sandboxEl).text('')
14 app/assets/stylesheets/categories.css.sass 100644 → 100755
View
@@ -2,21 +2,21 @@
.loader
text-align: center
padding-top: 20px
-
+
.top-cat
.top-cat-name
display: block
- background: url('/assets/arrow.png') no-repeat #ddd
+ background: url('arrow.png') no-repeat #ddd
border-bottom: 1px solid #ccc
padding: 7px 0 7px 25px
cursor: pointer
-
+
.top-cat-name:hover, &.hover .top-cat-name
- background: url('/assets/arrow.png') 0 -27px no-repeat #cecece
+ background: url('arrow.png') 0 -27px no-repeat #cecece
border-bottom: 1px solid rgba(0, 0, 0, 0.1)
box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2)
color: #111
-
+
.sub-cats
display: none
@@ -28,14 +28,14 @@
border-bottom: 1px dotted #ddd
padding: 7px 0 7px 25px
cursor: pointer
-
+
.sub-cat-name:hover, &.hover .sub-cat-name
background: #dedede
border-bottom: 1px solid #d3d3d3
.open, .open.hover
.top-cat-name, .top-cat-name:hover
- background: url('/assets/arrow.png') 0 -54px no-repeat #cecece
+ background: url('arrow.png') 0 -54px no-repeat #cecece
border-bottom: 1px solid rgba(0, 0, 0, 0.1)
box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2)
color: #111
4 app/assets/stylesheets/entry.css.sass 100644 → 100755
View
@@ -4,8 +4,8 @@
height: 400px
&.loading
- background: url('/assets/loader.gif') no-repeat center center
-
+ background: url('loader.gif') no-repeat center center
+
#entry-wrapper
padding: 20px 30px
12 app/assets/stylesheets/main.css.sass 100644 → 100755
View
@@ -1,6 +1,6 @@
html
font-size: 16px
-
+
body
font-size: 62.5%
font-family: "Helvetica Neue", Arial, sans-serif
@@ -78,7 +78,7 @@ body
display: block
width: 264px
height: 61px
- background: url('/assets/hashrocket.png') no-repeat
+ background: url('hashrocket.png') no-repeat
text-indent: -30000px
#credits
@@ -120,7 +120,7 @@ body
#changelog
position: relative
-
+
a
position: absolute
top: 55px
@@ -164,16 +164,16 @@ body
#zip
a
- background: url('/assets/download_zip.png') top center no-repeat
+ background: url('download_zip.png') top center no-repeat
#air
a
- background: url('/assets/download_air.png') top center no-repeat
+ background: url('download_air.png') top center no-repeat
cursor: no-drop
#git
a
- background: url('/assets/download_git.png') top center no-repeat
+ background: url('download_git.png') top center no-repeat
#keys
padding: 0 0 15px 30px
8 app/jqapi.rb 100644 → 100755
View
@@ -43,22 +43,22 @@ class Jqapi < Sinatra::Base
serve_file('docs/entries', "#{params[:splat][0]}.json")
end
- get '/resources/*.png' do
+ get 'resources/*.png' do
content_type 'image/png'
serve_file('docs/resources', "#{params[:splat][0]}.png")
end
- get '/resources/*.jpg' do
+ get 'resources/*.jpg' do
content_type 'image/jpeg'
serve_file('docs/resources', "#{params[:splat][0]}.jpg")
end
- get '/resources/*.gif' do
+ get 'resources/*.gif' do
content_type 'image/gif'
serve_file('docs/resources', "#{params[:splat][0]}.gif")
end
- get '/LICENSE' do
+ get 'LICENSE' do
content_type 'text'
serve_file('', 'LICENSE')
end
24 app/views/index.haml 100644 → 100755
View
@@ -6,12 +6,12 @@
%meta{:name => "content-type", :content => "text/html; charset=utf-8"}
%meta{:name => "description", :content => "Alternative jQuery Documentation Browser"}
- %link{:rel => "shortcut icon", :href => "/assets/favicon.ico", :type => "image/x-icon"}
+ %link{:rel => "shortcut icon", :href => "assets/favicon.ico", :type => "image/x-icon"}
%link{:rel => "icon", :href => "/favicon.ico", :type => "image/x-icon"}
-
- %link{:href => '/assets/bundle.css', :type => 'text/css', :rel => 'stylesheet'}
- %script{:src => '/assets/bundle.js', :type => 'text/javascript'}
-
+
+ %link{:href => 'assets/bundle.css', :type => 'text/css', :rel => 'stylesheet'}
+ %script{:src => 'assets/bundle.js', :type => 'text/javascript'}
+
%body
#sidebar
#search
@@ -45,7 +45,7 @@
%li
%a{:href => '#changelog'}
%span Changelog
-
+
%ul#navigation
%li
%a{:href => '/'}
@@ -73,7 +73,7 @@
\.
%p
- The aim of this project is to get out of the way of your development work.
+ The aim of this project is to get out of the way of your development work.
Quickly switch to this docs and find what you are looking for.
%p
@@ -134,7 +134,7 @@
%ul.signatures
%li.signature
%h2.title Usage
-
+
.row.clearfix
.left
%p
@@ -168,7 +168,7 @@
%ul.signatures
%li.signature#download
%h2.title Download
-
+
.row.clearfix
.third#zip
%a{:href => '/jqapi.zip'} Download as Zip Archive
@@ -230,7 +230,7 @@
%ul.signatures
%li.signature
%h2.title License
-
+
#license
%div
%a{:href => 'http://jquery.com'} jQuery
@@ -239,7 +239,7 @@
\. jQAPI is
%a{:href => 'https://github.com/jqapi/jqapi'}Open-Source
and running under the same
- %a{:href => '/LICENSE'} licenses
+ %a{:href => 'LICENSE'} licenses
\.
%div
jQAPI is coded by
@@ -271,7 +271,7 @@
Released very first version.
%a{:href => 'http://twitter.com/jqapi'} Follow @jqapi for updates
-
+
:javascript
if(window.location.hostname === 'jqapi.com') {
var _gaq = _gaq || [];
Something went wrong with that request. Please try again.