compages 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/app/models/page.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
class Page < ActiveRecord::Base
|
2
|
+
attr_reader :page_html
|
3
|
+
has_many :page_elements, :include=>:content, :order=>"area_name, position ASC" do
|
4
|
+
def of_area (area_name)
|
5
|
+
find_all "area_name = '#{area_name}'"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
# returns an array of strings with all the area_names associated to the elements of this page
|
9
|
+
has_many :areas, :class_name=>"PageElement", :select=>"area_name", :group=>"area_name"
|
10
|
+
has_many :contents, :through => :page_elements
|
11
|
+
acts_as_urlnameable :title, :overwrite=>true, :message=>'is unavailable.', :validate=>:class
|
12
|
+
|
13
|
+
|
14
|
+
THEMES_BASE_PATH = RAILS_ROOT+"/public/themes/"
|
15
|
+
|
16
|
+
def render( mode = :show )
|
17
|
+
@page_html = theme_body
|
18
|
+
fill_areas do |area_name|
|
19
|
+
area_html = ""
|
20
|
+
area_html = %(<div class='compages_area' id='area_#{ area_name }'>) if mode == :edit
|
21
|
+
for page_element in page_elements.of_area area_name
|
22
|
+
unless page_element.content.nil?
|
23
|
+
area_html << %(<div class='compages_element' id='element_#{ page_element.id }'>) if mode == :edit
|
24
|
+
area_html << page_element.content.body_to_html
|
25
|
+
area_html << %(</div>) if mode == :edit
|
26
|
+
else
|
27
|
+
page_element.destroy
|
28
|
+
end
|
29
|
+
end
|
30
|
+
area_html << %(</div>) if mode == :edit
|
31
|
+
area_html
|
32
|
+
end
|
33
|
+
fill_theme_vars
|
34
|
+
end
|
35
|
+
|
36
|
+
# renders the whole page with its theme and contents
|
37
|
+
def to_html
|
38
|
+
@page_html = theme_body
|
39
|
+
# subsitute areas definition (like %%area:my_area_name%%)
|
40
|
+
# with the html for the area elements
|
41
|
+
@page_html.gsub!( %r{%%area:([a-z_]+)%%} ) do ||
|
42
|
+
area_name, area_html = $1, ""
|
43
|
+
for page_element in page_elements.of_area area_name
|
44
|
+
area_html = page_element.content.body_to_html
|
45
|
+
end
|
46
|
+
area_html
|
47
|
+
end
|
48
|
+
fill_theme_vars
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
def fill_areas
|
53
|
+
# subsitute areas definition (like %%area:myareaname%%)
|
54
|
+
# with the html for the area elements
|
55
|
+
@page_html.gsub!( %r{%%area:([a-z_]+)%%} ) do ||
|
56
|
+
area_name = $1
|
57
|
+
yield area_name
|
58
|
+
end
|
59
|
+
return @page_html
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def fill_theme_vars
|
64
|
+
# subsitutes some other %%-style "variables" (see above)
|
65
|
+
@page_html.gsub!( %r{%%([a-z_]+):([a-z_]*)%%} ) do ||
|
66
|
+
case $1
|
67
|
+
when "page"
|
68
|
+
title if $2 == "title"
|
69
|
+
when "theme"
|
70
|
+
THEMES_BASE_PATH[(RAILS_ROOT+"/public").length..-1] + theme_name if $2 == "path"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
return @page_html
|
74
|
+
end
|
75
|
+
|
76
|
+
# returns the theme main file code
|
77
|
+
def Page.theme_body (theme_name)
|
78
|
+
File.open( THEMES_BASE_PATH + theme_name + "/index.html" ).read
|
79
|
+
end
|
80
|
+
|
81
|
+
# returns the theme main file code
|
82
|
+
def theme_body
|
83
|
+
Page.theme_body( theme_name )
|
84
|
+
end
|
85
|
+
|
86
|
+
# returns an array with all the available theme names
|
87
|
+
def Page.available_themes
|
88
|
+
Dir.entries(THEMES_BASE_PATH).collect {|f| f.gsub("_", "_") unless (f =~ /\..*/ ) }.compact
|
89
|
+
end
|
90
|
+
|
91
|
+
def Page.theme_areas (theme_name)
|
92
|
+
areas_colection = []
|
93
|
+
(Page.theme_body theme_name).gsub %r{%%area:([a-z_]+)%%} do |match|
|
94
|
+
areas_colection << $1
|
95
|
+
end
|
96
|
+
return areas_colection
|
97
|
+
end
|
98
|
+
def theme_areas
|
99
|
+
Page.theme_areas( theme_name )
|
100
|
+
end
|
101
|
+
|
102
|
+
def area_names #of the page
|
103
|
+
theme_areas #areas.collect {|area| area.area_name }.compact
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= @content.body_to_html %>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<!--table id="library_widget" class="widget bar_content" -->
|
2
|
+
<div id="library_widget" class="widget bar_content" style="width:90%;margin:auto;background-color:#fff;">
|
3
|
+
<!--tbody><tr>
|
4
|
+
<td-->
|
5
|
+
<div class="widget_instructions" style="width:30%; float:left;">
|
6
|
+
<h2>About library</h2>
|
7
|
+
<p></p>
|
8
|
+
</div>
|
9
|
+
<!--/td>
|
10
|
+
<td-->
|
11
|
+
<div id="library" style="width:30%; float:left;">
|
12
|
+
<div id="contents_list">
|
13
|
+
<label for="searchtext">Search Library:</label>
|
14
|
+
<%= text_field_tag :searchtext %><br/>
|
15
|
+
<%= image_tag "spinner.gif", :id=>"spinner", :style=>"display:none;" %>
|
16
|
+
<span id="search_comment"></span><br/>
|
17
|
+
<select name="content[id]" id="select_content" style="overflow:auto;width:20em;" size="10">
|
18
|
+
<%= render :partial=>"contents_list" %>
|
19
|
+
</select><br/>
|
20
|
+
<small id="content_actions" style="display:none">Selected content:
|
21
|
+
<%= link_to_remote "delete",
|
22
|
+
{ :url=>{:controller=>"contents", :action=>"delete_content", :id=>@page.id },
|
23
|
+
:submit=>"contents_list",
|
24
|
+
:confirm=>"This deletion will affect all the pages!\n\nAre you sure?",
|
25
|
+
:loading=>( remote_function :url => { :action => :live_search },
|
26
|
+
:with => "('searchtext='+$('searchtext').value)"),
|
27
|
+
:loading => "Element.show('spinner')",
|
28
|
+
:complete => "Element.hide('spinner')"
|
29
|
+
},
|
30
|
+
{ :style=>"color:red" }%>
|
31
|
+
<%= link_to "edit", "" %></small>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<%= observe_field(:searchtext,
|
35
|
+
:frequency => 0.5,
|
36
|
+
:with => "('searchtext='+$('searchtext').value)",
|
37
|
+
:loading => "Element.show('spinner')",
|
38
|
+
:complete => "Element.hide('spinner')",
|
39
|
+
:url => { :action => :live_search }) %>
|
40
|
+
<%= observe_field(:select_content,
|
41
|
+
:on => "select",
|
42
|
+
:frequency => 0.1,
|
43
|
+
:update => "content_preview",
|
44
|
+
:with => "select_content",
|
45
|
+
:loading => "Element.show('spinner')",
|
46
|
+
:complete => "Element.hide('spinner');if ($('select_content').value != '') {Element.show('content_actions')};",
|
47
|
+
:url => { :action => :content_preview }) %>
|
48
|
+
|
49
|
+
<h2><%= link_to_remote "add to the page!", :url=>{:controller=>"contents", :action=>"create_page_element", :id=>@page.id }, :submit=>"contents_list" %></h2>
|
50
|
+
</div>
|
51
|
+
<!--/td>
|
52
|
+
<td!-->
|
53
|
+
<div id="content_preview" style="width:30%;height:10em; float:left;">
|
54
|
+
<i style="color:lightgrey">no content selected for the preview</i>
|
55
|
+
</div>
|
56
|
+
<!--/td!-->
|
57
|
+
<div class="clear"></div>
|
58
|
+
<!--/tr>
|
59
|
+
</tbody></table!-->
|
60
|
+
</div>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<table id="write_widget" class="widget bar_content" >
|
2
|
+
<tbody><tr>
|
3
|
+
<td>
|
4
|
+
<div id="textile_instructions" class="widget_instructions" style="display:none;">
|
5
|
+
<h2>What is Textile?</h2>
|
6
|
+
<p>Textile is a simple markup language.</p>
|
7
|
+
<h2>textile → formatted text</h2>
|
8
|
+
<p>_a phrase_ → <span style="font-style:italic;">a phrase</span> (italic)</p>
|
9
|
+
<p>*a phrase* → <span style="font-weight:bold;">a phrase</span> (bold)</p>
|
10
|
+
<p>_*a phrase*_ → <span style="font-weight:bold;font-style:italic;">a phrase</span> (italic+bold)</p>
|
11
|
+
<p>"Google":http://google.com → <a href="http://google.com" style="text-decoration:underline;color:blue;padding:0;margin:0;">Google</a> (links)</p>
|
12
|
+
|
13
|
+
<p>For more on Textile's language, hop over to <a href="http://hobix.com/textile/" target="_blank">A Textile Reference</a>.</p>
|
14
|
+
</div>
|
15
|
+
</td>
|
16
|
+
<td>
|
17
|
+
<div id="write_area">
|
18
|
+
<%= form_remote_tag :url=>{:controller=>"contents", :action=>"create_page_element", :id=>@page.id}, :html=>{:id=>"write_content_form"}%>
|
19
|
+
<h1>Write here... </h1><br/><%= text_area :content, :body %>
|
20
|
+
<%= hidden_field :content, :content_type, :value=>"text/textile"%>
|
21
|
+
<br/><%#= submit_to_remote "Save", "" %>
|
22
|
+
<%= end_form_tag %>
|
23
|
+
<h2><%= link_to_remote "Save!", :url=>{:controller=>"contents", :action=>"create_page_element", :id=>@page.id }, :submit=>"write_content_form" %></h2>
|
24
|
+
<br/>You can use <em>textile</em> here. <small><%= link_to_function "(what is textile?)", visual_effect( :toggle_slide, "textile_instructions" )%></small>
|
25
|
+
|
26
|
+
</div>
|
27
|
+
</td>
|
28
|
+
<td>
|
29
|
+
<div id="content_metadatas" style="display:none;">
|
30
|
+
<% remote_form_for :meta_data, :url=>{:controller=>"contents", :action=>"add_metadata"} do |f| %>
|
31
|
+
<h1>Add Meta-datas</h1>
|
32
|
+
Key: <%= f.text_field :key, :disabled=>true %><br/>
|
33
|
+
Value: <%= f.text_field :value, :disabled=>true %>
|
34
|
+
<%= f.hidden_field :content_id, :value=>@content%>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
</td>
|
38
|
+
<div class="clear"/> </div>
|
39
|
+
</tr>
|
40
|
+
</tbody></table>
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
|
3
|
+
<head>
|
4
|
+
<title>Pages: <%= controller.action_name %></title>
|
5
|
+
<%= stylesheet_link_tag 'compages' %>
|
6
|
+
<%= javascript_include_tag :defaults, :unobtrusive %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
|
10
|
+
<p style="color: green" id="flash_notice" class="flash notice"><%= flash[:notice] %></p>
|
11
|
+
<p style="color: red" id="flash_error" class="flash error"><%= flash[:error] %></p>
|
12
|
+
|
13
|
+
<div id="wrapper">
|
14
|
+
<div id="journal-page" style="">
|
15
|
+
<%= @content_for_layout %>
|
16
|
+
<div class="clear"/> </div>
|
17
|
+
</div>
|
18
|
+
<div id="journal-shadow">
|
19
|
+
Copyright © 2006 Elia Schito
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<%= javascript_tag( visual_effect :blind_down, 'journal-page', :duration => 0.5 ) %>
|
23
|
+
</body>
|
24
|
+
</html>
|
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<script type="text/javascript">
|
4
|
+
|
5
|
+
function goToMenu(menuName){
|
6
|
+
<%= update_page do |page|
|
7
|
+
page.select("#options_bar .menu").each {|menu| menu.hide }
|
8
|
+
page << "$(menuName).show();return false;"
|
9
|
+
end %>
|
10
|
+
}
|
11
|
+
Position.includeScrollOffsets = true;
|
12
|
+
|
13
|
+
</script>
|
14
|
+
|
15
|
+
|
16
|
+
<div id="compages">
|
17
|
+
<% apply_behaviour "#restore_bar", make_draggable %>
|
18
|
+
<div id="restore_bar">
|
19
|
+
<div id="restore_bar_ie">
|
20
|
+
<span class="drag_handle">Drag me...</span><br/>
|
21
|
+
<input type="hidden" id="selected_element" name="selected_element" value=""/>
|
22
|
+
<%= link_to_remote "Remove!", {:url=>{:controller=>"contents", :action=>"remove_page_element", :id=>@page.id }, :submit=>"restore_bar"}, {:id=>"remove_element", :style=>"position:relative;display:none;"} %>
|
23
|
+
<br/><%= link_to_function "Show Options", update_page{|p| p['compages_bar_wrapper'].visual_effect :appear, :duration=>0.2; p['restore_bar'].hide;p['hide_bar'].visual_effect :pulsate, :duration=>2 }, :style=>"position:relative;"%>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div id="compages_bar_wrapper" style="display: none;">
|
28
|
+
<div id="options_bar">
|
29
|
+
<div id="hide_bar"><%= link_to_function "hide this bar", update_page {|p| p['compages_bar_wrapper'].visual_effect :fade, :duration=>0.2; p['restore_bar'].show } %></div>
|
30
|
+
|
31
|
+
<ul id="main_menu" class="menu">
|
32
|
+
<span class="back"><%= link_to "« BACK", :action => "list" %></span>
|
33
|
+
<li><%= link_to_function "Add some content", "goToMenu('add_content_menu');" %></li>
|
34
|
+
<li id="highlight_areas"><%= link_to_function "highlight areas", update_page{|p|
|
35
|
+
p.select('.compages_area').each{|area| area.set_style :outline=>"3px solid #ffffaa;" }
|
36
|
+
p["highlight_areas"].hide;p["restore_highlighted_areas"].show } %>
|
37
|
+
</li>
|
38
|
+
<li id="restore_highlighted_areas" style="display:none;background:#ffffaa;">
|
39
|
+
<%= link_to_function "highlight areas", update_page{|p|
|
40
|
+
p.select('.compages_area').each{|area| area.set_style :outline=>"none;" }
|
41
|
+
p["highlight_areas"].show;p["restore_highlighted_areas"].hide } %>
|
42
|
+
</li>
|
43
|
+
|
44
|
+
<li id="change_theme"><%= link_to_remote "Change the page Theme", :url=>{:action=>"select_theme", :id=>@page.id } %></li>
|
45
|
+
</ul>
|
46
|
+
|
47
|
+
<ul id="add_content_menu" class="menu" style="display:none" >
|
48
|
+
<li class="back"><%= link_to_function "« BACK", "goToMenu('main_menu');" %></li>
|
49
|
+
<li><%= link_to_remote "Write now!", :url=>{:controller=>"contents", :action=>"write_now", :id=>@page.id } %></li>
|
50
|
+
<li><%= link_to_remote "Pick from library...", :url=>{:controller=>"contents", :action=>"show_library", :id=>@page.id } %></li>
|
51
|
+
</ul>
|
52
|
+
|
53
|
+
<ul id="write_content_menu" class="menu" style="display:none" >
|
54
|
+
<li class="back"><%= link_to_function "« Cancel", update_page{|p| p<< "goToMenu('add_content_menu');"; p.replace_html "widgets", ""} %></li>
|
55
|
+
</ul>
|
56
|
+
|
57
|
+
</div>
|
58
|
+
<div id="widgets"></div>
|
59
|
+
<%= if_ie_tag %{<div id="ie_shadow"> </div>} %>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<li class="page_listed" id="page_<%= @page.id %>">
|
2
|
+
<span id="page_<%= @page.id %>_edit">“</span>
|
3
|
+
<span class="title" id="page_<%= @page.id %>_title">
|
4
|
+
<%= in_place_editor_field :page, :title, {}, :external_control=>"page_#{@page.id}_edit"%>
|
5
|
+
”
|
6
|
+
</span>
|
7
|
+
<br><span class="actions">
|
8
|
+
<%= link_to "View online", "/#{@page.urlname}", :target => "_blank"%> |
|
9
|
+
<%= link_to 'Edit', :action => 'edit', :id => @page %> |
|
10
|
+
<%= link_to_remote 'Delete', :url=>{:action => 'destroy', :id => @page} %>
|
11
|
+
</span>
|
12
|
+
|
13
|
+
</li>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% @page_html = @page.render :edit
|
2
|
+
|
3
|
+
head_content = javascript_include_tag( :defaults, :unobtrusive )<< stylesheet_link_tag( "page_editing" )
|
4
|
+
@page_html.gsub! %r{<\/head>}i, head_content<< "\n</head>"
|
5
|
+
@page_html.gsub! %r{<body.*?>}i, render( :partial=>"edit_menu" )
|
6
|
+
|
7
|
+
sortables_code = ""
|
8
|
+
for area in @page.area_names
|
9
|
+
sortables_code << sortable_element( "area_"<< area,
|
10
|
+
:url=>{ :controller=>"contents", :action=>"update_area_elements", :id=>("area_"+area) },
|
11
|
+
:dropOnEmpty=>true,
|
12
|
+
:tag=>:div,
|
13
|
+
:only=>"compages_element",
|
14
|
+
:constraint=>false,
|
15
|
+
:hoverclass=>"\"dragging\"",
|
16
|
+
:containment=>@page.area_names.collect{|name| "area_"<< name})
|
17
|
+
end
|
18
|
+
|
19
|
+
@page_html.gsub! %r{<\/body>}i, import_stylesheet("editing")<< if_ie_tag(import_stylesheet "editing_ie_filth")<< sortables_code<< "</body>"
|
20
|
+
|
21
|
+
|
22
|
+
# i behaviour non stampano stringhe, quindi non c'� bisogno di inserirli nella pagina
|
23
|
+
apply_behaviour( ".compages_element:click" ,
|
24
|
+
update_page{|p|
|
25
|
+
p.select('.compages_element').each{|e| e.set_style(:border=>"none")}
|
26
|
+
p<< 'this.setStyle({"border": "2px dotted black !important;"});'
|
27
|
+
p<< '$("selected_element").value=this.id'
|
28
|
+
p['remove_element'].show
|
29
|
+
# p.delay 10.seconds do |page|
|
30
|
+
# p.select('.compages_element').each{|e| e.set_style(:border=>"none")}
|
31
|
+
# p['remove_element'].visual_effect :fade
|
32
|
+
# end
|
33
|
+
}, :prevent_default=>true )
|
34
|
+
apply_behaviour( "table" , "this.setStyle('position:relative;');" ) %>
|
35
|
+
<%= @page_html %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<h1 class="main_title">COMPAGES</h1>
|
2
|
+
|
3
|
+
<div class="subtitle">
|
4
|
+
a lean content management & publishing system
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<table><tbody><tr>
|
8
|
+
<td class="column left_column">
|
9
|
+
<h2>What you can do now?</h2>
|
10
|
+
<p>
|
11
|
+
If you don't know where to start you can click on "Manage pages" to create your first sitepage.
|
12
|
+
<ol>
|
13
|
+
<li><%= link_to "Manage Pages", :action => 'list' %></li>
|
14
|
+
<li><%= link_to "View Your Site", "/", :popup=>true %></li>
|
15
|
+
<li><%= link_to "Manage Users", :action => 'list' %></li>
|
16
|
+
</ol>
|
17
|
+
</p>
|
18
|
+
</td>
|
19
|
+
<td class="column right_column lborder">
|
20
|
+
<h2>What is Compages</h2>
|
21
|
+
<p>
|
22
|
+
Compages is a web application that hepls you to build and maintain your site,
|
23
|
+
<%= image_tag "logo_journal_small", :style=>"float:right;"%>
|
24
|
+
usually caled a "Content Management System".
|
25
|
+
I hope you'll find in this software an intuitive way to get things done.
|
26
|
+
<br /><%= link_to_function "[more...]", visual_effect( :toggle_blind, "more" ), :id=>"more_link" %>
|
27
|
+
<div id="more" style="display:none">
|
28
|
+
Here are the main features/aims of the project:
|
29
|
+
<ul>
|
30
|
+
<li>A pleasant user interface</li>
|
31
|
+
<li>Drag-n-drop contents around the page</li>
|
32
|
+
<li>Change the content appearance with a click</li>
|
33
|
+
<li>Nearly NO user management/rights system</li>
|
34
|
+
<li>WYSIWYG content writing</li>
|
35
|
+
<li>Built using Ruby on Rails (which means that adapting Compges is as easy
|
36
|
+
as any other Rails application)</li>
|
37
|
+
<li>Minimal templating system <br/><small>(building a template is reduced to
|
38
|
+
the insertion of strings like %%area:my_area_name%% where you want to enable dropping of contents)</small></li>
|
39
|
+
</ul>
|
40
|
+
</div>
|
41
|
+
</p>
|
42
|
+
<p class="align_right"><span class="signature"> Elia Schito </span><i>(author of Compages)</i></p>
|
43
|
+
</td>
|
44
|
+
</tr></tbody></table>
|
45
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
<div class="subtitle"><%= link_to "« Back", {:controller => "pages"}, :class=>"left"%> COMPAGES - LISTING PAGES </div>
|
3
|
+
|
4
|
+
<table><tbody><tr>
|
5
|
+
<td class="left_column column rborder" style="m in-height:25em;">
|
6
|
+
<h2>Pages archive</h2>
|
7
|
+
<p><%= link_to_remote "Add a page »", :url=>{:action=>"create"}%>
|
8
|
+
<% unless @pages.empty? %>
|
9
|
+
<ol id="pages_listed">
|
10
|
+
<% for page in @pages %>
|
11
|
+
<% @page = page %>
|
12
|
+
<%= render :partial => "page_listed" %>
|
13
|
+
<% end %>
|
14
|
+
</ol>
|
15
|
+
<% else %>
|
16
|
+
<p> Currently there are no pages! Start creating the first one by clicking on
|
17
|
+
<em>Add a page ></em>.</p>
|
18
|
+
<% end %>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
</td>
|
22
|
+
|
23
|
+
<td class="right_column column">
|
24
|
+
<h2> Pages Help<i>!</i> </h2>
|
25
|
+
<p>Here are listed all the pages of the site, you can <em>edit the title by clicking
|
26
|
+
on it</em>.</p>
|
27
|
+
<p>To add a page to your site <em>click on “add a page”</em>.</p>
|
28
|
+
<p>To wipe out a page you can <em>click on “delete”</em>.</p>
|
29
|
+
|
30
|
+
<h2>Editing...</h2>
|
31
|
+
<p>To fill up a page with contents or review contets and layout of a page
|
32
|
+
<em>click on “edit”</em>.</p>
|
33
|
+
<p>By clicking on <em>edit</em> you'll be able to:
|
34
|
+
<ul>
|
35
|
+
<li>add, and/or remove contents from your page</li>
|
36
|
+
<li>change the position of the contents within the page</li>
|
37
|
+
<li>chose the theme of your page</li>
|
38
|
+
</ul>
|
39
|
+
|
40
|
+
</td>
|
41
|
+
</tr></tbody></table>
|