[kune-commits] r1007 - in trunk/src/main/rails/publicspace:
app/controllers app/models app/views/kunedbg
app/views/layouts db/migrate test/fixtures test/unit
dani matas
danigb at ourproject.org
Sun Dec 21 03:35:41 CET 2008
Author: danigb
Date: 2008-12-21 03:35:36 +0100 (Sun, 21 Dec 2008)
New Revision: 1007
Added:
trunk/src/main/rails/publicspace/app/models/kuser.rb
trunk/src/main/rails/publicspace/db/migrate/20081221023151_create_kusers.rb
trunk/src/main/rails/publicspace/test/fixtures/kusers.yml
trunk/src/main/rails/publicspace/test/unit/kuser_test.rb
Modified:
trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb
trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb
trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb
Log:
simple rails debug controller implemented.
Modified: trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb 2008-12-20 22:31:01 UTC (rev 1006)
+++ trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb 2008-12-21 02:35:36 UTC (rev 1007)
@@ -1,11 +1,20 @@
class KunedbgController < ApplicationController
layout 'kunedbg'
-
+
+ helper_method :model_types
+
+ MODELS = {:groups => Group, :content => Content, :revisions => Revision, :users => Kuser }
+
def index
- render :text => 'hola', :layout => true
+ render :text => '', :layout => true
end
+ def model_types
+ MODELS.keys
+ end
+
def list
- @models = Group.find :all
+ @mclass = MODELS[params[:model].to_sym]
+ @models = @mclass.find :all
end
end
Added: trunk/src/main/rails/publicspace/app/models/kuser.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/models/kuser.rb 2008-12-20 22:31:01 UTC (rev 1006)
+++ trunk/src/main/rails/publicspace/app/models/kuser.rb 2008-12-21 02:35:36 UTC (rev 1007)
@@ -0,0 +1,2 @@
+class Kuser < ActiveRecord::Base
+end
Modified: trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb
===================================================================
--- trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb 2008-12-20 22:31:01 UTC (rev 1006)
+++ trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb 2008-12-21 02:35:36 UTC (rev 1007)
@@ -1,10 +1,17 @@
+
<table>
- <thead>
-
- </thead>
+ <thead><tr>
+ <% for name in @mclass.column_names -%>
+ <td><%= name %></td>
+ <% end -%>
+ </tr></thead>
<tbody>
<% for model in @models %>
+ <tr class="<%= cycle('even', 'odd') %> "><% for name in @mclass.column_names -%>
+ <td><%= model.send name %></td>
+ <% end -%>
+ </tr>
<% end %>
</tbody>
</table>
\ No newline at end of file
Modified: trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb
===================================================================
--- trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb 2008-12-20 22:31:01 UTC (rev 1006)
+++ trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb 2008-12-21 02:35:36 UTC (rev 1007)
@@ -5,19 +5,31 @@
<link rel="icon" href="images/xy/favicon.ico" type="image/x-icon">
<title>kune debug page</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
- <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css">
+ <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css">
<style type="text/css">
- body {background-color: #efefef;}
h1 {font-size: 150%;}
- .page {width: 60em; margin: 1em auto; background-color: white; border: 1px solid gray;}
-
+ .page {margin: 1em; background-color: white; border: 1px solid gray;}
+ table {margin: 1em 0; }
+ a { color: black; text-decoration: none;}
+ thead tr {font-weight: bold;}
+ tr {border-bottom: 1px solid gray;}
+ tr.even {background-color: #efefef; }
+ td {padding: 0.1em 0.3em;}
+ ul.menu {width: 100%; overflow: hidden; margin: 0.5em 1em;}
+ ul.menu li {display: block; float: left;}
+ ul.menu a {display: block; margin-right: 1em; border: 1px solid #efefef; padding: 0.5em 1em;}
+ ul.menu a:hover {background-color: #efefef;}
</style>
</head>
<body>
<div class="page">
- <ul class="menu"><li><%= link_to 'grupos', :action => 'list', :model => 'Group' %></li></ul>
+ <ul class="menu">
+ <% for mtype in model_types -%>
+ <li><%= link_to mtype, :action => 'list', :model => mtype %></li>
+ <% end -%>
+ </ul>
<div class="content">
- <%= yield %>
+ <%= yield %>
</div>
</div>
</body>
Added: trunk/src/main/rails/publicspace/db/migrate/20081221023151_create_kusers.rb
===================================================================
--- trunk/src/main/rails/publicspace/db/migrate/20081221023151_create_kusers.rb 2008-12-20 22:31:01 UTC (rev 1006)
+++ trunk/src/main/rails/publicspace/db/migrate/20081221023151_create_kusers.rb 2008-12-21 02:35:36 UTC (rev 1007)
@@ -0,0 +1,12 @@
+class CreateKusers < ActiveRecord::Migration
+ def self.up
+ create_table :kusers do |t|
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :kusers
+ end
+end
Added: trunk/src/main/rails/publicspace/test/fixtures/kusers.yml
===================================================================
--- trunk/src/main/rails/publicspace/test/fixtures/kusers.yml 2008-12-20 22:31:01 UTC (rev 1006)
+++ trunk/src/main/rails/publicspace/test/fixtures/kusers.yml 2008-12-21 02:35:36 UTC (rev 1007)
@@ -0,0 +1,7 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+# one:
+# column: value
+#
+# two:
+# column: value
Added: trunk/src/main/rails/publicspace/test/unit/kuser_test.rb
===================================================================
--- trunk/src/main/rails/publicspace/test/unit/kuser_test.rb 2008-12-20 22:31:01 UTC (rev 1006)
+++ trunk/src/main/rails/publicspace/test/unit/kuser_test.rb 2008-12-21 02:35:36 UTC (rev 1007)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class KuserTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
More information about the kune-commits
mailing list