Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cdnjs UI & a little styling

  • Loading branch information...
commit 608077173878b24a989e0163e682300ff31ee35c 1 parent cc4f9a3
@charly authored
View
29 app/assets/stylesheets/jail/application.css
@@ -12,7 +12,9 @@
*= require_tree .
*/
-body, div { margin: 0; padding:0;}
+body, div {
+ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+ margin: 0; padding:0;}
#header, #page, #footer {
@@ -25,28 +27,41 @@ body, div { margin: 0; padding:0;}
background-color: #444}
#header a {
+ text-decoration: none;
color: #EEE;}
+fieldset {
+ color: #444;
+ background-color: #CCC}
+
+legend {
+ padding: 3px 9px;
+ color: #CCC;
+ background-color: #444;
+ border: thin solid #222;
+}
+
+.smaller {
+ font-size: .7em;}
+
.notice {
text-align: center;
background-color: #BCED91;
border: thin solid #629632;
color:; #629632;
- padding: 18px;
-}
+ padding: 18px;}
ul.jaillinks {
width: 400px;
- list-style: none;
-}
+ list-style: none;}
ul.jaillinks li a {
color: #777;
display: block;
text-decoration: none;
padding: 6px;
- border-bottom: thin dashed #DDD;
-}
+ border-bottom: thin dashed #DDD;}
+
ul.jaillinks li a:hover {
background-color: #DDD}
View
20 app/controllers/jail/cdnjs_controller.rb
@@ -0,0 +1,20 @@
+require_dependency "jail/application_controller"
+
+module Jail
+ class CdnjsController < ApplicationController
+ def index
+ @cdnjs = Cdnjs.libs.map(&:name)
+ end
+
+ def show
+ @cdnjs = Cdnjs.find(params[:name])
+ end
+
+ def install
+ @cdnjs = Cdnjs.find(params[:name])
+ @cdnjs.install(params["files"])
+
+ redirect_to( "/jail/cdnjs/#{params[:name]}", :notice => "Installed!" )
+ end
+ end
+end
View
6 app/views/jail/cdnjs/_files.html.erb
@@ -0,0 +1,6 @@
+<%- @cdnjs.mapped_files.each do |ext, n_files| %>
+ <p><%= ext %></p>
+ <%- n_files.each do |file| %>
+ <br><%= file %>
+ <% end %>
+<% end %>
View
11 app/views/jail/cdnjs/index.html.erb
@@ -0,0 +1,11 @@
+<%#=debug @cdnjs %>
+
+<h1>
+ <%= link_to "CDNJS", "https://github.com/cdnjs/cdnjs" %> List of Javascripts Libraries
+</h1>
+
+<ul class='jaillinks'>
+ <%- @cdnjs.each do |name| %>
+ <li><%= link_to name, "/jail/cdnjs/#{name}" %></li>
+ <% end %>
+</ul>
View
26 app/views/jail/cdnjs/show.html.erb
@@ -0,0 +1,26 @@
+<%- if flash[:notice] %>
+ <div class='notice'>
+ <%= flash[:notice] %>
+ </div>
+<% end %>
+
+<h1><%= @cdnjs.name %></h1>
+<p><%= @cdnjs.description %></p>
+
+<%= form_tag "/jail/cdnjs/#{@cdnjs.name}" do %>
+ <fieldset>
+ <legend>Files To Install (uncheck unnecesseray)</legend>
+ <%- @cdnjs.files.map(&:name).each do |name| %>
+ <p>
+ <%= label_tag name %>
+ <%= check_box('files', name, {:checked => true}, checked_value="1", unchecked_value="0") %>
+ </p>
+ <% end %>
+ <%= submit_tag "Install" %>
+ </fieldset>
+<% end %>
+
+<p>homepage: <%= link_to @cdnjs.homepage, @cdnjs.homepage %></p>
+<%- @cdnjs.repositories.map(&:url).each do |url| %>
+ <p>repository : <%= link_to url, url %></p>
+<% end %>
View
12 app/views/layouts/jail/application.html.erb
@@ -8,8 +8,16 @@
</head>
<body>
<div id="header">
- <h1><%=link_to "Jail", root_path %></h1>
- Puts your assets in rails
+ <h1>
+ <%=link_to "Jail", root_path %>
+ <span class='smaller'> - Puts your Js in Rails</span>
+ </h1>
+ <div style="text-align: center;">
+ <%= link_to "Jail's list", "/jail/" %>
+ |
+ <%= link_to "Cdnjs's List", "/jail/cdnjs" %>
+ </div>
+
</div>
<div id="page">
View
10 config/routes.rb
@@ -1,10 +1,20 @@
Jail::Engine.routes.draw do
root :to => "githubs#index"
+ match "/cdnjs" => "cdnjs#index"
+ with_options(:name => /[^\/]+/ ) do |opt|
+ opt.match "/cdnjs/:name" => "cdnjs#show", :via => :get
+ opt.match "/cdnjs/:name" => "cdnjs#install", :via => :post
+ #opt.match "/cdnjs/:name/remove" => "cdnjs#remove"
+ #opt.match "/cdnjs/:name/*path" => "cdnjs#show"
+ end
+
with_options(:repo => /[^\/]+/ ) do |opt|
opt.match ":name/:repo" => "githubs#show"
opt.match ":name/:repo/install" => "githubs#install"
opt.match ":name/:repo/remove" => "githubs#remove"
opt.match ":name/:repo/*path" => "githubs#show"
end
+
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.