milk-it-databrowser 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +22 -0
- data/Rakefile +22 -0
- data/install.rb +3 -0
- data/lib/data_browser.rb +6 -0
- data/lib/data_browser/data_browser.rb +49 -0
- data/lib/data_browser/data_browser_controller.rb +79 -0
- data/lib/data_browser/helpers.rb +36 -0
- data/lib/data_browser/routing.rb +26 -0
- data/lib/data_browser/views/data_browser/data_browser/_form.html.erb +25 -0
- data/lib/data_browser/views/data_browser/data_browser/_obj.rhtml +7 -0
- data/lib/data_browser/views/data_browser/data_browser/about.html.erb +7 -0
- data/lib/data_browser/views/data_browser/data_browser/browse.html.erb +31 -0
- data/lib/data_browser/views/data_browser/data_browser/browse.js.rjs +1 -0
- data/lib/data_browser/views/data_browser/data_browser/edit.html.erb +6 -0
- data/lib/data_browser/views/data_browser/data_browser/index.html.erb +8 -0
- data/lib/data_browser/views/data_browser/data_browser/new.html.erb +6 -0
- data/lib/data_browser/views/layouts/data_browser.html.erb +237 -0
- data/test/databrowser_test.rb +7 -0
- data/uninstall.rb +3 -0
- metadata +86 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Carlos Henrique Palhares Moreira
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= DataBrowser
|
2
|
+
|
3
|
+
To start using Rails DataBrowser, put `map.databrowser` in the your routes.rb file.
|
4
|
+
Please, don't forget to require 'data_browser' att he begining of your routes.rb
|
5
|
+
|
6
|
+
== Example
|
7
|
+
|
8
|
+
require 'data_browser'
|
9
|
+
ActionController::Routing::Routes.draw do |map|
|
10
|
+
# your routes
|
11
|
+
map.databrowser
|
12
|
+
end
|
13
|
+
|
14
|
+
or use:
|
15
|
+
|
16
|
+
map.databrowser if RAILS_ENV.eql?("development")
|
17
|
+
|
18
|
+
for development mode only.
|
19
|
+
|
20
|
+
See http://trac.milk-it.net/open/wiki/DataBrowser for further information.
|
21
|
+
|
22
|
+
Copyright (c) 2008 Milk-it Software House, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the databrowser plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.pattern = 'test/**/*_test.rb'
|
12
|
+
t.verbose = true
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Generate documentation for the databrowser plugin.'
|
16
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'Databrowser'
|
19
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
20
|
+
rdoc.rdoc_files.include('README')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
data/install.rb
ADDED
data/lib/data_browser.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
require 'data_browser/data_browser'
|
2
|
+
require 'data_browser/data_browser_controller'
|
3
|
+
require 'data_browser/routing'
|
4
|
+
|
5
|
+
::ActionController::Routing::RouteSet::Mapper.send(:include, DataBrowser::Routing)
|
6
|
+
DataBrowser::DataBrowserController.prepend_view_path(File.join(File.dirname(File.expand_path(__FILE__)), "data_browser", "views"))
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# DataBrowser
|
2
|
+
require 'digest/sha1'
|
3
|
+
|
4
|
+
module DataBrowser
|
5
|
+
@@user_digest = nil
|
6
|
+
@@models = []
|
7
|
+
@@tables = []
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def should_auth
|
11
|
+
@@user_digest
|
12
|
+
end
|
13
|
+
|
14
|
+
def digest(user, pass)
|
15
|
+
Digest::SHA1.hexdigest(user.to_s + pass.to_s)
|
16
|
+
end
|
17
|
+
|
18
|
+
def protect(user, pass)
|
19
|
+
@@user_digest = digest(user, pass)
|
20
|
+
end
|
21
|
+
|
22
|
+
def auth(user, pass)
|
23
|
+
return @@user_digest if digest(user, pass) == @@user_digest
|
24
|
+
false
|
25
|
+
end
|
26
|
+
|
27
|
+
def check_digest(digest)
|
28
|
+
@@user_digest == digest
|
29
|
+
end
|
30
|
+
|
31
|
+
# models configuration
|
32
|
+
|
33
|
+
def models
|
34
|
+
@@models
|
35
|
+
end
|
36
|
+
|
37
|
+
def models=(models)
|
38
|
+
@@models = models if models.is_a?(Array)
|
39
|
+
end
|
40
|
+
|
41
|
+
def tables
|
42
|
+
@@tables
|
43
|
+
end
|
44
|
+
|
45
|
+
def tables=(tables)
|
46
|
+
@@tables = tables if tables.is_a?(Array)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module DataBrowser
|
2
|
+
class DataBrowserController < ::ActionController::Base
|
3
|
+
layout "data_browser"
|
4
|
+
protect_from_forgery :secret => Time.now.to_i.to_s
|
5
|
+
before_filter :load_models, :authenticate
|
6
|
+
|
7
|
+
include DataBrowser::Helpers
|
8
|
+
|
9
|
+
# all the work here is being done by :load_models
|
10
|
+
def index; end
|
11
|
+
def new; end
|
12
|
+
def edit; end
|
13
|
+
|
14
|
+
def browse
|
15
|
+
params[:select] ||= current_model.column_names
|
16
|
+
@objects = current_model.find(:all,
|
17
|
+
:conditions => params[:conditions],
|
18
|
+
:select => params[:select] ? params[:select].join(", ") : nil
|
19
|
+
)
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
format.html
|
23
|
+
format.js
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def empty
|
28
|
+
current_model.delete_all
|
29
|
+
flash[:notice] = "#{current_model.table_name} model was emptied"
|
30
|
+
redirect_to data_browser_home_url()
|
31
|
+
end
|
32
|
+
|
33
|
+
def destroy
|
34
|
+
current_object.delete_all(current_object.attributes)
|
35
|
+
flash[:notice] = "#{current_model.table_name} #{@obj.to_param} successfuly deleted!"
|
36
|
+
redirect_to data_browser_model_url(:model => current_model_id)
|
37
|
+
end
|
38
|
+
|
39
|
+
def update
|
40
|
+
current_model.update_all(data_from_params, current_object.attributes)
|
41
|
+
flash[:notice] = "#{current_model.table_name} #{@obj.to_param} successfuly saved!"
|
42
|
+
redirect_to data_browser_model_url(:model => current_model_id)
|
43
|
+
end
|
44
|
+
|
45
|
+
def create
|
46
|
+
current_model.create(data_from_params)
|
47
|
+
flash[:notice] = "#{current_model.table_name} #{current_object.to_param || "record"} successfuly saved!"
|
48
|
+
redirect_to data_browser_model_url(:model => current_model_id)
|
49
|
+
end
|
50
|
+
|
51
|
+
protected
|
52
|
+
|
53
|
+
def load_models
|
54
|
+
if DataBrowser.models.size == 0
|
55
|
+
(DataBrowser.tables.empty?? ActiveRecord::Base.connection.tables : DataBrowser.tables).each do |table|
|
56
|
+
model_name = "DataBrowser::#{table.classify}"
|
57
|
+
eval("#{model_name} = Class.new(ActiveRecord::Base); DataBrowser.models.push(#{model_name})")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
@models = DataBrowser.models
|
62
|
+
end
|
63
|
+
|
64
|
+
def authenticate
|
65
|
+
if DataBrowser::should_auth && !DataBrowser::check_digest(session[:databrowser])
|
66
|
+
authenticate_or_request_with_http_basic("DataBrowser") do |user, pass|
|
67
|
+
session[:databrowser] = DataBrowser::auth(user, pass)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def data_from_params
|
75
|
+
pos = ActionController::RecordIdentifier.singular_class_name(current_model)
|
76
|
+
current_model.new(params[pos]).attributes # Hum... well, you know..
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module DataBrowser
|
2
|
+
module Helpers
|
3
|
+
def self.included(base)
|
4
|
+
base.send :helper_method, :current_model, :current_object, :current_model_id, :object_params
|
5
|
+
end
|
6
|
+
|
7
|
+
def current_model
|
8
|
+
@model ||= DataBrowser.models[current_model_id] if current_model_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def current_object
|
12
|
+
@obj ||= if params[:id] && !params[:id].eql?("x")
|
13
|
+
current_model.find(params[:id])
|
14
|
+
elsif params[:object]
|
15
|
+
current_model.first :conditions => params[:object]
|
16
|
+
else
|
17
|
+
current_model.new
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def current_model_id
|
22
|
+
params[:model].to_i if params[:model]
|
23
|
+
end
|
24
|
+
|
25
|
+
def object_params(object)
|
26
|
+
params = {:model => current_model_id}
|
27
|
+
if object.to_param
|
28
|
+
params[:id] = object.to_param
|
29
|
+
else
|
30
|
+
params[:id] = "x"
|
31
|
+
params[:object] = object.attributes
|
32
|
+
end
|
33
|
+
params
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module DataBrowser
|
2
|
+
module Routing
|
3
|
+
def databrowser(root="databrowser")
|
4
|
+
with_options :controller => "data_browser/data_browser" do |db|
|
5
|
+
# Databrowser pages
|
6
|
+
db.data_browser_home "/#{root}", :action => "index"
|
7
|
+
db.data_browser_about "/#{root}/about", :action => "about"
|
8
|
+
# Model manipulation
|
9
|
+
db.with_options :model => /\d+/ do |model|
|
10
|
+
model.data_browser_model "/#{root}/:model", :action => "browse", :conditions => {:method => :get}
|
11
|
+
model.data_browser_new "/#{root}/:model/new", :action => "new", :conditions => {:method => :get}
|
12
|
+
|
13
|
+
model.connect "/#{root}/:model", :action => "empty", :conditions => {:method => :delete}
|
14
|
+
model.connect "/#{root}/:model", :action => "create", :conditions => {:method => :post}
|
15
|
+
|
16
|
+
# Object manipulation
|
17
|
+
model.data_browser_object "/#{root}/:model/:id/", :action => "show", :conditions => {:method => :get}
|
18
|
+
model.data_browser_edit "/#{root}/:model/:id/edit", :action => "edit", :conditions => {:method => :get}
|
19
|
+
|
20
|
+
model.connect "/#{root}/:model/:id", :action => "update", :conditions => {:method => :put}
|
21
|
+
model.connect "/#{root}/:model/:id", :action => "destroy", :conditions => {:method => :delete}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<ul>
|
2
|
+
<%
|
3
|
+
current_model.columns_hash.each do |name, column|
|
4
|
+
next if name.eql?("id")
|
5
|
+
%>
|
6
|
+
<li>
|
7
|
+
<label><%= column.human_name %></label>
|
8
|
+
<div>
|
9
|
+
<%= case column.type
|
10
|
+
when :date
|
11
|
+
form.date_select(name)
|
12
|
+
when :datetime
|
13
|
+
form.datetime_select(name)
|
14
|
+
when :text
|
15
|
+
form.text_area(name)
|
16
|
+
when :boolean
|
17
|
+
form.check_box(name)
|
18
|
+
else
|
19
|
+
form.text_field(name)
|
20
|
+
end
|
21
|
+
%>
|
22
|
+
</div>
|
23
|
+
</li>
|
24
|
+
<% end %>
|
25
|
+
</ul>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<tr class="<%= cycle("odd", "") %>">
|
2
|
+
<td><%= link_to("Edit", data_browser_edit_path(object_params(obj))) %></td>
|
3
|
+
<td><%= link_to("Delete", data_browser_object_path(object_params(obj)), :method => :delete, :confirm => "Are you sure?") %></td>
|
4
|
+
<% for column in params[:select] %>
|
5
|
+
<td><%= obj.attributes[column] %></td>
|
6
|
+
<% end %>
|
7
|
+
</tr>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<h2>About Rails DataBrowser</h2>
|
2
|
+
|
3
|
+
<p>Rails DataBrowser is a data browser based on the idea of <a href="http://www.djangoproject.com/documentation/databrowse/">Django's Databrowser</a>.</p>
|
4
|
+
<p>Using Rails DataBrowser you can browse, view, edit, crate and delete data through your model classes. It's not a replacement to your DBMS or to your CMS, it's just a helper for developers and WebMasters to manage data without.</p>
|
5
|
+
<p>If you find a bug, please report it <a href="http://redmine.milk-it.net/projects/databrowser/issues/new">here</a></p>
|
6
|
+
<p />
|
7
|
+
<p>Rails DataBrowser plugin is sponsored by <a href="http://milk-it.net">Milk-it Software House</a> and maintained by <%= mail_to "carlos@milk-it.net", "Carlos Júnior", :encode => "hex", :replace_at => " at ", :replace_dot => "dot" %>.</p>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<% form_tag(data_browser_model_path(:model => current_model_id), {:id => "search_form"}) do %>
|
2
|
+
<div id="search-box" style="display:none">
|
3
|
+
<p>
|
4
|
+
<label>Select</label><br />
|
5
|
+
<% for column in current_model.column_names %>
|
6
|
+
<label><%= check_box_tag("select[]", column, params[:select].include?(column)) %><%= column %></label>
|
7
|
+
<% end %>
|
8
|
+
</p>
|
9
|
+
<p>
|
10
|
+
<label for="conditions">Conditions:</label><br />
|
11
|
+
<%= text_area_tag("conditions", params[:conditions], :style => "width:100%", :rows => "4") %>
|
12
|
+
</p>
|
13
|
+
<input type="submit" value="Buscar" />
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
<a href="javascript:showSearchBox()" id="show-search">Search</a>
|
17
|
+
<br />
|
18
|
+
<table id="data-table">
|
19
|
+
<thead>
|
20
|
+
<th colspan="2"></th>
|
21
|
+
<% for column in params[:select] %>
|
22
|
+
<th><%= column %></th>
|
23
|
+
<% end %>
|
24
|
+
</thead>
|
25
|
+
<tbody sid="objects_body">
|
26
|
+
<%= render :partial => "obj", :collection => @objects %>
|
27
|
+
<% if @objects.size == 0 %>
|
28
|
+
<td class="empty" colspan="<%=params[:select].size + 2%>">Empty model</td>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
@@ -0,0 +1 @@
|
|
1
|
+
page[:objects_body].innerHTML = render(:partial => "obj", :collection => @objects)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<% form_for(current_object, :url => data_browser_object_path(object_params(current_object)), :method => :put) do |f| %>
|
2
|
+
<%= render :partial => "form", :object => f %>
|
3
|
+
<div class="button">
|
4
|
+
<%= submit_tag("Save") %> or <%= link_to("cancel", :action => "browse", :model => @model.to_s) %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<ul>
|
2
|
+
<% @models.each_with_index do |model, i| %>
|
3
|
+
<li>
|
4
|
+
<%= link_to(model.table_name, data_browser_model_path(:model => i)) %> (<%= model.count %> records)
|
5
|
+
<%= link_to("empty", data_browser_model_path(:model => i), :confirm => "Are you sure?", :method => :delete) %>
|
6
|
+
</li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<% form_for(current_object, :url => data_browser_model_path(:model => current_model_id), :method => :post) do |f| %>
|
2
|
+
<%= render :partial => "form", :object => f %>
|
3
|
+
<div class="button">
|
4
|
+
<%= submit_tag("Create") %> or <%= link_to("cancel", :action => "browse", :model => @model.to_s) %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
@@ -0,0 +1,237 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title>Rails DataBrowser</title>
|
6
|
+
<style type="text/css">
|
7
|
+
/* --------------------------------------------------------------
|
8
|
+
|
9
|
+
reset.css
|
10
|
+
* Resets default browser CSS.
|
11
|
+
|
12
|
+
Based on work by Eric Meyer:
|
13
|
+
* meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
|
14
|
+
|
15
|
+
- Part of Blueprint CSS Framework
|
16
|
+
|
17
|
+
-------------------------------------------------------------- */
|
18
|
+
|
19
|
+
html, body, div, span, object, iframe,
|
20
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
21
|
+
a, abbr, acronym, address, code,
|
22
|
+
del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
|
23
|
+
fieldset, form, label, legend,
|
24
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
25
|
+
margin: 0;
|
26
|
+
padding: 0;
|
27
|
+
border: 0;
|
28
|
+
font-weight: inherit;
|
29
|
+
font-style: inherit;
|
30
|
+
font-size: 100%;
|
31
|
+
font-family: inherit;
|
32
|
+
vertical-align: baseline;
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
body { line-height: 1.5; background: #fff; margin:1.5em 0; }
|
37
|
+
|
38
|
+
/* Tables still need 'cellspacing="0"' in the markup. */
|
39
|
+
table { border-collapse: separate; border-spacing: 0; }
|
40
|
+
caption, th, td { text-align: left; font-weight:400; }
|
41
|
+
|
42
|
+
/* Remove possible quote marks (") from <q>, <blockquote>. */
|
43
|
+
blockquote:before, blockquote:after, q:before, q:after { content: ""; }
|
44
|
+
blockquote, q { quotes: "" ""; }
|
45
|
+
|
46
|
+
a img { border: none; }
|
47
|
+
|
48
|
+
/* ====== Databrowser ====== */
|
49
|
+
|
50
|
+
body {font-family:Arial, Helvetica, sans-serif; font-size:80%; padding:1%; margin:0; border-top:2px solid #e6646c; }
|
51
|
+
|
52
|
+
a:link, a:visited { color:#09C; text-decoration:underline; }
|
53
|
+
a:hover { text-decoration: none; color: #007EA8; }
|
54
|
+
a:active { color:orange; }
|
55
|
+
|
56
|
+
h1 {
|
57
|
+
font-family:Georgia, "Times New Roman", Times, serif;
|
58
|
+
color:#B6343C;
|
59
|
+
font-size:150%;
|
60
|
+
text-align:right;
|
61
|
+
}
|
62
|
+
|
63
|
+
h1 a b { color:#E6646C; }
|
64
|
+
|
65
|
+
h1 a {color:#B6343C !important; text-decoration:none !important;}
|
66
|
+
h1 a:hover { color: #8B272D }
|
67
|
+
|
68
|
+
h2 {
|
69
|
+
font-family:Georgia, "Times New Roman", Times, serif;
|
70
|
+
font-size:140%;
|
71
|
+
color:#444;
|
72
|
+
}
|
73
|
+
|
74
|
+
h3 {
|
75
|
+
font-size:100%;
|
76
|
+
color:#666;
|
77
|
+
}
|
78
|
+
|
79
|
+
table {
|
80
|
+
width:100%;
|
81
|
+
margin:1% auto;
|
82
|
+
font-size:90%;
|
83
|
+
border-collapse:collapse;
|
84
|
+
}
|
85
|
+
|
86
|
+
table th, table td {
|
87
|
+
padding:1px 0 1px 3px;
|
88
|
+
}
|
89
|
+
|
90
|
+
table th {
|
91
|
+
background-color:#EEF8FB;
|
92
|
+
color:#B6343C;
|
93
|
+
border:1px solid #DEF1F8;
|
94
|
+
border-width:1px 0 1px 1px;
|
95
|
+
font-weight:bold;
|
96
|
+
padding:1px 4px 1px 4px;
|
97
|
+
}
|
98
|
+
|
99
|
+
table td {
|
100
|
+
border-bottom:1px dotted #E5E5E5;
|
101
|
+
}
|
102
|
+
|
103
|
+
table td.empty {text-align:center}
|
104
|
+
|
105
|
+
table tr.odd td {
|
106
|
+
background-color:#F9F9FF;
|
107
|
+
}
|
108
|
+
|
109
|
+
div#content ul {
|
110
|
+
list-style:circle inside;
|
111
|
+
font-size:80%;
|
112
|
+
color:#999;
|
113
|
+
}
|
114
|
+
|
115
|
+
div#content {
|
116
|
+
padding-left:13%;
|
117
|
+
}
|
118
|
+
|
119
|
+
div#content ul a {
|
120
|
+
font-size:125%;
|
121
|
+
}
|
122
|
+
|
123
|
+
ul#models {
|
124
|
+
float:left;
|
125
|
+
border:1px solid #ddd;
|
126
|
+
-moz-border-radius:6px;
|
127
|
+
padding:1%;
|
128
|
+
margin-right:15px;
|
129
|
+
list-style:circle inside;
|
130
|
+
line-height: 1.6;
|
131
|
+
background:#fff;
|
132
|
+
width:10%;
|
133
|
+
}
|
134
|
+
|
135
|
+
li {
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
/* Forms */
|
140
|
+
|
141
|
+
input, textarea, select {
|
142
|
+
color:#333;
|
143
|
+
border:1px solid #BBB;
|
144
|
+
}
|
145
|
+
|
146
|
+
select { padding:0 0 0 1px;}
|
147
|
+
|
148
|
+
form ul {
|
149
|
+
list-style:none;
|
150
|
+
margin:6px 0 10px 0;
|
151
|
+
clear:none;
|
152
|
+
float:left;
|
153
|
+
list-style:none !important;
|
154
|
+
text-align:left;
|
155
|
+
}
|
156
|
+
|
157
|
+
form li {
|
158
|
+
clear:both;
|
159
|
+
float:left;
|
160
|
+
padding: 5px 0 5px 0;
|
161
|
+
width:100%;
|
162
|
+
background:none;
|
163
|
+
line-height:normal;
|
164
|
+
margin:0;
|
165
|
+
}
|
166
|
+
|
167
|
+
form li div li {float:none;border:none;}
|
168
|
+
form li div ul {float:none;margin:none;border:0;}
|
169
|
+
form label {
|
170
|
+
float:left;
|
171
|
+
display:block;
|
172
|
+
width:190px;
|
173
|
+
}
|
174
|
+
|
175
|
+
form label.inline {
|
176
|
+
display:inline !important;
|
177
|
+
float:none !important;
|
178
|
+
margin-top:-2px;
|
179
|
+
width:auto;
|
180
|
+
}
|
181
|
+
|
182
|
+
form li div {
|
183
|
+
margin-left:10px;
|
184
|
+
float:left;
|
185
|
+
}
|
186
|
+
|
187
|
+
form li div div { margin-left:0 !important; float:none !important; }
|
188
|
+
|
189
|
+
div.button {margin-top:6px; padding-left:200px;clear:both}
|
190
|
+
div.button input { color:#069; font-weight:bold; background: #F9F0C4; border:2px solid #F6E69F; padding-left:10px; padding-right:10px; }
|
191
|
+
div.button input.imagem { background:none !important; border:0 !important;}
|
192
|
+
|
193
|
+
div#footer {border-top:1px solid;
|
194
|
+
clear:both;
|
195
|
+
color:#BBBBBB;
|
196
|
+
font-size:10px;
|
197
|
+
height:31px;
|
198
|
+
padding:0.25em 0pt;}
|
199
|
+
div#footer p.left {float:left;}
|
200
|
+
div#footer p.right {float:right;text-align:right;}
|
201
|
+
p {margin:4px 0 0 0}
|
202
|
+
</style>
|
203
|
+
<script>
|
204
|
+
function showSearchBox()
|
205
|
+
{
|
206
|
+
document.getElementById("search-box").style.display = "block";
|
207
|
+
document.getElementById("show-search").style.display = "none";
|
208
|
+
}
|
209
|
+
</script>
|
210
|
+
</head>
|
211
|
+
<body id="home">
|
212
|
+
<h1><%= link_to("<b>Rails</b>DataBrowser", data_browser_home_path()) %></h1>
|
213
|
+
<ul id="models">
|
214
|
+
<% @models.each_with_index do |model, i| %>
|
215
|
+
<li><%= link_to(model.table_name, data_browser_model_path(:model => i)) %></li>
|
216
|
+
<% end %>
|
217
|
+
</ul>
|
218
|
+
<div id="content">
|
219
|
+
<% if current_model %>
|
220
|
+
<h2><%= current_model.table_name %> <%= link_to("new", data_browser_new_path(:model => current_model_id)) %></h2>
|
221
|
+
<% end %>
|
222
|
+
<%= content_tag(:h3, flash[:notice], :class => "notice") if flash[:notice] %>
|
223
|
+
<%= yield %>
|
224
|
+
</div>
|
225
|
+
<div style="clear:both"> </div>
|
226
|
+
<div id="footer">
|
227
|
+
<p class="left">
|
228
|
+
Powered by <%= link_to("DataBrowser", data_browser_about_path()) %><br />
|
229
|
+
by <a href="http://milk-it.net">Milk-it</a>
|
230
|
+
</p>
|
231
|
+
<p class="right">
|
232
|
+
Visit Rails DataBrowser Official WebSite.<br />
|
233
|
+
<a href="http://redmine.milk-it.net/projects/show/databrowser">redmine.milk-it.net/projects</a>
|
234
|
+
</p>
|
235
|
+
</div>
|
236
|
+
</body>
|
237
|
+
</html>
|
data/uninstall.rb
ADDED
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: milk-it-databrowser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Carlos Junior
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-08-06 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "2.0"
|
23
|
+
version:
|
24
|
+
description: Rails DataBrowser helps you in development providing an easy to use interface to access your database. This can be also used in production mode, as an interface to your data.
|
25
|
+
email:
|
26
|
+
- carlos@milk-it.net
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.rdoc
|
33
|
+
- MIT-LICENSE
|
34
|
+
files:
|
35
|
+
- README
|
36
|
+
- Rakefile
|
37
|
+
- MIT-LICENSE
|
38
|
+
- install.rb
|
39
|
+
- uninstall.rb
|
40
|
+
- lib/data_browser.rb
|
41
|
+
- lib/data_browser/data_browser.rb
|
42
|
+
- lib/data_browser/data_browser_controller.rb
|
43
|
+
- lib/data_browser/routing.rb
|
44
|
+
- lib/data_browser/helpers.rb
|
45
|
+
- lib/data_browser/views/data_browser/data_browser/about.html.erb
|
46
|
+
- lib/data_browser/views/data_browser/data_browser/browse.html.erb
|
47
|
+
- lib/data_browser/views/data_browser/data_browser/browse.js.rjs
|
48
|
+
- lib/data_browser/views/data_browser/data_browser/edit.html.erb
|
49
|
+
- lib/data_browser/views/data_browser/data_browser/_form.html.erb
|
50
|
+
- lib/data_browser/views/data_browser/data_browser/index.html.erb
|
51
|
+
- lib/data_browser/views/data_browser/data_browser/new.html.erb
|
52
|
+
- lib/data_browser/views/data_browser/data_browser/_obj.rhtml
|
53
|
+
- lib/data_browser/views/layouts/data_browser.html.erb
|
54
|
+
- README.rdoc
|
55
|
+
has_rdoc: false
|
56
|
+
homepage: http://redmine.milk-it.net/projects
|
57
|
+
post_install_message: |
|
58
|
+
|
59
|
+
Access http://redmine.milk-it.net/projects to learn how to use DataBrowser.
|
60
|
+
It's simple as add 2 lines in your routes.rb!
|
61
|
+
|
62
|
+
rdoc_options: []
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: "0"
|
71
|
+
version:
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: "0"
|
77
|
+
version:
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: databrowser
|
81
|
+
rubygems_version: 1.2.0
|
82
|
+
signing_key:
|
83
|
+
specification_version: 2
|
84
|
+
summary: Rails DataBrowser helps you in development providing an easy to use interface to access your database. This can be also used in production mode, as an interface to your data.
|
85
|
+
test_files:
|
86
|
+
- test/databrowser_test.rb
|