aura 0.0.1.pre10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. data/.gitignore +6 -0
  2. data/.travis.yml +3 -0
  3. data/Gemfile +2 -0
  4. data/HISTORY.md +95 -0
  5. data/README.md +53 -0
  6. data/Rakefile +27 -0
  7. data/Scribefile +8 -0
  8. data/app/css/_utilities.scss +88 -0
  9. data/app/css/admin.scss +21 -0
  10. data/app/css/admin/_settings.scss +136 -0
  11. data/app/css/admin/chrome.scss +208 -0
  12. data/app/css/admin/common.scss +78 -0
  13. data/app/css/admin/forms.scss +342 -0
  14. data/app/css/admin/jquery_wysiwyg.scss +96 -0
  15. data/app/css/admin/loading.scss +18 -0
  16. data/app/css/admin/meta.scss +42 -0
  17. data/app/css/admin/reset.scss +46 -0
  18. data/app/css/admin/sections.scss +79 -0
  19. data/app/css/admin/setup.scss +22 -0
  20. data/app/css/admin/sidebar.scss +136 -0
  21. data/app/css/admin/slug.scss +78 -0
  22. data/app/css/admin/uiscreen.scss +22 -0
  23. data/app/css/admin/wysiwyg_field.scss +11 -0
  24. data/app/css/admin_watermark.scss +23 -0
  25. data/app/css/default_home_page.scss +13 -0
  26. data/app/css/login.scss +47 -0
  27. data/app/helpers/admin_helpers.rb +59 -0
  28. data/app/helpers/flash_helpers.rb +86 -0
  29. data/app/helpers/form_builder_helpers.rb +9 -0
  30. data/app/helpers/html_helpers.rb +27 -0
  31. data/app/helpers/jquery_helpers.rb +26 -0
  32. data/app/helpers/main_helpers.rb +67 -0
  33. data/app/helpers/page_helpers.rb +92 -0
  34. data/app/helpers/template_helpers.rb +94 -0
  35. data/app/helpers/user_helpers.rb +45 -0
  36. data/app/init/admin.rb +34 -0
  37. data/app/init/extensions.rb +18 -0
  38. data/app/init/pistol.rb +11 -0
  39. data/app/init/sequel.rb +11 -0
  40. data/app/main.rb +106 -0
  41. data/app/migrations/page.rb +29 -0
  42. data/app/migrations/settings.rb +11 -0
  43. data/app/migrations/user.rb +13 -0
  44. data/app/models/page.rb +116 -0
  45. data/app/models/page_seed.rb +47 -0
  46. data/app/models/settings.rb +59 -0
  47. data/app/models/user.rb +60 -0
  48. data/app/routes/admin.rb +44 -0
  49. data/app/routes/css_js.rb +53 -0
  50. data/app/routes/design_tests.rb +15 -0
  51. data/app/routes/editor.rb +152 -0
  52. data/app/routes/site.rb +33 -0
  53. data/app/routes/user.rb +48 -0
  54. data/app/views/admin/_back_to_dashboard.haml +3 -0
  55. data/app/views/admin/dashboard.haml +46 -0
  56. data/app/views/admin/layout.haml +73 -0
  57. data/app/views/admin/settings.haml +40 -0
  58. data/app/views/admin/settings/database.haml +42 -0
  59. data/app/views/base/crumbs.haml +50 -0
  60. data/app/views/base/delete.haml +19 -0
  61. data/app/views/base/edit.haml +61 -0
  62. data/app/views/base/errors.haml +10 -0
  63. data/app/views/base/form.haml +11 -0
  64. data/app/views/base/list.haml +14 -0
  65. data/app/views/base/list_actions.haml +4 -0
  66. data/app/views/base/list_item.haml +7 -0
  67. data/app/views/base/nav.haml +36 -0
  68. data/app/views/base/new.haml +36 -0
  69. data/app/views/base/preview.haml +28 -0
  70. data/app/views/base/tabs.haml +12 -0
  71. data/app/views/default_home_page.haml +15 -0
  72. data/app/views/design_tests/admin_styles.haml +58 -0
  73. data/app/views/form_builder/builder.haml +29 -0
  74. data/app/views/page/edit.haml +29 -0
  75. data/app/views/page/form.haml +22 -0
  76. data/app/views/page/meta_form.haml +22 -0
  77. data/app/views/page/new.haml +26 -0
  78. data/app/views/user/edit.haml +52 -0
  79. data/app/views/user/form.haml +43 -0
  80. data/app/views/user/list.haml +11 -0
  81. data/app/views/user/login.haml +33 -0
  82. data/app/views/user/new.haml +25 -0
  83. data/app/views/user/welcome.haml +29 -0
  84. data/app/views/watermark/watermark.haml +16 -0
  85. data/aura.gemspec +36 -0
  86. data/bin/aura +8 -0
  87. data/config/database.rb +12 -0
  88. data/config/extensions.rb +5 -0
  89. data/config/scss.rb +14 -0
  90. data/config/user.rb +10 -0
  91. data/default/.gitignore +6 -0
  92. data/default/Gemfile +11 -0
  93. data/default/README.md +24 -0
  94. data/default/Rakefile +8 -0
  95. data/default/app/README +3 -0
  96. data/default/app/css/.gitignore +0 -0
  97. data/default/app/helpers/helpers.rb.example +9 -0
  98. data/default/app/js/.gitignore +0 -0
  99. data/default/app/migrations/model.rb.example +20 -0
  100. data/default/app/models/model.rb.example +11 -0
  101. data/default/app/models/page-ext.rb.example +17 -0
  102. data/default/app/routes/site.rb.example +5 -0
  103. data/default/app/views/hello.haml.example +1 -0
  104. data/default/config.ru +3 -0
  105. data/default/config/.gitignore +0 -0
  106. data/default/config/database.rb.example +30 -0
  107. data/default/config/extensions.rb +5 -0
  108. data/default/config/user.rb.example +10 -0
  109. data/default/db/.gitignore +0 -0
  110. data/default/init.rb +15 -0
  111. data/default/public/.gitignore +0 -0
  112. data/extensions/contact_form/migrations/contact_form.rb +13 -0
  113. data/extensions/contact_form/models/contact_form.rb +13 -0
  114. data/extensions/contact_form/routes/contact_form.rb +11 -0
  115. data/extensions/contact_form/views/contact_form/edit.haml +8 -0
  116. data/extensions/contact_form/views/contact_form/form.haml +3 -0
  117. data/extensions/contact_form/views/contact_form/nav.haml +42 -0
  118. data/extensions/contact_form/views/contact_form/responses.haml +20 -0
  119. data/extensions/contact_form/views/contact_form/tabs.haml +8 -0
  120. data/extensions/default_theme/css/theme/_settings.scss +3 -0
  121. data/extensions/default_theme/css/theme/chrome.scss +66 -0
  122. data/extensions/default_theme/css/theme/reset.scss +34 -0
  123. data/extensions/default_theme/css/theme/style.scss +3 -0
  124. data/extensions/default_theme/info.yml +2 -0
  125. data/extensions/default_theme/public/browse.png +0 -0
  126. data/extensions/default_theme/views/base/id_portfolio.haml +32 -0
  127. data/extensions/default_theme/views/base/show.haml +31 -0
  128. data/extensions/default_theme/views/errors/error.haml +9 -0
  129. data/extensions/default_theme/views/errors/not_found.haml +11 -0
  130. data/extensions/default_theme/views/layout.haml +33 -0
  131. data/lib/aura.rb +315 -0
  132. data/lib/aura/admin.rb +41 -0
  133. data/lib/aura/app.rb +4 -0
  134. data/lib/aura/cli.rb +19 -0
  135. data/lib/aura/cli/base.rb +89 -0
  136. data/lib/aura/cli/helpers.rb +32 -0
  137. data/lib/aura/editor.rb +30 -0
  138. data/lib/aura/extension.rb +189 -0
  139. data/lib/aura/files.rb +38 -0
  140. data/lib/aura/menu.rb +142 -0
  141. data/lib/aura/models.rb +80 -0
  142. data/lib/aura/public.rb +68 -0
  143. data/lib/aura/rendering.rb +134 -0
  144. data/lib/aura/seeder.rb +38 -0
  145. data/lib/aura/slugs.rb +87 -0
  146. data/lib/aura/subtype.rb +48 -0
  147. data/lib/aura/tasks.rb +24 -0
  148. data/lib/aura/tasks/common.rb +17 -0
  149. data/lib/aura/tasks/db.rake +54 -0
  150. data/lib/aura/utils.rb +81 -0
  151. data/lib/aura/version.rb +25 -0
  152. data/lib/core/hasharray.rb +65 -0
  153. data/lib/core/object_ext.rb +9 -0
  154. data/lib/sequel/plugins/aura_custom.rb +16 -0
  155. data/lib/sequel/plugins/aura_editable.rb +39 -0
  156. data/lib/sequel/plugins/aura_hierarchy.rb +82 -0
  157. data/lib/sequel/plugins/aura_model.rb +271 -0
  158. data/lib/sequel/plugins/aura_renderable.rb +42 -0
  159. data/lib/sequel/plugins/aura_sluggable.rb +103 -0
  160. data/lib/sequel/plugins/aura_subtyped.rb +83 -0
  161. data/lib/terra.rb +185 -0
  162. data/lib/terra/ext.rb +16 -0
  163. data/lib/terra/field.rb +98 -0
  164. data/lib/terra/fields.rb +122 -0
  165. data/lib/terra/fieldset.rb +93 -0
  166. data/lib/terra/form.rb +111 -0
  167. data/manual/configuration.md +42 -0
  168. data/manual/extensions.md +45 -0
  169. data/manual/files.md +70 -0
  170. data/manual/helpers.md +39 -0
  171. data/manual/index.md +65 -0
  172. data/manual/models.md +58 -0
  173. data/manual/recipes.md +38 -0
  174. data/manual/recipes/bundling_sample_data.md +30 -0
  175. data/manual/recipes/creating_themes.md +10 -0
  176. data/manual/recipes/using_markdown_or_textile.md +24 -0
  177. data/manual/routes.md +39 -0
  178. data/manual/theming.md +55 -0
  179. data/manual/views.md +128 -0
  180. data/public/hi.html +0 -0
  181. data/public/images/admin/back.png +0 -0
  182. data/public/images/admin/browse.png +0 -0
  183. data/public/images/admin/mock-bg.png +0 -0
  184. data/public/images/admin/top-loader.gif +0 -0
  185. data/public/images/admin/uiscreen-loader.gif +0 -0
  186. data/public/images/admin_icons/add.png +0 -0
  187. data/public/images/admin_icons/contact.png +0 -0
  188. data/public/images/admin_icons/dashboard.png +0 -0
  189. data/public/images/admin_icons/generic.png +0 -0
  190. data/public/images/admin_icons/home-12.png +0 -0
  191. data/public/images/admin_icons/page.png +0 -0
  192. data/public/images/admin_icons/settings.png +0 -0
  193. data/public/images/jquery.wysiwyg.gif +0 -0
  194. data/public/js/admin.form_builder.js +15 -0
  195. data/public/js/admin.js +62 -0
  196. data/public/js/admin.layout.js +53 -0
  197. data/public/js/admin.nav.js +241 -0
  198. data/public/js/admin.slug.js +46 -0
  199. data/public/js/admin.subpage.js +15 -0
  200. data/public/js/jquery.hashlisten.js +85 -0
  201. data/public/js/jquery.js +166 -0
  202. data/public/js/jquery.livenavigate.js +58 -0
  203. data/public/js/jquery.livequery.js +226 -0
  204. data/public/js/jquery.quickvalidate.js +164 -0
  205. data/public/js/jquery.tmpl.js +486 -0
  206. data/public/js/jquery.uiscreen.js +150 -0
  207. data/public/js/jquery.wysiwyg.js +2339 -0
  208. data/public/js/jqueryui.js +766 -0
  209. data/public/js/lib.dirty.js +11 -0
  210. data/public/js/lib.loading.js +23 -0
  211. data/public/js/lib.wysiwyg.js +155 -0
  212. data/public/js/underscore-1.1.7.js +27 -0
  213. data/test/app/app/css/test_raw.css +1 -0
  214. data/test/app/app/css/test_sass.sass +3 -0
  215. data/test/app/app/damogram.txt +1 -0
  216. data/test/app/app/js/test_coffee.coffee +4 -0
  217. data/test/app/app/js/test_javascript.js +4 -0
  218. data/test/app/init.rb +5 -0
  219. data/test/stories/admin_css_story.rb +18 -0
  220. data/test/stories/css_js_story.rb +29 -0
  221. data/test/stories/first_login_story.rb +29 -0
  222. data/test/stories/visit_story.rb +39 -0
  223. data/test/stories_helper.rb +58 -0
  224. data/test/test_cli_helper.rb +31 -0
  225. data/test/test_helper.rb +111 -0
  226. data/test/test_temp_helper.rb +9 -0
  227. data/test/unit/cli_test.rb +38 -0
  228. data/test/unit/dump_test.rb +14 -0
  229. data/test/unit/extensions_test.rb +18 -0
  230. data/test/unit/files_test.rb +14 -0
  231. data/test/unit/flash_helper_test.rb +36 -0
  232. data/test/unit/html_helper_test.rb +29 -0
  233. data/test/unit/jquery_helper_test.rb +18 -0
  234. data/test/unit/model_test.rb +34 -0
  235. data/test/unit/page_helpers_test.rb +36 -0
  236. data/test/unit/seeder_test.rb +15 -0
  237. data/test/unit/settings_test.rb +29 -0
  238. data/test/unit/slug_test.rb +39 -0
  239. data/test/unit/ss_migration_test.rb +14 -0
  240. data/test/unit/terra_test.rb +125 -0
  241. data/test/unit/utils_test.rb +11 -0
  242. data/vendor/sinatra-sequel/.gitignore +3 -0
  243. data/vendor/sinatra-sequel/COPYING +18 -0
  244. data/vendor/sinatra-sequel/README.md +84 -0
  245. data/vendor/sinatra-sequel/Rakefile +67 -0
  246. data/vendor/sinatra-sequel/lib/sinatra/sequel.rb +73 -0
  247. data/vendor/sinatra-sequel/sinatra-sequel.gemspec +39 -0
  248. data/vendor/sinatra-sequel/spec/spec_sinatra_sequel.rb +70 -0
  249. metadata +536 -0
