spree-cms 0.1.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/LICENSE +23 -0
- data/README.md +68 -0
- data/Rakefile +31 -0
- data/app/controllers/admin/content_categories_controller.rb +32 -0
- data/app/controllers/admin/content_images_controller.rb +21 -0
- data/app/controllers/admin/content_parts_controller.rb +27 -0
- data/app/controllers/content_category_controller.rb +9 -0
- data/app/controllers/content_part_controller.rb +8 -0
- data/app/helpers/cms_helpers.rb +15 -0
- data/app/models/content_category.rb +16 -0
- data/app/models/content_file.rb +8 -0
- data/app/models/content_image.rb +10 -0
- data/app/models/content_part.rb +58 -0
- data/app/views/admin/content_categories/_content_category.html.erb +5 -0
- data/app/views/admin/content_categories/index.html.erb +35 -0
- data/app/views/admin/content_categories/show.html.erb +30 -0
- data/app/views/admin/content_images/file_browser.html.erb +18 -0
- data/app/views/admin/content_images/index.html.erb +35 -0
- data/app/views/admin/content_parts/_content_part.html.erb +9 -0
- data/app/views/admin/content_parts/_form.html.erb +55 -0
- data/app/views/admin/content_parts/_sub_menu.html.erb +11 -0
- data/app/views/admin/content_parts/edit.html.erb +6 -0
- data/app/views/admin/content_parts/index.html.erb +25 -0
- data/app/views/admin/content_parts/new.html.erb +6 -0
- data/app/views/admin/shared/_ckeditor.html.erb +16 -0
- data/app/views/content_categories/_content_category_default.html.erb +3 -0
- data/app/views/content_category/show.html.erb +19 -0
- data/app/views/content_part/show.html.erb +2 -0
- data/app/views/content_parts/_content_part_default.html.erb +8 -0
- data/app/views/shared/cms/parts/_fubar_fubar_fubar.html.erb +1 -0
- data/config/locales/en.content_categories.yml +2 -0
- data/config/locales/en.content_parts.yml +2 -0
- data/config/routes.rb +28 -0
- data/db/migrate/0001_create_content_parts.rb +20 -0
- data/db/migrate/0002_create_content_categories.rb +19 -0
- data/db/migrate/0003_create_content_images.rb +17 -0
- data/db/migrate/0004_add_permalink_to_content_categories.rb +9 -0
- data/db/migrate/0005_add_overlay_image_id_to_content_parts.rb +9 -0
- data/db/migrate/0006_add_name_and_alt_to_content_images.rb +11 -0
- data/lib/cms.rb +17 -0
- data/lib/cms_hooks.rb +7 -0
- data/lib/tasks/cms.rake +1 -0
- data/lib/tasks/install.rake +25 -0
- data/public/ckeditor/adapters/jquery.js +6 -0
- data/public/ckeditor/ckeditor.js +141 -0
- data/public/ckeditor/ckeditor_basic.js +8 -0
- data/public/ckeditor/ckeditor_basic_source.js +20 -0
- data/public/ckeditor/ckeditor_source.js +25 -0
- data/public/ckeditor/config.js +11 -0
- data/public/ckeditor/contents.css +45 -0
- data/public/ckeditor/custom_config.js +28 -0
- data/public/ckeditor/images/spacer.gif +0 -0
- data/public/ckeditor/lang/_languages.js +6 -0
- data/public/ckeditor/lang/_translationstatus.txt +60 -0
- data/public/ckeditor/lang/af.js +6 -0
- data/public/ckeditor/lang/ar.js +6 -0
- data/public/ckeditor/lang/bg.js +6 -0
- data/public/ckeditor/lang/bn.js +6 -0
- data/public/ckeditor/lang/bs.js +6 -0
- data/public/ckeditor/lang/ca.js +6 -0
- data/public/ckeditor/lang/cs.js +6 -0
- data/public/ckeditor/lang/cy.js +6 -0
- data/public/ckeditor/lang/da.js +6 -0
- data/public/ckeditor/lang/de.js +6 -0
- data/public/ckeditor/lang/el.js +6 -0
- data/public/ckeditor/lang/en-au.js +6 -0
- data/public/ckeditor/lang/en-ca.js +6 -0
- data/public/ckeditor/lang/en-gb.js +6 -0
- data/public/ckeditor/lang/en.js +6 -0
- data/public/ckeditor/lang/eo.js +6 -0
- data/public/ckeditor/lang/es.js +6 -0
- data/public/ckeditor/lang/et.js +6 -0
- data/public/ckeditor/lang/eu.js +6 -0
- data/public/ckeditor/lang/fa.js +6 -0
- data/public/ckeditor/lang/fi.js +6 -0
- data/public/ckeditor/lang/fo.js +6 -0
- data/public/ckeditor/lang/fr-ca.js +6 -0
- data/public/ckeditor/lang/fr.js +6 -0
- data/public/ckeditor/lang/gl.js +6 -0
- data/public/ckeditor/lang/gu.js +6 -0
- data/public/ckeditor/lang/he.js +6 -0
- data/public/ckeditor/lang/hi.js +6 -0
- data/public/ckeditor/lang/hr.js +6 -0
- data/public/ckeditor/lang/hu.js +6 -0
- data/public/ckeditor/lang/is.js +6 -0
- data/public/ckeditor/lang/it.js +6 -0
- data/public/ckeditor/lang/ja.js +6 -0
- data/public/ckeditor/lang/km.js +6 -0
- data/public/ckeditor/lang/ko.js +6 -0
- data/public/ckeditor/lang/lt.js +6 -0
- data/public/ckeditor/lang/lv.js +6 -0
- data/public/ckeditor/lang/mn.js +6 -0
- data/public/ckeditor/lang/ms.js +6 -0
- data/public/ckeditor/lang/nb.js +6 -0
- data/public/ckeditor/lang/nl.js +6 -0
- data/public/ckeditor/lang/no.js +6 -0
- data/public/ckeditor/lang/pl.js +6 -0
- data/public/ckeditor/lang/pt-br.js +6 -0
- data/public/ckeditor/lang/pt.js +6 -0
- data/public/ckeditor/lang/ro.js +6 -0
- data/public/ckeditor/lang/ru.js +6 -0
- data/public/ckeditor/lang/sk.js +6 -0
- data/public/ckeditor/lang/sl.js +6 -0
- data/public/ckeditor/lang/sr-latn.js +6 -0
- data/public/ckeditor/lang/sr.js +6 -0
- data/public/ckeditor/lang/sv.js +6 -0
- data/public/ckeditor/lang/th.js +6 -0
- data/public/ckeditor/lang/tr.js +6 -0
- data/public/ckeditor/lang/uk.js +6 -0
- data/public/ckeditor/lang/vi.js +6 -0
- data/public/ckeditor/lang/zh-cn.js +6 -0
- data/public/ckeditor/lang/zh.js +6 -0
- data/public/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +7 -0
- data/public/ckeditor/plugins/a11yhelp/lang/en.js +6 -0
- data/public/ckeditor/plugins/a11yhelp/lang/he.js +6 -0
- data/public/ckeditor/plugins/about/dialogs/about.js +6 -0
- data/public/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/public/ckeditor/plugins/adobeair/plugin.js +6 -0
- data/public/ckeditor/plugins/autogrow/plugin.js +6 -0
- data/public/ckeditor/plugins/clipboard/dialogs/paste.js +7 -0
- data/public/ckeditor/plugins/colordialog/dialogs/colordialog.js +7 -0
- data/public/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
- data/public/ckeditor/plugins/div/dialogs/div.js +8 -0
- data/public/ckeditor/plugins/find/dialogs/find.js +9 -0
- data/public/ckeditor/plugins/flash/dialogs/flash.js +9 -0
- data/public/ckeditor/plugins/flash/images/placeholder.png +0 -0
- data/public/ckeditor/plugins/forms/dialogs/button.js +6 -0
- data/public/ckeditor/plugins/forms/dialogs/checkbox.js +6 -0
- data/public/ckeditor/plugins/forms/dialogs/form.js +6 -0
- data/public/ckeditor/plugins/forms/dialogs/hiddenfield.js +6 -0
- data/public/ckeditor/plugins/forms/dialogs/radio.js +6 -0
- data/public/ckeditor/plugins/forms/dialogs/select.js +9 -0
- data/public/ckeditor/plugins/forms/dialogs/textarea.js +6 -0
- data/public/ckeditor/plugins/forms/dialogs/textfield.js +6 -0
- data/public/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
- data/public/ckeditor/plugins/iframe/dialogs/iframe.js +7 -0
- data/public/ckeditor/plugins/iframe/images/placeholder.png +0 -0
- data/public/ckeditor/plugins/iframedialog/plugin.js +6 -0
- data/public/ckeditor/plugins/image/dialogs/image.js +13 -0
- data/public/ckeditor/plugins/link/dialogs/anchor.js +6 -0
- data/public/ckeditor/plugins/link/dialogs/link.js +11 -0
- data/public/ckeditor/plugins/link/images/anchor.gif +0 -0
- data/public/ckeditor/plugins/liststyle/dialogs/liststyle.js +6 -0
- data/public/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
- data/public/ckeditor/plugins/pastefromword/filter/default.js +10 -0
- data/public/ckeditor/plugins/pastetext/dialogs/pastetext.js +6 -0
- data/public/ckeditor/plugins/placeholder/dialogs/placeholder.js +6 -0
- data/public/ckeditor/plugins/placeholder/lang/en.js +6 -0
- data/public/ckeditor/plugins/placeholder/placeholder.gif +0 -0
- data/public/ckeditor/plugins/placeholder/plugin.js +6 -0
- data/public/ckeditor/plugins/scayt/dialogs/options.js +8 -0
- data/public/ckeditor/plugins/scayt/dialogs/toolbar.css +6 -0
- data/public/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/public/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/public/ckeditor/plugins/smiley/dialogs/smiley.js +7 -0
- data/public/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/envelope.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/heart.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/kiss.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/public/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
- data/public/ckeditor/plugins/specialchar/dialogs/specialchar.js +7 -0
- data/public/ckeditor/plugins/specialchar/lang/en.js +6 -0
- data/public/ckeditor/plugins/styles/styles/default.js +6 -0
- data/public/ckeditor/plugins/table/dialogs/table.js +9 -0
- data/public/ckeditor/plugins/tableresize/plugin.js +7 -0
- data/public/ckeditor/plugins/tabletools/dialogs/tableCell.js +8 -0
- data/public/ckeditor/plugins/templates/dialogs/templates.js +7 -0
- data/public/ckeditor/plugins/templates/templates/default.js +6 -0
- data/public/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/public/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/public/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/public/ckeditor/plugins/uicolor/dialogs/uicolor.js +7 -0
- data/public/ckeditor/plugins/uicolor/lang/en.js +6 -0
- data/public/ckeditor/plugins/uicolor/lang/he.js +6 -0
- data/public/ckeditor/plugins/uicolor/plugin.js +6 -0
- data/public/ckeditor/plugins/uicolor/uicolor.gif +0 -0
- data/public/ckeditor/plugins/uicolor/yui/assets/hue_bg.png +0 -0
- data/public/ckeditor/plugins/uicolor/yui/assets/hue_thumb.png +0 -0
- data/public/ckeditor/plugins/uicolor/yui/assets/picker_mask.png +0 -0
- data/public/ckeditor/plugins/uicolor/yui/assets/picker_thumb.png +0 -0
- data/public/ckeditor/plugins/uicolor/yui/assets/yui.css +6 -0
- data/public/ckeditor/plugins/uicolor/yui/yui.js +76 -0
- data/public/ckeditor/plugins/wsc/dialogs/ciframe.html +49 -0
- data/public/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +52 -0
- data/public/ckeditor/plugins/wsc/dialogs/wsc.css +6 -0
- data/public/ckeditor/plugins/wsc/dialogs/wsc.js +7 -0
- data/public/ckeditor/skins/kama/dialog.css +9 -0
- data/public/ckeditor/skins/kama/editor.css +13 -0
- data/public/ckeditor/skins/kama/icons.png +0 -0
- data/public/ckeditor/skins/kama/icons_rtl.png +0 -0
- data/public/ckeditor/skins/kama/images/dialog_sides.gif +0 -0
- data/public/ckeditor/skins/kama/images/dialog_sides.png +0 -0
- data/public/ckeditor/skins/kama/images/dialog_sides_rtl.png +0 -0
- data/public/ckeditor/skins/kama/images/mini.gif +0 -0
- data/public/ckeditor/skins/kama/images/noimage.png +0 -0
- data/public/ckeditor/skins/kama/images/sprites.png +0 -0
- data/public/ckeditor/skins/kama/images/sprites_ie6.png +0 -0
- data/public/ckeditor/skins/kama/images/toolbar_start.gif +0 -0
- data/public/ckeditor/skins/kama/skin.js +7 -0
- data/public/ckeditor/skins/kama/templates.css +6 -0
- data/public/ckeditor/skins/office2003/dialog.css +9 -0
- data/public/ckeditor/skins/office2003/editor.css +14 -0
- data/public/ckeditor/skins/office2003/icons.png +0 -0
- data/public/ckeditor/skins/office2003/icons_rtl.png +0 -0
- data/public/ckeditor/skins/office2003/images/dialog_sides.gif +0 -0
- data/public/ckeditor/skins/office2003/images/dialog_sides.png +0 -0
- data/public/ckeditor/skins/office2003/images/dialog_sides_rtl.png +0 -0
- data/public/ckeditor/skins/office2003/images/mini.gif +0 -0
- data/public/ckeditor/skins/office2003/images/noimage.png +0 -0
- data/public/ckeditor/skins/office2003/images/sprites.png +0 -0
- data/public/ckeditor/skins/office2003/images/sprites_ie6.png +0 -0
- data/public/ckeditor/skins/office2003/skin.js +6 -0
- data/public/ckeditor/skins/office2003/templates.css +6 -0
- data/public/ckeditor/skins/v2/dialog.css +9 -0
- data/public/ckeditor/skins/v2/editor.css +13 -0
- data/public/ckeditor/skins/v2/icons.png +0 -0
- data/public/ckeditor/skins/v2/icons_rtl.png +0 -0
- data/public/ckeditor/skins/v2/images/dialog_sides.gif +0 -0
- data/public/ckeditor/skins/v2/images/dialog_sides.png +0 -0
- data/public/ckeditor/skins/v2/images/dialog_sides_rtl.png +0 -0
- data/public/ckeditor/skins/v2/images/mini.gif +0 -0
- data/public/ckeditor/skins/v2/images/noimage.png +0 -0
- data/public/ckeditor/skins/v2/images/sprites.png +0 -0
- data/public/ckeditor/skins/v2/images/sprites_ie6.png +0 -0
- data/public/ckeditor/skins/v2/images/toolbar_start.gif +0 -0
- data/public/ckeditor/skins/v2/skin.js +6 -0
- data/public/ckeditor/skins/v2/templates.css +6 -0
- data/public/ckeditor/themes/default/theme.js +8 -0
- metadata +332 -0
data/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
2
|
+
are permitted provided that the following conditions are met:
|
|
3
|
+
|
|
4
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
5
|
+
this list of conditions and the following disclaimer.
|
|
6
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
7
|
+
this list of conditions and the following disclaimer in the documentation
|
|
8
|
+
and/or other materials provided with the distribution.
|
|
9
|
+
* Neither the name of the Rails Dog LLC nor the names of its
|
|
10
|
+
contributors may be used to endorse or promote products derived from this
|
|
11
|
+
software without specific prior written permission.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
14
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
15
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
16
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
17
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
18
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
19
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
20
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
21
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
22
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Cms
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
This is a simple CMS extension for Spree 0.40.3. I developed this as
|
|
5
|
+
a successor to the <link to other CMS plugin> plugin that my company
|
|
6
|
+
used before. Alas the data model is in no way compatible.
|
|
7
|
+
|
|
8
|
+
Content is organized through ContentParts. Each ContentPart has a title,
|
|
9
|
+
a body and a weight. The weight controls the order through which content
|
|
10
|
+
parts will be rendered: lighter (smaller) weights come first, if there
|
|
11
|
+
are parts with the same weight those are sorted by their last update's
|
|
12
|
+
date.
|
|
13
|
+
|
|
14
|
+
A content can also include an excerpt. This will mostly be used when
|
|
15
|
+
a short summary of the content is needed. A common use case is a shop's
|
|
16
|
+
landing page: on the index page we want to display an overview of all
|
|
17
|
+
written posts (thus the excerpt is shown), when a user clicks one of
|
|
18
|
+
those the full post (and thus it's body) is shown.
|
|
19
|
+
|
|
20
|
+
Each content should be assigned to a category. A category can define how
|
|
21
|
+
it's associated content_parts will be rendered through various knobs. The
|
|
22
|
+
plugin already includes default templates for normal use cases.
|
|
23
|
+
|
|
24
|
+
Customizing Views and Partials
|
|
25
|
+
==============================
|
|
26
|
+
|
|
27
|
+
Now comes the magic.. you are expected to render objects as usual through
|
|
28
|
+
the partial helper in your view code, ie.:
|
|
29
|
+
|
|
30
|
+
Render the parts of a whole category:
|
|
31
|
+
<%= render ContentCategory.find_by_name("fubar fubar fubar") %>
|
|
32
|
+
|
|
33
|
+
Render a couple of parts:
|
|
34
|
+
<%= render ContentParts.all %>
|
|
35
|
+
|
|
36
|
+
Render a single content part:
|
|
37
|
+
<%= render ContentPart.first %>
|
|
38
|
+
|
|
39
|
+
You can customize almost everything with this scheme. When a category is
|
|
40
|
+
rendered the cms module looks up if there's a partial within (all relative
|
|
41
|
+
to your view-path) "shared/cms/categories/" named as the category (ie.:
|
|
42
|
+
"#{category.name.parameterize("_")}.html.erb"). If this file was found it
|
|
43
|
+
is used for rendering the category, if not, the content_categories template
|
|
44
|
+
"default_content_category" is rendered.
|
|
45
|
+
|
|
46
|
+
Exactly the same works with content parts, except that the partials should
|
|
47
|
+
be situated in "shared/cms/parts" and the default template is
|
|
48
|
+
"content_parts/content_part_default".
|
|
49
|
+
|
|
50
|
+
Build in WYSWIG Editor CKEditor
|
|
51
|
+
===============================
|
|
52
|
+
|
|
53
|
+
This extension comes with the WYSWIG Editor CKEditor.
|
|
54
|
+
By default, all text areas in the admin interfaces uses the editor.
|
|
55
|
+
If you don't want to use it on a text area you have to use the class
|
|
56
|
+
attribute "excludeckeditor". You can customize the settings of the CKEditor
|
|
57
|
+
appearence in /public/ckeditor/custom_config.js.
|
|
58
|
+
If you want to render the HTML-Code inside your templates be sure to use
|
|
59
|
+
"<%=raw ".
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
How to install
|
|
63
|
+
==============
|
|
64
|
+
|
|
65
|
+
Example goes here.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
Copyright (c) 2011 Andreas Happe, released under the New BSD License
|
data/Rakefile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require File.expand_path('../../config/application', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'rake'
|
|
5
|
+
require 'rake/testtask'
|
|
6
|
+
require 'rake/packagetask'
|
|
7
|
+
require 'rake/gempackagetask'
|
|
8
|
+
|
|
9
|
+
spec = eval(File.read('cms.gemspec'))
|
|
10
|
+
|
|
11
|
+
Rake::GemPackageTask.new(spec) do |p|
|
|
12
|
+
p.gem_spec = spec
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc "Release to gemcutter"
|
|
16
|
+
task :release => :package do
|
|
17
|
+
require 'rake/gemcutter'
|
|
18
|
+
Rake::Gemcutter::Tasks.new(spec).define
|
|
19
|
+
Rake::Task['gem:push'].invoke
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "Default Task"
|
|
23
|
+
task :default => [ :spec ]
|
|
24
|
+
|
|
25
|
+
require 'rspec/core/rake_task'
|
|
26
|
+
RSpec::Core::RakeTask.new
|
|
27
|
+
|
|
28
|
+
# require 'cucumber/rake/task'
|
|
29
|
+
# Cucumber::Rake::Task.new do |t|
|
|
30
|
+
# t.cucumber_opts = %w{--format pretty}
|
|
31
|
+
# end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class Admin::ContentCategoriesController < Admin::BaseController
|
|
2
|
+
|
|
3
|
+
resource_controller
|
|
4
|
+
|
|
5
|
+
index.before do
|
|
6
|
+
@new_category = ContentCategory.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
create do
|
|
10
|
+
wants.html { redirect_to admin_content_categories_path }
|
|
11
|
+
|
|
12
|
+
failure do
|
|
13
|
+
wants.html { redirect_to admin_content_categories_path }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
destroy do
|
|
18
|
+
wants.html { redirect_to admin_content_categories_path }
|
|
19
|
+
|
|
20
|
+
failure do
|
|
21
|
+
wants.html { redirect_to admin_content_categories_path }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
update do
|
|
26
|
+
wants.html { redirect_to admin_content_categories_path }
|
|
27
|
+
|
|
28
|
+
failure do
|
|
29
|
+
wants.html { redirect_to admin_content_categories_path }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class Admin::ContentImagesController < Admin::BaseController
|
|
2
|
+
resource_controller
|
|
3
|
+
|
|
4
|
+
index.before do
|
|
5
|
+
@content_images = ContentImage.where(:content_part_id => nil,
|
|
6
|
+
:content_part_as_overlay_id => nil)
|
|
7
|
+
|
|
8
|
+
@new_image = ContentImage.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
create.wants.html { redirect_to admin_content_images_path }
|
|
12
|
+
update.wants.html { redirect_to admin_content_images_path }
|
|
13
|
+
destroy.wants.html { redirect_to admin_content_images_path }
|
|
14
|
+
index.wants.html do
|
|
15
|
+
if params[:embedded] == "true"
|
|
16
|
+
render 'admin/content_images/file_browser', :layout => false
|
|
17
|
+
else
|
|
18
|
+
render 'admin/content_images/index'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class Admin::ContentPartsController < Admin::BaseController
|
|
2
|
+
resource_controller :belongs_to => :content_category
|
|
3
|
+
|
|
4
|
+
create.before do
|
|
5
|
+
@content_part.user = @current_user
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
new_action.before do
|
|
9
|
+
@content_category = ContentCategory.find(params[:content_category_id])
|
|
10
|
+
@content_part = @content_category.content_parts.new :user => @current_user
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
edit.before do
|
|
14
|
+
@content_category = ContentCategory.find(params[:content_category_id])
|
|
15
|
+
@content_part = @content_category.content_parts.find(params[:id])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
create.wants.html { redirect_to admin_content_category_path(@content_part.category) }
|
|
19
|
+
update.wants.html { redirect_to admin_content_category_path(@content_part.category) }
|
|
20
|
+
destroy.wants.html { redirect_to admin_content_category_path(@content_part.category) }
|
|
21
|
+
|
|
22
|
+
protected
|
|
23
|
+
|
|
24
|
+
def parent_association
|
|
25
|
+
@parent_association ||= parent_object.content_parts
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module CmsHelpers
|
|
2
|
+
def insert_full_category(category)
|
|
3
|
+
if category.is_a?(String)
|
|
4
|
+
category = ContentCategory.find_by_name(category)
|
|
5
|
+
elsif category.is_a?(ContentCategory)
|
|
6
|
+
# do nothing
|
|
7
|
+
else
|
|
8
|
+
raise category.inspect
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
if !category.nil?
|
|
12
|
+
# TODO: render the different partss
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class ContentCategory < ActiveRecord::Base
|
|
2
|
+
validates_presence_of :name
|
|
3
|
+
validates_uniqueness_of :name
|
|
4
|
+
|
|
5
|
+
before_save :update_permalink
|
|
6
|
+
|
|
7
|
+
has_many :content_parts, :foreign_key => 'category_id', :dependent => :nullify
|
|
8
|
+
|
|
9
|
+
named_scope :by_name, lambda { |name| { :conditions => { :name => name}}}
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
def update_permalink
|
|
14
|
+
self.permalink = self.name.parameterize
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
class ContentPart < ActiveRecord::Base
|
|
2
|
+
|
|
3
|
+
validates_presence_of :title, :body, :body_raw, :user_id
|
|
4
|
+
validates_numericality_of :weight
|
|
5
|
+
validates_uniqueness_of :permalink
|
|
6
|
+
|
|
7
|
+
belongs_to :user
|
|
8
|
+
belongs_to :category, :class_name => 'ContentCategory', :foreign_key => 'category_id'
|
|
9
|
+
|
|
10
|
+
# for use as a post/summary post in conjunction with the excerpt
|
|
11
|
+
has_one :image, :class_name => 'ContentImage', :dependent => :destroy
|
|
12
|
+
has_one :image_overlay, :foreign_key => "content_part_as_overlay_id", :class_name => 'ContentImage', :dependent => :destroy
|
|
13
|
+
|
|
14
|
+
default_scope :order => 'weight ASC, created_at DESC'
|
|
15
|
+
|
|
16
|
+
before_validation :process_body, :create_permalink
|
|
17
|
+
|
|
18
|
+
protected
|
|
19
|
+
|
|
20
|
+
def create_permalink
|
|
21
|
+
# do not update permalinks automatically. Ever.
|
|
22
|
+
return unless self.permalink.blank?
|
|
23
|
+
|
|
24
|
+
self.permalink = self.title.parameterize
|
|
25
|
+
|
|
26
|
+
if self.permalink.blank?
|
|
27
|
+
self.permalink = Digest::SHA1.hexdigest("fubar-#{Time.now.to_s}")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def process_body
|
|
32
|
+
self.body = self.body_raw
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def image_path=(image)
|
|
36
|
+
self.build_image :image => image
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def image_path
|
|
40
|
+
if self.image && self.image.image
|
|
41
|
+
self.image.image.url
|
|
42
|
+
else
|
|
43
|
+
""
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def image_overlay_path=(image)
|
|
48
|
+
self.build_image_overlay :image => image
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def image_overlay_path
|
|
52
|
+
if self.image_overlay && self.image_overlay.image
|
|
53
|
+
self.image_overlay.image.url
|
|
54
|
+
else
|
|
55
|
+
""
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<% begin %>
|
|
2
|
+
<%= render :partial => "shared/cms/categories/#{content_category.name.parameterize("_")}", :locals => content_category %>
|
|
3
|
+
<% rescue ActionView::MissingTemplate %>
|
|
4
|
+
<%= render :partial => "content_categories/content_category_default", :object => content_category %>
|
|
5
|
+
<% end %>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
|
2
|
+
|
|
3
|
+
<div class="new_resource">
|
|
4
|
+
<% form_for @new_category, :url => admin_content_categories_path do |f| %>
|
|
5
|
+
<%= f.label :name %>
|
|
6
|
+
<%= f.text_field :name %>
|
|
7
|
+
<%= f.label :show_image %>
|
|
8
|
+
<%= f.check_box :show_image %>
|
|
9
|
+
<%= f.label :paginated %>
|
|
10
|
+
<%= f.check_box :paginated %>
|
|
11
|
+
<%= f.submit %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<table class="index" border="0" cellspacing="5" cellpadding="5">
|
|
16
|
+
<tr>
|
|
17
|
+
<th>Name</th>
|
|
18
|
+
<th>Show Image?</th>
|
|
19
|
+
<th>Paginated?</th>
|
|
20
|
+
<th>Part Count</th>
|
|
21
|
+
<th></th>
|
|
22
|
+
</tr>
|
|
23
|
+
<tbody>
|
|
24
|
+
<% @content_categories.each do |category|%>
|
|
25
|
+
<tr>
|
|
26
|
+
<td><%= category.name %></td>
|
|
27
|
+
<td><%= category.show_image %></td>
|
|
28
|
+
<td><%= category.paginated %></td>
|
|
29
|
+
<td><%= category.content_parts.count %></td>
|
|
30
|
+
<td><%= link_to "Destroy", admin_content_category_path(category), :method => :delete, :confirm => "Are you sure?"%></td>
|
|
31
|
+
</tr>
|
|
32
|
+
</tbody>
|
|
33
|
+
<% end %>
|
|
34
|
+
</table>
|
|
35
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
|
2
|
+
|
|
3
|
+
<h1>Listing <%= @content_category.name %></h1>
|
|
4
|
+
|
|
5
|
+
<%= link_to "New Content", new_admin_content_category_content_part_path(@content_category) %>
|
|
6
|
+
|
|
7
|
+
<table class="index" border="0" cellspacing="5" cellpadding="5">
|
|
8
|
+
<tr>
|
|
9
|
+
<th>Title</th>
|
|
10
|
+
<th>Permalink</th>
|
|
11
|
+
<th>Weight</th>
|
|
12
|
+
<th>Published On</th>
|
|
13
|
+
<th></th>
|
|
14
|
+
</tr>
|
|
15
|
+
<tbody>
|
|
16
|
+
<% @content_category.content_parts.each do |content|%>
|
|
17
|
+
<tr>
|
|
18
|
+
<td><%= content.title %></td>
|
|
19
|
+
<td><%= content.permalink %></td>
|
|
20
|
+
<td><%= content.weight %></td>
|
|
21
|
+
<td></td>
|
|
22
|
+
<td>
|
|
23
|
+
<%= link_to "Edit", edit_admin_content_category_content_part_path(@content_category, content) %>
|
|
24
|
+
|
|
|
25
|
+
<%= link_to "Destroy", admin_content_category_content_part_path(@content_category, content), :method => :delete, :confirm => "Are you sure?"%>
|
|
26
|
+
</td>
|
|
27
|
+
</tr>
|
|
28
|
+
<% end %>
|
|
29
|
+
</tbody>
|
|
30
|
+
</table>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<table class="index" border="0" cellspacing="5" cellpadding="5">
|
|
2
|
+
<tr>
|
|
3
|
+
<th>Name</th>
|
|
4
|
+
<th>Alt Description</th>
|
|
5
|
+
<th>Upload Date</th>
|
|
6
|
+
<th>URL</th>
|
|
7
|
+
</tr>
|
|
8
|
+
<tbody>
|
|
9
|
+
<% @content_images.each do |image|%>
|
|
10
|
+
<tr>
|
|
11
|
+
<td><%= link_to_function image.name, "window.opener.CKEDITOR.tools.callFunction(#{params["CKEditorFuncNum"]}, \"#{image.image.url}\"); window.close();" %></td>
|
|
12
|
+
<td><%= image.alt %></td>
|
|
13
|
+
<td><%=l image.created_at.to_date %></td>
|
|
14
|
+
<td><%= image.image.url %></td>
|
|
15
|
+
</tr>
|
|
16
|
+
</tbody>
|
|
17
|
+
<% end %>
|
|
18
|
+
</table>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
|
2
|
+
|
|
3
|
+
<div class="new_resource">
|
|
4
|
+
<% form_for @new_image, :url => admin_content_images_path, :html => { :multipart => true} do |f| %>
|
|
5
|
+
<%= f.label :name %>
|
|
6
|
+
<%= f.text_field :name %>
|
|
7
|
+
<%= f.label :alt %>
|
|
8
|
+
<%= f.text_field :alt %>
|
|
9
|
+
<%= f.label :image %>
|
|
10
|
+
<%= f.file_field :image %>
|
|
11
|
+
<%= f.submit %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<table class="index" border="0" cellspacing="5" cellpadding="5">
|
|
16
|
+
<tr>
|
|
17
|
+
<th>Name</th>
|
|
18
|
+
<th>Alt Description</th>
|
|
19
|
+
<th>Upload Date</th>
|
|
20
|
+
<th>URL</th>
|
|
21
|
+
<th></th>
|
|
22
|
+
</tr>
|
|
23
|
+
<tbody>
|
|
24
|
+
<% @content_images.each do |image|%>
|
|
25
|
+
<tr>
|
|
26
|
+
<td><%= image.name %></td>
|
|
27
|
+
<td><%= image.alt %></td>
|
|
28
|
+
<td><%=l image.created_at.to_date %></td>
|
|
29
|
+
<td><%= image.image.url %></td>
|
|
30
|
+
<td><%= link_to "Destroy", admin_content_image_path(image), :method => :delete, :confirm => "Are you sure?"%></td>
|
|
31
|
+
</tr>
|
|
32
|
+
</tbody>
|
|
33
|
+
<% end %>
|
|
34
|
+
</table>
|
|
35
|
+
</div>
|