compages 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.project +18 -0
- data/README +180 -0
- data/Rakefile +10 -0
- data/app/controllers/application.rb +4 -0
- data/app/controllers/contents_controller.rb +116 -0
- data/app/controllers/pages_controller.rb +59 -0
- data/app/controllers/render_controller.rb +24 -0
- data/app/helpers/application_helper.rb +6 -0
- data/app/helpers/contents_helper.rb +5 -0
- data/app/helpers/pages_helper.rb +5 -0
- data/app/helpers/render_helper.rb +2 -0
- data/app/models/content.rb +26 -0
- data/app/models/meta_data.rb +3 -0
- data/app/models/page.rb +106 -0
- data/app/models/page_element.rb +9 -0
- data/app/views/contents/_content_preview.rhtml +1 -0
- data/app/views/contents/_contents_list.rhtml +3 -0
- data/app/views/contents/_show_library.rhtml +60 -0
- data/app/views/contents/_write_now.rhtml +42 -0
- data/app/views/layouts/pages.rhtml +24 -0
- data/app/views/layouts/render.rhtml +11 -0
- data/app/views/pages/_change_theme.rhtml +0 -0
- data/app/views/pages/_edit_menu.rhtml +62 -0
- data/app/views/pages/_page_listed.rhtml +13 -0
- data/app/views/pages/_select_theme.rhtml +4 -0
- data/app/views/pages/edit.rhtml +35 -0
- data/app/views/pages/index.rhtml +45 -0
- data/app/views/pages/list.rhtml +41 -0
- data/app/views/pages/list_a.rhtml +40 -0
- data/app/views/pages/welcome.rhtml +27 -0
- data/app/views/render/_blank.rhtml +3 -0
- data/app/views/render/show.rhtml +1 -0
- data/bin/compages +14 -0
- data/config/boot.rb +44 -0
- data/config/database.yml.home +35 -0
- data/config/environment.rb +53 -0
- data/config/environments/development.rb +21 -0
- data/config/environments/production.rb +18 -0
- data/config/environments/test.rb +19 -0
- data/config/routes.rb +32 -0
- data/db/Copia di schema.rb +48 -0
- data/db/migrate/001_create_pages.rb +12 -0
- data/db/migrate/002_create_contents.rb +12 -0
- data/db/migrate/003_create_meta_datas.rb +14 -0
- data/db/migrate/004_create_page_elements.rb +17 -0
- data/db/migrate/005_add_urlnames.rb +15 -0
- data/db/migrate/006_add_sessions.rb +15 -0
- data/db/schema.mysql.sql +65 -0
- data/db/schema.postgresql.sql +65 -0
- data/db/schema.rb +49 -0
- data/db/schema.sqlite.sql +65 -0
- data/db/schema.sqlserver.sql +71 -0
- data/db/schema_version +1 -0
- data/doc/ER-model/v1.dia +0 -0
- data/doc/ER-model/v2.dia +0 -0
- data/doc/ER-model/v3.dia +0 -0
- data/doc/README_FOR_APP +2 -0
- data/doc/esempi/doc-vir/ecds.htm +2362 -0
- data/doc/esempi/doc-vir/ecds_files/search.gif +0 -0
- data/doc/esempi/doc-vir/ecds_files/upld.gif +0 -0
- data/doc/esempi/doc-vir/ecds_files/upld.jpg +0 -0
- data/installer/apache13.conf.example.template +33 -0
- data/installer/apache20.conf.example.template +40 -0
- data/installer/lighttpd.conf.example.template +6 -0
- data/installer/rails_installer_defaults.yml +5 -0
- data/lib/redcloth.rb +1130 -0
- data/lib/render_engine.rb +94 -0
- data/lib/tasks/release.rake +46 -0
- data/public/.htaccess +41 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/_index.html +277 -0
- data/public/favicon.ico +0 -0
- data/public/images/body_bg.gif +0 -0
- data/public/images/body_bg_short.gif +0 -0
- data/public/images/ie_shadow.png +0 -0
- data/public/images/journal_reflex.gif +0 -0
- data/public/images/journal_shadow.gif +0 -0
- data/public/images/logo_journal_small.bmp +0 -0
- data/public/images/logo_journal_small.png +0 -0
- data/public/images/page_edit_shadow.png +0 -0
- data/public/images/restore_bar.png +0 -0
- data/public/images/spinner.gif +0 -0
- data/public/javascripts/application.js +23 -0
- data/public/javascripts/controls.js +815 -0
- data/public/javascripts/dragdrop.js +913 -0
- data/public/javascripts/effects.js +958 -0
- data/public/javascripts/lowpro.js +307 -0
- data/public/javascripts/prototype.js +2006 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/compages.css +196 -0
- data/public/stylesheets/editing.css +180 -0
- data/public/stylesheets/editing_ie_filth.css +36 -0
- data/public/themes/Doc_basic/_script.js +342 -0
- data/public/themes/Doc_basic/images/Thumbs.db +0 -0
- data/public/themes/Doc_basic/images/search.gif +0 -0
- data/public/themes/Doc_basic/images/upld.gif +0 -0
- data/public/themes/Doc_basic/images/upld.jpg +0 -0
- data/public/themes/Doc_basic/index.html +114 -0
- data/public/themes/Doc_basic/style.css +1743 -0
- data/public/themes/color7boxes/default2.css +42 -0
- data/public/themes/color7boxes/index.html +40 -0
- data/public/themes/prova/index.html +12 -0
- data/public/zDoc/images/search.gif +0 -0
- data/public/zDoc/images/upld.gif +0 -0
- data/public/zDoc/images/upld.jpg +0 -0
- data/public/zDoc/index.html +176 -0
- data/public/zDoc/script.js +342 -0
- data/public/zDoc/style.css +1741 -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/runner +3 -0
- data/script/server +3 -0
- data/test/fixtures/contents.yml +5 -0
- data/test/fixtures/meta_datas.yml +5 -0
- data/test/fixtures/page_elements.yml +5 -0
- data/test/fixtures/pages.yml +5 -0
- data/test/functional/contents_controller_test.rb +18 -0
- data/test/functional/pages_controller_test.rb +18 -0
- data/test/functional/render_controller_test.rb +18 -0
- data/test/test_helper.rb +28 -0
- data/test/unit/content_test.rb +10 -0
- data/test/unit/meta_data_test.rb +10 -0
- data/test/unit/page_element_test.rb +10 -0
- data/test/unit/page_test.rb +10 -0
- data/tmp/sessions/ruby_sess.0ced4c30e36477ab +0 -0
- data/tmp/sessions/ruby_sess.20fbe26671422e70 +0 -0
- data/tmp/sessions/ruby_sess.2c72521f3a7e2ba9 +0 -0
- data/tmp/sessions/ruby_sess.4107a69d982a2eb7 +0 -0
- data/tmp/sessions/ruby_sess.573ded9c7fdd9035 +0 -0
- data/tmp/sessions/ruby_sess.5a9767815bb96258 +0 -0
- data/tmp/sessions/ruby_sess.85d723b794005388 +0 -0
- data/tmp/sessions/ruby_sess.875b3b3e3529afdb +0 -0
- data/tmp/sessions/ruby_sess.936766f3a397c88b +0 -0
- data/tmp/sessions/ruby_sess.984e2e4c9a2e7891 +0 -0
- data/tmp/sessions/ruby_sess.a1faebd7448bc45d +0 -0
- data/tmp/sessions/ruby_sess.a415768c7635bc15 +0 -0
- data/tmp/sessions/ruby_sess.b2dadcbe6c1b0add +0 -0
- data/tmp/sessions/ruby_sess.ca9100beb103a428 +0 -0
- data/tmp/sessions/ruby_sess.d649c800a046efde +0 -0
- data/tmp/sessions/ruby_sess.db73bbfafd5a537c +0 -0
- data/tmp/sessions/ruby_sess.e32487b847524df1 +0 -0
- data/tmp/sessions/ruby_sess.f4e45d67828cc437 +0 -0
- data/tmp/sessions/ruby_sess.f5a3f064f2f7a26f +0 -0
- data/tmp/sessions/ruby_sess.ff0c47b35f238cda +0 -0
- data/vendor/plugins/acts_as_urlnameable.tar.gz +0 -0
- data/vendor/plugins/acts_as_urlnameable/LICENSE +19 -0
- data/vendor/plugins/acts_as_urlnameable/README +193 -0
- data/vendor/plugins/acts_as_urlnameable/Rakefile +25 -0
- data/vendor/plugins/acts_as_urlnameable/TODO +5 -0
- data/vendor/plugins/acts_as_urlnameable/db/00x_add_urlnames_table.rb +15 -0
- data/vendor/plugins/acts_as_urlnameable/db/urlnames_table.sql +7 -0
- data/vendor/plugins/acts_as_urlnameable/doc/classes/ActiveRecord/Acts/Urlnameable/ClassMethods.html +167 -0
- data/vendor/plugins/acts_as_urlnameable/doc/classes/ActiveRecord/Acts/Urlnameable/InstanceMethods.html +213 -0
- data/vendor/plugins/acts_as_urlnameable/doc/classes/ActiveRecord/Acts/Urlnameable/SingletonMethods.html +189 -0
- data/vendor/plugins/acts_as_urlnameable/doc/created.rid +1 -0
- data/vendor/plugins/acts_as_urlnameable/doc/files/LICENSE.html +129 -0
- data/vendor/plugins/acts_as_urlnameable/doc/files/README.html +333 -0
- data/vendor/plugins/acts_as_urlnameable/doc/files/TODO.html +121 -0
- data/vendor/plugins/acts_as_urlnameable/doc/files/lib/acts_as_urlnameable_rb.html +101 -0
- data/vendor/plugins/acts_as_urlnameable/doc/fr_class_index.html +29 -0
- data/vendor/plugins/acts_as_urlnameable/doc/fr_file_index.html +30 -0
- data/vendor/plugins/acts_as_urlnameable/doc/fr_method_index.html +34 -0
- data/vendor/plugins/acts_as_urlnameable/doc/index.html +24 -0
- data/vendor/plugins/acts_as_urlnameable/doc/rdoc-style.css +208 -0
- data/vendor/plugins/acts_as_urlnameable/init.rb +3 -0
- data/vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb +159 -0
- data/vendor/plugins/acts_as_urlnameable/lib/urlname.rb +3 -0
- data/vendor/plugins/acts_as_urlnameable/test/acts_as_urlnameable_test.rb +233 -0
- data/vendor/plugins/acts_as_urlnameable/test/connection.rb +8 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/article.rb +13 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/articles.yml +62 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/page.rb +14 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/pages.yml +35 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/people.yml +9 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/person.rb +26 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/schema.rb +24 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/section.rb +5 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/sections.yml +9 -0
- data/vendor/plugins/acts_as_urlnameable/test/fixtures/urlnames.yml +153 -0
- data/vendor/plugins/acts_as_urlnameable/test/test_helper.rb +42 -0
- data/vendor/plugins/gems/README +30 -0
- data/vendor/plugins/gems/init.rb +9 -0
- data/vendor/plugins/gems/tasks/gems_tasks.rake +32 -0
- data/vendor/plugins/unobtrusive_javascript/CHANGELOG +72 -0
- data/vendor/plugins/unobtrusive_javascript/README +73 -0
- data/vendor/plugins/unobtrusive_javascript/Rakefile +33 -0
- data/vendor/plugins/unobtrusive_javascript/about.yml +6 -0
- data/vendor/plugins/unobtrusive_javascript/assets/javascripts/lowpro.js +307 -0
- data/vendor/plugins/unobtrusive_javascript/init.rb +21 -0
- data/vendor/plugins/unobtrusive_javascript/install.rb +1 -0
- data/vendor/plugins/unobtrusive_javascript/lib/actionview_helpers_patches.rb +17 -0
- data/vendor/plugins/unobtrusive_javascript/lib/asset_tag_helper_patches.rb +33 -0
- data/vendor/plugins/unobtrusive_javascript/lib/behaviour_caching.rb +70 -0
- data/vendor/plugins/unobtrusive_javascript/lib/controllers/unobtrusive_javascript_controller.rb +52 -0
- data/vendor/plugins/unobtrusive_javascript/lib/prototype_helper_patches.rb +72 -0
- data/vendor/plugins/unobtrusive_javascript/lib/scriptaculous_helper_patches.rb +62 -0
- data/vendor/plugins/unobtrusive_javascript/lib/tag_helper_patches.rb +37 -0
- data/vendor/plugins/unobtrusive_javascript/lib/ujs.rb +32 -0
- data/vendor/plugins/unobtrusive_javascript/lib/ujs/behaviour_helper.rb +62 -0
- data/vendor/plugins/unobtrusive_javascript/lib/ujs/behaviour_script.rb +54 -0
- data/vendor/plugins/unobtrusive_javascript/lib/ujs/behaviour_script_converter.rb +23 -0
- data/vendor/plugins/unobtrusive_javascript/lib/ujs/controller_methods.rb +55 -0
- data/vendor/plugins/unobtrusive_javascript/lib/ujs/helpers.rb +152 -0
- data/vendor/plugins/unobtrusive_javascript/lib/ujs/javascript_proxies.rb +57 -0
- data/vendor/plugins/unobtrusive_javascript/tasks/unobtrusive_javascript_tasks.rake +15 -0
- data/vendor/plugins/unobtrusive_javascript/test/asset_tag_helper_patches_test.rb +32 -0
- data/vendor/plugins/unobtrusive_javascript/test/behaviour_helper_test.rb +180 -0
- data/vendor/plugins/unobtrusive_javascript/test/behaviour_script_converter_test.rb +72 -0
- data/vendor/plugins/unobtrusive_javascript/test/behaviour_script_test.rb +98 -0
- data/vendor/plugins/unobtrusive_javascript/test/config/environment.rb +8 -0
- data/vendor/plugins/unobtrusive_javascript/test/config/routes.rb +4 -0
- data/vendor/plugins/unobtrusive_javascript/test/config/schema.rb +3 -0
- data/vendor/plugins/unobtrusive_javascript/test/controller_methods_test.rb +48 -0
- data/vendor/plugins/unobtrusive_javascript/test/helpers_test.rb +186 -0
- data/vendor/plugins/unobtrusive_javascript/test/javascript_proxies_test.rb +3 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/ptk/boot.rb +26 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/ptk/gem/action_controller.rb +11 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/ptk/gem/action_mailer.rb +4 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/ptk/gem/active_record.rb +27 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/ptk/gem/rails.rb +31 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/ptk/ptk.rb +148 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/ptk/suite/difference.rb +23 -0
- data/vendor/plugins/unobtrusive_javascript/test/lib/stubs/controller_stub.rb +10 -0
- data/vendor/plugins/unobtrusive_javascript/test/ptk_helper.rb +29 -0
- data/vendor/plugins/unobtrusive_javascript/test/tag_helper_patches_test.rb +59 -0
- data/vendor/plugins/unobtrusive_javascript/test/test_helper.rb +25 -0
- data/vendor/plugins/unobtrusive_javascript/test/unobtrusive_javascript_controller_test.rb +95 -0
- data/vendor/plugins/unobtrusive_javascript/uninstall.rb +1 -0
- data/vendor/redcloth/bin/redcloth +3 -0
- data/vendor/redcloth/doc/CHANGELOG +160 -0
- data/vendor/redcloth/doc/COPYING +25 -0
- data/vendor/redcloth/doc/README +106 -0
- data/vendor/redcloth/doc/REFERENCE +216 -0
- data/vendor/redcloth/doc/make.rb +359 -0
- data/vendor/redcloth/lib/redcloth.rb +1130 -0
- data/vendor/redcloth/run-tests.rb +28 -0
- data/vendor/redcloth/setup.rb +1376 -0
- data/vendor/redcloth/tests/code.yml +105 -0
- data/vendor/redcloth/tests/hard_breaks.yml +26 -0
- data/vendor/redcloth/tests/images.yml +171 -0
- data/vendor/redcloth/tests/instiki.yml +39 -0
- data/vendor/redcloth/tests/links.yml +155 -0
- data/vendor/redcloth/tests/lists.yml +77 -0
- data/vendor/redcloth/tests/markdown.yml +218 -0
- data/vendor/redcloth/tests/poignant.yml +64 -0
- data/vendor/redcloth/tests/table.yml +198 -0
- data/vendor/redcloth/tests/textism.yml +406 -0
- metadata +432 -0
data/.project
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>compages</name>
|
|
4
|
+
<comment></comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.rubypeople.rdt.core.rubybuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.radrails.rails.ui.railsnature</nature>
|
|
16
|
+
<nature>org.rubypeople.rdt.core.rubynature</nature>
|
|
17
|
+
</natures>
|
|
18
|
+
</projectDescription>
|
data/README
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
== Welcome to Rails
|
|
2
|
+
|
|
3
|
+
Rails is a web-application and persistence framework that includes everything
|
|
4
|
+
needed to create database-backed web-applications according to the
|
|
5
|
+
Model-View-Control pattern of separation. This pattern splits the view (also
|
|
6
|
+
called the presentation) into "dumb" templates that are primarily responsible
|
|
7
|
+
for inserting pre-built data in between HTML tags. The model contains the
|
|
8
|
+
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
|
9
|
+
the business logic and knows how to persist themselves to a database. The
|
|
10
|
+
controller handles the incoming requests (such as Save New Account, Update
|
|
11
|
+
Product, Show Post) by manipulating the model and directing data to the view.
|
|
12
|
+
|
|
13
|
+
In Rails, the model is handled by what's called an object-relational mapping
|
|
14
|
+
layer entitled Active Record. This layer allows you to present the data from
|
|
15
|
+
database rows as objects and embellish these data objects with business logic
|
|
16
|
+
methods. You can read more about Active Record in
|
|
17
|
+
link:files/vendor/rails/activerecord/README.html.
|
|
18
|
+
|
|
19
|
+
The controller and view are handled by the Action Pack, which handles both
|
|
20
|
+
layers by its two parts: Action View and Action Controller. These two layers
|
|
21
|
+
are bundled in a single package due to their heavy interdependence. This is
|
|
22
|
+
unlike the relationship between the Active Record and Action Pack that is much
|
|
23
|
+
more separate. Each of these packages can be used independently outside of
|
|
24
|
+
Rails. You can read more about Action Pack in
|
|
25
|
+
link:files/vendor/rails/actionpack/README.html.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
== Getting started
|
|
29
|
+
|
|
30
|
+
1. Start the web server: <tt>ruby script/server</tt> (run with --help for options)
|
|
31
|
+
2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
|
|
32
|
+
3. Follow the guidelines to start developing your application
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
== Web servers
|
|
36
|
+
|
|
37
|
+
Rails uses the built-in web server in Ruby called WEBrick by default, so you don't
|
|
38
|
+
have to install or configure anything to play around.
|
|
39
|
+
|
|
40
|
+
If you have lighttpd installed, though, it'll be used instead when running script/server.
|
|
41
|
+
It's considerably faster than WEBrick and suited for production use, but requires additional
|
|
42
|
+
installation and currently only works well on OS X/Unix (Windows users are encouraged
|
|
43
|
+
to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from
|
|
44
|
+
http://www.lighttpd.net.
|
|
45
|
+
|
|
46
|
+
If you want something that's halfway between WEBrick and lighttpd, we heartily recommend
|
|
47
|
+
Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that
|
|
48
|
+
also works very well with Windows. See more at http://mongrel.rubyforge.org/.
|
|
49
|
+
|
|
50
|
+
But of course its also possible to run Rails with the premiere open source web server Apache.
|
|
51
|
+
To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want
|
|
52
|
+
to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid.
|
|
53
|
+
|
|
54
|
+
See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI.
|
|
55
|
+
|
|
56
|
+
== Example for Apache conf
|
|
57
|
+
|
|
58
|
+
<VirtualHost *:80>
|
|
59
|
+
ServerName rails
|
|
60
|
+
DocumentRoot /path/application/public/
|
|
61
|
+
ErrorLog /path/application/log/server.log
|
|
62
|
+
|
|
63
|
+
<Directory /path/application/public/>
|
|
64
|
+
Options ExecCGI FollowSymLinks
|
|
65
|
+
AllowOverride all
|
|
66
|
+
Allow from all
|
|
67
|
+
Order allow,deny
|
|
68
|
+
</Directory>
|
|
69
|
+
</VirtualHost>
|
|
70
|
+
|
|
71
|
+
NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
|
|
72
|
+
should be on and ".cgi" should respond. All requests from 127.0.0.1 go
|
|
73
|
+
through CGI, so no Apache restart is necessary for changes. All other requests
|
|
74
|
+
go through FCGI (or mod_ruby), which requires a restart to show changes.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
== Debugging Rails
|
|
78
|
+
|
|
79
|
+
Have "tail -f" commands running on both the server.log, production.log, and
|
|
80
|
+
test.log files. Rails will automatically display debugging and runtime
|
|
81
|
+
information to these files. Debugging info will also be shown in the browser
|
|
82
|
+
on requests from 127.0.0.1.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
== Breakpoints
|
|
86
|
+
|
|
87
|
+
Breakpoint support is available through the script/breakpointer client. This
|
|
88
|
+
means that you can break out of execution at any point in the code, investigate
|
|
89
|
+
and change the model, AND then resume execution! Example:
|
|
90
|
+
|
|
91
|
+
class WeblogController < ActionController::Base
|
|
92
|
+
def index
|
|
93
|
+
@posts = Post.find_all
|
|
94
|
+
breakpoint "Breaking out from the list"
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
So the controller will accept the action, run the first line, then present you
|
|
99
|
+
with a IRB prompt in the breakpointer window. Here you can do things like:
|
|
100
|
+
|
|
101
|
+
Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
|
|
102
|
+
|
|
103
|
+
>> @posts.inspect
|
|
104
|
+
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
|
105
|
+
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
|
106
|
+
>> @posts.first.title = "hello from a breakpoint"
|
|
107
|
+
=> "hello from a breakpoint"
|
|
108
|
+
|
|
109
|
+
...and even better is that you can examine how your runtime objects actually work:
|
|
110
|
+
|
|
111
|
+
>> f = @posts.first
|
|
112
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
|
113
|
+
>> f.
|
|
114
|
+
Display all 152 possibilities? (y or n)
|
|
115
|
+
|
|
116
|
+
Finally, when you're ready to resume execution, you press CTRL-D
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
== Console
|
|
120
|
+
|
|
121
|
+
You can interact with the domain model by starting the console through script/console.
|
|
122
|
+
Here you'll have all parts of the application configured, just like it is when the
|
|
123
|
+
application is running. You can inspect domain models, change values, and save to the
|
|
124
|
+
database. Starting the script without arguments will launch it in the development environment.
|
|
125
|
+
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
== Description of contents
|
|
129
|
+
|
|
130
|
+
app
|
|
131
|
+
Holds all the code that's specific to this particular application.
|
|
132
|
+
|
|
133
|
+
app/controllers
|
|
134
|
+
Holds controllers that should be named like weblog_controller.rb for
|
|
135
|
+
automated URL mapping. All controllers should descend from
|
|
136
|
+
ActionController::Base.
|
|
137
|
+
|
|
138
|
+
app/models
|
|
139
|
+
Holds models that should be named like post.rb.
|
|
140
|
+
Most models will descend from ActiveRecord::Base.
|
|
141
|
+
|
|
142
|
+
app/views
|
|
143
|
+
Holds the template files for the view that should be named like
|
|
144
|
+
weblog/index.rhtml for the WeblogController#index action. All views use eRuby
|
|
145
|
+
syntax. This directory can also be used to keep stylesheets, images, and so on
|
|
146
|
+
that can be symlinked to public.
|
|
147
|
+
|
|
148
|
+
app/helpers
|
|
149
|
+
Holds view helpers that should be named like weblog_helper.rb.
|
|
150
|
+
|
|
151
|
+
app/apis
|
|
152
|
+
Holds API classes for web services.
|
|
153
|
+
|
|
154
|
+
config
|
|
155
|
+
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
|
156
|
+
|
|
157
|
+
components
|
|
158
|
+
Self-contained mini-applications that can bundle together controllers, models, and views.
|
|
159
|
+
|
|
160
|
+
db
|
|
161
|
+
Contains the database schema in schema.rb. db/migrate contains all
|
|
162
|
+
the sequence of Migrations for your schema.
|
|
163
|
+
|
|
164
|
+
lib
|
|
165
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
|
166
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
|
167
|
+
|
|
168
|
+
public
|
|
169
|
+
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
|
170
|
+
and javascripts. Also contains the dispatchers and the default HTML files.
|
|
171
|
+
|
|
172
|
+
script
|
|
173
|
+
Helper scripts for automation and generation.
|
|
174
|
+
|
|
175
|
+
test
|
|
176
|
+
Unit and functional tests along with fixtures.
|
|
177
|
+
|
|
178
|
+
vendor
|
|
179
|
+
External libraries that the application depends on. Also includes the plugins subdirectory.
|
|
180
|
+
This directory is in the load path.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
+
|
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
|
5
|
+
|
|
6
|
+
require 'rake'
|
|
7
|
+
require 'rake/testtask'
|
|
8
|
+
require 'rake/rdoctask'
|
|
9
|
+
|
|
10
|
+
require 'tasks/rails'
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
class ContentsController < ApplicationController
|
|
2
|
+
|
|
3
|
+
def write_now
|
|
4
|
+
@page = Page.find(params[:id])
|
|
5
|
+
render :update do |page|
|
|
6
|
+
page << "goToMenu('write_content_menu');"
|
|
7
|
+
page.replace_html "widgets", :partial => "write_now"
|
|
8
|
+
# page.insert_html :bottom, "page_actions", :partial => "write_now"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def show_library
|
|
13
|
+
@page = Page.find(params[:id])
|
|
14
|
+
@contents = Content.find :all
|
|
15
|
+
render :update do |page|
|
|
16
|
+
page << "goToMenu('write_content_menu');"
|
|
17
|
+
page.replace_html "widgets", :partial => "show_library"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def live_search (search_text = params[:searchtext])
|
|
22
|
+
@phrase = search_text
|
|
23
|
+
@contents = Content.find(:all, :conditions => "( contents.body LIKE '%#{@phrase}%' )")
|
|
24
|
+
s = render_to_string( :partial => "contents_list" )
|
|
25
|
+
render :update do |page|
|
|
26
|
+
page.alert(s)#:todo:debug:
|
|
27
|
+
page["select_content"].replace_html :partial => "contents_list"
|
|
28
|
+
page["search_comment"].replace_html( @phrase==""?"":"#{@contents.length.to_s} result#{'s' unless @contents.length==1} for <code>#{@phrase}</code>" )
|
|
29
|
+
page["content_actions"].hide
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def content_preview
|
|
34
|
+
unless params[:select_content]==""
|
|
35
|
+
@content = Content.find params[:select_content]
|
|
36
|
+
render :partial=>"content_preview"
|
|
37
|
+
else
|
|
38
|
+
render :text => %{<i style="color:lightgrey">no content selected for the preview</i>}
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def delete_content
|
|
43
|
+
@content = Content.find params[:content][:id]
|
|
44
|
+
@page_elements = @content.page_elements.find_all "page_id = #{params[:id]}"
|
|
45
|
+
elements_to_remove = @page_elements.collect {|page_element|
|
|
46
|
+
if page_element.page_id.to_s == params[:id]
|
|
47
|
+
'element_'<< page_element.id.to_s
|
|
48
|
+
end
|
|
49
|
+
page_element.destroy
|
|
50
|
+
}.compact
|
|
51
|
+
|
|
52
|
+
render :update do |page|
|
|
53
|
+
if elements_to_remove
|
|
54
|
+
elements_to_remove.each{ |e| page["element_"+e.id.to_s].remove }
|
|
55
|
+
end
|
|
56
|
+
page<< remote_function(
|
|
57
|
+
:url => { :action => :live_search },
|
|
58
|
+
:with => "('searchtext='+$('searchtext').value)" )
|
|
59
|
+
end
|
|
60
|
+
@content.destroy
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def create_page_element
|
|
64
|
+
@page = Page.find(params[:id])
|
|
65
|
+
@page_element = PageElement.create(:area_name=>"main", :page_id=>params[:id])
|
|
66
|
+
if params[:content][:id]
|
|
67
|
+
@page_element.content = Content.find(params[:content][:id])
|
|
68
|
+
else
|
|
69
|
+
@page_element.content = Content.create(params[:content])
|
|
70
|
+
end
|
|
71
|
+
if @page_element.save
|
|
72
|
+
element_html = %(<div class='compages_element' id='element_#{ @page_element.id }'>)
|
|
73
|
+
element_html << @page_element.content.body_to_html
|
|
74
|
+
element_html << %(</div>)
|
|
75
|
+
render :update do |page|
|
|
76
|
+
#qui problemi con IE :todo:
|
|
77
|
+
page.replace_html "widgets", ""
|
|
78
|
+
page.insert_html :top, "area_main", element_html
|
|
79
|
+
area = "main"
|
|
80
|
+
page.sortable( "area_"<< area,
|
|
81
|
+
:url=>{ :controller=>"contents", :action=>"update_area_elements", :id=>("area_"+area) },
|
|
82
|
+
:dropOnEmpty=>true,
|
|
83
|
+
:tag=>:div,
|
|
84
|
+
:only=>"compages_element",
|
|
85
|
+
:constraint=>false,
|
|
86
|
+
:hoverclass=>"\"dragging\"",
|
|
87
|
+
:containment=>@page.area_names.collect{|name| "area_"<< name})
|
|
88
|
+
page["element_#{ @page_element.id }"].visual_effect :highlight
|
|
89
|
+
page<< "goToMenu('add_content_menu');"
|
|
90
|
+
end
|
|
91
|
+
else
|
|
92
|
+
@page_element.destroy
|
|
93
|
+
render :text=>params.inspect
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def update_area_elements
|
|
98
|
+
position = 0
|
|
99
|
+
area_name = params[:id]
|
|
100
|
+
for page_element_id in params[area_name]
|
|
101
|
+
page_element = PageElement.find page_element_id
|
|
102
|
+
page_element.update_attribute(:position, position)
|
|
103
|
+
page_element.update_attribute(:area_name, area_name["area_".length..-1])
|
|
104
|
+
position += 1
|
|
105
|
+
end
|
|
106
|
+
render :nothing=>true
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def remove_page_element( element_id = params[:selected_element]["element_".length..-1] )
|
|
110
|
+
PageElement.find( element_id ).destroy
|
|
111
|
+
render :update do |page|
|
|
112
|
+
page.remove "element_"+element_id
|
|
113
|
+
page['remove_element'].hide
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
class PagesController < ApplicationController
|
|
2
|
+
|
|
3
|
+
layout "pages", :except => :edit
|
|
4
|
+
|
|
5
|
+
scaffold :page, :suffix => true
|
|
6
|
+
scaffold :content, :suffix => true
|
|
7
|
+
|
|
8
|
+
in_place_edit_for :page, :title
|
|
9
|
+
|
|
10
|
+
def index
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def list
|
|
14
|
+
@pages = Page.find_all
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create
|
|
18
|
+
@page = Page.create(:title => "New Page ("<<( Page.find(:all).last.id + 1 ).to_s<< ")",
|
|
19
|
+
:theme_name => Page.available_themes.first )
|
|
20
|
+
if @page.save
|
|
21
|
+
render :update do |page|
|
|
22
|
+
page.insert_html :bottom, 'pages_listed', :partial=>'page_listed'
|
|
23
|
+
page["page_"<< @page.id.to_s].hide
|
|
24
|
+
page["page_"<< @page.id.to_s].visual_effect :slide_down
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
render :update do |page|
|
|
28
|
+
page.replace_html 'flash_error', "The page title you've chosen is unavailable, please try with a diferent title."
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def destroy
|
|
34
|
+
@page = Page.find(params[:id])
|
|
35
|
+
@page.destroy
|
|
36
|
+
render :update do |page|
|
|
37
|
+
page['page_'+params[:id]].visual_effect :drop_out
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def edit
|
|
42
|
+
@page = Page.find(params[:id])
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def select_theme
|
|
46
|
+
@page = Page.find(params[:id])
|
|
47
|
+
render :update do |page|
|
|
48
|
+
page.insert_html :bottom, "change_theme", :partial => "select_theme"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def save_theme
|
|
53
|
+
@page = Page.find(params[:id])
|
|
54
|
+
@page.update_attribute :theme_name, params[:page][:theme_name]
|
|
55
|
+
|
|
56
|
+
redirect_to :action=>"edit", :id=>params[:id]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'render_engine'
|
|
2
|
+
class RenderController < ApplicationController
|
|
3
|
+
layout false
|
|
4
|
+
# ecco pronta la regex per beccare i segnalatori dei template: %%[a-z_]+:[a-z_]*(:[a-z_]+)?%%
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
show
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def show
|
|
11
|
+
# show page with :url_name
|
|
12
|
+
if params[:urlname]
|
|
13
|
+
@page = Page.find_by_urlname params[:urlname]
|
|
14
|
+
else
|
|
15
|
+
# :todo: contrassegnare in qualche maniera e far scegliere all'utente la pagina iniziale
|
|
16
|
+
@page = Page.find :first
|
|
17
|
+
if @page.nil?
|
|
18
|
+
render :partial=>"blank"
|
|
19
|
+
else
|
|
20
|
+
render :action => 'show'
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class Content < ActiveRecord::Base
|
|
2
|
+
has_many :meta_datas
|
|
3
|
+
has_many :page_elements, :dependent => :destroy
|
|
4
|
+
has_many :pages, :through => :page_elements
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def body_to_html
|
|
8
|
+
case content_type
|
|
9
|
+
when "text/textile"
|
|
10
|
+
if body.blank?
|
|
11
|
+
""
|
|
12
|
+
else
|
|
13
|
+
textilized = RedCloth.new(body, [ :hard_breaks ])
|
|
14
|
+
textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=")
|
|
15
|
+
textilized.to_html
|
|
16
|
+
end
|
|
17
|
+
when "text/html"
|
|
18
|
+
body
|
|
19
|
+
else
|
|
20
|
+
body
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
def title
|
|
24
|
+
truncate strip_html( body )
|
|
25
|
+
end
|
|
26
|
+
end
|