alchemy-demo_kit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/README.md +12 -0
  2. data/Rakefile +8 -0
  3. data/app/assets/stylesheets/alchemy/demo_kit.scss +440 -0
  4. data/app/views/alchemy/elements/_article_editor.html.erb +11 -0
  5. data/app/views/alchemy/elements/_article_view.html.erb +25 -0
  6. data/app/views/alchemy/elements/_bild_editor.html.erb +1 -0
  7. data/app/views/alchemy/elements/_bild_text_editor.html.erb +7 -0
  8. data/app/views/alchemy/elements/_bild_text_view.html.erb +9 -0
  9. data/app/views/alchemy/elements/_bild_view.html.erb +9 -0
  10. data/app/views/alchemy/elements/_claim_editor.html.erb +1 -0
  11. data/app/views/alchemy/elements/_claim_view.html.erb +1 -0
  12. data/app/views/alchemy/elements/_contactform_editor.html.erb +4 -0
  13. data/app/views/alchemy/elements/_contactform_view.html.erb +78 -0
  14. data/app/views/alchemy/elements/_download_editor.html.erb +4 -0
  15. data/app/views/alchemy/elements/_download_view.html.erb +7 -0
  16. data/app/views/alchemy/elements/_footnote_editor.html.erb +1 -0
  17. data/app/views/alchemy/elements/_footnote_view.html.erb +5 -0
  18. data/app/views/alchemy/elements/_header_editor.html.erb +1 -0
  19. data/app/views/alchemy/elements/_header_view.html.erb +1 -0
  20. data/app/views/alchemy/elements/_headline_editor.html.erb +1 -0
  21. data/app/views/alchemy/elements/_headline_view.html.erb +1 -0
  22. data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +3 -0
  23. data/app/views/alchemy/elements/_image_mosaic_view.html.erb +14 -0
  24. data/app/views/alchemy/elements/_intro_editor.html.erb +1 -0
  25. data/app/views/alchemy/elements/_intro_image_text_editor.html.erb +3 -0
  26. data/app/views/alchemy/elements/_intro_image_text_view.html.erb +16 -0
  27. data/app/views/alchemy/elements/_intro_view.html.erb +3 -0
  28. data/app/views/alchemy/elements/_news_editor.html.erb +3 -0
  29. data/app/views/alchemy/elements/_news_view.html.erb +11 -0
  30. data/app/views/alchemy/elements/_searchresult_editor.html.erb +4 -0
  31. data/app/views/alchemy/elements/_searchresult_view.html.erb +4 -0
  32. data/app/views/alchemy/elements/_sitemap_editor.html.erb +3 -0
  33. data/app/views/alchemy/elements/_sitemap_view.html.erb +38 -0
  34. data/app/views/alchemy/elements/_sitename_editor.html.erb +1 -0
  35. data/app/views/alchemy/elements/_sitename_view.html.erb +1 -0
  36. data/app/views/alchemy/elements/_subheadline_editor.html.erb +1 -0
  37. data/app/views/alchemy/elements/_subheadline_view.html.erb +5 -0
  38. data/app/views/alchemy/elements/_text_editor.html.erb +1 -0
  39. data/app/views/alchemy/elements/_text_view.html.erb +3 -0
  40. data/app/views/alchemy/page_layouts/_contact.html.erb +14 -0
  41. data/app/views/alchemy/page_layouts/_intro.html.erb +14 -0
  42. data/app/views/alchemy/page_layouts/_layout_footer.html.erb +14 -0
  43. data/app/views/alchemy/page_layouts/_layout_header.html.erb +14 -0
  44. data/app/views/alchemy/page_layouts/_news.html.erb +14 -0
  45. data/app/views/alchemy/page_layouts/_newsletter_layout.html.erb +1 -0
  46. data/app/views/alchemy/page_layouts/_search.html.erb +14 -0
  47. data/app/views/alchemy/page_layouts/_standard.html.erb +14 -0
  48. data/app/views/layouts/application.html.erb +50 -0
  49. data/config/alchemy/elements.yml +274 -0
  50. data/config/alchemy/page_layouts.yml +74 -0
  51. data/lib/alchemy/demo_kit.rb +6 -0
  52. data/lib/alchemy/demo_kit/engine.rb +6 -0
  53. data/lib/alchemy/demo_kit/version.rb +5 -0
  54. data/lib/rails/generators/alchemy/demo_kit_generator.rb +34 -0
  55. data/lib/tasks/alchemy/demo_kit/install.rake +10 -0
  56. metadata +124 -0
