motiro 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +280 -0
- data/README +28 -0
- data/README.en +175 -0
- data/README.pt-br +175 -0
- data/Rakefile +10 -0
- data/app/controllers/account_controller.rb +62 -0
- data/app/controllers/application.rb +72 -0
- data/app/controllers/edition_controller.rb +13 -0
- data/app/controllers/javascript_controller.rb +21 -0
- data/app/controllers/report_controller.rb +79 -0
- data/app/controllers/root_controller.rb +7 -0
- data/app/controllers/wiki_controller.rb +102 -0
- data/app/core/cache_reporter.rb +53 -0
- data/app/core/cache_reporter_fetcher.rb +33 -0
- data/app/core/chief_editor.rb +69 -0
- data/app/core/reporter.rb +105 -0
- data/app/core/reporter_driver.rb +36 -0
- data/app/core/reporter_fetcher.rb +39 -0
- data/app/core/settings.rb +43 -0
- data/app/core/version.rb +1 -0
- data/app/core/wiki_page_not_found.rb +33 -0
- data/app/core/wiki_reporter.rb +83 -0
- data/app/helpers/account_helper.rb +2 -0
- data/app/helpers/application_helper.rb +68 -0
- data/app/helpers/default_page_provider.rb +28 -0
- data/app/helpers/report_helper.rb +2 -0
- data/app/helpers/root_helper.rb +2 -0
- data/app/helpers/wiki_helper.rb +3 -0
- data/app/models/change.rb +96 -0
- data/app/models/diff_table_builder.rb +285 -0
- data/app/models/event.rb +18 -0
- data/app/models/headline.rb +109 -0
- data/app/models/page.rb +114 -0
- data/app/models/page_sweeper.rb +26 -0
- data/app/models/user.rb +85 -0
- data/app/ports/chdir_runner.rb +36 -0
- data/app/ports/reporter_loader.rb +9 -0
- data/app/ports/runner.rb +64 -0
- data/app/reporters/darcs_connection.rb +54 -0
- data/app/reporters/darcs_reporter.rb +104 -0
- data/app/reporters/darcs_settings.rb +9 -0
- data/app/reporters/darcs_temp_repo.rb +40 -0
- data/app/reporters/events_reporter.rb +28 -0
- data/app/reporters/features_reporter.rb +24 -0
- data/app/reporters/subversion_reporter.rb +203 -0
- data/app/reporters/svn_connection.rb +62 -0
- data/app/reporters/svn_settings.rb +40 -0
- data/app/views/account/_authorization.rhtml +54 -0
- data/app/views/account/_availability.rhtml +5 -0
- data/app/views/account/availability.rhtml +1 -0
- data/app/views/account/login.rhtml +22 -0
- data/app/views/account/logout.rhtml +10 -0
- data/app/views/javascript/motiro.rjs +132 -0
- data/app/views/javascript/niftycube.rjs +300 -0
- data/app/views/layouts/_bottom.rhtml +5 -0
- data/app/views/layouts/_header.rhtml +7 -0
- data/app/views/layouts/_top.rhtml +25 -0
- data/app/views/layouts/application.rhtml +3 -0
- data/app/views/layouts/scaffold.rhtml +13 -0
- data/app/views/layouts/wiki_edit.rhtml +26 -0
- data/app/views/report/list.rhtml +32 -0
- data/app/views/report/older.rhtml +26 -0
- data/app/views/report/rss.rxml +29 -0
- data/app/views/report/show.rhtml +20 -0
- data/app/views/root/index.rhtml +33 -0
- data/app/views/wiki/_editbar.rhtml +26 -0
- data/app/views/wiki/_properties_edit.rhtml +5 -0
- data/app/views/wiki/_properties_show.rhtml +5 -0
- data/app/views/wiki/edit.rhtml +56 -0
- data/app/views/wiki/properties_edit.rhtml +1 -0
- data/app/views/wiki/show.rhtml +9 -0
- data/bin/motiro +44 -0
- data/config/boot.rb +19 -0
- data/config/database.yml +14 -0
- data/config/environment.rb +64 -0
- data/config/environments/development.rb +20 -0
- data/config/environments/production.rb +19 -0
- data/config/environments/test.rb +19 -0
- data/config/motiro.yml +43 -0
- data/config/routes.rb +79 -0
- data/db/migrate/005_globalize_migration.rb +11363 -0
- data/db/migrate/006_remove_headline_title.rb +14 -0
- data/db/migrate/007_stretch_rid.rb +11 -0
- data/db/migrate/008_add_page_editors.rb +12 -0
- data/db/migrate/009_add_page_original_author.rb +12 -0
- data/db/migrate/010_remove_empty_string_defaults_from_pages.rb +17 -0
- data/db/migrate/011_add_title_and_kind_to_pages.rb +13 -0
- data/db/migrate/012_page_modification_info.rb +13 -0
- data/db/migrate/013_nullify_initial_page_attributes.rb +21 -0
- data/db/migrate/014_events_are_wiki_pages.rb +13 -0
- data/db/migrate/015_migrate_previous_event_data.rb +23 -0
- data/db/migrate/1_initial_structure.rb +36 -0
- data/db/migrate/2_add_authentication.rb +12 -0
- data/db/migrate/3_drop_articles.rb +26 -0
- data/db/migrate/4_add_page_editing.rb +14 -0
- data/db/motirodb.sqlite.initial +0 -0
- data/db/schema_version +1 -0
- data/db/translation/pt-BR.rb +76 -0
- data/doc/README_FOR_APP +2 -0
- data/installer/rails_installer_defaults.yml +5 -0
- data/lib/import_translations.rb +154 -0
- data/lib/login_system.rb +89 -0
- data/lib/relative_time.rb +48 -0
- data/lib/string_extensions.rb +10 -0
- data/lib/stub_hash.rb +22 -0
- data/lib/tasks/packaging.rake +93 -0
- data/lib/tasks/testing.rake +32 -0
- data/lib/tick_daemon.rb +41 -0
- data/lib/translator.rb +67 -0
- data/lib/wiki_renderer.rb +42 -0
- data/lib/wiki_url_generator.rb +29 -0
- data/log/.keepdir +0 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/calendar.png +0 -0
- data/public/images/rss.png +0 -0
- data/public/javascripts/controls.js +750 -0
- data/public/javascripts/dragdrop.js +584 -0
- data/public/javascripts/effects.js +854 -0
- data/public/javascripts/prototype.js +1785 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/motiro.css +269 -0
- data/public/stylesheets/niftyCorners.css +35 -0
- data/public/stylesheets/scaffold.css +74 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/process/spinner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/ticker +29 -0
- data/test/acceptance/account_test.rb +186 -0
- data/test/acceptance/darcs_test.rb +62 -0
- data/test/acceptance/events_test.rb +47 -0
- data/test/acceptance/main_page_test.rb +92 -0
- data/test/acceptance/subversion_test.rb +319 -0
- data/test/acceptance/ts_all_suites.rb +27 -0
- data/test/acceptance/wiki_test.rb +202 -0
- data/test/contract/darcs_test.rb +51 -0
- data/test/contract/remote_darcs_test.rb +61 -0
- data/test/contract/svn_test.rb +53 -0
- data/test/fixtures/changes.yml +25 -0
- data/test/fixtures/headlines.yml +45 -0
- data/test/fixtures/pages.yml +98 -0
- data/test/fixtures/users.yml +31 -0
- data/test/functional/account_controller_test.rb +96 -0
- data/test/functional/report_controller_test.rb +113 -0
- data/test/functional/report_features_test.rb +38 -0
- data/test/functional/report_subversion_test.rb +79 -0
- data/test/functional/root_controller_test.rb +127 -0
- data/test/functional/wiki_controller_test.rb +280 -0
- data/test/lib/acceptance_test_case.rb +43 -0
- data/test/lib/configuration.rb +53 -0
- data/test/lib/darcs_excerpts.rb +181 -0
- data/test/lib/darcs_repo.rb +77 -0
- data/test/lib/live_mode_test.rb +51 -0
- data/test/lib/local_svn.rb +157 -0
- data/test/lib/netutils.rb +42 -0
- data/test/lib/platform_thread.rb +62 -0
- data/test/lib/repoutils.rb +23 -0
- data/test/lib/selenium_extensions.rb +32 -0
- data/test/lib/stubio.rb +37 -0
- data/test/lib/svn_excerpts.rb +288 -0
- data/test/lib/test_configuration.rb +14 -0
- data/test/lib/webserver.rb +71 -0
- data/test/meta/configuration_test.rb +72 -0
- data/test/meta/darcs_repo_test.rb +118 -0
- data/test/meta/local_svn_test.rb +125 -0
- data/test/meta/platform_thread_test.rb +46 -0
- data/test/meta/stubio_test.rb +44 -0
- data/test/mocks/headline.rb +34 -0
- data/test/mocks/svn_reporter.rb +29 -0
- data/test/stubs/svn_settings.rb +19 -0
- data/test/stubs/url_generator.rb +24 -0
- data/test/test_helper.rb +36 -0
- data/test/unit/cache_reporter_fetcher_test.rb +46 -0
- data/test/unit/cache_reporter_test.rb +97 -0
- data/test/unit/caching_test.rb +78 -0
- data/test/unit/change_test.rb +152 -0
- data/test/unit/chdir_runner_test.rb +77 -0
- data/test/unit/chief_editor_test.rb +234 -0
- data/test/unit/darcs_connection_test.rb +109 -0
- data/test/unit/darcs_reporter_test.rb +146 -0
- data/test/unit/darcs_settings_test.rb +37 -0
- data/test/unit/darcs_temp_repo_test.rb +51 -0
- data/test/unit/default_page_provider_test.rb +46 -0
- data/test/unit/diff_table_builder_test.rb +602 -0
- data/test/unit/headline_test.rb +259 -0
- data/test/unit/page_test.rb +145 -0
- data/test/unit/relative_time_test.rb +56 -0
- data/test/unit/reporter_driver_test.rb +85 -0
- data/test/unit/reporter_fetcher_test.rb +31 -0
- data/test/unit/reporter_test.rb +81 -0
- data/test/unit/runner_test.rb +93 -0
- data/test/unit/settings_test.rb +55 -0
- data/test/unit/string_extensions_test.rb +10 -0
- data/test/unit/svn_connection_test.rb +183 -0
- data/test/unit/svn_reporter_interaction_test.rb +38 -0
- data/test/unit/svn_reporter_test.rb +286 -0
- data/test/unit/svn_settings_test.rb +86 -0
- data/test/unit/translator_test.rb +96 -0
- data/test/unit/user_test.rb +125 -0
- data/test/unit/wiki_renderer_test.rb +87 -0
- data/test/unit/wiki_reporter_test.rb +94 -0
- data/test/unit/wiki_url_generator_test.rb +31 -0
- data/vendor/motiro-installer.rb +159 -0
- data/vendor/plugins/globalize/LICENSE +9 -0
- data/vendor/plugins/globalize/README +49 -0
- data/vendor/plugins/globalize/data/country_data.csv +240 -0
- data/vendor/plugins/globalize/data/language_data.csv +188 -0
- data/vendor/plugins/globalize/data/translation_data.csv +3421 -0
- data/vendor/plugins/globalize/generators/globalize/USAGE +10 -0
- data/vendor/plugins/globalize/generators/globalize/globalize_generator.rb +42 -0
- data/vendor/plugins/globalize/generators/globalize/templates/migration.rb.gz +0 -0
- data/vendor/plugins/globalize/generators/globalize/templates/tiny_migration.rb.gz +0 -0
- data/vendor/plugins/globalize/init.rb +30 -0
- data/vendor/plugins/globalize/lib/globalize/localization/core_ext.rb +170 -0
- data/vendor/plugins/globalize/lib/globalize/localization/core_ext_hooks.rb +33 -0
- data/vendor/plugins/globalize/lib/globalize/localization/db_translate.rb +494 -0
- data/vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb +152 -0
- data/vendor/plugins/globalize/lib/globalize/localization/locale.rb +173 -0
- data/vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb +40 -0
- data/vendor/plugins/globalize/lib/globalize/models/country.rb +24 -0
- data/vendor/plugins/globalize/lib/globalize/models/currency.rb +188 -0
- data/vendor/plugins/globalize/lib/globalize/models/language.rb +84 -0
- data/vendor/plugins/globalize/lib/globalize/models/model_translation.rb +4 -0
- data/vendor/plugins/globalize/lib/globalize/models/translation.rb +9 -0
- data/vendor/plugins/globalize/lib/globalize/models/view_translation.rb +14 -0
- data/vendor/plugins/globalize/lib/globalize/rails/action_mailer.rb +125 -0
- data/vendor/plugins/globalize/lib/globalize/rails/action_view.rb +79 -0
- data/vendor/plugins/globalize/lib/globalize/rails/active_record.rb +129 -0
- data/vendor/plugins/globalize/lib/globalize/rails/active_record_helper.rb +33 -0
- data/vendor/plugins/globalize/populators/pop_dates.rb +81 -0
- data/vendor/plugins/globalize/populators/pop_migration.rb +18 -0
- data/vendor/plugins/globalize/populators/pop_pluralization.rb +26 -0
- data/vendor/plugins/globalize/populators/pop_seps.rb +32 -0
- data/vendor/plugins/globalize/tasks/data.rake +130 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en-US.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.he.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test.rb +54 -0
- data/vendor/plugins/globalize/test/config/database.yml.default +16 -0
- data/vendor/plugins/globalize/test/config/database.yml.example +22 -0
- data/vendor/plugins/globalize/test/core_ext_test.rb +61 -0
- data/vendor/plugins/globalize/test/currency_test.rb +141 -0
- data/vendor/plugins/globalize/test/date_helper_test.rb +634 -0
- data/vendor/plugins/globalize/test/db/schema.rb +90 -0
- data/vendor/plugins/globalize/test/db_translation_test.rb +374 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_categories.yml +7 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_categories_products.yml +7 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_countries.yml +41 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_languages.yml +64 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_manufacturers.yml +5 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_products.yml +29 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_simples.yml +5 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_translations.yml +354 -0
- data/vendor/plugins/globalize/test/locale_test.rb +27 -0
- data/vendor/plugins/globalize/test/mime_responds_test.rb +358 -0
- data/vendor/plugins/globalize/test/model_test.rb +17 -0
- data/vendor/plugins/globalize/test/standard_data_test_helper.rb +33 -0
- data/vendor/plugins/globalize/test/test_helper.rb +19 -0
- data/vendor/plugins/globalize/test/test_standard_data.rb +54 -0
- data/vendor/plugins/globalize/test/validation_test.rb +29 -0
- data/vendor/plugins/globalize/test/view_picking_test.rb +49 -0
- data/vendor/plugins/globalize/test/view_translation_test.rb +237 -0
- data/vendor/plugins/globalize/test/views/layouts/standard.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rxml +1 -0
- data/vendor/plugins/globalize/test/views/test.he-IL.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test2.he.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test2.rhtml +1 -0
- data/vendor/plugins/test_xml/MIT-LICENSE +20 -0
- data/vendor/plugins/test_xml/README +20 -0
- data/vendor/plugins/test_xml/Rakefile +22 -0
- data/vendor/plugins/test_xml/init.rb +7 -0
- data/vendor/plugins/test_xml/lib/xml_assertions.rb +22 -0
- data/vendor/plugins/test_xml/test/test_xml_test.rb +40 -0
- metadata +505 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
class RemoveHeadlineTitle < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
remove_column 'headlines', 'title'
|
5
|
+
add_index 'headlines', 'rid'
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
remove_index 'headlines', 'rid'
|
11
|
+
add_column 'headlines', 'title', :string, :limit => 100, :default => "", :null => false
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class RemoveEmptyStringDefaultsFromPages < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
rename_table 'pages', 'pages_old'
|
5
|
+
create_table 'pages', :force => true do |t|
|
6
|
+
t.column "name", :string, :null => false
|
7
|
+
t.column "text", :text, :null => false
|
8
|
+
t.column 'editors', :text, :null => false
|
9
|
+
t.column 'original_author_id', :integer
|
10
|
+
end
|
11
|
+
execute 'INSERT INTO pages (name, text, editors, original_author_id) SELECT name, text, editors, original_author_id FROM pages_old'
|
12
|
+
drop_table 'pages_old'
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down; end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class PageModificationInfo < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
add_column 'pages', 'modified_at', :timestamp
|
5
|
+
add_column 'pages', 'last_editor_id', :integer
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
remove_column 'pages', 'modified_at'
|
10
|
+
remove_column 'pages', 'last_editor_id'
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class NullifyInitialPageAttributes < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
rename_table 'pages', 'pages_old'
|
5
|
+
create_table 'pages', :force => true do |t|
|
6
|
+
t.column "name", :string
|
7
|
+
t.column "text", :text
|
8
|
+
t.column 'editors', :text
|
9
|
+
t.column 'original_author_id', :integer
|
10
|
+
t.column 'kind', :text
|
11
|
+
t.column 'title', :text
|
12
|
+
t.column 'modified_at', :timestamp
|
13
|
+
t.column 'last_editor_id', :integer
|
14
|
+
end
|
15
|
+
execute 'INSERT INTO pages (name, text, editors, original_author_id, kind, title, modified_at, last_editor_id) SELECT name, text, editors, original_author_id, kind, title, modified_at, last_editor_id FROM pages_old'
|
16
|
+
drop_table 'pages_old'
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.down; end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class EventsAreWikiPages < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
add_column('pages', 'type', :string)
|
5
|
+
add_column('pages', 'happens_at', :date)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
remove_column('pages', 'type')
|
10
|
+
remove_column('pages', 'happens_at')
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class MigratePreviousEventData < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
Headline.find(:all, :conditions => "reported_by = 'events'").each do |hl|
|
5
|
+
author = User.find_by_login(hl.author)
|
6
|
+
e = Event.new(:title => hl.title,
|
7
|
+
:name => hl.title.downcase.gsub(/ /, '_').camelize,
|
8
|
+
:text => hl.description,
|
9
|
+
:editors => '', :original_author => author, :kind => 'event',
|
10
|
+
:modified_at => Time.local(2007, 1, 22, 14, 35, 43),
|
11
|
+
:last_editor => author,
|
12
|
+
:happens_at => Date.civil(hl.happened_at.year,
|
13
|
+
hl.happened_at.month,
|
14
|
+
hl.happened_at.day))
|
15
|
+
e.save
|
16
|
+
hl.destroy
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class InitialStructure < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table "headlines", :force => true do |t|
|
5
|
+
t.column "author", :string, :limit => 40, :default => "", :null => false
|
6
|
+
t.column "title", :string, :limit => 100, :default => "", :null => false
|
7
|
+
t.column "happened_at", :timestamp
|
8
|
+
t.column "reported_by", :string, :limit => 40, :default => "", :null => false
|
9
|
+
t.column "rid", :string, :limit => 40, :default => "", :null => false
|
10
|
+
end
|
11
|
+
|
12
|
+
create_table "articles", :force => true do |t|
|
13
|
+
t.column "headline_id", :integer, :default => 0, :null => false
|
14
|
+
t.column "description", :text
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index "articles", ["headline_id"], :name => "fk_article_headline"
|
18
|
+
|
19
|
+
create_table "changes", :force => true do |t|
|
20
|
+
t.column "article_id", :integer, :default => 0, :null => false
|
21
|
+
t.column "summary", :text, :default => "", :null => false
|
22
|
+
t.column "resource_kind", :string, :limit => 6
|
23
|
+
t.column "diff", :text
|
24
|
+
end
|
25
|
+
|
26
|
+
add_index "changes", ["article_id"], :name => "fk_change_article"
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def self.down
|
32
|
+
drop_table 'changes'
|
33
|
+
drop_table 'articles'
|
34
|
+
drop_table 'headlines'
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class DropArticles < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
add_column 'headlines', "description", :text
|
5
|
+
remove_index 'changes', :name => 'fk_change_article'
|
6
|
+
rename_column 'changes', 'article_id', 'headline_id'
|
7
|
+
add_index "changes", ["headline_id"], :name => "fk_change_headline"
|
8
|
+
drop_table 'articles'
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
create_table "articles", :force => true do |t|
|
14
|
+
t.column "headline_id", :integer, :default => 0, :null => false
|
15
|
+
t.column "description", :text
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index "articles", ["headline_id"], :name => "fk_article_headline"
|
19
|
+
|
20
|
+
remove_index 'changes', :name => 'fk_change_headline'
|
21
|
+
rename_column 'changes', 'headline_id', 'article_id'
|
22
|
+
add_index "changes", ["article_id"], :name => "fk_change_article"
|
23
|
+
|
24
|
+
remove_column 'headlines', 'descrition'
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddPageEditing < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table "pages", :force => true do |t|
|
5
|
+
t.column "name", :string, :default => '', :null => false
|
6
|
+
t.column "text", :text, :default => '', :null => false
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
drop_table "pages"
|
13
|
+
end
|
14
|
+
end
|
Binary file
|
data/db/schema_version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
15
|
@@ -0,0 +1,76 @@
|
|
1
|
+
{
|
2
|
+
# Relative dates
|
3
|
+
'Tomorrow' => 'Amanhã',
|
4
|
+
'Yesterday' => 'Ontem',
|
5
|
+
"%s ago" => 'Há %s',
|
6
|
+
"%s from now" => 'Daqui a %s',
|
7
|
+
'minute' => 'minuto',
|
8
|
+
'hour' => 'hora',
|
9
|
+
'day' => 'dia',
|
10
|
+
'week' => 'semana',
|
11
|
+
'month' => 'mês',
|
12
|
+
'year' => 'ano',
|
13
|
+
'Less than one minute ago' => 'Há menos de um minuto',
|
14
|
+
|
15
|
+
# Main page
|
16
|
+
'Welcome' => 'Bem-vindo',
|
17
|
+
'User' => 'Usuário',
|
18
|
+
'Password' => 'Senha',
|
19
|
+
'Confirmation' => 'Confirmação',
|
20
|
+
'New user?' => 'Novo usuário?',
|
21
|
+
'Not available' => 'Não está disponível',
|
22
|
+
'Passwords do not match' => 'Senhas não conferem',
|
23
|
+
'Sign out' => 'Sair',
|
24
|
+
'Last update by %s at %s' => 'Última atualização por %s em %s',
|
25
|
+
'Edit' => 'Editar',
|
26
|
+
'(requires authentication)' => '(identifique-se, por favor)',
|
27
|
+
'(not authorized)' => '(não autorizado)',
|
28
|
+
'Latest news from %s' => 'Últimas notícias do %s',
|
29
|
+
'Recently changed suggestions' => 'Últimas sugestões modificadas',
|
30
|
+
'Scheduled events' => 'Eventos agendados',
|
31
|
+
'Planned features' => 'Funcionalidades planejadas',
|
32
|
+
'version' => 'versão',
|
33
|
+
'Add' => 'Adicionar',
|
34
|
+
'Older' => 'Antigas',
|
35
|
+
|
36
|
+
# Breadcrumbs for revision and wiki pages
|
37
|
+
'You are here: ' => 'Você está aqui: ',
|
38
|
+
'Home' => 'Início',
|
39
|
+
'Features' => 'Sugestões',
|
40
|
+
'Events' => 'Eventos',
|
41
|
+
|
42
|
+
# Source revision details page
|
43
|
+
'Revision details' => 'Detalhes de revisão',
|
44
|
+
'Revision %s' => 'Revisão %s',
|
45
|
+
'Changes to %s' => 'Alterações em %s',
|
46
|
+
'The article %s from the %s reporter could not be found' => 'Não foi possível encontrar o artigo %s do repórter %s',
|
47
|
+
|
48
|
+
# Event details and new event pages
|
49
|
+
'Events' => 'Eventos',
|
50
|
+
'Event' => 'Evento',
|
51
|
+
'Date' => 'Data',
|
52
|
+
'Note' => 'Observação',
|
53
|
+
'Event added' => 'Evento registrado',
|
54
|
+
'This event is planned for' => 'Este evento está planejado para',
|
55
|
+
'This event was planned for' => 'Este evento foi planejado para',
|
56
|
+
'The first line on the event text will turn into a summary displayed on the main page' => 'A primeira linha do texto do evento será exibida como resumo na página principal',
|
57
|
+
|
58
|
+
# Wiki edition page
|
59
|
+
'Insert page title here' => 'Digite o título aqui',
|
60
|
+
'Save modifications' => 'Salvar modificações',
|
61
|
+
'Discard' => 'Descartar',
|
62
|
+
'Quick reference' => 'Referência rápida',
|
63
|
+
'Title' => 'Título',
|
64
|
+
'address' => 'endereço',
|
65
|
+
'label' => 'rótulo',
|
66
|
+
'Page properties' => 'Propriedades da página',
|
67
|
+
'This page is a' => 'Esta página é uma',
|
68
|
+
'common wiki page' => 'página wiki comum',
|
69
|
+
'feature suggestion' => 'sugestão de recurso',
|
70
|
+
'event description' => 'descrição de evento',
|
71
|
+
'Who should be able to edit this page?' => 'Quem pode editar esta página?',
|
72
|
+
'(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
|
73
|
+
|
74
|
+
# Older headlines page
|
75
|
+
'Author' => 'Autor'
|
76
|
+
}
|
data/doc/README_FOR_APP
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
def populate_translation_tables
|
4
|
+
# add in defaults
|
5
|
+
load_from_csv("globalize_countries", country_data)
|
6
|
+
load_from_csv("globalize_languages", language_data)
|
7
|
+
load_from_csv("globalize_translations", translation_data)
|
8
|
+
end
|
9
|
+
|
10
|
+
def load_from_csv(table_name, data)
|
11
|
+
column_clause = nil
|
12
|
+
is_header = false
|
13
|
+
cnx = ActiveRecord::Base.connection
|
14
|
+
ActiveRecord::Base.silence do
|
15
|
+
reader = CSV::Reader.create(data)
|
16
|
+
|
17
|
+
columns = reader.shift.map {|column_name| cnx.quote_column_name(column_name) }
|
18
|
+
column_clause = columns.join(', ')
|
19
|
+
|
20
|
+
reader.each do |row|
|
21
|
+
next if row.first.nil? # skip blank lines
|
22
|
+
raise "No table name defined" if !table_name
|
23
|
+
raise "No header defined" if !column_clause
|
24
|
+
values_clause = row.map {|v| cnx.quote(v).gsub('\\n', "\n").gsub('\\r', "\r") }.join(', ')
|
25
|
+
sql = "INSERT INTO #{table_name} (#{column_clause}) VALUES (#{values_clause})"
|
26
|
+
cnx.insert(sql)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def country_data
|
32
|
+
<<END_OF_DATA
|
33
|
+
"id","code","english_name","date_format","currency_format","currency_code","thousands_sep","decimal_sep","currency_decimal_sep","number_grouping_scheme"
|
34
|
+
1,"BR","Brazil",,"R$%n","BRR",".",",",",","western"
|
35
|
+
2,"US","United States of America",,,"USD",",",".",".","western"
|
36
|
+
END_OF_DATA
|
37
|
+
end
|
38
|
+
|
39
|
+
def language_data
|
40
|
+
<<END_OF_DATA
|
41
|
+
"id","iso_639_1","iso_639_2","iso_639_3","rfc_3066","english_name","english_name_locale","english_name_modifier","native_name","native_name_locale","native_name_modifier","macro_language","direction","pluralization","scope"
|
42
|
+
1,"en","eng","eng",,"English",,,,,,0,"ltr","c == 1 ? 1 : 2","L"
|
43
|
+
2,"pt","por","por",,"Portuguese",,,"português",,,0,"ltr","c == 1 ? 1 : 2","L"
|
44
|
+
END_OF_DATA
|
45
|
+
end
|
46
|
+
|
47
|
+
def translation_data
|
48
|
+
<<END_OF_DATA
|
49
|
+
"id","type","tr_key","table_name","item_id","facet","language_id","text","pluralization_index"
|
50
|
+
1,"ViewTranslation","Sunday [weekday]","",,"",1,"Sunday",1
|
51
|
+
2,"ViewTranslation","Monday [weekday]","",,"",1,"Monday",1
|
52
|
+
3,"ViewTranslation","Tuesday [weekday]","",,"",1,"Tuesday",1
|
53
|
+
4,"ViewTranslation","Wednesday [weekday]","",,"",1,"Wednesday",1
|
54
|
+
5,"ViewTranslation","Thursday [weekday]","",,"",1,"Thursday",1
|
55
|
+
6,"ViewTranslation","Friday [weekday]","",,"",1,"Friday",1
|
56
|
+
7,"ViewTranslation","Saturday [weekday]","",,"",1,"Saturday",1
|
57
|
+
8,"ViewTranslation","Sun [abbreviated weekday]","",,"",1,"Sun",1
|
58
|
+
9,"ViewTranslation","Mon [abbreviated weekday]","",,"",1,"Mon",1
|
59
|
+
10,"ViewTranslation","Tue [abbreviated weekday]","",,"",1,"Tue",1
|
60
|
+
11,"ViewTranslation","Wed [abbreviated weekday]","",,"",1,"Wed",1
|
61
|
+
12,"ViewTranslation","Thu [abbreviated weekday]","",,"",1,"Thu",1
|
62
|
+
13,"ViewTranslation","Fri [abbreviated weekday]","",,"",1,"Fri",1
|
63
|
+
14,"ViewTranslation","Sat [abbreviated weekday]","",,"",1,"Sat",1
|
64
|
+
15,"ViewTranslation","January [month]","",,"",1,"January",1
|
65
|
+
16,"ViewTranslation","February [month]","",,"",1,"February",1
|
66
|
+
17,"ViewTranslation","March [month]","",,"",1,"March",1
|
67
|
+
18,"ViewTranslation","April [month]","",,"",1,"April",1
|
68
|
+
19,"ViewTranslation","May [month]","",,"",1,"May",1
|
69
|
+
20,"ViewTranslation","June [month]","",,"",1,"June",1
|
70
|
+
21,"ViewTranslation","July [month]","",,"",1,"July",1
|
71
|
+
22,"ViewTranslation","August [month]","",,"",1,"August",1
|
72
|
+
23,"ViewTranslation","September [month]","",,"",1,"September",1
|
73
|
+
24,"ViewTranslation","October [month]","",,"",1,"October",1
|
74
|
+
25,"ViewTranslation","November [month]","",,"",1,"November",1
|
75
|
+
26,"ViewTranslation","December [month]","",,"",1,"December",1
|
76
|
+
27,"ViewTranslation","Jan [abbreviated month]","",,"",1,"Jan",1
|
77
|
+
28,"ViewTranslation","Feb [abbreviated month]","",,"",1,"Feb",1
|
78
|
+
29,"ViewTranslation","Mar [abbreviated month]","",,"",1,"Mar",1
|
79
|
+
30,"ViewTranslation","Apr [abbreviated month]","",,"",1,"Apr",1
|
80
|
+
31,"ViewTranslation","May [abbreviated month]","",,"",1,"May",1
|
81
|
+
32,"ViewTranslation","Jun [abbreviated month]","",,"",1,"Jun",1
|
82
|
+
33,"ViewTranslation","Jul [abbreviated month]","",,"",1,"Jul",1
|
83
|
+
34,"ViewTranslation","Aug [abbreviated month]","",,"",1,"Aug",1
|
84
|
+
35,"ViewTranslation","Sep [abbreviated month]","",,"",1,"Sep",1
|
85
|
+
36,"ViewTranslation","Oct [abbreviated month]","",,"",1,"Oct",1
|
86
|
+
37,"ViewTranslation","Nov [abbreviated month]","",,"",1,"Nov",1
|
87
|
+
38,"ViewTranslation","Dec [abbreviated month]","",,"",1,"Dec",1
|
88
|
+
5967,"ViewTranslation","Sunday [weekday]","",,"",2,"Domingo",1
|
89
|
+
5968,"ViewTranslation","Monday [weekday]","",,"",2,"Segunda",1
|
90
|
+
5969,"ViewTranslation","Tuesday [weekday]","",,"",2,"Terça",1
|
91
|
+
5970,"ViewTranslation","Wednesday [weekday]","",,"",2,"Quarta",1
|
92
|
+
5971,"ViewTranslation","Thursday [weekday]","",,"",2,"Quinta",1
|
93
|
+
5972,"ViewTranslation","Friday [weekday]","",,"",2,"Sexta",1
|
94
|
+
5973,"ViewTranslation","Saturday [weekday]","",,"",2,"Sábado",1
|
95
|
+
5974,"ViewTranslation","Sun [abbreviated weekday]","",,"",2,"Dom",1
|
96
|
+
5975,"ViewTranslation","Mon [abbreviated weekday]","",,"",2,"Seg",1
|
97
|
+
5976,"ViewTranslation","Tue [abbreviated weekday]","",,"",2,"Ter",1
|
98
|
+
5977,"ViewTranslation","Wed [abbreviated weekday]","",,"",2,"Qua",1
|
99
|
+
5978,"ViewTranslation","Thu [abbreviated weekday]","",,"",2,"Qui",1
|
100
|
+
5979,"ViewTranslation","Fri [abbreviated weekday]","",,"",2,"Sex",1
|
101
|
+
5980,"ViewTranslation","Sat [abbreviated weekday]","",,"",2,"Sáb",1
|
102
|
+
5981,"ViewTranslation","January [month]","",,"",2,"Janeiro",1
|
103
|
+
5982,"ViewTranslation","February [month]","",,"",2,"Fevereiro",1
|
104
|
+
5983,"ViewTranslation","March [month]","",,"",2,"Março",1
|
105
|
+
5984,"ViewTranslation","April [month]","",,"",2,"Abril",1
|
106
|
+
5985,"ViewTranslation","May [month]","",,"",2,"Maio",1
|
107
|
+
5986,"ViewTranslation","June [month]","",,"",2,"Junho",1
|
108
|
+
5987,"ViewTranslation","July [month]","",,"",2,"Julho",1
|
109
|
+
5988,"ViewTranslation","August [month]","",,"",2,"Agosto",1
|
110
|
+
5989,"ViewTranslation","September [month]","",,"",2,"Setembro",1
|
111
|
+
5990,"ViewTranslation","October [month]","",,"",2,"Outubro",1
|
112
|
+
5991,"ViewTranslation","November [month]","",,"",2,"Novembro",1
|
113
|
+
5992,"ViewTranslation","December [month]","",,"",2,"Dezembro",1
|
114
|
+
5993,"ViewTranslation","Jan [abbreviated month]","",,"",2,"Jan",1
|
115
|
+
5994,"ViewTranslation","Feb [abbreviated month]","",,"",2,"Fev",1
|
116
|
+
5995,"ViewTranslation","Mar [abbreviated month]","",,"",2,"Mar",1
|
117
|
+
5996,"ViewTranslation","Apr [abbreviated month]","",,"",2,"Abr",1
|
118
|
+
5997,"ViewTranslation","May [abbreviated month]","",,"",2,"Mai",1
|
119
|
+
5998,"ViewTranslation","Jun [abbreviated month]","",,"",2,"Jun",1
|
120
|
+
5999,"ViewTranslation","Jul [abbreviated month]","",,"",2,"Jul",1
|
121
|
+
6000,"ViewTranslation","Aug [abbreviated month]","",,"",2,"Ago",1
|
122
|
+
6001,"ViewTranslation","Sep [abbreviated month]","",,"",2,"Set",1
|
123
|
+
6002,"ViewTranslation","Oct [abbreviated month]","",,"",2,"Out",1
|
124
|
+
6003,"ViewTranslation","Nov [abbreviated month]","",,"",2,"Nov",1
|
125
|
+
6004,"ViewTranslation","Dec [abbreviated month]","",,"",2,"Dez",1
|
126
|
+
END_OF_DATA
|
127
|
+
end
|
128
|
+
|
129
|
+
begin
|
130
|
+
Locale.set_base_language('en-US')
|
131
|
+
|
132
|
+
begin
|
133
|
+
Locale.set_translation('test', Language.pick('pt-BR'), 'teste')
|
134
|
+
rescue
|
135
|
+
populate_translation_tables
|
136
|
+
end
|
137
|
+
|
138
|
+
translation_dir = File.expand_path(__FILE__ + '/../../db/translation')
|
139
|
+
Dir.foreach(translation_dir) do |file|
|
140
|
+
if (file != '.' && file != '..' && file =~ /\.rb\Z/) then
|
141
|
+
lang_code = file[0, file.length - 3]
|
142
|
+
language = Language.pick(lang_code)
|
143
|
+
contents = File.read(File.join(translation_dir, file))
|
144
|
+
translations = eval contents
|
145
|
+
translations.each do |key, value|
|
146
|
+
Locale.set_translation(key, language, value)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
rescue
|
151
|
+
# ignore errors and don't do anything, we are probably being called by
|
152
|
+
# rake as part of the initial migration. after it runs, no errors will be
|
153
|
+
# raised and we'll execute normally
|
154
|
+
end
|
data/lib/login_system.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require_dependency "user"
|
2
|
+
|
3
|
+
module LoginSystem
|
4
|
+
|
5
|
+
protected
|
6
|
+
|
7
|
+
# overwrite this if you want to restrict access to only a few actions
|
8
|
+
# or if you want to check if the user has the correct rights
|
9
|
+
# example:
|
10
|
+
#
|
11
|
+
# # only allow nonbobs
|
12
|
+
# def authorize?(user)
|
13
|
+
# user.login != "bob"
|
14
|
+
# end
|
15
|
+
def authorize?(user)
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
# overwrite this method if you only want to protect certain actions of the controller
|
20
|
+
# example:
|
21
|
+
#
|
22
|
+
# # don't protect the login and the about method
|
23
|
+
# def protect?(action)
|
24
|
+
# if ['action', 'about'].include?(action)
|
25
|
+
# return false
|
26
|
+
# else
|
27
|
+
# return true
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
def protect?(action)
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
# login_required filter. add
|
35
|
+
#
|
36
|
+
# before_filter :login_required
|
37
|
+
#
|
38
|
+
# if the controller should be under any rights management.
|
39
|
+
# for finer access control you can overwrite
|
40
|
+
#
|
41
|
+
# def authorize?(user)
|
42
|
+
#
|
43
|
+
def login_required
|
44
|
+
|
45
|
+
if not protect?(action_name)
|
46
|
+
return true
|
47
|
+
end
|
48
|
+
|
49
|
+
if session[:user] and authorize?(session[:user])
|
50
|
+
return true
|
51
|
+
end
|
52
|
+
|
53
|
+
# store current location so that we can
|
54
|
+
# come back after the user logged in
|
55
|
+
store_location
|
56
|
+
|
57
|
+
# call overwriteable reaction to unauthorized access
|
58
|
+
access_denied
|
59
|
+
return false
|
60
|
+
end
|
61
|
+
|
62
|
+
# overwrite if you want to have special behavior in case the user is not authorized
|
63
|
+
# to access the current operation.
|
64
|
+
# the default action is to redirect to the login screen
|
65
|
+
# example use :
|
66
|
+
# a popup window might just close itself for instance
|
67
|
+
def access_denied
|
68
|
+
redirect_to :controller=>"/account", :action =>"login"
|
69
|
+
end
|
70
|
+
|
71
|
+
# store current uri in the session.
|
72
|
+
# we can return to this location by calling return_location
|
73
|
+
def store_location
|
74
|
+
session[:return_to] = request.request_uri
|
75
|
+
end
|
76
|
+
|
77
|
+
# move to the last store_location call or to the passed default one
|
78
|
+
def redirect_back_or_default(target)
|
79
|
+
if ! target.nil?
|
80
|
+
redirect_to target
|
81
|
+
elsif session[:return_to].nil?
|
82
|
+
redirect_to :controller => 'root', :action => 'index'
|
83
|
+
else
|
84
|
+
redirect_to_url session[:return_to]
|
85
|
+
session[:return_to] = nil
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class Time
|
2
|
+
|
3
|
+
def relative_to_now(reference_time=Time.now)
|
4
|
+
secs = self.to_i - reference_time.to_i
|
5
|
+
sufix = if secs < 0 then 'ago' else 'from now' end
|
6
|
+
secs = secs.abs
|
7
|
+
result = nil
|
8
|
+
# 31536000 = 86400 * 365 days (1 year)
|
9
|
+
# 2592000 = 86400 * 30 days (1 month)
|
10
|
+
# 604800 = 86400 seconds * 7 days (1 week)
|
11
|
+
# 86400 = 60 seconds * 60 minutes * 24 h (1 day)
|
12
|
+
# 3600 = 60 seconds * 60 minutes (1 hour)
|
13
|
+
[ [31536000, 'year'], [2592000, 'month'], [604800, 'week'],
|
14
|
+
[86400, 'day'], [3600, 'hour'], [60, 'minute']].
|
15
|
+
each do |x|
|
16
|
+
if result.nil? && secs >= x[0] then
|
17
|
+
number = secs / x[0]
|
18
|
+
result = filter_time_to(number, x[1], sufix)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
return result || 'Less than one minute ago'.t
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
include Inflector
|
27
|
+
|
28
|
+
def filter_time_to(number, period, sufix)
|
29
|
+
return 'Yesterday'.t if 1 == number && 'day' == period && 'ago' == sufix
|
30
|
+
return 'Tomorrow'.t if 1 == number && 'day' == period && 'from now' == sufix
|
31
|
+
period = period.t
|
32
|
+
inflected = if number > 1 then pluralize(period) else period end
|
33
|
+
return "%s #{sufix}" / "#{number} #{inflected}"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
class Date
|
39
|
+
|
40
|
+
def relative_to_now(reference_time=Time.now)
|
41
|
+
to_t.relative_to_now(reference_time)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_t
|
45
|
+
Time.local(year, month, day, 23, 59, 59)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|