logilogi-svn Mailing List for LogiLogi - Software Libre for the Web (Page 9)
Status: Beta
Brought to you by:
wybow
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
(7) |
Apr
(18) |
May
(59) |
Jun
(73) |
Jul
(31) |
Aug
(19) |
Sep
(18) |
Oct
(31) |
Nov
(9) |
Dec
(15) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(30) |
Feb
(62) |
Mar
(70) |
Apr
(75) |
May
(139) |
Jun
(85) |
Jul
(28) |
Aug
(33) |
Sep
(145) |
Oct
(45) |
Nov
(76) |
Dec
(48) |
| 2009 |
Jan
(12) |
Feb
(39) |
Mar
(5) |
Apr
(6) |
May
(23) |
Jun
(44) |
Jul
(17) |
Aug
(15) |
Sep
(49) |
Oct
(28) |
Nov
(14) |
Dec
(6) |
| 2010 |
Jan
(22) |
Feb
(24) |
Mar
(14) |
Apr
(3) |
May
(2) |
Jun
(30) |
Jul
(9) |
Aug
(9) |
Sep
(10) |
Oct
(1) |
Nov
|
Dec
(1) |
| 2011 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <wy...@us...> - 2009-09-08 20:57:16
|
Revision: 1584
http://logilogi.svn.sourceforge.net/logilogi/?rev=1584&view=rev
Author: wybow
Date: 2009-09-08 20:57:08 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Added missing task
Added Paths:
-----------
projects/loglog/trunk/lib/tasks/mongrel.rake
Added: projects/loglog/trunk/lib/tasks/mongrel.rake
===================================================================
--- projects/loglog/trunk/lib/tasks/mongrel.rake (rev 0)
+++ projects/loglog/trunk/lib/tasks/mongrel.rake 2009-09-08 20:57:08 UTC (rev 1584)
@@ -0,0 +1,21 @@
+namespace :mongrel do
+ desc "Restarts the mongrel cluster"
+ task :restart => :environment do
+ sh "mongrel_rails cluster::stop -C " +
+ File.join(RAILS_ROOT, 'config', 'mongrel_cluster.yml') +
+ " && mongrel_rails cluster::start -C " +
+ File.join(RAILS_ROOT, 'config', 'mongrel_cluster.yml')
+ end
+
+ desc "Starts the mongrel cluster"
+ task :start => :environment do
+ sh "mongrel_rails cluster::start -C " +
+ File.join(RAILS_ROOT, 'config', 'mongrel_cluster.yml')
+ end
+
+ desc "Stops the mongrel cluster"
+ task :stop => :environment do
+ sh "mongrel_rails cluster::stop -C " +
+ File.join(RAILS_ROOT, 'config', 'mongrel_cluster.yml')
+ end
+end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-08 15:46:08
|
Revision: 1583
http://logilogi.svn.sourceforge.net/logilogi/?rev=1583&view=rev
Author: wybow
Date: 2009-09-08 15:46:00 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Removed cache, added do
Modified Paths:
--------------
projects/loglog/trunk/Capfile
projects/loglog/trunk/lib/capistrano/global.rb
Added Paths:
-----------
projects/loglog/trunk/public/do/
Removed Paths:
-------------
projects/loglog/trunk/public/pub/cache/
Modified: projects/loglog/trunk/Capfile
===================================================================
--- projects/loglog/trunk/Capfile 2009-09-08 15:10:19 UTC (rev 1582)
+++ projects/loglog/trunk/Capfile 2009-09-08 15:46:00 UTC (rev 1583)
@@ -2,6 +2,6 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'config/deploy'
-load 'lib/capistrano/logilogi'
+load 'lib/capistrano/loglog'
load 'lib/capistrano/global'
load 'lib/capistrano/deploy'
Modified: projects/loglog/trunk/lib/capistrano/global.rb
===================================================================
--- projects/loglog/trunk/lib/capistrano/global.rb 2009-09-08 15:10:19 UTC (rev 1582)
+++ projects/loglog/trunk/lib/capistrano/global.rb 2009-09-08 15:46:00 UTC (rev 1583)
@@ -5,15 +5,15 @@
namespace :deploy do
desc "Updates the code and restarts"
task :default do
- find_and_execute_task("logilogi:deploy:default_no_webserver_restart")
- find_and_execute_task("logilogi:webserver:restart")
+ find_and_execute_task("loglog:deploy:default_no_webserver_restart")
+ find_and_execute_task("loglog:webserver:restart")
end
desc "Updates, executes migrations / rebuilds the db (only for edge stage) and restarts daemons"
task :full do
default
- find_and_execute_task("logilogi:deploy:full_no_webserver_restart")
- find_and_execute_task("logilogi:webserver:restart")
+ find_and_execute_task("loglog:deploy:full_no_webserver_restart")
+ find_and_execute_task("loglog:webserver:restart")
end
end
@@ -24,8 +24,8 @@
namespace :server do
task :restart do
- find_and_execute_task("logilogi:mongrels:restart")
- find_and_execute_task("logilogi:webserver:restart")
+ find_and_execute_task("loglog:mongrels:restart")
+ find_and_execute_task("loglog:webserver:restart")
end
end
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-08 15:10:27
|
Revision: 1582
http://logilogi.svn.sourceforge.net/logilogi/?rev=1582&view=rev
Author: wybow
Date: 2009-09-08 15:10:19 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Added lua script
Added Paths:
-----------
projects/loglog/trunk/public/cache.lua
Added: projects/loglog/trunk/public/cache.lua
===================================================================
--- projects/loglog/trunk/public/cache.lua (rev 0)
+++ projects/loglog/trunk/public/cache.lua 2009-09-08 15:10:19 UTC (rev 1582)
@@ -0,0 +1,25 @@
+-- Common function, used for setting headers and sending content
+function set_for_send (postfix, header_table)
+ file = lighty.env["physical.doc-root"] .. lighty.env["request.uri"] .. postfix
+ if lighty.stat(file) then
+ for k,v in pairs(header_table) do lighty.header[k] = v end
+ lighty.content = { { filename = file } }
+ return 200
+ else
+ return lighty.RESTART_REQUEST
+ end
+end
+
+-- Look for cached index.html
+if ( lighty.env["request.uri"] == nil or lighty.env["request.uri"] == "/") then
+ return set_for_send("/index.html", {["Content-Type"] = "text/html"})
+-- Llcorners pngs, use inline disposition
+elseif ( string.find(lighty.env["request.uri"], ".*\.png$") ) then
+ return set_for_send("", {["Content-Type"] = "image/png", ["Content-Disposition"] = "inline"})
+-- Atom feeds
+elseif ( string.find(lighty.env["request.uri"], ".*\.atom$") ) then
+ return set_for_send("", {["Content-Type"] = "application/atom+xml"})
+-- Misc html pages
+else
+ return set_for_send(".html", {["Content-Type"] = "text/html"})
+end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-08 15:03:16
|
Revision: 1581
http://logilogi.svn.sourceforge.net/logilogi/?rev=1581&view=rev
Author: wybow
Date: 2009-09-08 15:03:05 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Added test for messages & permission
Modified Paths:
--------------
projects/loglog/trunk/app/controllers/messages_controller.rb
projects/loglog/trunk/db/schema.rb
Added Paths:
-----------
projects/loglog/trunk/app/views/messages/show.erb
projects/loglog/trunk/test/functional/messages_controller_test.rb
Modified: projects/loglog/trunk/app/controllers/messages_controller.rb
===================================================================
--- projects/loglog/trunk/app/controllers/messages_controller.rb 2009-09-08 13:26:16 UTC (rev 1580)
+++ projects/loglog/trunk/app/controllers/messages_controller.rb 2009-09-08 15:03:05 UTC (rev 1581)
@@ -12,29 +12,36 @@
#++#
class MessagesController < ApplicationController
+ ### Filters
+
+ before_filter :find_app
+ before_filter :find, : :show
+
+ ### Filter-functions
+
+ def find
+ @message = Message.find(params[:id])
+ end
+
### REST-methods
def show
- # TODO include channel name
- @message = Message.find(params[:id])
-
respond_to do |format|
format.xml { render :xml => @message }
end
end
def create
- app = App.find_by_name(params[:app_id])
- if current_app == app
+ if current_app == @app
mess = params[:message].dup
ok, last_message = true
if mess[:channel_names]
mess.delete(:channel_names).split(',').each do |channel_name|
- ok = self.save_message(mess, app, channel_name) if ok
+ ok = self.save_message(mess, @app, channel_name) if ok
end
elsif mess[:channel_name]
channel_name = mess.delete(:channel_name)
- ok = self.save_message(mess, app, channel_name)
+ ok = self.save_message(mess, @app, channel_name)
end
if ok
@@ -44,7 +51,8 @@
render :xml => last_message.errors, :status => :unprocessable_entity
end
else
- render :xml => last_message.errors, :status => :unprocessable_entity
+ render :xml => {:error => "You have no permission to do this"},
+ :status => :unprocessable_entity
end
end
Modified: projects/loglog/trunk/db/schema.rb
===================================================================
--- projects/loglog/trunk/db/schema.rb 2009-09-08 13:26:16 UTC (rev 1580)
+++ projects/loglog/trunk/db/schema.rb 2009-09-08 15:03:05 UTC (rev 1581)
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20090712120351) do
+ActiveRecord::Schema.define(:version => 20090713120351) do
create_table "apps", :force => true do |t|
t.string "name", :limit => 20, :null => false
@@ -39,6 +39,16 @@
t.datetime "created_at", :null => false
end
+ create_table "sessions", :force => true do |t|
+ t.string "session_id", :null => false
+ t.text "data"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
+ add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
+
create_table "subscriptions", :force => true do |t|
t.integer "user_id", :null => false
t.integer "channel_id", :null => false
Added: projects/loglog/trunk/test/functional/messages_controller_test.rb
===================================================================
--- projects/loglog/trunk/test/functional/messages_controller_test.rb (rev 0)
+++ projects/loglog/trunk/test/functional/messages_controller_test.rb 2009-09-08 15:03:05 UTC (rev 1581)
@@ -0,0 +1,66 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogiLogi is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+require File.dirname(__FILE__) + '/../test_helper'
+require 'messages_controller'
+
+class MessagesControllerTest < ActionController::TestCase
+ fixtures :all
+
+ def setup
+ @controller = MessagesController.new
+ setup_request
+ end
+
+ ### Actions
+
+ # REST-methods
+
+ def test_show
+ get :show, :app_id => apps(:enll).name,
+ :id => messages(:logi_john_johnson_userjohnjohnson).id,
+ :format => "xml"
+ assert_response :success
+ end
+
+ def test_create
+ enll = apps(:enll)
+ logis = channels(:logis)
+ messages_count = logis.messages.count
+
+ # Not logged in, no message created
+ post :create, :app_id => enll.name, :format => "xml",
+ :message => {
+ :kind => "Logi",
+ :channel_names => logis.name.to_s + ",u_eduard_edison",
+ :title => "This is a logi",
+ :author => "Eduard Edison",
+ :text => "Hi, welcome to this logi",
+ :url => "http://www.yahoo.com"}
+ logis.reload
+ assert_equal messages_count, logis.messages.count
+
+ # Logged in, a message created
+ login(enll)
+ post :create, :app_id => enll.name, :format => "xml",
+ :message => {
+ :kind => "Logi",
+ :channel_names => logis.name.to_s + ",u_eduard_edison",
+ :title => "This is a second logi",
+ :author => "Eduard Edison",
+ :text => "Hi, welcome to another logi",
+ :url => "http://www.yahoo.com"}
+ logis.reload
+ assert_equal messages_count + 1, logis.messages.count
+ end
+end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-08 13:26:25
|
Revision: 1580
http://logilogi.svn.sourceforge.net/logilogi/?rev=1580&view=rev
Author: wybow
Date: 2009-09-08 13:26:16 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Preparing for deployment
Modified Paths:
--------------
projects/loglog/trunk/config/initializers/session_store.rb
projects/loglog/trunk/lib/tasks/db.rake
Added Paths:
-----------
projects/loglog/trunk/Capfile
projects/loglog/trunk/config/deploy.rb
projects/loglog/trunk/config/mongrel_cluster.yml.tmpl
projects/loglog/trunk/config.ru
projects/loglog/trunk/db/backup/
projects/loglog/trunk/db/migrate/20090713120351_create_sessions.rb
projects/loglog/trunk/lib/capistrano/
projects/loglog/trunk/lib/capistrano/deploy.rb
projects/loglog/trunk/lib/capistrano/global.rb
projects/loglog/trunk/lib/capistrano/loglog.rb
projects/loglog/trunk/lib/tasks/pub.rake
projects/loglog/trunk/lib/tasks/server.rake
projects/loglog/trunk/public/pub/
projects/loglog/trunk/public/pub/cache/
Added: projects/loglog/trunk/Capfile
===================================================================
--- projects/loglog/trunk/Capfile (rev 0)
+++ projects/loglog/trunk/Capfile 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,7 @@
+$: << './lib'
+
+load 'deploy' if respond_to?(:namespace) # cap2 differentiator
+load 'config/deploy'
+load 'lib/capistrano/logilogi'
+load 'lib/capistrano/global'
+load 'lib/capistrano/deploy'
Added: projects/loglog/trunk/config/deploy.rb
===================================================================
--- projects/loglog/trunk/config/deploy.rb (rev 0)
+++ projects/loglog/trunk/config/deploy.rb 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,22 @@
+require 'mongrel_cluster/recipes'
+
+set :application, "loglog"
+set :repository, "https://logilogi.svn.sourceforge.net/svnroot/logilogi/projects/loglog/trunk"
+
+# If you aren't deploying to /u/apps/#{application} on the target
+# servers (which is the default), you can specify the actual location
+# via the :deploy_to variable:
+
+set :deploy_to, "/var/www/#{application}"
+
+set :runner, "www-data"
+set :remote_user, "wybo"
+set :keep_releases, 5
+
+# If you aren't using Subversion to manage your source code, specify
+# your SCM below:
+# set :scm, :subversion
+
+role :app, "log.logilogi.org"
+role :web, "log.logilogi.org"
+role :db, "log.logilogi.org", :primary => true
Modified: projects/loglog/trunk/config/initializers/session_store.rb
===================================================================
--- projects/loglog/trunk/config/initializers/session_store.rb 2009-09-08 10:41:32 UTC (rev 1579)
+++ projects/loglog/trunk/config/initializers/session_store.rb 2009-09-08 13:26:16 UTC (rev 1580)
@@ -4,12 +4,13 @@
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
-ActionController::Base.session = {
- :key => '_log_log_session',
- :secret => 'b277dad33b4048e1623a42a3481a3d836546a37ba7f4d4f0318f24fafcab011c3d77cb40be51b149406754c115ad5c64ae5f0954151f4b8065e0539631267930'
-}
+# ActionController::Base.session = {
+# :key => '_log_log_session',
+# :secret => 'b277dad33b4048e1623a42a3481a3d836546a37ba7f4d4f0318f24fafcab011c3d77cb40be51b149406754c115ad5c64ae5f0954151f4b8065e0539631267930'
+# }
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
-# ActionController::Base.session_store = :active_record_store
+
+ActionController::Base.session_store = :active_record_store
Added: projects/loglog/trunk/config/mongrel_cluster.yml.tmpl
===================================================================
--- projects/loglog/trunk/config/mongrel_cluster.yml.tmpl (rev 0)
+++ projects/loglog/trunk/config/mongrel_cluster.yml.tmpl 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,7 @@
+cwd: /var/www/logilogi-edge/current
+log_file: log/mongrel.log
+port: "8000"
+environment: development
+address: 127.0.0.1
+pid_file: tmp/pids/mongrel.pid
+servers: 1
Added: projects/loglog/trunk/config.ru
===================================================================
--- projects/loglog/trunk/config.ru (rev 0)
+++ projects/loglog/trunk/config.ru 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,7 @@
+# Rack Dispatcher
+
+# Require your environment file to bootstrap Rails
+require File.dirname(__FILE__) + '/config/environment'
+
+# Dispatch the request
+run ActionController::Dispatcher.new
Added: projects/loglog/trunk/db/migrate/20090713120351_create_sessions.rb
===================================================================
--- projects/loglog/trunk/db/migrate/20090713120351_create_sessions.rb (rev 0)
+++ projects/loglog/trunk/db/migrate/20090713120351_create_sessions.rb 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,16 @@
+class CreateSessions < ActiveRecord::Migration
+ def self.up
+ create_table :sessions do |t|
+ t.string :session_id, :null => false
+ t.text :data
+ t.timestamps
+ end
+
+ add_index :sessions, :session_id
+ add_index :sessions, :updated_at
+ end
+
+ def self.down
+ drop_table :sessions
+ end
+end
Added: projects/loglog/trunk/lib/capistrano/deploy.rb
===================================================================
--- projects/loglog/trunk/lib/capistrano/deploy.rb (rev 0)
+++ projects/loglog/trunk/lib/capistrano/deploy.rb 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,29 @@
+# Overrided to make non-root
+
+namespace :deploy do
+ task :start, :roles => :app do
+ as = fetch(:runner, "app")
+ via = fetch(:run_method, :sudo)
+ invoke_command "sh -c 'cd #{current_path}; rake mongrel:start'",
+ :via => via, :as => as
+ end
+
+ task :stop, :roles => :app do
+ as = fetch(:runner, "app")
+ via = fetch(:run_method, :sudo)
+ invoke_command "sh -c 'cd #{current_path}; rake mongrel:stop'",
+ :via => via, :as => as
+ end
+
+ task :restart do
+ find_and_execute_task("deploy:stop")
+ find_and_execute_task("deploy:start")
+ end
+
+ # Overrided to allow for chowning before rollback.
+ task :update_code, :except => { :no_release => true } do
+ on_rollback { rollback_code }
+ strategy.deploy!
+ finalize_update
+ end
+end
Added: projects/loglog/trunk/lib/capistrano/global.rb
===================================================================
--- projects/loglog/trunk/lib/capistrano/global.rb (rev 0)
+++ projects/loglog/trunk/lib/capistrano/global.rb 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,31 @@
+namespace :global do
+ ### Tasks
+
+ desc "Updates and restarts for all languages"
+ namespace :deploy do
+ desc "Updates the code and restarts"
+ task :default do
+ find_and_execute_task("logilogi:deploy:default_no_webserver_restart")
+ find_and_execute_task("logilogi:webserver:restart")
+ end
+
+ desc "Updates, executes migrations / rebuilds the db (only for edge stage) and restarts daemons"
+ task :full do
+ default
+ find_and_execute_task("logilogi:deploy:full_no_webserver_restart")
+ find_and_execute_task("logilogi:webserver:restart")
+ end
+ end
+
+ desc "Does a checkout to the remote_checkout_to dir. Mainly internal use"
+ task :remote_checkout do
+ run "cd #{remote_checkout_to}; svn update"
+ end
+
+ namespace :server do
+ task :restart do
+ find_and_execute_task("logilogi:mongrels:restart")
+ find_and_execute_task("logilogi:webserver:restart")
+ end
+ end
+end
Added: projects/loglog/trunk/lib/capistrano/loglog.rb
===================================================================
--- projects/loglog/trunk/lib/capistrano/loglog.rb (rev 0)
+++ projects/loglog/trunk/lib/capistrano/loglog.rb 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,186 @@
+namespace :loglog do
+ ### Filters
+
+ after "deploy:setup", "loglog:setup_chown_base",
+ "loglog:setup_extra_shared", "loglog:setup_chown_to_www_data"
+ after "deploy:finalize_update", "loglog:update_extra_shared", "loglog:update_chown_to_www_data"
+ before "deploy:rollback_code", "loglog:rollback_chowns"
+
+ ### Constants
+
+ # Dirs in addition to log, public/system and pids that are linked to
+ EXTRA_SHARED_DIRS = [
+ "tmp/sockets",
+ "db/backup",
+ "public/pub"
+ ]
+
+ # Created inside shared, access via linked upper dir (or files)
+ NON_LINKED_SHARED_DIRS = [
+ "config",
+ "log/awstats",
+ "public/pub/webstat"
+ ]
+
+ # Copied from something.rb.tmpl to something.rb
+ SHARED_TEMPLATE_FILES = [
+ "config/database.yml",
+ "config/mongrel_cluster.yml"
+ ]
+
+ # Chowned inside shared
+ CHOWN_WWW_DATA_DIRS = [
+ "tmp/sockets",
+ "public/pub/webstat",
+ "log",
+ "pids"
+ ]
+
+ # Chowned inside the release, not linked
+ UPDATE_CHOWN_WWW_DATA = [
+ "public/javascripts",
+ "public/do",
+ "tmp",
+ "db/schema.rb"
+ ]
+
+ ### Tasks
+
+ desc "Updates and restarts the production-server"
+ namespace :deploy do
+ desc "Updates controllers and views and restarts"
+ task :default do
+ find_and_execute_task("loglog:deploy:default_no_webserver_restart")
+ find_and_execute_task("loglog:server:restart")
+ end
+
+ task :default_no_webserver_restart do
+ find_and_execute_task("loglog:deploy:update")
+ find_and_execute_task("loglog:mongrels:restart")
+ end
+
+ desc "Updates, executes migrations and restarts"
+ task :full do
+ find_and_execute_task("loglog:deploy:full_no_webserver_restart")
+ find_and_execute_task("loglog:server:restart")
+ end
+
+ task :full_no_webserver_restart do
+ find_and_execute_task("loglog:deploy:update")
+ find_and_execute_task("loglog:deploy:migrate")
+ find_and_execute_task("loglog:mongrels:restart")
+ end
+
+ desc "Initializes a new install"
+ task :new do
+ find_and_execute_task("deploy:setup")
+ find_and_execute_task("deploy:update")
+ end
+
+ desc "Updates the code, and cleans up, no server or deamons restart"
+ task :update do
+ find_and_execute_task("deploy:update")
+ find_and_execute_task("deploy:cleanup")
+ end
+
+ desc "Migrates the production-database"
+ task :migrate do
+ as = fetch(:runner, "app")
+ via = fetch(:run_method, :sudo)
+ begin
+ invoke_command "sh -c 'cd #{current_path}; rake db:migrate RAILS_ENV=production'",
+ :via => via, :as => as
+ rescue
+ puts $!
+ end
+ end
+ end
+
+ namespace :server do
+ desc "Restarts the webserver and the mongrels"
+ task :restart, :roles => :app do
+ find_and_execute_task("loglog:mongrels:restart")
+ find_and_execute_task("loglog:webserver:restart")
+ end
+ end
+
+ namespace :mongrels do
+ desc "Restarts the server"
+ task :restart, :roles => :app do
+ find_and_execute_task("deploy:restart")
+ end
+ end
+
+ namespace :webserver do
+ desc "Restarts the webserver"
+ task :restart, :roles => :app do
+ via = as = fetch(:run_method, :sudo)
+ invoke_command "/etc/init.d/lighttpd restart",
+ :via => via
+ end
+ end
+
+ namespace :db do
+ task :redo do
+ as = fetch(:runner, "app")
+ via = fetch(:run_method, :sudo)
+ invoke_command "sh -c 'cd #{current_path}; rake db:dev:redo'",
+ :via => via, :as => as
+ invoke_command "sh -c 'cd #{current_path}; rake db:initialize'",
+ :via => via, :as => as
+ end
+ end
+
+ task :rollback_chowns do
+ temp_runner = runner
+ set :runner, remote_user
+ update_chown_to_www_data
+ set :runner, temp_runner
+ end
+
+ ### Functions
+
+ def run_chown_data(dir_file, path = shared_path)
+ runner = fetch(:runner, "app")
+ invoke_command "#{try_sudo} chown -R #{runner}:#{runner} #{path}/#{dir_file}"
+ end
+
+ ### Filter-functions
+
+ task :setup_chown_base do
+ via = fetch(:run_method, :sudo)
+ run "#{try_sudo} chown -R #{remote_user}:#{remote_user} #{deploy_to}"
+ end
+
+ task :setup_extra_shared do
+ (EXTRA_SHARED_DIRS + NON_LINKED_SHARED_DIRS).each do |dir|
+ run "mkdir -p #{shared_path}/#{dir}"
+ end
+ end
+
+ task :setup_chown_to_www_data do
+ CHOWN_WWW_DATA_DIRS.each do |dir|
+ run_chown_data(dir)
+ end
+ end
+
+ task :update_extra_shared do
+ EXTRA_SHARED_DIRS.each do |dir|
+ run <<-CMD
+ rm -rf #{latest_release}/#{dir} &&
+ ln -s #{shared_path}/#{dir} #{latest_release}/#{dir}
+ CMD
+ end
+ SHARED_TEMPLATE_FILES.each do |file|
+ run "if [ ! -e #{shared_path}/#{file} ]; " +
+ "then cp #{latest_release}/#{file}.tmpl #{shared_path}/#{file}; fi"
+ run "ln -s #{shared_path}/#{file} #{latest_release}/#{file}"
+ end
+ end
+
+ task :update_chown_to_www_data do
+ UPDATE_CHOWN_WWW_DATA.each do |dir_file|
+ run_chown_data(dir_file, latest_release)
+ end
+ end
+end
Modified: projects/loglog/trunk/lib/tasks/db.rake
===================================================================
--- projects/loglog/trunk/lib/tasks/db.rake 2009-09-08 10:41:32 UTC (rev 1579)
+++ projects/loglog/trunk/lib/tasks/db.rake 2009-09-08 13:26:16 UTC (rev 1580)
@@ -44,4 +44,13 @@
Rake::Task["db:schema:load"].invoke
Rake::Task["db:fixtures:load"].invoke
end
+
+ namespace :sessions do
+ desc "Cleans out sessions older than 10 days"
+ task :clean => :environment do
+ ActiveRecord::Base.connection.execute(
+ "DELETE FROM #{session_table_name}" +
+ " WHERE updated_at < '#{10.days.ago.to_s(:db)}'")
+ end
+ end
end
Added: projects/loglog/trunk/lib/tasks/pub.rake
===================================================================
--- projects/loglog/trunk/lib/tasks/pub.rake (rev 0)
+++ projects/loglog/trunk/lib/tasks/pub.rake 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,8 @@
+namespace :pub do
+ namespace :cache do
+ desc "Clears the public cache"
+ task :clear do
+ sh "rm -rf public/pub/cache/*"
+ end
+ end
+end
Added: projects/loglog/trunk/lib/tasks/server.rake
===================================================================
--- projects/loglog/trunk/lib/tasks/server.rake (rev 0)
+++ projects/loglog/trunk/lib/tasks/server.rake 2009-09-08 13:26:16 UTC (rev 1580)
@@ -0,0 +1,76 @@
+namespace :server do
+ namespace :production do
+ desc "For views and controllers, restarts the production-server"
+ task :deploy do
+ sh "cap global:deploy -S stage=production"
+ end
+
+ desc "Runs migrations and restarts the daemons & the production-server"
+ task :deploy_full do
+ sh "cap global:deploy:full -S stage=production"
+ end
+
+ desc "Restarts the production-server"
+ task :restart do
+ sh "cap global:server:restart -S stage=production"
+ end
+ end
+
+ namespace :doc do
+ desc "Updates the docs on LogiLogi.org"
+ task :upload do
+ raise 'USER must be set' if ENV['USER'].nil?
+ sh "rake doc:clobber_app;" +
+ "rake doc:clobber_plugins;" +
+ "rake doc:app;" +
+ "rake doc:plugins:body_builder;" +
+ "rake doc:plugins:magick_corners;" +
+ "rake doc:plugins:thorny_form" do |ok, res|
+ if ok
+ sh "rsync -a --delete doc/ #{ENV['USER']}@logilogi.org:" +
+ "/var/www/logilogi/en/current/public/pub/projects/loglog/doc"
+ else
+ puts res.to_s
+ end
+ end
+ end
+ end
+
+ namespace :maintenance do
+ desc "Runs daily maintenance tasks, like backups, cleaning cache and" +
+ " sessions. Pass in options for sub-tasks"
+ task :daily do
+ Rake::Task["server:db:backup"].invoke
+ Rake::Task["pub:cache:clear"].invoke
+ Rake::Task["db:sessions:clean"].invoke
+ end
+ end
+
+ namespace :db do
+ desc "Backups the database, to be ran on the server"
+ task :backup => :environment do
+ Dir.chdir(File.join(RAILS_ROOT,"db","backup"))
+ raise 'USER and PASSWORD must be set' if ENV['USER'].nil? or ENV['PASSWORD'].nil?
+ database = Rails::Configuration.new.database_configuration[RAILS_ENV]["database"]
+ sh "rm -f logilogi.sql"
+ sh "mysqldump -u #{ENV['USER']} --password=#{ENV['PASSWORD']} " +
+ "#{database} > logilogi.sql"
+ end
+ end
+
+ namespace :webstat do
+ desc "Generates the webstats for logilogi"
+ task :update do
+ # TODO fix for multilang
+ lock_file = "tmp/logilogi_statting"
+ raise 'Already running, remove lockfile' if File.exists?(lock_file)
+ FileUtils.touch(lock_file)
+ sh "export LOGFILE=/var/www/logilogi/en/current/log/access.log; " +
+ "/usr/lib/cgi-bin/awstats.pl -config=logilogi.org -update > /dev/null; " +
+ "/usr/local/lib/cgi-bin/awstats_buildstaticpages.pl -config=logilogi.org" +
+ " -awstatsprog=/usr/lib/cgi-bin/awstats.pl" +
+ " -dir=/var/www/logilogi/en/current/public/pub/webstat -diricons=/pub/webstat/icon > /dev/null;"
+ FileUtils.rm(lock_file)
+ end
+ end
+end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-08 10:41:46
|
Revision: 1579
http://logilogi.svn.sourceforge.net/logilogi/?rev=1579&view=rev
Author: wybow
Date: 2009-09-08 10:41:32 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Initial commit of loglog
Added Paths:
-----------
projects/loglog/
projects/loglog/trunk/
projects/loglog/trunk/README
projects/loglog/trunk/Rakefile
projects/loglog/trunk/app/
projects/loglog/trunk/app/controllers/
projects/loglog/trunk/app/controllers/application_controller.rb
projects/loglog/trunk/app/controllers/apps_controller.rb
projects/loglog/trunk/app/controllers/channels_controller.rb
projects/loglog/trunk/app/controllers/feeds_controller.rb
projects/loglog/trunk/app/controllers/messages_controller.rb
projects/loglog/trunk/app/controllers/periods_controller.rb
projects/loglog/trunk/app/helpers/
projects/loglog/trunk/app/helpers/application_helper.rb
projects/loglog/trunk/app/models/
projects/loglog/trunk/app/models/app.rb
projects/loglog/trunk/app/models/app_session.rb
projects/loglog/trunk/app/models/channel.rb
projects/loglog/trunk/app/models/message.rb
projects/loglog/trunk/app/models/remote_user.rb
projects/loglog/trunk/app/models/subscription.rb
projects/loglog/trunk/app/models/user.rb
projects/loglog/trunk/app/models/user_session.rb
projects/loglog/trunk/app/views/
projects/loglog/trunk/app/views/apps/
projects/loglog/trunk/app/views/apps/index.html.erb
projects/loglog/trunk/app/views/channels/
projects/loglog/trunk/app/views/channels/index.html.erb
projects/loglog/trunk/app/views/channels/show.html.erb
projects/loglog/trunk/app/views/feeds/
projects/loglog/trunk/app/views/feeds/show.atom.builder
projects/loglog/trunk/app/views/layouts/
projects/loglog/trunk/app/views/layouts/_foot.html.erb
projects/loglog/trunk/app/views/layouts/_footer.html.erb
projects/loglog/trunk/app/views/layouts/_head.html.erb
projects/loglog/trunk/app/views/layouts/_title_bar.html.erb
projects/loglog/trunk/app/views/layouts/main.html.erb
projects/loglog/trunk/app/views/messages/
projects/loglog/trunk/app/views/messages/create.erb
projects/loglog/trunk/app/views/periods/
projects/loglog/trunk/app/views/periods/show.txt.erb
projects/loglog/trunk/config/
projects/loglog/trunk/config/boot.rb
projects/loglog/trunk/config/database.yml.tmpl
projects/loglog/trunk/config/environment.rb
projects/loglog/trunk/config/environments/
projects/loglog/trunk/config/environments/development.rb
projects/loglog/trunk/config/environments/production.rb
projects/loglog/trunk/config/environments/test.rb
projects/loglog/trunk/config/initializers/
projects/loglog/trunk/config/initializers/backtrace_silencers.rb
projects/loglog/trunk/config/initializers/inflections.rb
projects/loglog/trunk/config/initializers/mime_types.rb
projects/loglog/trunk/config/initializers/new_rails_defaults.rb
projects/loglog/trunk/config/initializers/session_store.rb
projects/loglog/trunk/config/routes.rb
projects/loglog/trunk/db/
projects/loglog/trunk/db/migrate/
projects/loglog/trunk/db/migrate/20090712120351_initial_schema.rb
projects/loglog/trunk/db/schema.rb
projects/loglog/trunk/doc/
projects/loglog/trunk/doc/README_FOR_APP
projects/loglog/trunk/lib/
projects/loglog/trunk/lib/tasks/
projects/loglog/trunk/lib/tasks/db.rake
projects/loglog/trunk/log/
projects/loglog/trunk/public/
projects/loglog/trunk/public/404.html
projects/loglog/trunk/public/422.html
projects/loglog/trunk/public/500.html
projects/loglog/trunk/public/favicon.ico
projects/loglog/trunk/public/images/
projects/loglog/trunk/public/images/logilogi_foundation.png
projects/loglog/trunk/public/images/rails.png
projects/loglog/trunk/public/images/rss.png
projects/loglog/trunk/public/images/svgs/
projects/loglog/trunk/public/images/svgs/rss.svg
projects/loglog/trunk/public/images/svgs/txt.svg
projects/loglog/trunk/public/images/txt.png
projects/loglog/trunk/public/images/zylon.png
projects/loglog/trunk/public/javascripts/
projects/loglog/trunk/public/javascripts/application.js
projects/loglog/trunk/public/javascripts/controls.js
projects/loglog/trunk/public/javascripts/dragdrop.js
projects/loglog/trunk/public/javascripts/effects.js
projects/loglog/trunk/public/javascripts/prototype.js
projects/loglog/trunk/public/robots.txt
projects/loglog/trunk/public/stylesheets/
projects/loglog/trunk/public/stylesheets/loglog.css
projects/loglog/trunk/script/
projects/loglog/trunk/script/about
projects/loglog/trunk/script/console
projects/loglog/trunk/script/dbconsole
projects/loglog/trunk/script/destroy
projects/loglog/trunk/script/generate
projects/loglog/trunk/script/performance/
projects/loglog/trunk/script/performance/benchmarker
projects/loglog/trunk/script/performance/profiler
projects/loglog/trunk/script/plugin
projects/loglog/trunk/script/runner
projects/loglog/trunk/script/server
projects/loglog/trunk/test/
projects/loglog/trunk/test/fixtures/
projects/loglog/trunk/test/fixtures/apps.yml
projects/loglog/trunk/test/fixtures/channels.yml
projects/loglog/trunk/test/fixtures/messages.yml
projects/loglog/trunk/test/fixtures/subscriptions.yml
projects/loglog/trunk/test/fixtures/users.yml
projects/loglog/trunk/test/functional/
projects/loglog/trunk/test/functional/apps_controller_test.rb
projects/loglog/trunk/test/functional/channels_controller_test.rb
projects/loglog/trunk/test/functional/feeds_controller_test.rb
projects/loglog/trunk/test/functional/periods_controller_test.rb
projects/loglog/trunk/test/integration/
projects/loglog/trunk/test/performance/
projects/loglog/trunk/test/performance/browsing_test.rb
projects/loglog/trunk/test/test_helper.rb
projects/loglog/trunk/test/unit/
projects/loglog/trunk/test/unit/app_test.rb
projects/loglog/trunk/test/unit/channel_test.rb
projects/loglog/trunk/test/unit/message_test.rb
projects/loglog/trunk/tmp/
projects/loglog/trunk/tmp/cache/
projects/loglog/trunk/tmp/pids/
projects/loglog/trunk/tmp/sessions/
projects/loglog/trunk/tmp/sockets/
projects/loglog/trunk/vendor/
projects/loglog/trunk/vendor/plugins/
Added: projects/loglog/trunk/README
===================================================================
--- projects/loglog/trunk/README (rev 0)
+++ projects/loglog/trunk/README 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,243 @@
+== Welcome to Rails
+
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb" templates
+that are primarily responsible for inserting pre-built data in between HTML tags.
+The model contains the "smart" domain objects (such as Account, Product, Person,
+Post) that holds all the business logic and knows how to persist themselves to
+a database. The controller handles the incoming requests (such as Save New Account,
+Update Product, Show Post) by manipulating the model and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting Started
+
+1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
+ and your application name. Ex: rails myapp
+2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
+3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
+4. Follow the guidelines to start developing your application
+
+
+== Web Servers
+
+By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
+with a variety of other web servers.
+
+Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
+suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
+getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
+More info at: http://mongrel.rubyforge.org
+
+Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
+Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
+FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
+
+== Apache .htaccess example for FCGI/CGI
+
+# General Apache options
+AddHandler fastcgi-script .fcgi
+AddHandler cgi-script .cgi
+Options +FollowSymLinks +ExecCGI
+
+# If you don't want Rails to look in certain directories,
+# use the following rewrite rules so that Apache won't rewrite certain requests
+#
+# Example:
+# RewriteCond %{REQUEST_URI} ^/notrails.*
+# RewriteRule .* - [L]
+
+# Redirect all requests not available on the filesystem to Rails
+# By default the cgi dispatcher is used which is very slow
+#
+# For better performance replace the dispatcher with the fastcgi one
+#
+# Example:
+# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
+RewriteEngine On
+
+# If your Rails application is accessed via an Alias directive,
+# then you MUST also set the RewriteBase in this htaccess file.
+#
+# Example:
+# Alias /myrailsapp /path/to/myrailsapp/public
+# RewriteBase /myrailsapp
+
+RewriteRule ^$ index.html [QSA]
+RewriteRule ^([^.]+)$ $1.html [QSA]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
+
+# In case Rails experiences terminal errors
+# Instead of displaying this message you can supply a file here which will be rendered instead
+#
+# Example:
+# ErrorDocument 500 /500.html
+
+ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
+
+
+== Debugging Rails
+
+Sometimes your application goes wrong. Fortunately there are a lot of tools that
+will help you debug it and get it back on the rails.
+
+First area to check is the application log files. Have "tail -f" commands running
+on the server.log and development.log. Rails will automatically display debugging
+and runtime information to these files. Debugging info will also be shown in the
+browser on requests from 127.0.0.1.
+
+You can also log your own messages directly into the log file from your code using
+the Ruby logger class from inside your controllers. Example:
+
+ class WeblogController < ActionController::Base
+ def destroy
+ @weblog = Weblog.find(params[:id])
+ @weblog.destroy
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
+ end
+ end
+
+The result will be a message in your log file along the lines of:
+
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
+
+More information on how to use the logger is at http://www.ruby-doc.org/core/
+
+Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
+
+* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
+* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
+
+These two online (and free) books will bring you up to speed on the Ruby language
+and also on programming in general.
+
+
+== Debugger
+
+Debugger support is available through the debugger command when you start your Mongrel or
+Webrick server with --debugger. This means that you can break out of execution at any point
+in the code, investigate and change the model, AND then resume execution!
+You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
+Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find(:all)
+ debugger
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the server window. Here you can do things like:
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
+ >> @posts.first.title = "hello from a debugger"
+ => "hello from a debugger"
+
+...and even better is that you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you enter "cont"
+
+
+== Console
+
+You can interact with the domain model by starting the console through <tt>script/console</tt>.
+Here you'll have all parts of the application configured, just like it is when the
+application is running. You can inspect domain models, change values, and save to the
+database. Starting the script without arguments will launch it in the development environment.
+Passing an argument will specify a different environment, like <tt>script/console production</tt>.
+
+To reload your controllers and models after launching the console run <tt>reload!</tt>
+
+== dbconsole
+
+You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
+You would be connected to the database with the credentials defined in database.yml.
+Starting the script without arguments will connect you to the development database. Passing an
+argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
+Currently works for mysql, postgresql and sqlite.
+
+== Description of Contents
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from ApplicationController
+ which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb.
+ Most models will descend from ActiveRecord::Base.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
+ syntax.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the common
+ header/footer method of wrapping views. In your views, define a layout using the
+ <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
+ call <% yield %> to render the view using this layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are generated
+ for you automatically when using script/generate for controllers. Helpers can be used to
+ wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all
+ the sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when generated
+ using <tt>rake doc:app</tt>
+
+lib
+ Application specific libraries. Basically, any kind of custom code that doesn't
+ belong under controllers, models, or helpers. This directory is in the load path.
+
+public
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
+ and javascripts. Also contains the dispatchers and the default HTML files. This should be
+ set as the DOCUMENT_ROOT of your web server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the script/generate scripts, template
+ test files will be generated for you and placed in this directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins subdirectory.
+ If the app has frozen rails, those gems also go here, under vendor/rails/.
+ This directory is in the load path.
Added: projects/loglog/trunk/Rakefile
===================================================================
--- projects/loglog/trunk/Rakefile (rev 0)
+++ projects/loglog/trunk/Rakefile 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
Added: projects/loglog/trunk/app/controllers/application_controller.rb
===================================================================
--- projects/loglog/trunk/app/controllers/application_controller.rb (rev 0)
+++ projects/loglog/trunk/app/controllers/application_controller.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,59 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogiLogi is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class ApplicationController < ActionController::Base
+ helper :all # include all helpers, all the time
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
+
+ def find_app
+ @app = App.find_by_name(params[:app_id])
+ end
+
+ def find_channel
+ @channel = @app.channels.find_by_name(params[:channel_id])
+ end
+
+ # Returns the current app session, see authlogic.
+ #
+ def current_app_session
+ return @current_app_session if defined?(@current_app_session)
+ @current_app_session = AppSession.find
+ end
+
+ # Returns the logged in app.
+ #
+ def current_app
+ return @current_app if defined?(@current_app)
+ if self.current_app_session
+ @current_app = current_app_session.app
+ else
+ @current_app = nil
+ end
+ end
+
+ # Makes sure an app is logged in.
+ #
+ # Note that it does not check whether the logged in app also is the
+ # app specified in the url.
+ #
+ def require_login
+ if self.current_app.nil?
+ flash[:warning] = "You must be logged in to access this page"
+# redirect_to new_app_session_url
+ return false
+ end
+ end
+
+ # Scrub sensitive parameters from your log
+ # filter_parameter_logging :password
+end
Added: projects/loglog/trunk/app/controllers/apps_controller.rb
===================================================================
--- projects/loglog/trunk/app/controllers/apps_controller.rb (rev 0)
+++ projects/loglog/trunk/app/controllers/apps_controller.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,39 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogiLogi is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class AppsController < ApplicationController
+ ### Layout
+
+ layout 'main'
+
+ ### Filters
+
+ before_filter :find
+
+ ### Filter-method
+
+ def find_remote_user
+ @remote_user = RemoteUser.find(params[:user_id], :params => {
+ :perishable_token => params[:perishable_token]})
+ end
+
+ def find
+ @app = App.find_by_name(params[:id])
+ end
+
+ ### REST-methods
+
+ def index
+ @apps = App.find(:all)
+ end
+end
Added: projects/loglog/trunk/app/controllers/channels_controller.rb
===================================================================
--- projects/loglog/trunk/app/controllers/channels_controller.rb (rev 0)
+++ projects/loglog/trunk/app/controllers/channels_controller.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,52 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogiLogi is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class ChannelsController < ApplicationController
+ ### Layout
+
+ layout 'main'
+
+ ### Filters
+
+ before_filter :find_app
+ before_filter :find,
+ :except => :index
+
+ ### Filter-functions
+
+ def find
+ @channel = @app.channels.find_by_name(params[:id])
+ end
+
+ ### Bodies
+
+ # see the BodyBuilder plugin.
+ #
+ # :head, :top and :sidebar are already set in application
+# body_parts :post
+#
+# top_body :navigation_bar
+
+ ### REST-methods
+
+ def index
+ @channels = @app.channels
+ end
+
+ def show
+ end
+
+ ### Body-methods
+
+# protected
+end
Added: projects/loglog/trunk/app/controllers/feeds_controller.rb
===================================================================
--- projects/loglog/trunk/app/controllers/feeds_controller.rb (rev 0)
+++ projects/loglog/trunk/app/controllers/feeds_controller.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,29 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogiLogi is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class FeedsController < ApplicationController
+ ### Filters
+
+ before_filter :find_app, :find_channel
+
+ ### REST-methods
+
+ def show
+ @messages = @channel.messages
+ respond_to do |format|
+ format.atom do
+ @title = 'LogLog ' + @channel.name + ' channel'
+ end
+ end
+ end
+end
Added: projects/loglog/trunk/app/controllers/messages_controller.rb
===================================================================
--- projects/loglog/trunk/app/controllers/messages_controller.rb (rev 0)
+++ projects/loglog/trunk/app/controllers/messages_controller.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,58 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogiLogi is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class MessagesController < ApplicationController
+ ### REST-methods
+
+ def show
+ # TODO include channel name
+ @message = Message.find(params[:id])
+
+ respond_to do |format|
+ format.xml { render :xml => @message }
+ end
+ end
+
+ def create
+ app = App.find_by_name(params[:app_id])
+ if current_app == app
+ mess = params[:message].dup
+ ok, last_message = true
+ if mess[:channel_names]
+ mess.delete(:channel_names).split(',').each do |channel_name|
+ ok = self.save_message(mess, app, channel_name) if ok
+ end
+ elsif mess[:channel_name]
+ channel_name = mess.delete(:channel_name)
+ ok = self.save_message(mess, app, channel_name)
+ end
+
+ if ok
+ render :xml => last_message, :status => :created,
+ :location => last_message
+ else
+ render :xml => last_message.errors, :status => :unprocessable_entity
+ end
+ else
+ render :xml => last_message.errors, :status => :unprocessable_entity
+ end
+ end
+
+ ### Helpers
+
+ def save_message(mess, app, channel_name)
+ last_message = Message.new(mess)
+ last_message.set_channel_from(app, channel_name)
+ return last_message.save
+ end
+end
Added: projects/loglog/trunk/app/controllers/periods_controller.rb
===================================================================
--- projects/loglog/trunk/app/controllers/periods_controller.rb (rev 0)
+++ projects/loglog/trunk/app/controllers/periods_controller.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,30 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogiLogi is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class PeriodsController < ApplicationController
+ ### Filters
+
+ before_filter :find_app, :find_channel
+
+ ### REST-methods
+
+ def show
+ @messages = @channel.messages.for_period(params[:id])
+ respond_to do |format|
+# format.html do
+# end
+ format.txt do
+ end
+ end
+ end
+end
Added: projects/loglog/trunk/app/helpers/application_helper.rb
===================================================================
--- projects/loglog/trunk/app/helpers/application_helper.rb (rev 0)
+++ projects/loglog/trunk/app/helpers/application_helper.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,46 @@
+# Methods added to this helper will be available to all templates in the application.
+module ApplicationHelper
+ # for feed
+ def message_url(args)
+ end
+
+ def site_name_link(options = {})
+ if options[:text]
+ text = options[:text]
+ else
+ text = self.site_name(options)
+ end
+ url = root_url
+ return link_to(text, url, :class => 'sitename')
+ end
+
+ def site_name(options = {})
+ if options[:length]
+ return self.pre_truncate(SITE_NAME,
+ :length => options[:length])
+ else
+ return SITE_NAME
+ end
+ end
+
+ def pre_truncate(text, options = {})
+ options[:length] ||= 30
+ if text.size > options[:length]
+ return '..' + text[(text.size - options[:length] + 2)..-1]
+ else
+ return text
+ end
+ end
+
+ def show_flash(type = nil)
+ if flash[:warning] or flash[:notice] or flash[:error] or (type and flash[type])
+ render :partial => 'application/flash',
+ :locals => { :flash => flash, :type => type }
+ end
+ end
+
+ def link_to_type(type, name, url)
+ link_to(image_tag(type + ".png"), url, :class => "typeimg") +
+ '<div class="belowtype">' + link_to('[' + name + ']', url) + '</div>'
+ end
+end
Added: projects/loglog/trunk/app/models/app.rb
===================================================================
--- projects/loglog/trunk/app/models/app.rb (rev 0)
+++ projects/loglog/trunk/app/models/app.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,62 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogLog is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class App < ActiveRecord::Base
+ ### Acts as
+
+ acts_as_authentic do |options|
+ options.login_field = :email
+ end
+
+ ### Relationships
+
+ has_many :channels, :dependent => :destroy
+
+ ### Filters
+
+ before_create :assert_persistence_token
+
+ ### Validations
+
+ validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w_]+$/,
+ :message => "should only contain alphanumerical symbols or" +
+ " underscores"
+ validates_uniqueness_of :email
+ validates_format_of :email, :with => /^[A-Za-z0-9_\.\-]+@[A-Za-z0-9\._-]+\.[A-Za-z]+$/,
+ :message => "is incorrect, please check for typo's"
+ validates_length_of :password, :minimum => 6, :on => :create, :allow_nil => true
+
+ ### Methods
+
+ def or_new_channel_for_name(name)
+ c = self.channels.find_by_name(name)
+ if c.nil?
+ return Channel.new(:app => self, :name => name)
+ else
+ return c
+ end
+ end
+
+ ### Filter-functions (some are public)
+
+ protected
+
+ # Makes sure the persistence token is not null.
+ #
+ def assert_persistence_token
+ if self.persistence_token.nil? or self.persistence_token.empty?
+ self.persistence_token = App.unique_token
+ end
+ end
+end
Added: projects/loglog/trunk/app/models/app_session.rb
===================================================================
--- projects/loglog/trunk/app/models/app_session.rb (rev 0)
+++ projects/loglog/trunk/app/models/app_session.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,15 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogLog is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class AppSession < Authlogic::Session::Base
+end
Added: projects/loglog/trunk/app/models/channel.rb
===================================================================
--- projects/loglog/trunk/app/models/channel.rb (rev 0)
+++ projects/loglog/trunk/app/models/channel.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,33 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogLog is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class Channel < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :app
+ has_many :messages, :dependent => :destroy
+ has_many :subscriptions, :dependent => :destroy
+ has_many :users, :through => :subscriptions
+
+ ### Filters
+
+ before_create :assert_title
+
+ ### Filter-methods
+
+ def assert_title
+ if self.title.nil? or self.title.empty?
+ self.title = self.name + " at " + self.app.name
+ end
+ end
+end
Added: projects/loglog/trunk/app/models/message.rb
===================================================================
--- projects/loglog/trunk/app/models/message.rb (rev 0)
+++ projects/loglog/trunk/app/models/message.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,40 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogLog is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class Message < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :channel
+
+ ### Named scopes
+
+ named_scope :for_period, lambda { |period|
+ { :conditions =>
+ case period
+ when "daily"
+ 'created_at > "' + (1.day - 10.minutes).ago.to_s(:db) + '"'
+ when "weekly"
+ 'created_at > "' + (1.week - 10.minutes).ago.to_s(:db) + '"'
+ when "monthly"
+ 'created_at > "' + (1.month - 10.minutes).ago.to_s(:db) + '"'
+ else
+ raise 'Wrong period given'
+ end }
+ }
+
+ ### Methods
+
+ def set_channel_from(app, channel_name)
+ self.channel = app.or_new_channel_for_name(channel_name)
+ end
+end
Added: projects/loglog/trunk/app/models/remote_user.rb
===================================================================
--- projects/loglog/trunk/app/models/remote_user.rb (rev 0)
+++ projects/loglog/trunk/app/models/remote_user.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,16 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogLog is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class RemoteUser < ActiveResource::Base
+ self.site = 'http://en.logi-manta.org:3000/do/'
+end
Added: projects/loglog/trunk/app/models/subscription.rb
===================================================================
--- projects/loglog/trunk/app/models/subscription.rb (rev 0)
+++ projects/loglog/trunk/app/models/subscription.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,23 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogLog is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class Subscription < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :user
+ belongs_to :channel
+
+ ### Validations
+
+ validates_uniqueness_of :channel_id, :scope => :user_id
+end
Added: projects/loglog/trunk/app/models/user.rb
===================================================================
--- projects/loglog/trunk/app/models/user.rb (rev 0)
+++ projects/loglog/trunk/app/models/user.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,27 @@
+#--#
+# Copyright: (c) 2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogLog program. LogLog is Free Software.
+# You can run/distribute/modify LogLog under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogLog remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class User < ActiveRecord::Base
+ ### Acts as
+
+ acts_as_authentic
+
+ ### Relationships
+
+ has_many :subscriptions, :dependent => :destroy
+ has_many :channels, :through => :subscriptions
+
+ ### Validations
+
+ validates_uniqueness_of :user_id
+end
Added: projects/loglog/trunk/app/models/user_session.rb
===================================================================
--- projects/loglog/trunk/app/models/user_session.rb (rev 0)
+++ projects/loglog/trunk/app/models/user_session.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,15 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogiLogi program. LogiLogi is Free Software.
+# You can run/distribute/modify LogiLogi under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogiLogi remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+class UserSession < Authlogic::Session::Base
+end
Added: projects/loglog/trunk/app/views/apps/index.html.erb
===================================================================
--- projects/loglog/trunk/app/views/apps/index.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/apps/index.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,7 @@
+<h1>Applications</h1>
+
+<ul>
+ <% @apps.each do |app| %>
+ <li><%= link_to app.name, app_channels_url(:app_id => app.name) %></li>
+ <% end %>
+</ul>
Added: projects/loglog/trunk/app/views/channels/index.html.erb
===================================================================
--- projects/loglog/trunk/app/views/channels/index.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/channels/index.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,7 @@
+<h1>Channels for <%= @app.name %></h1>
+
+<ul>
+ <% @channels.each do |channel| %>
+ <li><%= link_to channel.name, app_channel_url(:app_id => @app.name, :id => channel.name) %></li>
+ <% end %>
+</ul>
Added: projects/loglog/trunk/app/views/channels/show.html.erb
===================================================================
--- projects/loglog/trunk/app/views/channels/show.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/channels/show.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,48 @@
+<h1>Channel <%= @channel %></h1>
+
+<h2>Feeds</h2>
+
+<table>
+ <tr>
+ <td class="label">
+ <h3>Live</h3>
+ </td>
+ <td class="type">
+ <%= link_to_type('rss', 'RSS', app_channel_feed_url(
+ :channel_id => @channel.name, :format => 'atom')) %>
+ </td>
+ </tr>
+</table>
+
+<h2>Periodicals</h2>
+
+<table>
+ <tr>
+ <td class="label">
+ <h3>Daily</h3>
+ </td>
+ <td class="type">
+ <%= link_to_type('txt', 'TXT', app_channel_period_url(
+ :channel_id => @channel.name, :id => 'daily', :format => 'txt')) %>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <h3>Weekly</h3>
+ </td>
+ <td class="type">
+ <%= link_to_type('txt', 'TXT', app_channel_period_url(
+ :channel_id => @channel.name, :id => 'weekly', :format => 'txt')) %>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <h3>Monthly</h3>
+ </td>
+ <td class="type">
+ <%= link_to_type('txt', 'TXT', app_channel_period_url(
+ :channel_id => @channel.name, :id => 'monthly', :format => 'txt')) %>
+ </td>
+ </tr>
+
+</table>
Added: projects/loglog/trunk/app/views/feeds/show.atom.builder
===================================================================
--- projects/loglog/trunk/app/views/feeds/show.atom.builder (rev 0)
+++ projects/loglog/trunk/app/views/feeds/show.atom.builder 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,26 @@
+atom_feed do |feed|
+ feed.title(@title)
+ feed.updated((@messages.first.created_at))
+ feed.link "rel" => "self",
+ "href" => url_for(:only_path => false, :format => 'atom')
+ feed.link "rel" => "alternate",
+ "href" => url_for(:only_path => false)
+
+ @messages.each do |message|
+ feed.entry(message) do |entry|
+ entry.title(message.title || message.kind)
+ entry.link(message.url)
+ entry.content(message.text + '...', :type => 'text')
+
+# entry.categories do |categories|
+# message.tags.each do |tag|
+# categories.category(:term => tag)
+# end
+# end
+
+ entry.author do |author|
+ author.name(message.author)
+ end
+ end
+ end
+end
Added: projects/loglog/trunk/app/views/layouts/_foot.html.erb
===================================================================
--- projects/loglog/trunk/app/views/layouts/_foot.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/layouts/_foot.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,3 @@
+ </div>
+</body>
+</html>
Added: projects/loglog/trunk/app/views/layouts/_footer.html.erb
===================================================================
--- projects/loglog/trunk/app/views/layouts/_footer.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/layouts/_footer.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,24 @@
+<div class="spacer"></div>
+<div id="footer">
+ <div class="about_bar">
+ <div class="panel_content_padding">
+ <%= 'Best viewed with' %> <a href="http://www.mozilla.com/firefox/"><%= 'Firefox' %></a><br />
+ <a href="http://foundation.logilogi.org/2008/5/6/logilogi-manta-in-public-beta"><%= 'About LogLog' %></a> | <a href="mailto:fou...@lo..."><%= 'Contact us' %></a>
+ </div>
+ </div>
+ <div class="supported_bar">
+ <div class="panel_content_padding">
+ Supported / sponsored by:
+ </div>
+ <%= link_to image_tag('logilogi_foundation.png', :size => "156x40"), "http://foundation.logilogi.org" %>
+ <%= link_to image_tag('zylon.png', :size => "156x40"), "http://www.zylon.net" %>
+ </div>
+ <div class="copyright">
+ <div class="panel_content_padding">
+ © 2009 <a href="http://foundation.logilogi.org"><%= 'The LogiLogi Foundation' %></a>.
+ <a href="http://en.logilogi.org/Development/Logi_Logi=Wybo_Wiersma_32">LogLog is Free Software</a> and licensed under the <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">Affero GPL v3</a> <%= 'which means that the running version will always be' + ' ' + link_to('available for download', '') %>.<br />
+ Development happens on <a href="http://sourceforge.net/projects/logilogi">our Sourceforge page</a>.
+ Documentation and installation instructions <a href="http://en.logilogi.org/pub/projects/loglog/doc/app/">are here</a>.<br />
+ </div>
+ </div>
+</div><!-- /footer -->
Added: projects/loglog/trunk/app/views/layouts/_head.html.erb
===================================================================
--- projects/loglog/trunk/app/views/layouts/_head.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/layouts/_head.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title><%= @page_name %> - <%= SITE_NAME %> - <%= TITLE_LINE %></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta name="Keywords" content="<%= HEADER_KEYWORDS %>" />
+ <meta name="Description" content="<%= HEADER_DESCRIPTION %>" />
+ <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
+ <!-- TinyMCE is included on edits -->
+ <%= javascript_include_tag :defaults, :cache => true %>
+ <%= stylesheet_link_tag "loglog" %>
+ <!--[if IE]>
+ <%= stylesheet_link_tag "ie" %>
+ <![endif]-->
+</head>
+
+<body id="<%= @page_id %>" class="<%= @page_class %>">
+ <div id="container">
Added: projects/loglog/trunk/app/views/layouts/_title_bar.html.erb
===================================================================
--- projects/loglog/trunk/app/views/layouts/_title_bar.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/layouts/_title_bar.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,7 @@
+<div id="network_bar">
+ <div class="panel_content_padding">
+ <%= 'Part of the LogiLogi Network' %>:
+ <a href="http://foundation.logilogi.org">The LogiLogi Foundation</a>
+ - <b>LogiLogi.org</b>
+ </div>
+</div>
Added: projects/loglog/trunk/app/views/layouts/main.html.erb
===================================================================
--- projects/loglog/trunk/app/views/layouts/main.html.erb (rev 0)
+++ projects/loglog/trunk/app/views/layouts/main.html.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,18 @@
+<%= render :partial => 'layouts/head' %>
+
+ <%= render :partial => 'layouts/title_bar' %>
+
+ <%= yield :top_body %>
+ <%= show_flash('exposed') %>
+
+ <div class="main_column">
+ <%= yield %>
+ </div>
+
+ <div class="side_column">
+ <%= yield :sidebar_body %>
+ </div>
+
+ <%= render :partial => 'layouts/footer' %>
+
+<%= render :partial => 'layouts/foot' %>
Added: projects/loglog/trunk/app/views/periods/show.txt.erb
===================================================================
--- projects/loglog/trunk/app/views/periods/show.txt.erb (rev 0)
+++ projects/loglog/trunk/app/views/periods/show.txt.erb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,16 @@
+<%
+@messages.group_by(&:kind).each do |kind, similar_messages|
+%>~ <%= kind %> ~
+
+<%
+ similar_messages.each do |message|
+%> <%= message.author %>
+
+<%= word_wrap(message.text, :line_width => 40) %>
+
+<%= message.url %>
+
+<%
+ end
+end
+%>
Added: projects/loglog/trunk/config/boot.rb
===================================================================
--- projects/loglog/trunk/config/boot.rb (rev 0)
+++ projects/loglog/trunk/config/boot.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,110 @@
+# Don't change this file!
+# Configure your app in config/environment.rb and config/environments/*.rb
+
+RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
+
+module Rails
+ class << self
+ def boot!
+ unless booted?
+ preinitialize
+ pick_boot.run
+ end
+ end
+
+ def booted?
+ defined? Rails::Initializer
+ end
+
+ def pick_boot
+ (vendor_rails? ? VendorBoot : GemBoot).new
+ end
+
+ def vendor_rails?
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
+ end
+
+ def preinitialize
+ load(preinitializer_path) if File.exist?(preinitializer_path)
+ end
+
+ def preinitializer_path
+ "#{RAILS_ROOT}/config/preinitializer.rb"
+ end
+ end
+
+ class Boot
+ def run
+ load_initializer
+ Rails::Initializer.run(:set_load_path)
+ end
+ end
+
+ class VendorBoot < Boot
+ def load_initializer
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
+ Rails::Initializer.run(:install_gem_spec_stubs)
+ Rails::GemDependency.add_frozen_gem_path
+ end
+ end
+
+ class GemBoot < Boot
+ def load_initializer
+ self.class.load_rubygems
+ load_rails_gem
+ require 'initializer'
+ end
+
+ def load_rails_gem
+ if version = self.class.gem_version
+ gem 'rails', version
+ else
+ gem 'rails'
+ end
+ rescue Gem::LoadError => load_error
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
+ exit 1
+ end
+
+ class << self
+ def rubygems_version
+ Gem::RubyGemsVersion rescue nil
+ end
+
+ def gem_version
+ if defined? RAILS_GEM_VERSION
+ RAILS_GEM_VERSION
+ elsif ENV.include?('RAILS_GEM_VERSION')
+ ENV['RAILS_GEM_VERSION']
+ else
+ parse_gem_version(read_environment_rb)
+ end
+ end
+
+ def load_rubygems
+ require 'rubygems'
+ min_version = '1.3.1'
+ unless rubygems_version >= min_version
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
+ exit 1
+ end
+
+ rescue LoadError
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
+ exit 1
+ end
+
+ def parse_gem_version(text)
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
+ end
+
+ private
+ def read_environment_rb
+ File.read("#{RAILS_ROOT}/config/environment.rb")
+ end
+ end
+ end
+end
+
+# All that for this:
+Rails.boot!
Added: projects/loglog/trunk/config/database.yml.tmpl
===================================================================
--- projects/loglog/trunk/config/database.yml.tmpl (rev 0)
+++ projects/loglog/trunk/config/database.yml.tmpl 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,38 @@
+# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
+#
+# Get the fast C bindings:
+# gem install mysql
+# (on OS X: gem install mysql -- --include=/usr/local/lib)
+# And be sure to use new-style password hashing:
+# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
+defaults: &defaults
+ adapter: mysql
+ username: root
+ password:
+ socket: <%= ["/tmp/mysqld.sock",
+ "/tmp/mysql.sock",
+ "/var/run/mysqld/mysqld.sock",
+ "/var/lib/mysql/mysql.sock"].detect {|socket|
+ File.exist?(socket)
+ } %>
+ encoding: utf8
+
+development:
+ database: loglog_development
+ <<: *defaults
+
+ # Connect on a TCP socket. If omitted, the adapter will connect on the
+ # domain socket given by socket instead.
+ #host: localhost
+ #port: 3306
+
+# Warning: The database defined as 'test' will be erased and
+# re-generated from your development database when you run 'rake'.
+# Do not set this db to the same as development or production.
+test:
+ database: loglog_test
+ <<: *defaults
+
+production:
+ database: loglog_production
+ <<: *defaults
Added: projects/loglog/trunk/config/environment.rb
===================================================================
--- projects/loglog/trunk/config/environment.rb (rev 0)
+++ projects/loglog/trunk/config/environment.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,50 @@
+# Be sure to restart your server when you modify this file
+
+# Specifies gem version of Rails to use when vendor/rails is not present
+RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
+
+# Bootstrap the Rails environment, frameworks, and default configuration
+require File.join(File.dirname(__FILE__), 'boot')
+
+Rails::Initializer.run do |config|
+ # Gems LogLog needs
+ config.gem "authlogic"
+ config.gem "quantipay-authlogic_haapi", :lib => "authlogic_haapi"
+
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Add additional load paths for your own custom dirs
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
+
+ # Specify gems that this application depends on and have them installed with rake gems:install
+ # config.gem "bj"
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
+ # config.gem "aws-s3", :lib => "aws/s3"
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Skip frameworks you're not going to use. To use Rails without a database,
+ # you must remove the Active Record framework.
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
+
+ # Activate observers that should always be running
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names.
+ config.time_zone = 'UTC'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
+ # config.i18n.default_locale = :de
+end
+
+SITE_NAME = "LogLog.org"
+TITLE_LINE = "Yo"
+HEADER_KEYWORDS = "Yo"
+HEADER_DESCRIPTION = "Yo"
Added: projects/loglog/trunk/config/environments/development.rb
===================================================================
--- projects/loglog/trunk/config/environments/development.rb (rev 0)
+++ projects/loglog/trunk/config/environments/development.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,17 @@
+# Settings specified here will take precedence over those in config/environment.rb
+
+# In the development environment your application's code is reloaded on
+# every request. This slows down response time but is perfect for development
+# since you don't have to restart the webserver when you make code changes.
+config.cache_classes = false
+
+# Log error messages when you accidentally call methods on nil.
+config.whiny_nils = true
+
+# Show full error reports and disable caching
+config.action_controller.consider_all_requests_local = true
+config.action_view.debug_rjs = true
+config.action_controller.perform_caching = false
+
+# Don't care if the mailer can't send
+config.action_mailer.raise_delivery_errors = false
\ No newline at end of file
Added: projects/loglog/trunk/config/environments/production.rb
===================================================================
--- projects/loglog/trunk/config/environments/production.rb (rev 0)
+++ projects/loglog/trunk/config/environments/production.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,28 @@
+# Settings specified here will take precedence over those in config/environment.rb
+
+# The production environment is meant for finished, "live" apps.
+# Code is not reloaded between requests
+config.cache_classes = true
+
+# Full error reports are disabled and caching is turned on
+config.action_controller.consider_all_requests_local = false
+config.action_controller.perform_caching = true
+config.action_view.cache_template_loading = true
+
+# See everything in the log (default is :info)
+# config.log_level = :debug
+
+# Use a different logger for distributed setups
+# config.logger = SyslogLogger.new
+
+# Use a different cache store in production
+# config.cache_store = :mem_cache_store
+
+# Enable serving of images, stylesheets, and javascripts from an asset server
+# config.action_controller.asset_host = "http://assets.example.com"
+
+# Disable delivery errors, bad email addresses will be ignored
+# config.action_mailer.raise_delivery_errors = false
+
+# Enable threaded mode
+# config.threadsafe!
\ No newline at end of file
Added: projects/loglog/trunk/config/environments/test.rb
===================================================================
--- projects/loglog/trunk/config/environments/test.rb (rev 0)
+++ projects/loglog/trunk/config/environments/test.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,28 @@
+# Settings specified here will take precedence over those in config/environment.rb
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+config.cache_classes = true
+
+# Log error messages when you accidentally call methods on nil.
+config.whiny_nils = true
+
+# Show full error reports and disable caching
+config.action_controller.consider_all_requests_local = true
+config.action_controller.perform_caching = false
+config.action_view.cache_template_loading = true
+
+# Disable request forgery protection in test environment
+config.action_controller.allow_forgery_protection = false
+
+# Tell Action Mailer not to deliver emails to the real world.
+# The :test delivery method accumulates sent emails in the
+# ActionMailer::Base.deliveries array.
+config.action_mailer.delivery_method = :test
+
+# Use SQL instead of Active Record's schema dumper when creating the test database.
+# This is necessary if your schema can't be completely dumped by the schema dumper,
+# like if you have constraints or database-specific column types
+# config.active_record.schema_format = :sql
\ No newline at end of file
Added: projects/loglog/trunk/config/initializers/backtrace_silencers.rb
===================================================================
--- projects/loglog/trunk/config/initializers/backtrace_silencers.rb (rev 0)
+++ projects/loglog/trunk/config/initializers/backtrace_silencers.rb 2009-09-08 10:41:32 UTC (rev 1579)
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
\ No newline at end of file
Added: projects/loglog/trunk/config/initializers/inflect...
[truncated message content] |
|
From: <wy...@us...> - 2009-09-08 10:29:03
|
Revision: 1578
http://logilogi.svn.sourceforge.net/logilogi/?rev=1578&view=rev
Author: wybow
Date: 2009-09-08 10:28:53 +0000 (Tue, 08 Sep 2009)
Log Message:
-----------
Added Chinese portraits start by sebastian
Modified Paths:
--------------
trunk/app/models/user.rb
trunk/db/schema.rb
Added Paths:
-----------
trunk/app/controllers/chinese_portrait_controller.rb
trunk/app/models/chinese_answer.rb
trunk/app/models/chinese_opinion.rb
trunk/app/models/chinese_portrait.rb
trunk/app/models/const/chinese_portrait.rb
trunk/app/views/chinese_portrait/
trunk/db/migrate/20090905094509_create_chinese_portraits.rb
trunk/test/fixtures/chinese_answers.yml
trunk/test/fixtures/chinese_opinions.yml
trunk/test/fixtures/chinese_portraits.yml
trunk/test/functional/chinese_portrait_controller_test.rb
trunk/test/unit/chinese_answer_test.rb
trunk/test/unit/chinese_opinion_test.rb
trunk/test/unit/chinese_portrait_test.rb
trunk/test/unit/helpers/
trunk/test/unit/helpers/chinese_portrait_helper_test.rb
Added: trunk/app/controllers/chinese_portrait_controller.rb
===================================================================
--- trunk/app/controllers/chinese_portrait_controller.rb (rev 0)
+++ trunk/app/controllers/chinese_portrait_controller.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,2 @@
+class ChinesePortraitController < ApplicationController
+end
Added: trunk/app/models/chinese_answer.rb
===================================================================
--- trunk/app/models/chinese_answer.rb (rev 0)
+++ trunk/app/models/chinese_answer.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,4 @@
+class ChineseAnswer < ActiveRecord::Base
+ ### Relationships
+ belongs_to :chinese_portrait
+end
Added: trunk/app/models/chinese_opinion.rb
===================================================================
--- trunk/app/models/chinese_opinion.rb (rev 0)
+++ trunk/app/models/chinese_opinion.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,4 @@
+class ChineseOpinion < ActiveRecord::Base
+ ### Relationships
+ belongs_to :chinese_portrait
+end
Added: trunk/app/models/chinese_portrait.rb
===================================================================
--- trunk/app/models/chinese_portrait.rb (rev 0)
+++ trunk/app/models/chinese_portrait.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,11 @@
+class ChinesePortrait < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :user
+ has_many :chinese_answers
+ has_many :chinese_opinions
+
+ ### Validations
+
+ validates_presence_of :user
+end
Added: trunk/app/models/const/chinese_portrait.rb
===================================================================
--- trunk/app/models/const/chinese_portrait.rb (rev 0)
+++ trunk/app/models/const/chinese_portrait.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,10 @@
+module Const
+ class ChinesePortrait
+ ### Constants
+ QUESTION_1 = "Question 1 ?"
+ QUESTION_2 = "Question 2 ?"
+ QUESTION_3 = "Question 3 ?"
+ QUESTION_4 = "Question 4 ?"
+ QUESTION_5 = "Question 5 ?"
+ end
+end
Modified: trunk/app/models/user.rb
===================================================================
--- trunk/app/models/user.rb 2009-09-07 16:21:27 UTC (rev 1577)
+++ trunk/app/models/user.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -46,6 +46,7 @@
has_many :invitations, :dependent => :destroy
has_many :user_groups, :through => :user_group_memberships
has_many :peer_groups, :through => :peer_group_memberships
+ has_one :chinese_portrait
### Filters
Added: trunk/db/migrate/20090905094509_create_chinese_portraits.rb
===================================================================
--- trunk/db/migrate/20090905094509_create_chinese_portraits.rb (rev 0)
+++ trunk/db/migrate/20090905094509_create_chinese_portraits.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,32 @@
+class CreateChinesePortraits < ActiveRecord::Migration
+ def self.up
+ create_table :chinese_portraits do |t|
+ t.integer :user_id
+
+ t.timestamps
+ end
+ create_table :chinese_answers do |t|
+ t.integer :chinese_portrait_id
+ t.integer :question_nb
+ t.string :answer
+
+ t.timestamps
+ end
+ create_table :chinese_opinions do |t|
+ t.integer :chinese_portrait_id
+ t.integer :question_nb
+ t.string :answer
+ t.integer :user_id
+
+ t.timestamps
+ end
+
+ end
+
+ def self.down
+ drop_table :chinese_portraits
+ drop_table :chinese_answers
+ drop_table :chinese_opinions
+ end
+end
+
Modified: trunk/db/schema.rb
===================================================================
--- trunk/db/schema.rb 2009-09-07 16:21:27 UTC (rev 1577)
+++ trunk/db/schema.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20090726214545) do
+ActiveRecord::Schema.define(:version => 20090905094509) do
create_table "acts_as_xapian_jobs", :force => true do |t|
t.string "model", :null => false
@@ -19,6 +19,29 @@
add_index "acts_as_xapian_jobs", ["model", "model_id"], :name => "index_acts_as_xapian_jobs_on_model_and_model_id", :unique => true
+ create_table "chinese_answers", :force => true do |t|
+ t.integer "chinese_portrait_id"
+ t.integer "question_nb"
+ t.string "answer"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "chinese_opinions", :force => true do |t|
+ t.integer "chinese_portrait_id"
+ t.integer "question_nb"
+ t.string "answer"
+ t.integer "user_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "chinese_portraits", :force => true do |t|
+ t.integer "user_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "commentings", :force => true do |t|
t.integer "user_id", :null => false
t.integer "from_logi_id", :null => false
Added: trunk/test/fixtures/chinese_answers.yml
===================================================================
--- trunk/test/fixtures/chinese_answers.yml (rev 0)
+++ trunk/test/fixtures/chinese_answers.yml 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,11 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ chinese_portrait_id: 1
+ question_nb:
+ answer: MyString
+
+two:
+ chinese_portrait_id: 1
+ question_nb:
+ answer: MyString
Added: trunk/test/fixtures/chinese_opinions.yml
===================================================================
--- trunk/test/fixtures/chinese_opinions.yml (rev 0)
+++ trunk/test/fixtures/chinese_opinions.yml 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,13 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ chinese_portrait_id: 1
+ question_nb:
+ answer: MyString
+ user_id: 1
+
+two:
+ chinese_portrait_id: 1
+ question_nb:
+ answer: MyString
+ user_id: 1
Added: trunk/test/fixtures/chinese_portraits.yml
===================================================================
--- trunk/test/fixtures/chinese_portraits.yml (rev 0)
+++ trunk/test/fixtures/chinese_portraits.yml 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,7 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ user_id: 1
+
+two:
+ user_id: 1
Added: trunk/test/functional/chinese_portrait_controller_test.rb
===================================================================
--- trunk/test/functional/chinese_portrait_controller_test.rb (rev 0)
+++ trunk/test/functional/chinese_portrait_controller_test.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class ChinesePortraitControllerTest < ActionController::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
Added: trunk/test/unit/chinese_answer_test.rb
===================================================================
--- trunk/test/unit/chinese_answer_test.rb (rev 0)
+++ trunk/test/unit/chinese_answer_test.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class ChineseAnswerTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
Added: trunk/test/unit/chinese_opinion_test.rb
===================================================================
--- trunk/test/unit/chinese_opinion_test.rb (rev 0)
+++ trunk/test/unit/chinese_opinion_test.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class ChineseOpinionTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
Added: trunk/test/unit/chinese_portrait_test.rb
===================================================================
--- trunk/test/unit/chinese_portrait_test.rb (rev 0)
+++ trunk/test/unit/chinese_portrait_test.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class ChinesePortraitTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
Added: trunk/test/unit/helpers/chinese_portrait_helper_test.rb
===================================================================
--- trunk/test/unit/helpers/chinese_portrait_helper_test.rb (rev 0)
+++ trunk/test/unit/helpers/chinese_portrait_helper_test.rb 2009-09-08 10:28:53 UTC (rev 1578)
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class ChinesePortraitHelperTest < ActionView::TestCase
+end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <na...@us...> - 2009-09-07 16:21:35
|
Revision: 1577
http://logilogi.svn.sourceforge.net/logilogi/?rev=1577&view=rev
Author: natoine
Date: 2009-09-07 16:21:27 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
map resources corresponding for links, users, comments... see previous
commit ;)
Modified Paths:
--------------
trunk/config/routes.rb
Modified: trunk/config/routes.rb
===================================================================
--- trunk/config/routes.rb 2009-09-07 16:18:31 UTC (rev 1576)
+++ trunk/config/routes.rb 2009-09-07 16:21:27 UTC (rev 1577)
@@ -39,7 +39,8 @@
:name_prefix => '_hidden_',
:requirements => { :ll_link_string => /.*/ }
map.resources :users, :peer_group_admin_memberships, :peer_group_memberships,
- :user_groups, :prefs_profiles, :invitations, :votes,
+ :user_groups, :prefs_profiles, :invitations, :votes, :remarks, :comments, :links,
+ :ratings,
:path_prefix => 'do'
map.resources :peer_groups,
:path_prefix => 'do', :has_many => :invitations, :shallow => true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <na...@us...> - 2009-09-07 16:18:40
|
Revision: 1576
http://logilogi.svn.sourceforge.net/logilogi/?rev=1576&view=rev
Author: natoine
Date: 2009-09-07 16:18:31 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
Added method index for logis, comments, users, remarks and ratings
Modified Paths:
--------------
trunk/app/controllers/comments_controller.rb
trunk/app/controllers/logis_controller.rb
trunk/app/controllers/ratings_controller.rb
trunk/app/controllers/remarks_controller.rb
trunk/app/controllers/users_controller.rb
Modified: trunk/app/controllers/comments_controller.rb
===================================================================
--- trunk/app/controllers/comments_controller.rb 2009-09-07 16:16:50 UTC (rev 1575)
+++ trunk/app/controllers/comments_controller.rb 2009-09-07 16:18:31 UTC (rev 1576)
@@ -16,7 +16,7 @@
### Filters
- before_filter :resolve_context, :find_logi_and_logi_version
+ before_filter :resolve_context, :find_logi_and_logi_version, :except => :index
### Bodies
@@ -24,6 +24,15 @@
### REST-methods
+ def index
+ @comments = Commenting.find(:all)
+ respond_to do |format|
+ format.xml do
+ render :xml => @comments
+ end
+ end
+ end
+
def new
@selected = params[:selected] || 'new_logi'
@commenting_logi = Logi.new_with(:creator => current_user,
Modified: trunk/app/controllers/logis_controller.rb
===================================================================
--- trunk/app/controllers/logis_controller.rb 2009-09-07 16:16:50 UTC (rev 1575)
+++ trunk/app/controllers/logis_controller.rb 2009-09-07 16:18:31 UTC (rev 1576)
@@ -63,6 +63,10 @@
@incoming_links_to_tags = build_body :incoming_links_to_tags
render :template => 'logis/index.js.rjs'
end
+ format.xml do
+ @logis = Logi.find(:all)
+ render :xml => @logis
+ end
end
end
Modified: trunk/app/controllers/ratings_controller.rb
===================================================================
--- trunk/app/controllers/ratings_controller.rb 2009-09-07 16:16:50 UTC (rev 1575)
+++ trunk/app/controllers/ratings_controller.rb 2009-09-07 16:18:31 UTC (rev 1576)
@@ -17,12 +17,21 @@
### Filters
before_filter :resolve_context, :page_name,
- :except => [:listing]
+ :except => [:listing, :index ]
before_filter :find_logi_and_logi_version,
- :except => [:listing]
-
+ :except => [:listing, :index]
+
### REST-methods
-
+
+ def index
+ @ratings = Rating.find(:all)
+ respond_to do |format|
+ format.xml do
+ render :xml => @ratings
+ end
+ end
+ end
+
def show
end
end
Modified: trunk/app/controllers/remarks_controller.rb
===================================================================
--- trunk/app/controllers/remarks_controller.rb 2009-09-07 16:16:50 UTC (rev 1575)
+++ trunk/app/controllers/remarks_controller.rb 2009-09-07 16:18:31 UTC (rev 1576)
@@ -16,7 +16,7 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version
+ before_filter :resolve_context, :page_name, :find_logi_and_logi_version, :except => :index
### Bodies
@@ -24,7 +24,16 @@
: [:create, :edit, :destroy]
### REST-methods
-
+ def index
+ @remarks = Remark.find(:all)
+ respond_to do |format|
+ format.xml do
+ render :xml => @remarks
+ end
+ end
+ end
+
+
def create
if params[:positioned]
new_remark_position_range_list = self.weave_out_remarks(
Modified: trunk/app/controllers/users_controller.rb
===================================================================
--- trunk/app/controllers/users_controller.rb 2009-09-07 16:16:50 UTC (rev 1575)
+++ trunk/app/controllers/users_controller.rb 2009-09-07 16:18:31 UTC (rev 1576)
@@ -27,8 +27,17 @@
### Methods
def index
- @users = User.paginate(:page => params[:page], :per_page => 36)
- render :layout => 'broad'
+ # render :layout => 'broad'
+ respond_to do |format|
+ format.html do
+ @users = User.paginate(:page => params[:page], :per_page => 36)
+ render :layout => 'broad'
+ end
+ format.xml do
+ @users = User.find(:all)
+ render :xml => @users
+ end
+ end
end
def new
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <na...@us...> - 2009-09-07 16:16:57
|
Revision: 1575
http://logilogi.svn.sourceforge.net/logilogi/?rev=1575&view=rev
Author: natoine
Date: 2009-09-07 16:16:50 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
Added index method in links_controller.rb
Modified Paths:
--------------
trunk/app/controllers/links_controller.rb
Modified: trunk/app/controllers/links_controller.rb
===================================================================
--- trunk/app/controllers/links_controller.rb 2009-09-07 14:52:49 UTC (rev 1574)
+++ trunk/app/controllers/links_controller.rb 2009-09-07 16:16:50 UTC (rev 1575)
@@ -17,7 +17,7 @@
### Filters
before_filter :resolve_context, :page_name,
- :find_logi_and_logi_version
+ :find_logi_and_logi_version, :except => :index
### Bodies
@@ -26,6 +26,15 @@
### REST-methods
+ def index
+ @links = Link.find(:all)
+ respond_to do |format|
+ format.xml do
+ render :xml => @links
+ end
+ end
+ end
+
def create
self.insert_links(@logi, @logi_version, params[:body_with_inserts])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-07 14:52:58
|
Revision: 1574
http://logilogi.svn.sourceforge.net/logilogi/?rev=1574&view=rev
Author: wybow
Date: 2009-09-07 14:52:49 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
Prepared daemons for development
Modified Paths:
--------------
trunk/app/views/layouts/_title_bar.html.erb
trunk/doc/README_FOR_APP
trunk/lib/daemons/logilogi.rb
trunk/lib/daemons/logilogi_ctl
trunk/lib/tasks/daemons.rake
trunk/test/unit/user_test.rb
Modified: trunk/app/views/layouts/_title_bar.html.erb
===================================================================
--- trunk/app/views/layouts/_title_bar.html.erb 2009-09-07 10:01:39 UTC (rev 1573)
+++ trunk/app/views/layouts/_title_bar.html.erb 2009-09-07 14:52:49 UTC (rev 1574)
@@ -20,7 +20,7 @@
<a href="/"><img src="/images/logo.png" alt="LogiLogi book logo" />
<div id="header_text">
<div id="site_link">
- <%= site_link(:length => 18) %>
+ <%= site_link(:length => 17) %>
</div>
<div id="version" title="The second version of LogiLogi, now in public beta">
Manta
Modified: trunk/doc/README_FOR_APP
===================================================================
--- trunk/doc/README_FOR_APP 2009-09-07 10:01:39 UTC (rev 1573)
+++ trunk/doc/README_FOR_APP 2009-09-07 14:52:49 UTC (rev 1574)
@@ -84,6 +84,7 @@
authlogic-oid[http://authlogic-oid.rubyforge.org],
quantipay-authlogic_haapi[http://github.com/quantipay/authlogic_haapi/tree/master],
ratom[http://ratom.rubyforge.org/],
+json[http://json.rubyforge.org/],
mislav-will_paginate[http://wiki.github.com/mislav/will_paginate/],
positionrange[http://positionrange.rubyforge.org],
difflcs[http://difflcs.rubyforge.org],
@@ -103,7 +104,7 @@
Then You can install them with:
gem install daemons rubyzip ruby-openid authlogic authlogic-oid
- quantipay-authlogic_haapi ratom mislav-will_paginate authlogic
+ quantipay-authlogic_haapi ratom json mislav-will_paginate authlogic
positionrange difflcs textweaver mysql rmagick
(as root, same here as with Rails installation)
Modified: trunk/lib/daemons/logilogi.rb
===================================================================
--- trunk/lib/daemons/logilogi.rb 2009-09-07 10:01:39 UTC (rev 1573)
+++ trunk/lib/daemons/logilogi.rb 2009-09-07 14:52:49 UTC (rev 1574)
@@ -2,10 +2,12 @@
$rtpid = nil
+RAILS_ENV = ARGV[0]
+
Signal.trap("TERM") do
if $rtpid
Process.kill("TERM", $rtpid)
- Pocess.waitpid($rtpid)
+ Process.waitpid($rtpid)
end
exit
end
@@ -22,11 +24,11 @@
loop do
trapped_system "cd #{File.dirname(__FILE__)}/../..;" +
- " nice -n 17 rake daemons:run:constant RAILS_ENV=production"
+ " nice -n 17 rake daemons:run:constant RAILS_ENV=" + RAILS_ENV
if Time.now.hour > 3 and done_daily == false
- trapped_system "cd #{File.dirname(__FILE__)}/../..;" +
- " nice -n 17 rake daemons:run:daily RAILS_ENV=production"
+ trapped_system "cd #{File.dirname(__FILE__)}/../..;" +
+ " nice -n 17 rake daemons:run:daily RAILS_ENV=" + RAILS_ENV
$done_daily = true
end
$done_daily = false if Time.now.hour < 3
Modified: trunk/lib/daemons/logilogi_ctl
===================================================================
--- trunk/lib/daemons/logilogi_ctl 2009-09-07 10:01:39 UTC (rev 1573)
+++ trunk/lib/daemons/logilogi_ctl 2009-09-07 14:52:49 UTC (rev 1574)
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
require 'rubygems'
+require 'active_support'
require "daemons"
require 'yaml'
require 'erb'
-require 'active_support'
#require File.dirname(__FILE__) + "/../../config/initializers/daemons.rb"
options = YAML.load(
Modified: trunk/lib/tasks/daemons.rake
===================================================================
--- trunk/lib/tasks/daemons.rake 2009-09-07 10:01:39 UTC (rev 1573)
+++ trunk/lib/tasks/daemons.rake 2009-09-07 14:52:49 UTC (rev 1574)
@@ -10,12 +10,12 @@
desc "Starts the deamons of LogiLogi"
task :start do
- sh "lib/daemons/logilogi_ctl start"
+ sh "lib/daemons/logilogi_ctl start -- " + RAILS_ENV
end
desc "Stops the deamons of LogiLogi"
task :stop do
- sh "lib/daemons/logilogi_ctl stop"
+ sh "lib/daemons/logilogi_ctl stop -- " + RAILS_ENV
end
namespace :run do
Modified: trunk/test/unit/user_test.rb
===================================================================
--- trunk/test/unit/user_test.rb 2009-09-07 10:01:39 UTC (rev 1573)
+++ trunk/test/unit/user_test.rb 2009-09-07 14:52:49 UTC (rev 1574)
@@ -89,13 +89,21 @@
:name => 'Log Nes', :email => 'dr...@la...'}
u = User.new(hash)
assert u.save
- ActsAsXapian.update_index(true, false) # Needed here
+ u.reload
+ l = u.home_page_link
+ l.resolve
+ home_perma_id = l.volatile_to_logi.perma_id
+
+ # Needed here to find home-page for deletion
+ ActsAsXapian.update_index(true, false)
+
assert u.destroy
# Homepage destroyed
l = Link.new_from_s('Log_Nes/' + Tag.user.to_s)
l.resolve(:force => true)
assert !l.found_logi?
+ assert !Logi.find_by_perma_id(home_perma_id)
u2 = User.new(hash)
assert u2.save
@@ -162,6 +170,7 @@
def test_destroy_reset_dependents
u = users(:john_johnson)
+ l_id = u.created_logis.last.id
assert u.destroy
assert [], Link.find_by_user_id(u.id)
assert [], Link.find_by_user_id(nil)
@@ -169,6 +178,8 @@
assert [], Logi.find_by_creator_user_id(nil)
assert [], LogiVersion.find_by_editor_user_id(u.id)
assert [], LogiVersion.find_by_editor_user_id(nil)
+ l = Logi.find(l_id)
+ assert_equal User.anonymous, l.creator
end
def test_destroy_homepage
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-07 10:01:49
|
Revision: 1573
http://logilogi.svn.sourceforge.net/logilogi/?rev=1573&view=rev
Author: wybow
Date: 2009-09-07 10:01:39 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
Fixed bug in test, fixed logi at bottom submit after err
Modified Paths:
--------------
trunk/app/views/comments/_new.html.erb
trunk/app/views/comments/create.js.rjs
trunk/test/functional/perma_links_controller_test.rb
Modified: trunk/app/views/comments/_new.html.erb
===================================================================
--- trunk/app/views/comments/_new.html.erb 2009-09-07 08:08:34 UTC (rev 1572)
+++ trunk/app/views/comments/_new.html.erb 2009-09-07 10:01:39 UTC (rev 1573)
@@ -23,7 +23,9 @@
<% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
<label><%= _('Submit') %></label>
- <%= form.submit _('Submit'), : "tinyMCE.triggerSave(); $('logi_form').onsubmit()" %>
+ <%= form.submit _('Submit'), : "tinyMCE.triggerSave();" +
+ " tinyMCE.execCommand('mceRemoveControl', false, 'logi_edit_body');" +
+ " $('logi_form').onsubmit()" %>
<%= cancel_button :url => logi_url(@logi) %>
<% end %>
<% else %>
Modified: trunk/app/views/comments/create.js.rjs
===================================================================
--- trunk/app/views/comments/create.js.rjs 2009-09-07 08:08:34 UTC (rev 1572)
+++ trunk/app/views/comments/create.js.rjs 2009-09-07 10:01:39 UTC (rev 1573)
@@ -1,2 +1,2 @@
-page.replace_html @selected, :partial => 'new',
+page.replace @selected, :partial => 'new',
:locals => {:selected => @selected}
Modified: trunk/test/functional/perma_links_controller_test.rb
===================================================================
--- trunk/test/functional/perma_links_controller_test.rb 2009-09-07 08:08:34 UTC (rev 1572)
+++ trunk/test/functional/perma_links_controller_test.rb 2009-09-07 10:01:39 UTC (rev 1573)
@@ -26,22 +26,37 @@
# REST-methods
+
def test_create
l = logis(:logi_logi)
nr_of_l = l.from_links.size
l_v = l.current_logi_version
b_t = l_v.body
- l_l_tag = "Manta"
- l_l = "http://en.edge.logilogi.org/" + l_l_tag # The inserted link
+ manta = logis(:logi_logi_manta)
+ l_l = "http://en.edge.logilogi.org/" + manta.link.to_s # The inserted link
new_b_t = b_t[0...49] + "<a title=\"" + l_l + "\">" +
b_t[49...63] + "</a>" + b_t[63...-1]
post :create, {:ll_link_string => l.link.to_s,
:body_with_inserts => new_b_t}.merge(self.thorny_ok_hash)
- assert_response :success
+ assert_response :redirect
assert_equal nr_of_l + 1, l.from_links.size
- manta_l = l.from_links.find_by_requested_tags_string(l_l_tag)
+ manta_l = l.from_links.find_by_to_logi_id(manta.id)
assert manta_l
assert_equal l_v.raw_title.size + 49, manta_l.position_ranges.first.first
assert_equal l_v.raw_title.size + 63, manta_l.position_ranges.first.last
end
+
+ def test_create_only_perma_links
+ l = logis(:logi_logi)
+ nr_of_l = l.from_links.size
+ l_v = l.current_logi_version
+ b_t = l_v.body
+ l_l_tag = "Manta"
+ l_l = "http://en.edge.logilogi.org/" + l_l_tag # The inserted link
+ new_b_t = b_t[0...49] + "<a title=\"" + l_l + "\">" +
+ b_t[49...63] + "</a>" + b_t[63...-1]
+ post :create, {:ll_link_string => l.link.to_s,
+ :body_with_inserts => new_b_t}.merge(self.thorny_ok_hash)
+ assert_equal nr_of_l, l.from_links.size # no new link
+ end
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-07 08:08:40
|
Revision: 1572
http://logilogi.svn.sourceforge.net/logilogi/?rev=1572&view=rev
Author: wybow
Date: 2009-09-07 08:08:34 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
RJS for error cases on comments
Added Paths:
-----------
trunk/app/views/comments/create.js.rjs
Added: trunk/app/views/comments/create.js.rjs
===================================================================
--- trunk/app/views/comments/create.js.rjs (rev 0)
+++ trunk/app/views/comments/create.js.rjs 2009-09-07 08:08:34 UTC (rev 1572)
@@ -0,0 +1,2 @@
+page.replace_html @selected, :partial => 'new',
+ :locals => {:selected => @selected}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-06 22:18:53
|
Revision: 1571
http://logilogi.svn.sourceforge.net/logilogi/?rev=1571&view=rev
Author: wybow
Date: 2009-09-06 22:18:42 +0000 (Sun, 06 Sep 2009)
Log Message:
-----------
Updated func tests
Modified Paths:
--------------
trunk/test/functional/comments_controller_test.rb
trunk/test/functional/perma_links_controller_test.rb
Modified: trunk/test/functional/comments_controller_test.rb
===================================================================
--- trunk/test/functional/comments_controller_test.rb 2009-09-06 22:14:14 UTC (rev 1570)
+++ trunk/test/functional/comments_controller_test.rb 2009-09-06 22:18:42 UTC (rev 1571)
@@ -35,7 +35,7 @@
:perma_link => "http://en.edge.logilogi.org/" +
l2.link.to_s}.merge(self.thorny_ok_hash)
- assert_redirected_to @controller.logi_ll_url(l)
+ assert_response :success
l.reload
assert_equal l.commenting_logis.size, nr_of_c_l + 1
end
@@ -48,7 +48,7 @@
:logi => {:title => 'K',
:body => '<p>akatu</p>'}}.merge(self.thorny_ok_hash)
- assert_redirected_to @controller.logi_ll_url(l)
+ assert_response :success
l.reload
assert_equal l.commenting_logis.size, nr_of_c_l + 1
c_ls = Logi.find_all_by_text_stack('<h1>K</h1> <p>akatu</p>')
Modified: trunk/test/functional/perma_links_controller_test.rb
===================================================================
--- trunk/test/functional/perma_links_controller_test.rb 2009-09-06 22:14:14 UTC (rev 1570)
+++ trunk/test/functional/perma_links_controller_test.rb 2009-09-06 22:18:42 UTC (rev 1571)
@@ -37,7 +37,7 @@
b_t[49...63] + "</a>" + b_t[63...-1]
post :create, {:ll_link_string => l.link.to_s,
:body_with_inserts => new_b_t}.merge(self.thorny_ok_hash)
- assert_response :redirect
+ assert_response :success
assert_equal nr_of_l + 1, l.from_links.size
manta_l = l.from_links.find_by_requested_tags_string(l_l_tag)
assert manta_l
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-06 22:14:32
|
Revision: 1570
http://logilogi.svn.sourceforge.net/logilogi/?rev=1570&view=rev
Author: wybow
Date: 2009-09-06 22:14:14 +0000 (Sun, 06 Sep 2009)
Log Message:
-----------
Fixed add logi below, removed help-tab
Modified Paths:
--------------
trunk/app/controllers/application_controller.rb
trunk/app/controllers/comments_controller.rb
trunk/app/controllers/logis_controller.rb
trunk/app/controllers/perma_links_controller.rb
trunk/app/controllers/votes_controller.rb
trunk/app/models/logi_version.rb
trunk/app/views/comments/_new.html.erb
trunk/app/views/layouts/_title_bar.html.erb
trunk/app/views/logis/_commenting_logis.html.erb
trunk/app/views/logis/_edit_with_tags.html.erb
trunk/app/views/logis/_remarks.html.erb
trunk/app/views/votes/create.js.rjs
trunk/test/unit/logi_version_test.rb
Modified: trunk/app/controllers/application_controller.rb
===================================================================
--- trunk/app/controllers/application_controller.rb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/controllers/application_controller.rb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -191,6 +191,11 @@
end
end
+ def rating_and_new_vote
+ @rating = @logi.rating_for(self.current_prefs.peer_group)
+ @vote = @rating.vote_for(self.current_user, request.env['REMOTE_ADDR'])
+ end
+
# Sub-urls of logi: links, tags, votes and ratings
#
# Happlily keeping DRY :)
@@ -391,7 +396,7 @@
return logi, logi_version
end
- def insert_links(logi, logi_version, body_with_links)
+ def insert_links(logi, logi_version, body_with_links, options = {})
new_link_position_range_list = self.weave_out_links(body_with_links, logi_version, logi)
if new_link_position_range_list.empty?
logi.errors.add(:text, _('You need to select some text to add the link to' +
@@ -412,6 +417,9 @@
added_link.from_logi = logi
added_link.resolve
added_link.quick_validate
+ if options[:require_to_logi] and added_link.to_logi.nil?
+ added_link.errors.add(:link, 'needs to be to a specific logi')
+ end
transfer_errors(added_link, logi, :attribute => :link)
}
Modified: trunk/app/controllers/comments_controller.rb
===================================================================
--- trunk/app/controllers/comments_controller.rb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/controllers/comments_controller.rb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -32,32 +32,39 @@
render :partial => 'new.html.erb', :locals => {
:selected => @selected}
end
+ # needed to switch tags after error
+ alias :show :new
def create
- if params[:perma_link] and !params[:perma_link].empty?
+ if params[:perma_link] and !params[:positioned]
@link = Link.new_from_s(params[:perma_link])
@link.resolve
- if @link.errors.empty? and @link.to_logi and
+ if !@link.to_logi
+ @link.errors.add(:link, 'must be to a specific logi')
+ end
+
+ if @link.errors.empty?
self.thorny_form_free_of_spam?
- commenting = Commenting.new(:from_logi => @logi,
+ @commenting = Commenting.new(:from_logi => @logi,
:to_logi => @link.volatile_to_logi, :user => current_user)
- commenting.save
+ @commenting.save
flash[:notice] = "Successfully added replying logi" +
" #{@link.volatile_to_logi.to_s(:for => :full_show)}"
- redirect_to logi_ll_url(@logi)
+ render :update do |page|
+ page.redirect_to logi_ll_url(@logi)
+ end
else
- transfer_errors(@link, @logi, :comment_link)
+ transfer_errors(@link, @logi, :attribute => :comment_link)
flash[:error] = "Problem connecting replying logi"
@selected = 'existing_logi'
- render :template => 'logis/show'
end
- else
- commenting_logi, commenting_logi_version = self.create_logi(
+ else # new logi, possibly positioned
+ @commenting_logi, @commenting_logi_version = self.create_logi(
params[:logi], :untagged => true)
- commenting = Commenting.new(:from_logi => @logi,
- :to_logi => commenting_logi, :user => current_user)
+ @commenting = Commenting.new(:from_logi => @logi,
+ :to_logi => @commenting_logi, :user => current_user)
body_with_inserts = params[:body_with_inserts]
if params[:positioned] and
@@ -66,35 +73,42 @@
' to add the replying logi to')
end
- transfer_errors(commenting_logi, @logi)
+ transfer_errors(@commenting_logi, @logi)
- if @logi.errors.empty? and commenting_logi_version.valid? and
- commenting.valid? and self.thorny_form_free_of_spam?
+ if @logi.errors.empty? and @commenting_logi_version.valid? and
+ @commenting.valid? and self.thorny_form_free_of_spam?
# we can save as we know the link is valid on the logi
- commenting_logi.save
- commenting.save
+ @commenting_logi.save
+ @commenting.save
if params[:positioned]
body_with_comment_link = self.insert_comment_link(
- body_with_inserts, commenting_logi)
+ body_with_inserts, @commenting_logi)
self.insert_links(@logi, @logi_version, body_with_comment_link)
end
- if @logi.errors.empty?
- flash[:notice] = "Successfully created replying logi" +
- " #{commenting_logi.to_s(:for => :full_show)}"
+ flash[:notice] = "Successfully created replying logi" +
+ " #{@commenting_logi.to_s(:for => :full_show)}"
+
+ if params[:positioned]
redirect_to logi_ll_url(@logi)
else
+ render :update do |page|
+ page.redirect_to logi_ll_url(@logi)
+ end
+ end
+ else
+ transfer_errors(@commenting_logi_version, @logi_version)
+
+ if params[:positioned]
flash[:error] = "Problem creating replying logi"
@selected = 'comment'
render :template => 'logi_inserts/new'
+ return
+ else
+ flash[:error] = "Problem creating replying logi"
+ @selected = 'new_logi'
end
- else
- transfer_errors(commenting_logi_version, @logi_version)
-
- flash[:error] = "Problem creating replying logi"
- @selected = 'comment'
- render :template => 'logi_inserts/new'
end
end
end
Modified: trunk/app/controllers/logis_controller.rb
===================================================================
--- trunk/app/controllers/logis_controller.rb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/controllers/logis_controller.rb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -70,8 +70,7 @@
@selected = params[:selected]
respond_to do |format|
format.html do
- @rating = @logi.rating_for(self.current_prefs.peer_group)
- @vote = @rating.vote_for(self.current_user, request.env['REMOTE_ADDR'])
+ self.rating_and_new_vote
if params[:printer_friendly]
render :action => 'printer_friendly', :layout => false
Modified: trunk/app/controllers/perma_links_controller.rb
===================================================================
--- trunk/app/controllers/perma_links_controller.rb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/controllers/perma_links_controller.rb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -27,7 +27,8 @@
### REST-methods
def create
- self.insert_links(@logi, @logi_version, params[:body_with_inserts])
+ self.insert_links(@logi, @logi_version, params[:body_with_inserts],
+ :require_to_logi => true)
if @logi.errors.empty? and self.thorny_form_free_of_spam?
flash[:notice] = "Successfully added link to specific logi"
Modified: trunk/app/controllers/votes_controller.rb
===================================================================
--- trunk/app/controllers/votes_controller.rb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/controllers/votes_controller.rb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -39,8 +39,7 @@
def create
begin
Rating.transaction do
- @rating = @logi.rating_for(self.current_prefs.peer_group)
- @vote = @rating.vote_for(self.current_user, request.env['REMOTE_ADDR'])
+ self.rating_and_new_vote
@vote.score = params[:score].to_i
@rating.vote(@vote)
end
Modified: trunk/app/models/logi_version.rb
===================================================================
--- trunk/app/models/logi_version.rb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/models/logi_version.rb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -43,7 +43,7 @@
validates_uniqueness_of :nr, :scope => :logi_id
validates_presence_of :text
validates_presence_of :title
- validates_presence_of :body
+ validates_format_of :body, :with => /<p>.+<\/p>/, :message => 'cannot be empty'
###### Cached Methods
Modified: trunk/app/views/comments/_new.html.erb
===================================================================
--- trunk/app/views/comments/_new.html.erb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/views/comments/_new.html.erb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -10,16 +10,25 @@
:selected => selected, :id => "new_comment", :update_selected => true} do %>
<% end %>
-<% thorny_form_for(@commenting_logi, :url => logi_comments_path(:force => true),
- :method => :post, :html => {:id => "logi_form"}) do |form| %>
+<% remote_thorny_form_for(@logi,
+ :url => logi_comments_path(:force => true),
+ :html => {:method => :post, :id => "logi_form"}) do |form| %>
<% if selected == "new_logi" %>
-
<%= show_errors 'logi_version','logi' %>
<%= render :partial => 'logis/edit', :locals => {
- :name => 'logi', :logi_version => @commenting_logi_version} %>
+ :name => 'logi', :logi => @commenting_logi,
+ :logi_version => @commenting_logi_version} %>
+
+ <% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
+ <label><%= _('Submit') %></label>
+ <%= form.submit _('Submit'), : "tinyMCE.triggerSave(); $('logi_form').onsubmit()" %>
+ <%= cancel_button :url => logi_url(@logi) %>
+ <% end %>
<% else %>
+ <%= show_errors 'logi' %>
+
<% render :layout => 'application/panel', :locals => {:id => 'link_perma_id'} do %>
<label id="perma_link_label">Permanent Link</label>
<%= text_field_tag 'perma_link', nil, :id => "perma_link", :autocomplete => "off" %>
@@ -28,13 +37,13 @@
<% end %>
<%= render :partial => 'logis/check', :locals => {:name => 'comment'} %>
+
+ <% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
+ <label><%= _('Submit') %></label>
+ <%= form.submit _('Submit'), : "$('logi_form').onsubmit()" %>
+ <%= cancel_button :url => logi_url(@logi) %>
+ <% end %>
<% end -%>
-
- <% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
- <label><%= _('Submit') %></label>
- <%= form.submit _('Submit'), : "$('logi_form').submit()" %>
- <%= cancel_button :url => logi_url(@logi) %>
- <% end %>
<% end %>
<% javascript_tag do -%>
Modified: trunk/app/views/layouts/_title_bar.html.erb
===================================================================
--- trunk/app/views/layouts/_title_bar.html.erb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/views/layouts/_title_bar.html.erb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -48,7 +48,6 @@
<li id="primarytabs_changes"><%= link_to _('changes'), changes_url %></li>
<li id="primarytabs_groups"><%= link_to _('groups'), peer_groups_url %></li>
<li id="primarytabs_users"><%= link_to _('users'), users_url %></li>
- <li id="primarytabs_help"><%= link_to _('help'), logi_url('Help') %></li>
</ul>
</div>
<div class="spacer"></div>
Modified: trunk/app/views/logis/_commenting_logis.html.erb
===================================================================
--- trunk/app/views/logis/_commenting_logis.html.erb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/views/logis/_commenting_logis.html.erb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -1,4 +1,5 @@
-<% render :layout => 'application/panel_with_header', :locals => {:title => _("Replying Logis"), :id => "commenting"} do %>
+<% render :layout => 'application/panel_with_header',
+ :locals => {:title => _("Replying Logis"), :id => "commenting"} do %>
<div class="mirrored_notice_cloud"><%= _('Want to give a more in-depth response ?') %></div>
<div class="description">
<p><%= _('%{nr} Logis are replying') % {:nr => logis.size} %></p>
Modified: trunk/app/views/logis/_edit_with_tags.html.erb
===================================================================
--- trunk/app/views/logis/_edit_with_tags.html.erb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/views/logis/_edit_with_tags.html.erb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -11,7 +11,7 @@
<div class="main_column">
<%= render :partial => 'edit', :locals => {
- :name => 'logi', :logi_version => @logi_version} %>
+ :name => 'logi', :logi => @logi, :logi_version => @logi_version} %>
<% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
<label><%= _('Submit') %></label>
Modified: trunk/app/views/logis/_remarks.html.erb
===================================================================
--- trunk/app/views/logis/_remarks.html.erb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/views/logis/_remarks.html.erb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -1,13 +1,15 @@
<% render :layout => 'application/panel_with_header', :locals => {:title => _("Remarks"), :id => "remarking"} do %>
<div class="notice_cloud"><%= _('Short remark to author ?') %></div>
- <% remote_thorny_form_for([@logi, @remark], :update => {:success => 'remarks', :failure => 'errors'},
+ <% remote_thorny_form_for([@logi, @remark], :update => 'remarks',
:html => {:id => "create_remark"}) do |form| %>
<%= text_area :remark, :message %>
<%= form.submit _('add remark'), : "$('create_remark').onsubmit()", :class => 'add_button' %>
<% end %>
<div class="spacer"></div>
<% end %>
+
<%= show_errors 'remark' %>
+
<%= render :partial => 'remarks/list.html.erb', :locals => {:remarks => @remarks} %>
<% javascript_tag do -%>
Modified: trunk/app/views/votes/create.js.rjs
===================================================================
--- trunk/app/views/votes/create.js.rjs 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/app/views/votes/create.js.rjs 2009-09-06 22:14:14 UTC (rev 1570)
@@ -1,3 +1,7 @@
-page.replace_html 'ratings', :partial => 'votes/show', :locals => {:vote => @vote, :rating => @rating}
-page.replace_html 'votes', :partial => "logis/recent_votes", :locals => {:votes => @votes}
-page.replace_html_if_exists 'rating_current', :partial => "logis/rating_current", :locals => {:rating => @rating}
+page.replace_html 'ratings', :partial => 'votes/show',
+ :locals => {:vote => @vote, :rating => @rating}
+page.replace_html 'votes', :partial => "logis/recent_votes",
+ :locals => {:votes => @votes}
+page.replace_html_if_exists 'rating_current',
+ :partial => "logis/rating_current",
+ :locals => {:rating => @rating}
Modified: trunk/test/unit/logi_version_test.rb
===================================================================
--- trunk/test/unit/logi_version_test.rb 2009-09-06 14:04:49 UTC (rev 1569)
+++ trunk/test/unit/logi_version_test.rb 2009-09-06 22:14:14 UTC (rev 1570)
@@ -47,6 +47,45 @@
assert !l.save
end
+ def test_body_and_title_validation
+ john = users(:john_johnson)
+ l = Logi.new_with(:creator => john,
+ :text => '<h1>Tit</h1> <p></p>',
+ :user_group => john.default_prefs_profile.user_group)
+ l.tag_with_link(Link.new_from_s('Economics/Netherlands'))
+ assert !l.save
+
+ l = Logi.new_with(:creator => john,
+ :text => '<h1></h1> <p>mooo</p>',
+ :user_group => john.default_prefs_profile.user_group)
+ l.tag_with_link(Link.new_from_s('Economics/Netherlands'))
+ assert !l.save
+
+ l = Logi.new_with(:creator => john,
+ :text => '<h1>Tit</h1> <p>mooo</p>',
+ :user_group => john.default_prefs_profile.user_group)
+ l.tag_with_link(Link.new_from_s('Economics/Netherlands'))
+ assert l.save
+
+ l = Logi.new_with(:creator => john,
+ :title => 'Tit', :body => '',
+ :user_group => john.default_prefs_profile.user_group)
+ l.tag_with_link(Link.new_from_s('Economics/Netherlands'))
+ assert !l.save
+
+ l = Logi.new_with(:creator => john,
+ :title => '', :body => 'bo',
+ :user_group => john.default_prefs_profile.user_group)
+ l.tag_with_link(Link.new_from_s('Economics/Netherlands'))
+ assert !l.save
+
+ l = Logi.new_with(:creator => john,
+ :title => 'Tit', :body => 'bo',
+ :user_group => john.default_prefs_profile.user_group)
+ l.tag_with_link(Link.new_from_s('Economics/Netherlands'))
+ assert l.save
+ end
+
def test_loading_and_saving_position_ranges
l_v = logi_versions(:michel_foucault_politics_medieval_peter_abelard_economics_v2)
p_r_string = l_v.position_ranges_string
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-06 14:04:56
|
Revision: 1569
http://logilogi.svn.sourceforge.net/logilogi/?rev=1569&view=rev
Author: wybow
Date: 2009-09-06 14:04:49 +0000 (Sun, 06 Sep 2009)
Log Message:
-----------
Fixed add commenting logi below bug
Modified Paths:
--------------
trunk/app/controllers/application_controller.rb
trunk/app/controllers/comments_controller.rb
trunk/app/views/comments/_new.html.erb
Modified: trunk/app/controllers/application_controller.rb
===================================================================
--- trunk/app/controllers/application_controller.rb 2009-09-06 13:19:28 UTC (rev 1568)
+++ trunk/app/controllers/application_controller.rb 2009-09-06 14:04:49 UTC (rev 1569)
@@ -427,7 +427,13 @@
def tag_with_link(logi, link_string)
if link_string.empty?
- logi.untag
+ if logi.comments_on_logis.empty?
+ # TODO fix better
+ logi.errors.add(:tags, 'should not be empty if it is not a replying' +
+ ' logi')
+ else
+ logi.untag
+ end
return
end
Modified: trunk/app/controllers/comments_controller.rb
===================================================================
--- trunk/app/controllers/comments_controller.rb 2009-09-06 13:19:28 UTC (rev 1568)
+++ trunk/app/controllers/comments_controller.rb 2009-09-06 14:04:49 UTC (rev 1569)
@@ -26,9 +26,9 @@
def new
@selected = params[:selected] || 'new_logi'
- @logi = Logi.new_with(:creator => current_user,
+ @commenting_logi = Logi.new_with(:creator => current_user,
:user_group => current_prefs.user_group)
- @logi_version = @logi.current_logi_version
+ @commenting_logi_version = @commenting_logi.current_logi_version
render :partial => 'new.html.erb', :locals => {
:selected => @selected}
end
Modified: trunk/app/views/comments/_new.html.erb
===================================================================
--- trunk/app/views/comments/_new.html.erb 2009-09-06 13:19:28 UTC (rev 1568)
+++ trunk/app/views/comments/_new.html.erb 2009-09-06 14:04:49 UTC (rev 1569)
@@ -10,7 +10,7 @@
:selected => selected, :id => "new_comment", :update_selected => true} do %>
<% end %>
-<% thorny_form_for(@logi, :url => logi_comments_path(:force => true),
+<% thorny_form_for(@commenting_logi, :url => logi_comments_path(:force => true),
:method => :post, :html => {:id => "logi_form"}) do |form| %>
<% if selected == "new_logi" %>
@@ -18,7 +18,7 @@
<%= show_errors 'logi_version','logi' %>
<%= render :partial => 'logis/edit', :locals => {
- :name => 'logi', :logi_version => @logi_version} %>
+ :name => 'logi', :logi_version => @commenting_logi_version} %>
<% else %>
<% render :layout => 'application/panel', :locals => {:id => 'link_perma_id'} do %>
<label id="perma_link_label">Permanent Link</label>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-06 13:19:35
|
Revision: 1568
http://logilogi.svn.sourceforge.net/logilogi/?rev=1568&view=rev
Author: wybow
Date: 2009-09-06 13:19:28 +0000 (Sun, 06 Sep 2009)
Log Message:
-----------
Fixed confirm cancels
Modified Paths:
--------------
trunk/app/controllers/application_controller.rb
trunk/app/controllers/logi_settings_controller.rb
trunk/app/controllers/peer_groups_controller.rb
trunk/app/controllers/users_controller.rb
trunk/app/views/application/_confirm_delete.html.erb
trunk/app/views/application/_submit.html.erb
Modified: trunk/app/controllers/application_controller.rb
===================================================================
--- trunk/app/controllers/application_controller.rb 2009-09-06 11:28:43 UTC (rev 1567)
+++ trunk/app/controllers/application_controller.rb 2009-09-06 13:19:28 UTC (rev 1568)
@@ -301,7 +301,7 @@
def render_to_confirm_delete(options)
render :partial => 'application/confirm_delete', :layout => 'blank',
- :locals => {:text => options[:text], :url => options[:url]}
+ :locals => options
end
# Rewrites comma-, or space-separated tags to the logi-link format.
@@ -412,7 +412,7 @@
added_link.from_logi = logi
added_link.resolve
added_link.quick_validate
- transfer_errors(added_link, logi, :link)
+ transfer_errors(added_link, logi, :attribute => :link)
}
absolute_added_link_p_r_list =
@@ -432,7 +432,7 @@
end
link = Link.new_from_s(link_string)
- transfer_errors(link, logi, :tags)
+ transfer_errors(link, logi, :attribute => :tags)
if logi.errors.empty?
logi.tag_with_link(link)
@@ -446,7 +446,7 @@
self.weave_out(body_with_links, logi_version, logi) do |pos_range, inserted_string|
cluster_array = self.link_cluster_from_s(inserted_string)
cluster_array.each do |link|
- transfer_errors(link, logi, :link)
+ transfer_errors(link, logi, :attribute => :link)
end
if logi.errors.empty?
cluster_array.each {|link|
Modified: trunk/app/controllers/logi_settings_controller.rb
===================================================================
--- trunk/app/controllers/logi_settings_controller.rb 2009-09-06 11:28:43 UTC (rev 1567)
+++ trunk/app/controllers/logi_settings_controller.rb 2009-09-06 13:19:28 UTC (rev 1568)
@@ -39,7 +39,7 @@
if @logi.admin_rights?(current_user)
if params[:logi][:delete]
render_to_confirm_delete :text => 'Do you really want to delete this logi ?',
- :url => logi_url(@logi)
+ :url => logi_url(@logi), :cancel_url => logi_url(@logi)
elsif !@logi.user_group.public?
@logi.restriction = params[:logi][:restriction]
if @logi.save
Modified: trunk/app/controllers/peer_groups_controller.rb
===================================================================
--- trunk/app/controllers/peer_groups_controller.rb 2009-09-06 11:28:43 UTC (rev 1567)
+++ trunk/app/controllers/peer_groups_controller.rb 2009-09-06 13:19:28 UTC (rev 1568)
@@ -53,7 +53,8 @@
def update
render_to_confirm_delete :text => 'Do you want to delete this Peergroup ?',
- :url => peer_group_url(@peer_group)
+ :url => peer_group_url(@peer_group),
+ :cancel_url => edit_user_url(current_user)
end
def destroy
Modified: trunk/app/controllers/users_controller.rb
===================================================================
--- trunk/app/controllers/users_controller.rb 2009-09-06 11:28:43 UTC (rev 1567)
+++ trunk/app/controllers/users_controller.rb 2009-09-06 13:19:28 UTC (rev 1568)
@@ -76,7 +76,7 @@
if params[:user]
if params[:user][:delete]
render_to_confirm_delete :text => 'Are you sure you want to do this ?',
- :url => user_url(@user)
+ :url => user_url(@user), :cancel_url => edit_user_url(current_user)
return
end
@user.attributes = params[:user]
Modified: trunk/app/views/application/_confirm_delete.html.erb
===================================================================
--- trunk/app/views/application/_confirm_delete.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
+++ trunk/app/views/application/_confirm_delete.html.erb 2009-09-06 13:19:28 UTC (rev 1568)
@@ -4,7 +4,7 @@
<form action="<%= url %>" id="delete_form" method="post">
<%= hidden_field_tag '_method', 'delete' %>
<%= button_to_function _('Yes, delete!'), : "$('delete_form').submit()" %>
- <%= cancel_button %>
+ <%= cancel_button :url => cancel_url %>
</form>
<% end %>
</div>
Modified: trunk/app/views/application/_submit.html.erb
===================================================================
--- trunk/app/views/application/_submit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
+++ trunk/app/views/application/_submit.html.erb 2009-09-06 13:19:28 UTC (rev 1568)
@@ -1,5 +1,5 @@
<% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
<label><%= _('Submit') %></label>
<%= form.submit _('Submit') %>
- <%= cancel_buttoni :url => local_assigns[:cancel_url] %>
+ <%= cancel_button :url => local_assigns[:cancel_url] %>
<% end %>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-06 11:29:00
|
Revision: 1567
http://logilogi.svn.sourceforge.net/logilogi/?rev=1567&view=rev
Author: wybow
Date: 2009-09-06 11:28:43 +0000 (Sun, 06 Sep 2009)
Log Message:
-----------
Fixed cancel bug, improved descr of tags link
Modified Paths:
--------------
trunk/app/helpers/application_helper.rb
trunk/app/views/application/_submit.html.erb
trunk/app/views/comments/_new.html.erb
trunk/app/views/external_links/edit.html.erb
trunk/app/views/invitations/edit.html.erb
trunk/app/views/invitations/new.html.erb
trunk/app/views/links/edit.html.erb
trunk/app/views/logi_inserts/new.html.erb
trunk/app/views/logi_settings/edit.html.erb
trunk/app/views/logis/_edit_with_tags.html.erb
trunk/app/views/logis/_remarks.html.erb
trunk/app/views/password_resets/edit.html.erb
trunk/app/views/password_resets/new.html.erb
trunk/app/views/peer_groups/edit.html.erb
trunk/app/views/peer_groups/new.html.erb
trunk/app/views/remarks/edit.html.erb
trunk/app/views/searches/_navigation_bar_search_header.html.erb
trunk/app/views/user_sessions/_method.html.erb
trunk/app/views/users/_method.html.erb
trunk/app/views/users/edit.html.erb
trunk/lib/logi_form_builder.rb
Modified: trunk/app/helpers/application_helper.rb
===================================================================
--- trunk/app/helpers/application_helper.rb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/helpers/application_helper.rb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -141,7 +141,7 @@
{:text => _("Insert"), :name => "edit_insert",
:url => new_logi_logi_inserts_url(logi),
:description => _("Currently inserting into logi")},
- {:text => _("Remove"), :name => "edit_remove",
+ {:text => _("Take out"), :name => "edit_remove",
:url => edit_logi_remarks_url(logi),
:description => _("Currently removing from logi")},
{:text => _("Settings"), :name => "edit_settings",
@@ -587,9 +587,10 @@
end
end
- def cancel_button(text = nil)
- text ||= _("Cancel")
- button_to text, self.return_url_or_default, :class => 'cancel_button'
+ def cancel_button(options = {})
+ options[:text] ||= _("Cancel")
+ options[:url] ||= self.return_url_or_default
+ button_to options[:text], options[:url], :class => 'cancel_button'
end
def back_button(text = nil)
Modified: trunk/app/views/application/_submit.html.erb
===================================================================
--- trunk/app/views/application/_submit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/application/_submit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -1,4 +1,5 @@
<% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
<label><%= _('Submit') %></label>
<%= form.submit _('Submit') %>
+ <%= cancel_buttoni :url => local_assigns[:cancel_url] %>
<% end %>
Modified: trunk/app/views/comments/_new.html.erb
===================================================================
--- trunk/app/views/comments/_new.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/comments/_new.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -33,6 +33,7 @@
<% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
<label><%= _('Submit') %></label>
<%= form.submit _('Submit'), : "$('logi_form').submit()" %>
+ <%= cancel_button :url => logi_url(@logi) %>
<% end %>
<% end %>
Modified: trunk/app/views/external_links/edit.html.erb
===================================================================
--- trunk/app/views/external_links/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/external_links/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -56,6 +56,7 @@
<div class="spacer"></div>
<div class="main_column">
- <%= render :partial => 'application/submit', :locals => {:form => form} %>
+ <%= render :partial => 'application/submit', :locals => {:form => form,
+ :cancel_url => logi_url(@logi)} %>
</div>
<% end %>
Modified: trunk/app/views/invitations/edit.html.erb
===================================================================
--- trunk/app/views/invitations/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/invitations/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -21,6 +21,7 @@
<p>Accept your invitation</p>
<% end %>
<%= f.submit "Accept" %>
+ <%= cancel_button %>
<% end %>
<% end %>
<% else %>
Modified: trunk/app/views/invitations/new.html.erb
===================================================================
--- trunk/app/views/invitations/new.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/invitations/new.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -24,6 +24,7 @@
<%= f.radio_button :role, Const::PeerGroupMembership::MEMBER, :label => "Member", :label_class => 'behind' %>
<% end %>
<%= f.submit _('Send invitation') %>
+ <%= cancel_button :url => edit_user_url(current_user) %>
<% end %>
<% end %>
</div>
Modified: trunk/app/views/links/edit.html.erb
===================================================================
--- trunk/app/views/links/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/links/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -56,6 +56,7 @@
<div class="spacer"></div>
<div class="main_column">
- <%= render :partial => 'application/submit', :locals => {:form => form} %>
+ <%= render :partial => 'application/submit', :locals => {:form => form,
+ :cancel_url => logi_url(@logi)} %>
</div>
<% end %>
Modified: trunk/app/views/logi_inserts/new.html.erb
===================================================================
--- trunk/app/views/logi_inserts/new.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/logi_inserts/new.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -90,7 +90,7 @@
<% render :layout => 'application/panel_with_tabs_js', :locals => {
:tabs => [
{:text => _("Tags"), :name => "tags_link",
- :description => _("Insert a link to a set of tags")},
+ :description => _("Insert a link to all logis with the following tags")},
{:text => _("Specific Logi"), :name => "perma_link",
:description => _("Paste (Ctrl V) a permanent link to a specific logi")},
{:text => _("External Link"), :name => "external_link",
@@ -132,6 +132,7 @@
<%= form.submit _('Submit'),
: "body_inserter.prepare_action();" +
" $('insert_form').submit()" %>
+ <%= cancel_button :url => logi_url(@logi) %>
<% end %>
</div>
<% end %><!-- end panel_with_tabs_js -->
Modified: trunk/app/views/logi_settings/edit.html.erb
===================================================================
--- trunk/app/views/logi_settings/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/logi_settings/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -17,15 +17,16 @@
<% if !@logi.user_group.public? %>
<% render :layout => 'application/panel' do %>
<% form_for(@logi, :url => logi_logi_settings_path(@logi),
- :html => {:id => "permissions_form"}) do |f| %>
- <div class="field"><%= f.label 'Permissions:' %></div><br />
- <%= f.radio_button :restriction, Const::Logi::OVERSEER,
+ :html => {:id => "permissions_form"}) do |form| %>
+ <div class="field"><%= form.label 'Permissions:' %></div><br />
+ <%= form.radio_button :restriction, Const::Logi::OVERSEER,
:label => "Everybody is allowed to edit it",
:label_class => 'behind' %>
- <%= f.radio_button :restriction, Const::Logi::EDIT,
+ <%= form.radio_button :restriction, Const::Logi::EDIT,
:label => "Only you can edit it",
:label_class => 'behind' %>
- <%= f.submit _('Save') %>
+ <%= form.submit _('Save') %>
+ <%= cancel_button :url => logi_url(@logi) %>
<% end %>
<% end %>
<% end %>
@@ -38,6 +39,7 @@
<p>This will make it invisible</p>
<%= form.hidden_field 'delete', :value => 'true' %>
<%= form.submit _('Delete') %>
+ <%= cancel_button :url => logi_url(@logi) %>
<% end %>
<% end %>
</div>
Modified: trunk/app/views/logis/_edit_with_tags.html.erb
===================================================================
--- trunk/app/views/logis/_edit_with_tags.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/logis/_edit_with_tags.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -16,6 +16,7 @@
<% render :layout => 'application/panel', :locals => {:id => "submit"} do %>
<label><%= _('Submit') %></label>
<%= form.submit _('Submit'), : "logiEditPrepareLink(); $('logi_form').submit()" %>
+ <%= cancel_button :url => (@logi.new_record? ? nil : logi_url(@logi)) %>
<% end %>
<div class="spacer"></div>
</div>
Modified: trunk/app/views/logis/_remarks.html.erb
===================================================================
--- trunk/app/views/logis/_remarks.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/logis/_remarks.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -3,7 +3,7 @@
<% remote_thorny_form_for([@logi, @remark], :update => {:success => 'remarks', :failure => 'errors'},
:html => {:id => "create_remark"}) do |form| %>
<%= text_area :remark, :message %>
- <%= form.submit _('add remark'), :no_cancel => true, : "$('create_remark').onsubmit()", :class => 'add_button' %>
+ <%= form.submit _('add remark'), : "$('create_remark').onsubmit()", :class => 'add_button' %>
<% end %>
<div class="spacer"></div>
<% end %>
Modified: trunk/app/views/password_resets/edit.html.erb
===================================================================
--- trunk/app/views/password_resets/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/password_resets/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -6,11 +6,12 @@
<% end %>
<% render :layout => 'application/panel_with_header', :locals => {:title => _('New Password') } do %>
- <% form_for @user, :url => password_reset_path, :method => :put do |f| %>
- <%= f.error_messages %>
- <%= f.password_field :password %>
- <%= f.password_field :password_confirmation %>
- <%= f.submit "Update and log in" %>
+ <% form_for @user, :url => password_reset_path, :method => :put do |form| %>
+ <%= form.error_messages %>
+ <%= form.password_field :password %>
+ <%= form.password_field :password_confirmation %>
+ <%= form.submit "Update and log in" %>
+ <%= cancel_button :url => edit_user_url(current_user) %>
<% end %>
<% end %>
</div>
Modified: trunk/app/views/password_resets/new.html.erb
===================================================================
--- trunk/app/views/password_resets/new.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/password_resets/new.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -10,9 +10,10 @@
<%= show_flash %>
<% render :layout => 'application/panel_with_header', :locals => {:title => _('Your email') } do %>
- <% form_for @user, :url => password_resets_path do |f| %>
- <%= f.text_field :email %>
- <%= f.submit _('Reset my password') %>
+ <% form_for @user, :url => password_resets_path do |form| %>
+ <%= form.text_field :email %>
+ <%= form.submit _('Reset my password') %>
+ <%= cancel_button :url => edit_user_url(current_user) %>
<% end %>
<% end %>
</div>
Modified: trunk/app/views/peer_groups/edit.html.erb
===================================================================
--- trunk/app/views/peer_groups/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/peer_groups/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -16,6 +16,7 @@
<% form_for(@peer_group, :html => {:id => "delete_form"}) do |form| %>
<p><%= _("Remove the %{peer_group_ll_link} peergroup") %{:peer_group_ll_link => peer_group_ll_link(@peer_group)} %></p>
<%= form.submit _('Delete') %>
+ <%= cancel_button :url => edit_user_url(current_user) %>
<% end %>
<% end %>
</div>
Modified: trunk/app/views/peer_groups/new.html.erb
===================================================================
--- trunk/app/views/peer_groups/new.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/peer_groups/new.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -21,6 +21,7 @@
<p><%= _("Enter the name of your Peergroup") %></p>
<%= form.text_field 'name', :label => _("Peergroup Name") %>
<%= form.submit _('Create') %>
+ <%= cancel_button :url => edit_user_url(current_user) %>
<% end %>
<% end %>
</div>
Modified: trunk/app/views/remarks/edit.html.erb
===================================================================
--- trunk/app/views/remarks/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/remarks/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -56,6 +56,7 @@
<div class="spacer"></div>
<div class="main_column">
- <%= render :partial => 'application/submit', :locals => {:form => form} %>
+ <%= render :partial => 'application/submit', :locals => {:form => form,
+ :cancel_url => logi_url(@logi)} %>
</div>
<% end %>
Modified: trunk/app/views/searches/_navigation_bar_search_header.html.erb
===================================================================
--- trunk/app/views/searches/_navigation_bar_search_header.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/searches/_navigation_bar_search_header.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -3,6 +3,6 @@
<% form_for(:search, nil, :url => searches_url()) do |form| %>
<%= form.text_field :query, :name => :query, :value => @query,
:no_label => true, :id => 'search_query' %>
- <%= form.submit _('Search'), :no_cancel => true, :id => 'search_button' %>
+ <%= form.submit _('Search'), :id => 'search_button' %>
<% end %>
<div class="spacer"></div>
Modified: trunk/app/views/user_sessions/_method.html.erb
===================================================================
--- trunk/app/views/user_sessions/_method.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/user_sessions/_method.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -12,15 +12,16 @@
new_password_reset_path %>.</p>
<% end %>
- <% form_for @user_session, :url => user_session_path do |f| %>
+ <% form_for @user_session, :url => user_session_path do |form| %>
<% if selected == "normal" %>
- <%= f.text_field :email %>
- <%= f.password_field :password %>
+ <%= form.text_field :email %>
+ <%= form.password_field :password %>
<% else %>
- <%= f.text_field :openid_identifier %>
+ <%= form.text_field :openid_identifier %>
<% end %>
- <%= f.check_box :remember_me, :checked => true, :label_class => 'behind' %>
- <%= f.submit _('Login') %>
+ <%= form.check_box :remember_me, :checked => true, :label_class => 'behind' %>
+ <%= form.submit _('Login') %>
+ <%= cancel_button %>
<% end -%>
<% end %>
Modified: trunk/app/views/users/_method.html.erb
===================================================================
--- trunk/app/views/users/_method.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/users/_method.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -14,17 +14,18 @@
</p>
<% end %>
- <% form_for(@user, :html => {:id => "new_form"}) do |f| %>
- <%= f.text_field 'name', :label => _("Full Name") %>
- <%= f.text_field 'email' %>
+ <% form_for(@user, :html => {:id => "new_form"}) do |form| %>
+ <%= form.text_field 'name', :label => _("Full Name") %>
+ <%= form.text_field 'email' %>
<% if selected == "normal" %>
- <%= f.password_field :password %>
- <%= f.password_field :password_confirmation %>
- <%= f.submit _('Complete!') %>
+ <%= form.password_field :password %>
+ <%= form.password_field :password_confirmation %>
+ <%= form.submit _('Complete!') %>
<% else %>
- <%= f.text_field :openid_identifier %>
- <%= f.submit _('Continue') %>
+ <%= form.text_field :openid_identifier %>
+ <%= form.submit _('Continue') %>
<% end %>
+ <%= cancel_button %>
<% end %>
<% end %>
Modified: trunk/app/views/users/edit.html.erb
===================================================================
--- trunk/app/views/users/edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/app/views/users/edit.html.erb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -20,6 +20,7 @@
options_from_collection_for_select(
peer_groups, 'id', 'name', @prefs_profile.default_peer_group.id) %>
<%= form.submit _('Save') %>
+ <%= cancel_button %>
<% end %>
<% end %>
@@ -29,14 +30,15 @@
<% end %>
<% render :layout => 'application/panel_with_header', :locals => {:title => _('Settings')} do %>
- <% form_for(@user, :html => {:id => "email_form"}) do |f| %>
+ <% form_for(@user, :html => {:id => "email_form"}) do |form| %>
<p><%= "You can " + link_to("set your avatar here", "http://gravatar.com/signup") %></p>
<p><%= _("Leave blank/unchanged any field you don't want to change") %></p>
- <%= f.text_field 'email' %>
- <%= f.password_field :password %>
- <%= f.password_field :password_confirmation %>
- <%= f.text_field :openid_identifier %>
- <%= f.submit _('Save') %>
+ <%= form.text_field 'email' %>
+ <%= form.password_field :password %>
+ <%= form.password_field :password_confirmation %>
+ <%= form.text_field :openid_identifier %>
+ <%= form.submit _('Save') %>
+ <%= cancel_button %>
<% end %>
<% end %>
@@ -51,6 +53,7 @@
<p><%= _("If you delete your account, your logi's will become anonymous") %></p>
<%= form.hidden_field 'delete', :value => 'true' %>
<%= form.submit _('Delete') %>
+ <%= cancel_button %>
<% end %>
<% end %>
</div>
Modified: trunk/lib/logi_form_builder.rb
===================================================================
--- trunk/lib/logi_form_builder.rb 2009-09-05 16:13:28 UTC (rev 1566)
+++ trunk/lib/logi_form_builder.rb 2009-09-06 11:28:43 UTC (rev 1567)
@@ -23,9 +23,6 @@
def submit(field, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
string = @template.button(field, nil, options)
- if !options[:no_cancel]
- string += @template.cancel_button
- end
return string
end
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-05 16:13:36
|
Revision: 1566
http://logilogi.svn.sourceforge.net/logilogi/?rev=1566&view=rev
Author: wybow
Date: 2009-09-05 16:13:28 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
Hopefully fixed var bug, also greyed site_descr
Modified Paths:
--------------
trunk/app/views/logis/_cloud.html.erb
trunk/app/views/logis/_tag_list.html.erb
trunk/app/views/logis/_tag_sets.html.erb
trunk/app/views/main_page/_cloud.html.erb
trunk/app/views/tags/_edit.html.erb
trunk/public/stylesheets/logilogi.css
Modified: trunk/app/views/logis/_cloud.html.erb
===================================================================
--- trunk/app/views/logis/_cloud.html.erb 2009-09-05 15:35:22 UTC (rev 1565)
+++ trunk/app/views/logis/_cloud.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
@@ -1,4 +1,5 @@
-<% render :layout => 'application/panel_with_header', :locals => {:title => "Tags Suggested for Browsing", :id => "cloud"} do %>
+<% render :layout => 'application/panel_with_header',
+ :locals => {:title => "Related tags suggested for browsing", :id => "cloud"} do %>
<% classes = ['tag1', 'tag2', 'tag3', 'tag4', 'tag5'] %>
<% if !@used_tags.empty? %>
<% tag_cloud @used_tags, classes do |used_tag, css_class| %>
Modified: trunk/app/views/logis/_tag_list.html.erb
===================================================================
--- trunk/app/views/logis/_tag_list.html.erb 2009-09-05 15:35:22 UTC (rev 1565)
+++ trunk/app/views/logis/_tag_list.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
@@ -21,11 +21,6 @@
<%= end_form_tag() %>
<% end %>
<% javascript_tag do %>
- if (Prototype.Browser.IE) {
- var <%= name %> = new TagList('<%= name %>', '<%= url %>',
- '<%= param_name %>', '<%= Tag.replace.to_s %>');
- } else {
- <%= name %> = new TagList('<%= name %>', '<%= url %>',
- '<%= param_name %>', '<%= Tag.replace.to_s %>');
- }
+ window.<%= name %> = new TagList('<%= name %>', '<%= url %>',
+ '<%= param_name %>', '<%= Tag.replace.to_s %>');
<% end %>
Modified: trunk/app/views/logis/_tag_sets.html.erb
===================================================================
--- trunk/app/views/logis/_tag_sets.html.erb 2009-09-05 15:35:22 UTC (rev 1565)
+++ trunk/app/views/logis/_tag_sets.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
@@ -1,5 +1,5 @@
<% render :layout => 'application/panel_with_header', :locals => {
- :title => "Found logis for Tag Sets", :id => "tag_sets"} do %>
+ :title => "Found logis for tag sets", :id => "tag_sets"} do %>
<%= render :partial => "logis/tag_sets_list", :locals => {
:tag_set_links => @tag_set_links} %>
<% end %>
Modified: trunk/app/views/main_page/_cloud.html.erb
===================================================================
--- trunk/app/views/main_page/_cloud.html.erb 2009-09-05 15:35:22 UTC (rev 1565)
+++ trunk/app/views/main_page/_cloud.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
@@ -1,9 +1,11 @@
<% selected ||= "tags" %>
<div id="<%= selected %>">
<% render :layout => 'application/panel_with_tabs_ajax', :locals => {:tabs => [
- {:text => _("Tags"), :name => "tags", :description => _("Tags used most often, bigger is more")},
- {:text => _("Groups"), :name => "groups", :description => _("Names of the groups with most members, bigger is more")},
- {:text => _("Users"), :name => "users", :description => _("Names of the most prolific users, bigger is more")}],
+ {:text => _("Browse Tags"), :name => "tags",
+ :description => _("Tags used most often, bigger is more")},
+ {:text => _("Popular Groups"), :name => "groups",
+ :description => _("Names of the groups with most members, bigger is more")},
+ {:text => _("Prolific Users"), :name => "users", :description => _("Names of the most prolific users, bigger is more")}],
:selected => selected, :id => "cloud", :update_selected => true} do %>
<% classes = ['tag1', 'tag2', 'tag3', 'tag4', 'tag5'] %>
<% if selected == "users" %>
Modified: trunk/app/views/tags/_edit.html.erb
===================================================================
--- trunk/app/views/tags/_edit.html.erb 2009-09-05 15:35:22 UTC (rev 1565)
+++ trunk/app/views/tags/_edit.html.erb 2009-09-05 16:13:28 UTC (rev 1566)
@@ -1,7 +1,7 @@
<% render :layout => 'application/panel', :locals => {:id => name} do %>
<label>Tags</label>
<%= button_to_function _('Clear all tags'),
- name + '_list.remove_all_tags(); ' + name + '_list.submit()',
+ 'window.' + name + '_list.remove_all_tags(); window.' + name + '_list.submit()',
:class => 'cancel_button' %>
<div class="spacer"></div>
<%= render :partial => 'logis/tag_list', :locals => {:name => name + '_list',
Modified: trunk/public/stylesheets/logilogi.css
===================================================================
--- trunk/public/stylesheets/logilogi.css 2009-09-05 15:35:22 UTC (rev 1565)
+++ trunk/public/stylesheets/logilogi.css 2009-09-05 16:13:28 UTC (rev 1566)
@@ -1557,9 +1557,10 @@
padding-right: 0.5em;
}
#site_description {
- font-size: 15px;
+ font-size: 17px;
border: 0px;
margin: 0.2em 0em 0em 0.5em;
+ color: #555555;
}
/* recent changes */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-05 15:35:28
|
Revision: 1565
http://logilogi.svn.sourceforge.net/logilogi/?rev=1565&view=rev
Author: wybow
Date: 2009-09-05 15:35:22 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
Fixed IE var-bug
Modified Paths:
--------------
trunk/app/views/logis/_tag_list.html.erb
Modified: trunk/app/views/logis/_tag_list.html.erb
===================================================================
--- trunk/app/views/logis/_tag_list.html.erb 2009-09-05 15:19:29 UTC (rev 1564)
+++ trunk/app/views/logis/_tag_list.html.erb 2009-09-05 15:35:22 UTC (rev 1565)
@@ -21,6 +21,11 @@
<%= end_form_tag() %>
<% end %>
<% javascript_tag do %>
- <%= name %> = new TagList('<%= name %>', '<%= url %>',
- '<%= param_name %>', '<%= Tag.replace.to_s %>');
+ if (Prototype.Browser.IE) {
+ var <%= name %> = new TagList('<%= name %>', '<%= url %>',
+ '<%= param_name %>', '<%= Tag.replace.to_s %>');
+ } else {
+ <%= name %> = new TagList('<%= name %>', '<%= url %>',
+ '<%= param_name %>', '<%= Tag.replace.to_s %>');
+ }
<% end %>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-05 15:19:39
|
Revision: 1564
http://logilogi.svn.sourceforge.net/logilogi/?rev=1564&view=rev
Author: wybow
Date: 2009-09-05 15:19:29 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
Fixed MacBug
Modified Paths:
--------------
trunk/public/javascripts/application.js
Modified: trunk/public/javascripts/application.js
===================================================================
--- trunk/public/javascripts/application.js 2009-09-05 13:58:34 UTC (rev 1563)
+++ trunk/public/javascripts/application.js 2009-09-05 15:19:29 UTC (rev 1564)
@@ -156,7 +156,7 @@
},
initialize_tiny_mce: function() {
- if (Prototype.Browser.IE || OSystem.MacOS) {
+ if (Prototype.Browser.IE) {
this.initialize_tiny_mce_now();
} else {
Event.observe(window,'load',function() {
@@ -166,7 +166,7 @@
},
initialize_tiny_mce_now_in_ff: function() {
- if (!Prototype.Browser.IE && !OSystem.MacOS) {
+ if (!Prototype.Browser.IE) {
this.initialize_tiny_mce_now();
}
},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-05 13:58:41
|
Revision: 1563
http://logilogi.svn.sourceforge.net/logilogi/?rev=1563&view=rev
Author: wybow
Date: 2009-09-05 13:58:34 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
Fixed no links removed bugs
Modified Paths:
--------------
trunk/app/controllers/external_links_controller.rb
trunk/app/controllers/links_controller.rb
trunk/app/controllers/remarks_controller.rb
trunk/app/controllers/votes_controller.rb
Modified: trunk/app/controllers/external_links_controller.rb
===================================================================
--- trunk/app/controllers/external_links_controller.rb 2009-09-05 13:31:45 UTC (rev 1562)
+++ trunk/app/controllers/external_links_controller.rb 2009-09-05 13:58:34 UTC (rev 1563)
@@ -65,7 +65,7 @@
end
def destroy
- if !params[:deleted_inserts].empty?
+ if params[:deleted_inserts] and !params[:deleted_inserts].empty?
params[:deleted_inserts].each do |external_link_id|
@logi.external_links.find(external_link_id).destroy
end
@@ -73,7 +73,8 @@
redirect_to logi_url(@logi.link)
else
flash[:warning] = "No external link selected"
- render :template => 'edit'
+ self.edit
+ render :template => 'external_links/edit'
end
end
Modified: trunk/app/controllers/links_controller.rb
===================================================================
--- trunk/app/controllers/links_controller.rb 2009-09-05 13:31:45 UTC (rev 1562)
+++ trunk/app/controllers/links_controller.rb 2009-09-05 13:58:34 UTC (rev 1563)
@@ -45,7 +45,7 @@
end
def destroy
- if !params[:deleted_inserts].empty?
+ if params[:deleted_inserts] and !params[:deleted_inserts].empty?
params[:deleted_inserts].each do |link_id|
@logi.from_links.find(link_id).destroy
end
@@ -53,7 +53,8 @@
redirect_to logi_url(@logi.link)
else
flash[:warning] = "No link selected"
- render :template => 'edit'
+ self.edit
+ render :template => 'links/edit'
end
end
end
Modified: trunk/app/controllers/remarks_controller.rb
===================================================================
--- trunk/app/controllers/remarks_controller.rb 2009-09-05 13:31:45 UTC (rev 1562)
+++ trunk/app/controllers/remarks_controller.rb 2009-09-05 13:58:34 UTC (rev 1563)
@@ -76,7 +76,7 @@
end
def destroy
- if !params[:deleted_inserts].empty?
+ if params[:deleted_inserts] and !params[:deleted_inserts].empty?
params[:deleted_inserts].each do |remark_id|
@logi.remarks.find(remark_id).destroy
end
@@ -84,7 +84,8 @@
redirect_to logi_url(@logi.link)
else
flash[:warning] = "No remark selected"
- render :template => 'edit'
+ self.edit
+ render :template => 'remarks/edit'
end
end
Modified: trunk/app/controllers/votes_controller.rb
===================================================================
--- trunk/app/controllers/votes_controller.rb 2009-09-05 13:31:45 UTC (rev 1562)
+++ trunk/app/controllers/votes_controller.rb 2009-09-05 13:58:34 UTC (rev 1563)
@@ -44,7 +44,7 @@
@vote.score = params[:score].to_i
@rating.vote(@vote)
end
- @votes = @rating.votes[0..10]
+ @votes = @rating.votes.positive[0..10]
rescue RuntimeError => error
flash.now[:error] = error.to_s
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-05 13:31:51
|
Revision: 1562
http://logilogi.svn.sourceforge.net/logilogi/?rev=1562&view=rev
Author: wybow
Date: 2009-09-05 13:31:45 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
Fixed add tags bug, layout of logis replying & browse bar
Modified Paths:
--------------
trunk/app/controllers/external_links_controller.rb
trunk/app/controllers/links_controller.rb
trunk/app/models/external_link.rb
trunk/app/views/logis/_commenting_logis.html.erb
trunk/app/views/logis/_navigation_bar_browse_header.html.erb
trunk/app/views/logis/_tag_list.html.erb
Modified: trunk/app/controllers/external_links_controller.rb
===================================================================
--- trunk/app/controllers/external_links_controller.rb 2009-09-04 15:42:32 UTC (rev 1561)
+++ trunk/app/controllers/external_links_controller.rb 2009-09-05 13:31:45 UTC (rev 1562)
@@ -16,7 +16,8 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version
+ before_filter :resolve_context, :page_name,
+ :find_logi_and_logi_version
### Bodies
@@ -41,17 +42,20 @@
@external_link.position_ranges = new_external_link_position_range_list.
translate_from_view(@logi_version.position_ranges)
else
- @external_link = ExternalLink.new(:url => params[:external_link][:url],
- :text => params[:external_link][:text])
+ @external_link = nil
end
- if @logi.errors.empty? and @external_link.valid? and self.thorny_form_free_of_spam?
+ if @logi.errors.empty? and !@external_link.nil? and @external_link.valid? and
+ self.thorny_form_free_of_spam?
@external_link.save
flash[:notice] = "Successfully added external link"
redirect_to logi_url(@logi)
else
+ @external_link = ExternalLink.new(:url => params[:external_link][:url],
+ :text => params[:external_link][:text])
flash[:error] = "Problem adding external link"
- @selected = 'external_link'
+ @selected = 'link'
+ @link_selected = 'external_link'
render :template => 'logi_inserts/new'
end
end
Modified: trunk/app/controllers/links_controller.rb
===================================================================
--- trunk/app/controllers/links_controller.rb 2009-09-04 15:42:32 UTC (rev 1561)
+++ trunk/app/controllers/links_controller.rb 2009-09-05 13:31:45 UTC (rev 1562)
@@ -16,8 +16,8 @@
### Filters
- before_filter :resolve_context, :page_name
- before_filter :find_logi_and_logi_version
+ before_filter :resolve_context, :page_name,
+ :find_logi_and_logi_version
### Bodies
Modified: trunk/app/models/external_link.rb
===================================================================
--- trunk/app/models/external_link.rb 2009-09-04 15:42:32 UTC (rev 1561)
+++ trunk/app/models/external_link.rb 2009-09-05 13:31:45 UTC (rev 1562)
@@ -34,7 +34,8 @@
validates_presence_of :position_ranges_string
validates_length_of :text, :maximum => 200
validates_length_of :url, :maximum => 200
- validates_format_of :url, :with => /^(ftp|http(s)?):\/\/.*\..*$/, :message => 'Must include http:// and a dot'
+ validates_format_of :url, :with => /^(ftp|http(s)?):\/\/.*\..*$/,
+ :message => 'Must include http:// and a dot'
### Filter-functions
Modified: trunk/app/views/logis/_commenting_logis.html.erb
===================================================================
--- trunk/app/views/logis/_commenting_logis.html.erb 2009-09-04 15:42:32 UTC (rev 1561)
+++ trunk/app/views/logis/_commenting_logis.html.erb 2009-09-05 13:31:45 UTC (rev 1562)
@@ -1,7 +1,7 @@
<% render :layout => 'application/panel_with_header', :locals => {:title => _("Replying Logis"), :id => "commenting"} do %>
<div class="mirrored_notice_cloud"><%= _('Want to give a more in-depth response ?') %></div>
<div class="description">
- <p><%= _('There are %{nr} logis replying') % {:nr => logis.size} %></p>
+ <p><%= _('%{nr} Logis are replying') % {:nr => logis.size} %></p>
</div>
<div class="spacer"></div>
<%= toggle_button_to_remote 'or add a logi below', {:update => "comment_area",
Modified: trunk/app/views/logis/_navigation_bar_browse_header.html.erb
===================================================================
--- trunk/app/views/logis/_navigation_bar_browse_header.html.erb 2009-09-04 15:42:32 UTC (rev 1561)
+++ trunk/app/views/logis/_navigation_bar_browse_header.html.erb 2009-09-05 13:31:45 UTC (rev 1562)
@@ -6,5 +6,5 @@
:link => (current_context.nil? ? nil : current_context.link),
:url => browse_logis_url(:ll_link_string => ''),
:param_name => 'll_link_string',
- :replace_string => ''} %>
+ :replace_string => '', :without_spacer => true} %>
<div class="spacer"></div>
Modified: trunk/app/views/logis/_tag_list.html.erb
===================================================================
--- trunk/app/views/logis/_tag_list.html.erb 2009-09-04 15:42:32 UTC (rev 1561)
+++ trunk/app/views/logis/_tag_list.html.erb 2009-09-05 13:31:45 UTC (rev 1562)
@@ -1,19 +1,26 @@
<div id="<%= name %>" class="tags_container transparent_corner">
<!-- Filled via js -->
</div>
-<div class="spacer"></div>
+<% if !local_assigns[:without_spacer] %>
+ <div class="spacer"></div>
+<% end %>
<% if !local_assigns[:without_form] %>
<%= form_tag("#", :method => :put) %>
<% end %>
<div class="add_tag_form">
- <%= hidden_field_tag (name + '_string'), (link.nil? ? '' : link.to_s(:direction => :requested, :step => -1)), :autocomplete => "off" %>
- <%= text_field_tag (name + '_input'), nil, :id => (name + '_input'), :class => 'tag_list' %>
- <%= button_to_function 'Add tag', (name + '.add_tag_from_field(); ' + name + '.submit()'), :class => 'add_button tag_list' %>
+ <%= hidden_field_tag (name + '_string'),
+ (link.nil? ? '' : link.to_s(:direction => :requested, :step => -1)),
+ :autocomplete => "off" %>
+ <%= text_field_tag (name + '_input'), nil, :id => (name + '_input'),
+ :class => 'tag_list' %>
+ <%= button_to_function 'Add tag',
+ (name + '.add_tag_from_field(); ' + name + '.submit()'),
+ :class => 'add_button tag_list' %>
</div>
<% if !local_assigns[:without_form] %>
<%= end_form_tag() %>
<% end %>
<% javascript_tag do %>
- var <%= name %> = new TagList('<%= name %>', '<%= url %>',
+ <%= name %> = new TagList('<%= name %>', '<%= url %>',
'<%= param_name %>', '<%= Tag.replace.to_s %>');
<% end %>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-04 15:42:42
|
Revision: 1561
http://logilogi.svn.sourceforge.net/logilogi/?rev=1561&view=rev
Author: wybow
Date: 2009-09-04 15:42:32 +0000 (Fri, 04 Sep 2009)
Log Message:
-----------
Added example for xml exports
Modified Paths:
--------------
trunk/app/controllers/votes_controller.rb
trunk/config/routes.rb
trunk/lib/tasks/db.rake
Modified: trunk/app/controllers/votes_controller.rb
===================================================================
--- trunk/app/controllers/votes_controller.rb 2009-09-04 12:57:59 UTC (rev 1560)
+++ trunk/app/controllers/votes_controller.rb 2009-09-04 15:42:32 UTC (rev 1561)
@@ -18,10 +18,24 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version
+ before_filter :resolve_context, :page_name, :find_logi_and_logi_version,
+ :except => :index # ALERT needs except to stop it from calling these
+ # could become tricky where there already is an index method used
### REST-methods
+ def index
+ # ALERT you need to add the plural of the model-name to the config/routes.rb file
+ # where votes is already (the second occurrance of votes in the file)
+ @votes = Vote.positive.find(:all) # ALERT the positive should be removed for other cases
+ # And don't remove it here, I will be watching the commit-logs :-)
+ respond_to do |format|
+ format.xml do
+ render :xml => @votes
+ end
+ end
+ end
+
def create
begin
Rating.transaction do
Modified: trunk/config/routes.rb
===================================================================
--- trunk/config/routes.rb 2009-09-04 12:57:59 UTC (rev 1560)
+++ trunk/config/routes.rb 2009-09-04 15:42:32 UTC (rev 1561)
@@ -39,7 +39,7 @@
:name_prefix => '_hidden_',
:requirements => { :ll_link_string => /.*/ }
map.resources :users, :peer_group_admin_memberships, :peer_group_memberships,
- :user_groups, :prefs_profiles, :invitations,
+ :user_groups, :prefs_profiles, :invitations, :votes,
:path_prefix => 'do'
map.resources :peer_groups,
:path_prefix => 'do', :has_many => :invitations, :shallow => true
Modified: trunk/lib/tasks/db.rake
===================================================================
--- trunk/lib/tasks/db.rake 2009-09-04 12:57:59 UTC (rev 1560)
+++ trunk/lib/tasks/db.rake 2009-09-04 15:42:32 UTC (rev 1561)
@@ -48,6 +48,7 @@
Rake::Task["db:schema:load"].invoke
Rake::Task["config:initialize"].invoke
Rake::Task["db:initialize_default_data"].invoke
+ Rake::Task["index:create"].invoke
end
desc "Loads the default homepage and such, for internal use"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2009-09-04 12:58:06
|
Revision: 1560
http://logilogi.svn.sourceforge.net/logilogi/?rev=1560&view=rev
Author: wybow
Date: 2009-09-04 12:57:59 +0000 (Fri, 04 Sep 2009)
Log Message:
-----------
Updated docs
Modified Paths:
--------------
trunk/doc/README_FOR_APP
Modified: trunk/doc/README_FOR_APP
===================================================================
--- trunk/doc/README_FOR_APP 2009-09-04 12:22:39 UTC (rev 1559)
+++ trunk/doc/README_FOR_APP 2009-09-04 12:57:59 UTC (rev 1560)
@@ -96,16 +96,17 @@
Also see the Installation Notes at the bottom for how to meet the few
dependencies of the gems.
-You can install them with:
+First you need to add github as a source for gems:
+
+ gem sources -a http://gems.github.com
+
+Then You can install them with:
+
gem install daemons rubyzip ruby-openid authlogic authlogic-oid
quantipay-authlogic_haapi ratom mislav-will_paginate authlogic
positionrange difflcs textweaver mysql rmagick
(as root, same here as with Rails installation)
-If you encounter not-found errors you might have to try again after
-running:
-gem sources -a http://gems.github.com
-
Then you can get Manta directly from our
{Subversion repository}[http://sourceforge.net/svn/?group_id=78643]
@@ -116,15 +117,30 @@
=== Step 2: Configuring it
-Copy the config.rb.tmpl to config.rb in the config dir, and change
-settings as you see fit (usually no changes are needed, and for
-development no changes are recommended. Note that after initializing
-the database some settings cannot be changed anymore).
+Copy the
-Copy the template database.yml.tmpl in the config dir to database.yml,
-and add your database-username and -password. Making changes is only
-needed if you did set a root-password for your database.
+ config.rb.tmpl
+
+...to
+ config.rb
+
+...in the config dir, and change settings as you see fit (usually no
+changes are needed, and for development no changes are recommended.
+Note that after initializing the database some settings cannot be
+changed anymore).
+
+Copy the template
+
+ database.yml.tmpl
+
+...in the config dir to
+
+ database.yml,
+
+...and add your database-username and -password. Making changes is
+only needed if you did set a root-password for your database.
+
Then with rake dev:check you can test if you installed everything
correctly.
@@ -136,6 +152,7 @@
To (re-)initialize the test- and development-database with the
config and fixture data you should run (handiest for development):
+
rake db:dev:redo
(For the production environment you need to run
@@ -146,13 +163,13 @@
To get going with the GUI you should add something like the following
to your /etc/hosts:
- 0.0.0.0 www.logi-manta.org en.logi-manta.org de.logi-manta.org
+ 0.0.0.0 en.logi-manta.org de.logi-manta.org
Then start the included WEBRick server with script/server.
=== Step 3: Enjoying it
-Then you can point your browser to www.logi-manta.org:3000/
+Then you can point your browser to en.logi-manta.org:3000/
You're all set.
@@ -189,9 +206,9 @@
ImageMagick and libxml2:
sudo apt-get install make mysql-server mysql-client
- mysqlclient15-dev subversion libopenssl-ruby1.8 libxapian15
- libxapian-ruby1.8 gettext libxml2 imagemagick librsvg2-dev
- libmagick9-dev
+ libmysqlclient15-dev subversion libopenssl-ruby1.8
+ libxapian15 libxapian-ruby1.8 gettext libxml2 imagemagick
+ librsvg2-dev libmagick9-dev
RMagick will build extensions from source. If you have to install
ImageMagick from source (because it is out of date compared to
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|