@@ -0,0 +1,58 @@
1
+ title: Models
2
+ page_type: section
3
+ --
4
+ All models are Sequel models. Aura also uses the Sequel plugin system.
5
+
6
+ #### Creating a model
7
+ Subclass `Sequel::Model`.
8
+
9
+ [app/models/movie.rb (ruby)]
10
+ class Movie < Sequel::Model
11
+ # ...
12
+ end
13
+
14
+ #### Setting up migrations
15
+ Migrations are defined in `app/migrations/`. Use
16
+ [Sinatra-Sequel](http://github.com/rtomayko/sinatra-sequel)'s `migration`
17
+ method in your migrations files.
18
+
19
+ [app/migrations/movie.rb (ruby)]
20
+ class Main
21
+ migration "foo v0.0.1 - create" do
22
+ database.create_table do
23
+ primary_key :id
24
+
25
+ String :name
26
+ String :description
27
+
28
+ # ...
29
+ end
30
+ end
31
+ end
32
+
33
+ #### Setting up plugins
34
+ Use Sequel's `plugin` class method.
35
+
36
+ [app/models/movie.rb (ruby)]
37
+ class Movie < Sequel::Model
38
+ plugin :aura_editable
39
+ plugin :aura_sluggable
40
+ plugin :aura_hierarchy
41
+ end
42
+
43
+ ## Example
44
+
45
+ In your extension, create a model file like so.
46
+
47
+ # extensions/myext/models/post.rb
48
+ class Post < Sequel::Model
49
+
50
+ # put guts here
51
+ # for example:
52
+
53
+ plugin :aura_editable
54
+ plugin :aura_sluggable
55
+
56
+ def shown_in_menu?() true; end
57
+ end
58
+
@@ -0,0 +1,38 @@
1
+ title: Recipes
2
+ page_type: section
3
+ --
4
+ ## Creating custom page types
5
+
6
+ #### Use subtype
7
+ In your model:
8
+
9
+ class Page < Sequel::Model
10
+ subtype :portfolio,
11
+ :name => "Portfolio page",
12
+ :template => "id_portfolio"
13
+
14
+ custom_field :excerpt
15
+
16
+ form :portfolio do
17
+ text :excerpt, "Portfolio excerpt"
18
+ end
19
+ end
20
+
21
+ ## Adding something to the admin sidebar
22
+
23
+ #### Adding models
24
+ If it's a model you want on there:
25
+
26
+ class MyModel < Sequel::Model
27
+ def self.show_on_sidebar?; true; end
28
+ end
29
+
30
+ #### The rest
31
+ For anything else, put this in your app's initializers. (See {Aura::Menu} for more info)
32
+
33
+ [app/init/menu.rb (ruby)]
34
+ Aura.admin.menu.add "id",
35
+ :name => "My menu entry",
36
+ :href => '/admin/foo',
37
+ :icon => 'settings'
38
+
@@ -0,0 +1,30 @@
1
+ title: Bundling sample data
2
+ --
3
+ You may want to bundle some sample data with the application when you deploy.
4
+ This may be useful when you're delivering the CMS as one self-contained
5
+ package to your client.
6
+
7
+ #### Freeze your data
8
+ Assuming you have Aura working locally, freeze it using `rake db:dump`.
9
+ This creates a `config/seed.yml` file.
10
+
11
+ $ rake db:dump
12
+ * Working...
13
+ * Writing to config/seed.yml...
14
+
15
+ Done.
16
+
17
+ ...
18
+
19
+ #### config/seed.yml
20
+ Be sure to add this file to your repository.
21
+
22
+ $ ls -la config/seed.yml
23
+ -rw-r--r-- 1 rsc staff 28115 Jul 23 23:14 seed.yml
24
+
25
+ $ git add config/seed.yml
26
+
27
+ The next time your application starts, it will rebuild the database from
28
+ that snapshot. You can use `rake db:flush` to ensure that this will
29
+ happen the next time the application loads.
30
+
@@ -0,0 +1,10 @@
1
+ title: Creating themes
2
+ --
3
+ A theme is just an extension.
4
+
5
+ - Make an extension that has a `mytheme/views/` folder
6
+ - Make up a `mytheme/views/layout.haml`
7
+ - Override the look of a page in `mytheme/views/base/default.haml`
8
+ - Put public stuff (images et al) in `mytheme/public/`
9
+ - Put CSS files in `mytheme/views/css/`
10
+
@@ -0,0 +1,24 @@
1
+ title: Using Markdown or Textile
2
+ --
3
+
4
+ #### Custom formatting
5
+ You can use Markdown in your CMS. Go to HTML editing mode, and simply use
6
+ `<div format='markdown'>` on a block you want to Markdown-ify.
7
+
8
+ <div format='markdown'>
9
+ ### Hello
10
+
11
+ * This is Markdown text.
12
+ * In your site, this will look just like how it should be.
13
+ </div>
14
+
15
+ #### Textile
16
+ To use Textile, just use `format='textile'` instead.
17
+
18
+ <div format='textile'>
19
+ h3. Hello again
20
+
21
+ * This is Textile text!
22
+ * In your site, this will look just like how it should be.
23
+ </div>
24
+
@@ -0,0 +1,39 @@
1
+ title: Routes
2
+ page_type: section
3
+ --
4
+ Routes are defined and used exactly as how you would in Sinatra.
5
+
6
+ #### Defining routes
7
+ Create a file in the `app/routes/` folder of your app.
8
+
9
+ [app/routes/foo.rb (rb)]
10
+ class Main
11
+ get '/foo' do
12
+ show :foo
13
+ end
14
+ end
15
+
16
+ #### Handling 404's
17
+ You should use `pass` instead of `not_found`. This lets the default
18
+ Aura routes pick it up in case it points to something else.
19
+
20
+ [app/routes/foo.rb (rb)]
21
+ class Main
22
+ get '/book/:id' do |id|
23
+ @book = Book[id] or pass
24
+
25
+ # ...
26
+ end
27
+ end
28
+
29
+ #### Defining admin pages
30
+ Use the `show_admin` and `require_login` helpers.
31
+
32
+ [app/routes/foo.rb (rb)]
33
+ class Main
34
+ get '/admin/something' do |id|
35
+ require_login
36
+
37
+ show_admin :something
38
+ end
39
+ end
@@ -0,0 +1,55 @@
1
+ title: Theming
2
+ page_type: section
3
+ --
4
+ ## Themes
5
+ #### Theming
6
+ Just change the views.
7
+
8
+ $
9
+ app/views/layout.haml
10
+ app/views/page/show.haml
11
+
12
+ ## CSS
13
+
14
+ #### Adding CSS
15
+ Put files in `app/css/`. You can put Sass, SCSS, Less or plain CSS files.
16
+
17
+ [app/css/main.scss (css)]
18
+ $red: #833;
19
+
20
+ #main {
21
+ color: $red;
22
+ }
23
+
24
+ #### Accessing them
25
+ These files will be accessible in `http://localhost:4567/css`. For example,
26
+ these paths may correspond to the following files.
27
+
28
+ $ http://localhost:4567/css/screen.css
29
+ # ~/myapp/app/css/screen.css
30
+
31
+ $ http://localhost:4567/css/main.css
32
+ # ~/myapp/app/css/main.scss (Rendered by Sass CSS)
33
+
34
+ $ http://localhost:4567/css/admin/top.css
35
+ # ~/myapp/app/css/admin/top.less (Rendered by Less)
36
+
37
+ ## JavaScript
38
+
39
+ #### Adding JavaScript
40
+ You may put files in `app/js/`. You can put CoffeeScript in here as well.
41
+
42
+ [app/js/application.js (js)]
43
+ $(function() {
44
+ $("#top").show();
45
+ });
46
+
47
+ #### Accessing them
48
+ These files will be accessible in `http://localhost:4567/js`. For example,
49
+ these paths may correspond to the following files.
50
+
51
+ $ http://localhost:4567/js/prototype.js
52
+ # ~/myapp/app/js/prototype.js
53
+
54
+ $ http://localhost:4567/js/main.js
55
+ # ~/myapp/app/js/main.coffee (Rendered by CoffeeScript)
@@ -0,0 +1,128 @@
1
+ title: Views
2
+ page_type: section
3
+ --
4
+ Aura has a unique way of handling views, different from Sinatra's `render`.
5
+
6
+ #### Creating views
7
+ To create a view, put them in the `view/` folder of your extension.
8
+
9
+ [app/views/hello.haml (haml)]
10
+ %h1
11
+ Hello, world!
12
+
13
+ #### Showing views
14
+ Now call it in your Ruby code using `show`.
15
+ Unlike Sinatra's `render`, using `show` will automatically try and find the file
16
+ in the view directories of all extensions, and guess the right filetype based
17
+ on the extension.
18
+
19
+ [app/routes/hello.rb (ruby)]
20
+ get '/hello' do
21
+ show :hello
22
+ end
23
+
24
+ #### Showing views for models
25
+ You can pass a model to `show`. In this example, since the record is a `Page`,
26
+ Aura will render `:page/index` or `:base/index`, whichever it finds first.
27
+
28
+ page = Page['/about.html']
29
+
30
+ show page, :index
31
+
32
+ ## Partials
33
+
34
+ #### Using Partials
35
+ Aura provides a `partial` helper.
36
+
37
+ [app/views/hello.haml (haml)]
38
+ %hgroup
39
+ != partial :'hello/heading', title: 'Hello'
40
+
41
+ #### Defining partials
42
+ [extension/myext/views/hello/heading.haml (haml)]
43
+ %h1= title
44
+
45
+ ## Layouts
46
+
47
+ #### Defining layouts
48
+ Use the `layout` helper to define which layout will be used. This example will look for
49
+ a view called `cart.haml` (or any other layout extension).
50
+
51
+ [app/views/cart/list.haml (haml)]
52
+ - layout 'cart'
53
+
54
+ %h1 Your shopping cart
55
+
56
+ #### Layout files
57
+ Layouts are ordinary view files that use `yield`.
58
+
59
+ [app/views/cart.haml (haml)]
60
+ !!! 5
61
+ %html
62
+ %title Shopping cart
63
+ %body(class='cart')
64
+ != yield
65
+
66
+ #### Nested layouts
67
+ You may nest layouts using the `layout` helper in layouts as well. This example
68
+ will place everything inside the `default.haml` layout.
69
+
70
+ [app/views/cart.haml (haml)]
71
+ - layout 'default'
72
+
73
+ %section#cart
74
+ != yield
75
+
76
+ ## Content sections
77
+
78
+ #### Content sections
79
+ Aura uses `sinatra-content-for`. In your views, you can use the `content_for` helper.
80
+
81
+ [app/views/cart/list.haml (haml)]
82
+ - layout 'cart'
83
+
84
+ - content_for :sidebar do
85
+ %h3 Your cart
86
+ %a(href='/checkout') Checkout
87
+ %a(href='/') Continue shopping
88
+
89
+ #### Defining regions
90
+ In your layout, use `yield_content` to show the content for it.
91
+
92
+ [app/views/cart.haml (haml)]
93
+ %aside#sidebar
94
+ != yield_content :sidebar
95
+
96
+
97
+ ## View folders
98
+
99
+ Using `show` will find the file in all view directories. Those are:
100
+
101
+ - Your app's view path (`app/views/`)
102
+ - Views in your extensions
103
+ - The default views in the Aura gem
104
+
105
+ #### Example
106
+ For instance, if you have this structure:
107
+
108
+ extensions/
109
+ '- one/
110
+ | '- views/
111
+ | |- home.haml
112
+ | '- footer.haml
113
+ '- two/
114
+ '- views/
115
+ '- header.erb
116
+
117
+ #### for #show
118
+ You can then use:
119
+
120
+ show :home # Finds one/views/home.haml
121
+ show :footer # Finds one/views/footer.haml
122
+ show :header # Finds two/views/header.erb
123
+
124
+ #### for #partial
125
+ This is also done for partials:
126
+
127
+ partial :header # Finds views/header.erb
128
+ partial :header, :name => "Archer"
File without changes
@@ -0,0 +1,15 @@
1
+ ;(function ($) {
2
+ $('.form-builder fieldset').livequery(function () {
3
+ var $this = $(this);
4
+ $(this).sortable({
5
+ axis: 'y',
6
+ opacity: 0.5
7
+ });
8
+
9
+ $('a.delete', $this).live('click', function () {
10
+ var $p = $(this).closest('p');
11
+ $p.slideUp('fast', function () { $(this).remove(); });
12
+ return false;
13
+ })
14
+ });
15
+ })(jQuery);
@@ -0,0 +1,62 @@
1
+ ;(function ($) {
2
+ // This is the glue file.
3
+ // Most stuff here just glues together lib.* and jquery.* stuff.
4
+
5
+ $.uiscreen.background = "";
6
+ $.uiscreen.opacity = 0.8;
7
+ $.uiscreen.fadeout_time = 0;
8
+
9
+ // Focus
10
+ $("textarea, input, select")
11
+ .live('focus', function () {
12
+ $('body').find('.focus').removeClass('focus');
13
+ $(this).closest('form p').addClass('focus');
14
+ })
15
+ .live('blur', function () {
16
+ $(this).closest('form p').removeClass('focus');
17
+ });
18
+
19
+ // Redudndant submit
20
+ $("a[href=#submit]").live('click', function (e) {
21
+ $("form").submit();
22
+ return false;
23
+ });
24
+
25
+ // Preload of sorts
26
+ $(function () { $("body").show().addClass("loaded"); });
27
+
28
+ // Wysiwyg
29
+ $("textarea.html, p.html textarea").livequery(function () {
30
+ var $textarea = $(this);
31
+ $(function(){ $textarea.auraWysiwyg(); });
32
+ });
33
+
34
+ // How to:
35
+ // - area_class 'editable-title'
36
+ // - in the form, set the class to 'main-title' for the main title
37
+ //
38
+ // Set your form to have a class 'main-title' to have this cool thing here
39
+ //
40
+ $("#area.editable-title p.main-title").livequery(function () {
41
+ var $p = $(this);
42
+ var $input = $p.find('input');
43
+ var $title = $("#title .title-c");
44
+ var $label = $p.find('label');
45
+ var $h1 = $title.find('h1');
46
+
47
+ var $newInput = $("<input type='text'>");
48
+ $newInput.attr('value', $input.val());
49
+ $newInput.attr('placeholder', $label.text().replace(/^\s*|:?\s*$/g,'').replace(/\s+/g,' '));
50
+
51
+ $h1.remove();
52
+ $p.hide();
53
+
54
+ $title.append($newInput);
55
+
56
+ function onChange() {
57
+ $input.val($newInput.val());
58
+ };
59
+
60
+ $newInput.bind('keypress blur change', onChange);
61
+ });
62
+ })(jQuery);