@@ -0,0 +1,14 @@
1
+ <div id="header">
2
+ <div id="header_image">
3
+ <%= render_elements(:only => 'header', :fallback => {:for => 'header', :from => 'layout_header'}) %>
4
+ </div>
5
+ <%- claim = render_elements :only => ["claim"] -%>
6
+ <%- if !claim.blank? -%>
7
+ <div id="claim">
8
+ <%= claim %>
9
+ </div>
10
+ <%- end -%>
11
+ </div>
12
+ <div id="content">
13
+ <%= render_elements :except => ["claim", "header"] %>
14
+ </div>
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <!-- Your site title-prefix (That is YourSite in "YourSite - CurrentPage" is taken from a layout-page by default.
5
+ Alternatively you can hardcode it here -->
6
+ <%= render_meta_data(:title_prefix => sitename_from_header_page, :title_seperator => " - ") %>
7
+ <!-- Paths here are relative to app/assets/stylesheets.
8
+ alchemy/demo_kit, though, is located in the Alchemy demo kit gem and doesn't have to be present in your app,
9
+ but you can copy it over and customize it of course. -->
10
+ <%= stylesheet_link_tag "alchemy/demo_kit", :media => :screen %>
11
+ <%= stylesheet_link_tag "alchemy/demo_kit", :media => :print %>
12
+ <!-- Here is also the place for custom javascripts. Put them in app/assets/javascripts/yourscript.js (or yourscript.js.coffee)
13
+ and include them like this (remove the \):
14
+ <\%= javascript_include_tag "yourscript" %> -->
15
+ </head>
16
+ <body>
17
+ <div id="page">
18
+ <div id="language_select">
19
+ <!-- Render links with flags for all public languages -->
20
+ <%= language_switches(:linkname => :code) %>
21
+ </div>
22
+ <div id="breadcrump">
23
+ <!-- Renders a breadcrumb/ariadne-path. For customizing see docs for render_breadcrumb (link?) -->
24
+ <%= render_breadcrumb :seperator => "<span>&nbsp;<&nbsp;</span>" %>
25
+ </div>
26
+ <div id="navigation">
27
+ <!-- Renders main navigation. For customizing see docs for render_navigation (link?)
28
+ You can overwrite app/views/navigation/_renderer.html.erb and app/views/navigation/_link.html.erb
29
+ if you want to roll out your own markup -->
30
+ <%= render_navigation :all_sub_menues => true %>
31
+ </div>
32
+ <!-- Most important call here!
33
+ This yields (=inserts) all content of the current page.
34
+ Markup depends on page_layout, elements and essences and can be changed in app/views/alchemy/... -->
35
+ <%= yield %>
36
+ <div class="footer">
37
+ <!-- Renders elements that are called "footnote" (name-attribute in elements.yml)
38
+ from page_layout "layout_footer" (name-attribute in page_layout.yml) -->
39
+ <%= render_elements(
40
+ :from_page => 'layout_footer',
41
+ :only => ['footnote']
42
+ ) %>
43
+ </div>
44
+ </div>
45
+ <!-- This is used in Alchemy's backend to prevent navigating to other pages through the preview window -->
46
+ <%= alchemy_preview_mode_code %>
47
+ <!-- Renders a menu_bar when a user with sufficient rights visits a page -->
48
+ <%= alchemy_menu_bar %>
49
+ </body>
50
+ </html>
@@ -0,0 +1,274 @@
1
+ # == In this configuration you setup Alchemy´s element layouts.
2
+ #
3
+ # Use rails generate alchemy:scaffold to generate this file for your app.
4
+ #
5
+ # Elements containing all necessary basic tools for displaying and editing content inside Alchemy.
6
+ # They consists of composed contents (different essence-types) as shown in the illustration of an elements-sheme below.
7
+ #
8
+ # == Schema of an element
9
+ #
10
+ # =================================
11
+ # # Content 1 (EssenceText) #
12
+ # # #
13
+ # # Content 2 (EssencePicture) #
14
+ # # #
15
+ # # Content 3 (EssenceRichtext) #
16
+ # =================================
17
+ #
18
+ # == Example of a basic element layout
19
+ #
20
+ # - name: a_unique_name (Used for the partial name in +app/views/elements+ and translated as Element.display_name)
21
+ # unique: Bool //pass true if this element only can be displayed once on page
22
+ # contents:
23
+ # - name: head
24
+ # type: EssenceText
25
+ # - name: text
26
+ # type: EssenceRichtext
27
+ #
28
+ # As already mentioned above, there are different content-types wich can be defined for each content in an element.
29
+ #
30
+ # Defining these types is used to render predefined views in the element.
31
+ #
32
+ # == Content-Types:
33
+ #
34
+ # * EssenceText (Used to store a String (max. 255 Chars.) i.e. a headline, or productname. The editor is renderd as a single-lined input field. The view output will be sanitized and escaped. So it's XSS save.)
35
+ # * EssenceRichtext (Used to store editable richtext. Editor is rendered as a textarea with TinyMCE Editor.)
36
+ # * EssencePicture (Used to store pictures assigned through the library. The editor view provides a lot of options (i.e. image cropper). The view renders the assigned picture, resizes it, crops it and caches the result.)
37
+ # * EssenceFile (Used to store attachments assigned through the library. The view renders download link.)
38
+ # * EssenceAudio (Used to store attachments assigned through the library. The view renders an flash audio player.)
39
+ # * EssenceVideo (Used to store attachments assigned through the library. The view renders an flash video player.)
40
+ # * EssenceFlash (Used to store attachments assigned through the library. The view renders the embeded flash object.)
41
+ # * EssenceDate (Used to store a DateTime object. The view output is passed through Rails I18n Library, so it will be fully localized.)
42
+ # * EssenceHtml (Used to store HTML code. The view output renders the raw, not sanitized or unescaped String. So be careful!)
43
+ # * EssenceSelect (Used to store a String (max. 255 Chars.) value. The editor view is displayed as a select box)
44
+ # * EssenceBoolean (Used to store a Boolean (true or false) value. The editor view is displayed as a check box)
45
+ # * EssenceLink (Used to store an URL. The link button opens the same link overlay as the link button in the EssenceRichtext TinyMCE editor.)
46
+ #
47
+ # After finishing the setup of your element layouts, you need to generate the files for the elements before using them in Alchemy.
48
+ #
49
+ # For creating these files, use the following command in your terminal:
50
+ #
51
+ # rails g alchemy:elements
52
+ #
53
+ # or:
54
+ #
55
+ # rails g alchemy:elements --skip
56
+ #
57
+ # to skip existing elements
58
+ #
59
+ #
60
+ # All new elements will be created as two different partials in +Rails.root/app/views/elements+.
61
+ #
62
+ # For each element there is an editor-view wich will be rendered when editing them in Alchemy and another view for the website´s frontend.
63
+ #
64
+ # app/views/elements/_elements_name_editor.html.erb
65
+ # app/views/elements/_elements_name_view.html.erb
66
+ #
67
+ # For most contents in an element you can specify additional options, so they get rendered in a specific way.
68
+ # These options can be defined as symbols, but its too much to list them up here.
69
+ # You can find these options described in the application_helper.rb, most of them at the render_essence method.
70
+ #
71
+ # == Setting a content as preview-text for the element
72
+ #
73
+ # You can set a content-essence as preview-text for its element like this:
74
+ #
75
+ # take_me_for_preview: true
76
+ #
77
+ # == Adding contents dynamically in the frontend
78
+ #
79
+ # You are able to add content-essences dynamically to the element from the Alchemy frontend.
80
+ #
81
+ # You just have to make contents available for adding them.
82
+ #
83
+ # === Example:
84
+ #
85
+ # - name: headline
86
+ # unique: false
87
+ # contents:
88
+ # - name: headline
89
+ # type: EssenceText
90
+ # - name: big_text
91
+ # type: EssenceRichtext
92
+ # available_contents:
93
+ # - name: big_text
94
+ # type: EssenceRichtext
95
+ #
96
+ # And add a +<%= render_create_content_link(element, 'big_text') %>+ helper to your element editor partial.
97
+ #
98
+ # Now an Alchemy user can add as many additional +big_text+ contents as s/he wants.
99
+ #
100
+ # If you have more then one additional content defined you should use the:
101
+ #
102
+ # <%= render_new_content_link(element) %>
103
+ #
104
+ # helper. This opens an overlay from where the user can choose which content to add.
105
+ #
106
+ # === Translate element names
107
+ #
108
+ # Element names are passed through the +I18n+ library. So you can translate them in your config/locales language yml file.
109
+ #
110
+ # === Example:
111
+ #
112
+ # de:
113
+ # alchemy:
114
+ # element_names:
115
+ # contact: Kontakt
116
+ # search: Suche
117
+ #
118
+ # == Validations:
119
+ #
120
+ # You can validate the presence of a content. Just pass validate and one of the supported vaidatiosn methods to your content definition:
121
+ #
122
+ # - name: article
123
+ # display_name: Standard-Artikel
124
+ # contents:
125
+ # - name: intro
126
+ # type: EssenceText
127
+ # validate:
128
+ # - presence
129
+ #
130
+ # Now the user has to enter a value inside of the intro EssenceText textfield to save the element.
131
+ # Currently supported validations are:
132
+ #
133
+ # * presence
134
+ # * uniqueness
135
+ #
136
+ - name: article
137
+ taggable: true
138
+ contents:
139
+ - name: intro
140
+ type: EssenceText
141
+ - name: headline
142
+ type: EssenceText
143
+ settings:
144
+ deletable: true
145
+ - name: image
146
+ type: EssencePicture
147
+ - name: text
148
+ type: EssenceRichtext
149
+ settings:
150
+ deletable: true
151
+ available_contents:
152
+ - name: text
153
+ type: EssenceRichtext
154
+ - name: headline
155
+ type: EssenceText
156
+
157
+ - name: intro_image_text
158
+ unique: true
159
+ contents:
160
+ - name: headline
161
+ type: EssenceText
162
+ - name: image
163
+ type: EssencePicture
164
+ - name: text
165
+ type: EssenceRichtext
166
+
167
+ - name: text
168
+ contents:
169
+ - name: text
170
+ type: EssenceRichtext
171
+
172
+ - name: bild
173
+ contents:
174
+ - name: image
175
+ type: EssencePicture
176
+
177
+ - name: bild_text
178
+ contents:
179
+ - name: image
180
+ type: EssencePicture
181
+ - name: text
182
+ type: EssenceRichtext
183
+
184
+ - name: headline
185
+ contents:
186
+ - name: headline
187
+ type: EssenceText
188
+
189
+ - name: image_mosaic
190
+ picture_gallery: true
191
+ contents:
192
+ - name: caption
193
+ type: EssenceText
194
+ - name: show_caption
195
+ type: EssenceBoolean
196
+
197
+ - name: footnote
198
+ unique: true
199
+ contents:
200
+ - name: note
201
+ type: EssenceRichtext
202
+
203
+ - name: sitename
204
+ unique: true
205
+ contents:
206
+ - name: name
207
+ type: EssenceText
208
+
209
+ - name: claim
210
+ unique: true
211
+ contents:
212
+ - name: claim
213
+ type: EssenceText
214
+
215
+ - name: header
216
+ unique: true
217
+ contents:
218
+ - name: image
219
+ type: EssencePicture
220
+
221
+ - name: intro
222
+ contents:
223
+ - name: intro
224
+ type: EssenceRichtext
225
+
226
+ - name: subheadline
227
+ contents:
228
+ - name: subheadline
229
+ type: EssenceText
230
+
231
+ - name: download
232
+ contents:
233
+ - name: file
234
+ type: EssenceFile
235
+ settings:
236
+ deletable: true
237
+ available_contents:
238
+ - name: file
239
+ type: EssenceFile
240
+
241
+ - name: news
242
+ contents:
243
+ - name: date
244
+ type: EssenceDate
245
+ - name: news_headline
246
+ type: EssenceText
247
+ rss_title: true
248
+ - name: body
249
+ type: EssenceRichtext
250
+ rss_description: true
251
+
252
+ - name: searchresult
253
+ unique: true
254
+
255
+ - name: contactform
256
+ unique: true
257
+ contents:
258
+ - name: mail_from
259
+ type: EssenceText
260
+ validate:
261
+ - presence
262
+ - name: mail_to
263
+ type: EssenceText
264
+ validate:
265
+ - presence
266
+ - name: subject
267
+ type: EssenceText
268
+ take_me_for_preview: true
269
+ validate:
270
+ - presence
271
+ - name: success_page
272
+ type: EssenceSelect
273
+ validate:
274
+ - presence
@@ -0,0 +1,74 @@
1
+ # == This file defines the page_layouts for new pages.
2
+ #
3
+ # Please make your own page_layouts for your app in your own Rails.root/config/alchemy/page_layouts.yml file.
4
+ #
5
+ # === DSL:
6
+ # - name: String # The name of the layout used for views and inside the database. You can render a layout with the render_page_layout(name) helper.
7
+ # unique: Bool # Pass true and the user can only choose this layout once inside a language tree.
8
+ # hide: Bool # Pass true to hide this layout from the user.
9
+ # elements: Array # A list of element names that can be placed on this layout i.e. [text, picture]. Elements are defined inside the elements.yml file.
10
+ # insert_elements_at: String # Pass top to insert elements at top of the list. Default: bottom
11
+ # autogenerate: Array # A list of element names that are autogenerated after creating the Page.
12
+ # searchresults: Bool # Pass true to enable rendering the searchresults of the fulltext-search.
13
+ # layoutpage: Bool # Layoutpages are outside the normal pagetree and can be used to place "global" language independent Elements.
14
+ # cache: Bool # Pass false to disable the caching for this pages.
15
+ # feed: Bool # Pass true to enable a RSS feed of news elements from this page.
16
+ # redirects_to_external: Bool # Pass true to disable normal page rendering and redirect to a external page instead.
17
+ # controller: controller_name # Controller to use instead of the default PagesController
18
+ # action: action_name # Controllers action to use instead of the default PagesController#show
19
+ #
20
+ # === Translate page layout names
21
+ #
22
+ # Page layout names are passed through the I18n library. So you can translate them in your config/locales language yml file.
23
+ #
24
+ # Example:
25
+ #
26
+ # de:
27
+ # alchemy:
28
+ # page_layout_names:
29
+ # contact: Kontakt
30
+ # search: Suche
31
+ #
32
+ - name: intro
33
+ unique: true
34
+ elements: [header, intro_image_text]
35
+ autogenerate: [header, intro_image_text]
36
+
37
+ - name: standard
38
+ elements: [article, claim, header, bild, bild_text, text, intro, headline, image_mosaic, download]
39
+ autogenerate: [header, claim, article]
40
+ taggable: true
41
+
42
+ - name: contact
43
+ unique: true
44
+ cache: false
45
+ elements: [headline, text, contactform]
46
+ autogenerate: [headline, text, contactform]
47
+
48
+ - name: news
49
+ feed: true
50
+ unique: true
51
+ insert_elements_at: top
52
+ elements: [headline, news]
53
+ autogenerate: [news]
54
+ feed_elements: [news]
55
+
56
+ - name: search
57
+ unique: true
58
+ elements: [headline, text, searchresult]
59
+ autogenerate: [searchresult]
60
+ searchresults: true
61
+
62
+ - name: layout_header
63
+ unique: true
64
+ layoutpage: true
65
+ taggable: true
66
+ elements: [sitename, header]
67
+
68
+ - name: layout_footer
69
+ unique: true
70
+ layoutpage: true
71
+ elements: [footnote]
72
+
73
+ - name: external
74
+ redirects_to_external: true
@@ -0,0 +1,6 @@
1
+ require 'alchemy/demo_kit/engine'
2
+
3
+ module Alchemy
4
+ module DemoKit
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Alchemy
2
+ module DemoKit
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Alchemy
2
+ module DemoKit
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ require 'rails'
2
+
3
+ module Alchemy
4
+ module Generators
5
+ class DemoKitGenerator < ::Rails::Generators::Base
6
+ desc "This generator installs the Alchemy demo kit."
7
+ source_root File.expand_path('../../../../app/views', File.dirname(__FILE__))
8
+
9
+ def alchemy_scafffold
10
+ invoke "alchemy:scaffold"
11
+ end
12
+
13
+ def copy_files
14
+ copy_file "#{config_path}/elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
15
+ copy_file "#{config_path}/page_layouts.yml", "#{Rails.root}/config/alchemy/page_layouts.yml"
16
+ copy_file "layouts/application.html.erb", "#{Rails.root}/app/views/layouts/application.html.erb"
17
+ directory "alchemy/elements", "#{Rails.root}/app/views/alchemy/elements/"
18
+ directory "alchemy/page_layouts", "#{Rails.root}/app/views/alchemy/page_layouts/"
19
+ end
20
+
21
+ def inject_css_into_env
22
+ sentinel = /::Application\.configure do\s*$/
23
+ inject_into_file "#{Rails.root}/config/environments/production.rb", "\n config.assets.precompile += %w( alchemy/demo_kit.css )\n", { :after => sentinel, :verbose => true }
24
+ end
25
+
26
+ private
27
+
28
+ def config_path
29
+ @config_path ||= File.expand_path('../../../../config/alchemy', File.dirname(__FILE__))
30
+ end
31
+
32
+ end
33
+ end
34
+ end