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,48 @@
1
+ class Main
2
+ # The user is redirected here on first load.
3
+ get '/admin/welcome' do
4
+ require_login
5
+ @first = true
6
+ show_admin User, :edit,
7
+ :item => current_user,
8
+ :action => current_user.path(:edit),
9
+ :first => @first
10
+ end
11
+
12
+ post '/login' do
13
+ if login(User, params[:username], params[:password])
14
+ redirect_to_return_url
15
+
16
+ else
17
+ session[:error] = "Sorry, you must have mistyped something. Try again!"
18
+ redirect R(:login)
19
+ end
20
+ end
21
+
22
+ get '/login' do
23
+ redirect R(:admin) if logged_in?
24
+ if request.xhr?
25
+ return "<div id='redirect'>#{request.fullpath}</div>"
26
+ end
27
+
28
+ show 'user/login', :layout => nil
29
+ end
30
+
31
+ get '/logout' do
32
+ if logged_in?
33
+ logout(User)
34
+ flash_message "You have logged out."
35
+ end
36
+
37
+ redirect R(:login)
38
+ end
39
+
40
+ get '/user/me/edit' do
41
+ require_login
42
+ @item = current_user
43
+
44
+ show_admin @item, :edit,
45
+ :item => @item,
46
+ :action => @item.path(:edit)
47
+ end
48
+ end
@@ -0,0 +1,3 @@
1
+ %nav.back
2
+ != link_to R(:admin) do
3
+ = "Dashboard"
@@ -0,0 +1,46 @@
1
+ -# content_for :title do
2
+ %h1 Welcome!
3
+
4
+ - content_for(:nav) do
5
+ %nav.back
6
+ %nav.crumbs
7
+ != link_to R(:admin) do
8
+ = "Dashboard"
9
+
10
+ - Aura.editor.roots.each do |model, items|
11
+ - next unless model.try(:show_on_sidebar?)
12
+ != partial model, 'nav', :items => items, :model => model
13
+
14
+ %nav
15
+ %h3 System
16
+ %ul
17
+ - Aura.admin.menu.items.each do |item|
18
+ %li{class: ('browse' if item.items.any?)}
19
+ != link_to(item.href || '#') do
20
+ != admin_icon(item.icon || 'generic')
21
+ = item.name
22
+
23
+ - content_for :body do
24
+ %center{:style => 'font-size: 20px; color: #aaa; padding: 30px 0;'}
25
+ Welcome!
26
+
27
+ - if Aura.site_empty?
28
+ .slim.fixed
29
+ %section.dialog
30
+ %h3 Let's get started!
31
+ %p
32
+ Dude, your site is empty. How about filling it up?
33
+ Here are some ways to do that:
34
+
35
+ %ul.actions
36
+ %li
37
+ %a.black.button{:href => R(:page, :new)} Create a new page
38
+ %form{:method => 'post', :action => R(:admin, :settings, :database, :seed)}
39
+ %button{:type => 'submit'} Load sample data
40
+
41
+
42
+
43
+
44
+ -# %a{:href => Page.path(:list)} Manage pages
45
+ - 10.times do
46
+ %br
@@ -0,0 +1,73 @@
1
+ !!! 5
2
+ %html{:class => browser.body_class}
3
+ - unless request.xhr?
4
+ %head
5
+ %meta(charset='UTF-8')
6
+ %title!= title || Aura.get('site.name')
7
+ != jquery
8
+
9
+ - Aura.admin.css.each do |css|
10
+ %link{:rel => 'stylesheet', :media => css[:media] || 'screen', :type => 'text/css', :href => css[:href]}
11
+
12
+ %body{:class => body_class}
13
+
14
+ - unless request.xhr?
15
+ %script{:type => 'text/javascript'}
16
+ :plain
17
+ document.body.className += 'js-on';
18
+ document.body.style.display = 'none';
19
+
20
+ %header#top
21
+ %h3
22
+ %a{:href => R(:admin)}
23
+ = Aura.get('site.name')
24
+ %a.view.ext{:href => '/', :target => 'preview'}
25
+ view site
26
+
27
+ - unless current_user.nil?
28
+ %nav#aux
29
+ %h4
30
+ Hello,
31
+ %a{:href => R(:user, :me, :edit)}= current_user.email
32
+ %ul
33
+ %li
34
+ %a{:href => R(:logout)} Logout
35
+
36
+ %nav#tabs
37
+ - if has_content?(:tabs)
38
+ != yield_content :tabs
39
+
40
+ %header#title
41
+ - if has_content?(:title)
42
+ .title-c
43
+ != yield_content :title
44
+
45
+ - if has_content?(:toolbar)
46
+ %nav#toolbar
47
+ %ul
48
+ != yield_content :toolbar
49
+
50
+ #area{:class => area_class}
51
+ - if flash_messages? or flash_errors?
52
+ #flash
53
+ %div
54
+ %ul
55
+ - flash_messages.each do |msg|
56
+ %li.success= msg
57
+ - flash_errors.each do |msg|
58
+ %li.error= msg
59
+
60
+
61
+ #content
62
+ - if has_content?(:body)
63
+ != yield_content :body
64
+ != yield
65
+
66
+ %aside#nav
67
+ .nav-c
68
+ != yield_content :nav
69
+
70
+ - unless request.xhr?
71
+ != jquery_ui
72
+ != settings.admin_js.to_html
73
+
@@ -0,0 +1,40 @@
1
+ - title "Settings"
2
+
3
+ - content_for :title do
4
+ %h1 Aura Settings
5
+
6
+ - content_for :nav do
7
+
8
+ != admin_back_to_dashboard
9
+
10
+ %nav.crumbs
11
+ != link_to R(:admin, :settings) do
12
+ != admin_icon :settings
13
+ = "Settings"
14
+ %nav
15
+ %ul
16
+ -# TODO: admin_submenu('settings')
17
+ - Aura.admin.menu.get('settings').items.each do |item|
18
+ - klass = ('browse' if item.items.any?)
19
+ %li{:class => klass}
20
+ != link_to(item.href || '#') do
21
+ != admin_icon(item.icon || 'generic')
22
+ = item.name
23
+
24
+ - content_for :tabs do
25
+ %ul
26
+ %li
27
+ != link_to R(:admin, :settings) do
28
+ Settings
29
+
30
+ - Aura.admin.menu.get('settings').items.each do |item|
31
+ - klass = ('browse' if item.items.any?)
32
+ %li{:class => klass}
33
+ != link_to(item.href || '#') do
34
+ = item.name
35
+
36
+ - content_for :body do
37
+ Stuff go here
38
+ - 10.times do
39
+ %br
40
+
@@ -0,0 +1,42 @@
1
+ - content_for :nav do
2
+ != yield_content_of :'admin/settings', :nav
3
+ - content_for :tabs do
4
+ != yield_content_of :'admin/settings', :tabs
5
+
6
+ - content_for :title do
7
+ %h1
8
+ Database
9
+
10
+ - content_for :body do
11
+ .slim.fixed
12
+
13
+ %section
14
+ %h3 Load sample data
15
+ %p.align-center
16
+ Get started easily with sample data.
17
+ - if !Aura.site_empty?
18
+ Warning: this will delete all content in your site!
19
+
20
+ %form.ext{:method => 'post', :action => R(:admin, :settings, :database, :seed)}
21
+ %p.align-center
22
+ %button.small{:type => 'submit'} Load sample data
23
+
24
+ %section
25
+ %h3 Backup data
26
+ %p.align-center
27
+ You can download a latest backup of your data here.
28
+
29
+ %p.align-center
30
+ %a.button.small.ext{:href => '/admin/settings/database/backup.yml'} Download latest backup
31
+
32
+ %section
33
+ %h3 Reset data
34
+ %p.align-center
35
+ This will clear the database and everything on this site.
36
+ %a.ext{:href => 'javascript:$("#nuke").show();'} Click here
37
+ to do this.
38
+
39
+ %form.ext{:method => 'post', :action => R(:admin, :settings, :database, :flush)}
40
+ %p.align-center.hide#nuke
41
+ Are you sure you want to do this?
42
+ %button.black.small{:type => 'submit'} Nuke everything
@@ -0,0 +1,50 @@
1
+ - model ||= nil
2
+ - new ||= false
3
+
4
+ %section.crumbs
5
+ %ul
6
+ - unless item.nil?
7
+ - item.crumbs.each do |crumb|
8
+ %li
9
+ %span!= "&rsaquo;"
10
+ - if crumb.try(:editable?)
11
+ %a{:href => crumb.path(:edit)}= crumb.to_s
12
+ - else
13
+ %strong= crumb.to_s
14
+
15
+ - if new
16
+ %li.new
17
+ %span!= "&rsaquo;"
18
+ %strong (Here)
19
+
20
+ - if item.try(:sluggable?) || model.try(:sluggable?)
21
+
22
+ .url
23
+ .components
24
+ %span.protocol http://
25
+ %span.host<>= request.env['HTTP_HOST']
26
+
27
+ - if item.try(:parent?)
28
+ - path = item.parent.path
29
+ - path.split('/').reject { |s| s.empty? }.each do |segment|
30
+ %span.slash<>= "/"
31
+ %span.path<>= segment
32
+
33
+ %span.slash<>= "/"
34
+ - if item
35
+ %span.this<>= (item.slug if item)
36
+ - else
37
+ %span.this<>= "..."
38
+ %input{:type => 'text', :name => 'slug', :value => (item.slug if item)}
39
+ %ul.actions.js
40
+ %li
41
+ %a.edit{:href => '#edit'} Edit
42
+ - if item.try(:renderable?)
43
+ %li
44
+ %a.ext{:href => item.path} Visit
45
+ - if item.try(:parent?) == false
46
+ %li
47
+ %a{:href => '#set-as-homepage'} Set as homepage
48
+
49
+
50
+
@@ -0,0 +1,19 @@
1
+ - content_for :tabs do
2
+ != partial item, 'tabs', :item => item
3
+
4
+ - content_for(:title) do
5
+ %h1
6
+ = item
7
+ %em Delete
8
+
9
+ - content_for :nav do
10
+ != yield_content_of item, :edit, :nav, { :item => item, :action => '' }
11
+
12
+ - content_for :body do
13
+ .dialog
14
+ %form{:action => action, :method => 'post' }
15
+ %p
16
+ Do you want to delete this?
17
+ %p.submit
18
+ %button{:type => 'submit'}
19
+ %span Delete
@@ -0,0 +1,61 @@
1
+ - title "Edit: %s" % [ item.to_s ]
2
+
3
+ - content_for :tabs do
4
+ != partial item, :tabs, :item => item, :model => item.class
5
+
6
+ - content_for :nav do
7
+ - if item.children.any?
8
+ - if item.parent.nil?
9
+ != admin_back_to_dashboard
10
+
11
+ - else
12
+ %nav.back
13
+ != link_to item.parent.path(:edit) do
14
+ != admin_icon('page')
15
+ = item.parent.to_s
16
+
17
+ %nav.crumbs
18
+ != link_to item.path(:edit) do
19
+ != admin_icon('page')
20
+ = item.to_s
21
+
22
+ != partial item, :nav, :items => item.children, :parent => item
23
+
24
+ - else
25
+ - if item.parent?
26
+ -# Show the parent's menu
27
+ != yield_content_of item, :edit, :nav, { :item => item.parent }
28
+
29
+ - else
30
+ -# Show the main menu
31
+ != yield_content_of 'admin/dashboard', :nav
32
+
33
+ - content_for :title do
34
+ %h1= item
35
+
36
+ - content_for :toolbar do
37
+ - if item.try(:parentable?)
38
+ %li
39
+ %a{:href => item.path(:new)} Create subpage
40
+ %li
41
+ %a.black{:href => '#submit'} Save
42
+
43
+ - content_for :body do
44
+ != partial item, :crumbs, :item => item
45
+
46
+ != partial item, :errors, :errors => item.errors
47
+
48
+ .slim
49
+ %form{:action => action, :method => 'post'}
50
+ != partial item, :form, :item => item
51
+
52
+ %p.submit
53
+ %span.right
54
+ - if item.try(:deletable?)
55
+ %a{:href => item.path(:delete)} Delete this
56
+ != "&nbsp; | &nbsp;"
57
+ - if item.try(:renderable?)
58
+ %a{:href => item.path, :target => 'preview'} View this
59
+
60
+ %button{:type => 'submit'}
61
+ %span Save
@@ -0,0 +1,10 @@
1
+ - errors ||= []
2
+ - if errors.any? and params[:no_save].nil?
3
+ .flash.validation-errors
4
+ %h3 Can't continue:
5
+ %ul
6
+ - errors.each do |field, errs|
7
+ - errs.each do |err|
8
+ %li
9
+ = field
10
+ = err
@@ -0,0 +1,11 @@
1
+ - unless item.class.form.nil?
2
+
3
+ -# Default field
4
+ - fieldset = item.class.form.fieldset(:default)
5
+ !~ fieldset.to_html(item)
6
+
7
+ -# Extra fields
8
+ - item.class.form.fieldsets.each do |fieldset|
9
+ - next if fieldset.default?
10
+ !~ fieldset.to_html(item)
11
+
@@ -0,0 +1,14 @@
1
+ - content_for :title do
2
+ %h1
3
+ = model.title
4
+
5
+ - content_for :toolbar do
6
+ %li
7
+ %a{:href => model.path(:new)}= "Create new"
8
+
9
+ - content_for :body do
10
+ .slim
11
+ %section.items
12
+ %table
13
+ - model.each do |item|
14
+ != partial model, :list_item, :item => item
@@ -0,0 +1,4 @@
1
+ %li
2
+ %a{:href => item.path} View
3
+ %li
4
+ %a{:href => item.path(:delete)} Delete
@@ -0,0 +1,7 @@
1
+ %tr
2
+ %td
3
+ %a{:href => item.path('edit')}
4
+ = item
5
+ %td.actions
6
+ %ul.actions
7
+ != partial item, :'list_actions', :item => item