alchemy_cms 2.2.rc13 → 2.2.rc14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/Rakefile +3 -0
  2. data/alchemy_cms.gemspec +1 -0
  3. data/app/assets/javascripts/alchemy/alchemy.base.js +95 -94
  4. data/app/assets/javascripts/alchemy/alchemy.buttons.js +15 -11
  5. data/app/assets/javascripts/alchemy/alchemy.datepicker.js +18 -18
  6. data/app/assets/javascripts/alchemy/alchemy.dirty.js +20 -20
  7. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +50 -44
  8. data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +15 -12
  9. data/app/assets/javascripts/alchemy/alchemy.elements_window.js +47 -43
  10. data/app/assets/javascripts/alchemy/alchemy.file_progress.js +27 -17
  11. data/app/assets/javascripts/alchemy/alchemy.growler.js +19 -15
  12. data/app/assets/javascripts/alchemy/alchemy.html5.js +1 -2
  13. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +10 -11
  14. data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +6 -6
  15. data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +4 -6
  16. data/app/assets/javascripts/alchemy/alchemy.menubar.js +16 -20
  17. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +18 -16
  18. data/app/assets/javascripts/alchemy/alchemy.preview.js +30 -30
  19. data/app/assets/javascripts/alchemy/alchemy.preview_window.js +50 -42
  20. data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +11 -11
  21. data/app/assets/javascripts/alchemy/alchemy.swf_upload.js +83 -86
  22. data/app/assets/javascripts/alchemy/alchemy.uploader.js +106 -112
  23. data/app/assets/javascripts/alchemy/alchemy.windows.js +158 -130
  24. data/app/assets/stylesheets/alchemy/base.css.scss +7 -1
  25. data/app/assets/stylesheets/alchemy/buttons.css.scss +31 -25
  26. data/app/assets/stylesheets/alchemy/elements.css.scss +4 -0
  27. data/app/controllers/alchemy/admin/base_controller.rb +5 -1
  28. data/app/helpers/alchemy/admin/base_helper.rb +21 -13
  29. data/app/helpers/alchemy/admin/contents_helper.rb +52 -11
  30. data/app/helpers/alchemy/admin/elements_helper.rb +0 -1
  31. data/app/helpers/alchemy/admin/essences_helper.rb +5 -5
  32. data/app/helpers/alchemy/essences_helper.rb +1 -0
  33. data/app/models/alchemy/content.rb +102 -91
  34. data/app/models/alchemy/essence_boolean.rb +8 -0
  35. data/app/models/alchemy/essence_select.rb +7 -0
  36. data/app/sweepers/alchemy/content_sweeper.rb +2 -4
  37. data/app/views/alchemy/admin/clipboard/clear.js.erb +3 -2
  38. data/app/views/alchemy/admin/clipboard/index.html.erb +2 -2
  39. data/app/views/alchemy/admin/contents/create.js.erb +2 -0
  40. data/app/views/alchemy/admin/contents/destroy.js.coffee +4 -0
  41. data/app/views/alchemy/admin/contents/new.html.erb +1 -1
  42. data/app/views/alchemy/admin/elements/_element_foot.html.erb +3 -2
  43. data/app/views/alchemy/admin/elements/create.js.coffee +31 -0
  44. data/app/views/alchemy/admin/elements/fold.js.coffee +37 -0
  45. data/app/views/alchemy/admin/essence_pictures/assign.js.coffee +15 -0
  46. data/app/views/alchemy/admin/essence_pictures/destroy.js.coffee +19 -0
  47. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +12 -2
  48. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
  49. data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
  50. data/app/views/alchemy/admin/pages/destroy.js.coffee +19 -0
  51. data/app/views/alchemy/admin/pages/edit.html.erb +5 -5
  52. data/app/views/alchemy/admin/pages/update.js.coffee +36 -0
  53. data/app/views/alchemy/admin/resources/_form.html.erb +12 -1
  54. data/app/views/alchemy/admin/resources/_resource.html.erb +6 -3
  55. data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
  56. data/app/views/alchemy/admin/trash/clear.js.coffee +4 -0
  57. data/app/views/alchemy/admin/trash/index.html.erb +4 -4
  58. data/app/views/alchemy/elements/_article_editor.html.erb +4 -2
  59. data/app/views/alchemy/elements/_article_view.html.erb +7 -7
  60. data/app/views/alchemy/elements/_download_editor.html.erb +4 -1
  61. data/app/views/alchemy/elements/_download_view.html.erb +7 -3
  62. data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +1 -0
  63. data/app/views/alchemy/elements/_image_mosaic_view.html.erb +11 -9
  64. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +14 -0
  65. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -0
  66. data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
  67. data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
  68. data/app/views/alchemy/essences/_essence_html_editor.html.erb +1 -1
  69. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +1 -1
  70. data/app/views/alchemy/essences/_essence_select_editor.html.erb +35 -0
  71. data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -0
  72. data/app/views/alchemy/essences/_essence_text_editor.html.erb +29 -77
  73. data/app/views/alchemy/essences/_essence_text_view.html.erb +2 -2
  74. data/config/alchemy/elements.yml +72 -44
  75. data/config/locales/alchemy.de.yml +46 -45
  76. data/config/locales/alchemy.en.yml +90 -89
  77. data/db/migrate/20120608085509_create_alchemy_essence_selects.rb +11 -0
  78. data/db/migrate/20120611221734_create_alchemy_essence_booleans.rb +11 -0
  79. data/lib/alchemy/authentication_helpers.rb +3 -7
  80. data/lib/alchemy/engine.rb +3 -4
  81. data/lib/alchemy/essence.rb +24 -16
  82. data/lib/alchemy/resource.rb +22 -3
  83. data/lib/alchemy/resources_helper.rb +8 -0
  84. data/lib/alchemy/seeder.rb +26 -1
  85. data/lib/alchemy/upgrader.rb +70 -1
  86. data/lib/alchemy/version.rb +1 -1
  87. data/lib/alchemy_cms.rb +1 -0
  88. data/spec/controllers/admin/clipboard_controller_spec.rb +16 -4
  89. data/spec/controllers/admin/contents_controller_spec.rb +21 -4
  90. data/spec/dummy/app/models/event.rb +1 -1
  91. data/spec/dummy/db/schema.rb +18 -1
  92. data/spec/helpers/admin/contents_helper_spec.rb +3 -2
  93. data/spec/models/clipboard_spec.rb +14 -3
  94. data/spec/models/essence_boolean_spec.rb +15 -0
  95. data/spec/models/essence_select_spec.rb +15 -0
  96. data/spec/models/resource_spec.rb +113 -0
  97. metadata +40 -12
  98. data/app/views/alchemy/admin/contents/destroy.js.erb +0 -7
  99. data/app/views/alchemy/admin/elements/create.js.erb +0 -36
  100. data/app/views/alchemy/admin/elements/fold.js.erb +0 -41
  101. data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -16
  102. data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +0 -20
  103. data/app/views/alchemy/admin/pages/destroy.js.erb +0 -12
  104. data/app/views/alchemy/admin/pages/update.js.erb +0 -40
  105. data/app/views/alchemy/admin/trash/clear.js.erb +0 -3
  106. data/spec/dummy/app/models/.gitkeep +0 -0
@@ -0,0 +1,8 @@
1
+ # Stores boolean values.
2
+ # Provides a checkbox in the editor views.
3
+ module Alchemy
4
+ class EssenceBoolean < ActiveRecord::Base
5
+ acts_as_essence :ingredient_column => :value
6
+ attr_accessible :value
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ # Provides a select box that stores string values.
2
+ module Alchemy
3
+ class EssenceSelect < ActiveRecord::Base
4
+ acts_as_essence :ingredient_column => :value
5
+ attr_accessible :value
6
+ end
7
+ end
@@ -33,12 +33,10 @@ module Alchemy
33
33
  end
34
34
  end
35
35
 
36
- # Expires all content editor cache fragments that have a :display_as => :select setting
36
+ # Expires all EssenceSelect content editor cache fragments.
37
37
  def expire_contents_displayed_as_select(page)
38
38
  return unless page.urlname_changed? || page.name_changed?
39
- Content.essence_texts.all.select { |c| c.settings[:display_as] == 'select'}.each do |content|
40
- expire_fragment(content)
41
- end
39
+ Content.essence_selects.each { |content| expire_fragment(content) }
42
40
  end
43
41
 
44
42
  end
@@ -1,6 +1,7 @@
1
1
  (function($) {
2
-
2
+
3
3
  $("#clipboard_items").replaceWith("<p><%= t('No items in your clipboard') -%></p>");
4
4
  $('#clipboard_button .icon.clipboard').removeClass('full');
5
-
5
+ Alchemy.pleaseWaitOverlay(false);
6
+
6
7
  })(jQuery);
@@ -8,7 +8,7 @@
8
8
  <div id="clipboard_items">
9
9
  <ul>
10
10
  <%- @clipboard_items.each do |item| -%>
11
- <% item_class = item.class.name.demodulize.underscore %>
11
+ <% item_class = item.class.name.demodulize.underscore.pluralize %>
12
12
  <li id="clipboard_item_<%= item.id -%>" class="<%= item_class -%>">
13
13
  <%= item.class.to_s == 'Alchemy::Element' ? item.display_name_with_preview_text(60) : item.name %>
14
14
  <span class="float_right"><%= link_to(render_icon('delete-small'), alchemy.remove_admin_clipboard_path(:remarkable_type => item_class, :remarkable_id => item.id), :remote => true, :method => :delete, :title => t('Remove item from clipboard')) %></span>
@@ -16,7 +16,7 @@
16
16
  <%- end -%>
17
17
  </ul>
18
18
  <p>
19
- <%= link_to_confirmation_window(t('clear clipboard'), t('Do you really want to clear the clipboard?'), alchemy.clear_admin_clipboard_path, :class => 'button') %>
19
+ <%= link_to_confirmation_window(t('clear clipboard'), t('Do you really want to clear the clipboard?'), alchemy.clear_admin_clipboard_path(:remarkable_type => params[:remarkable_type]), :class => 'button') %>
20
20
  </p>
21
21
  </div>
22
22
  <%- end -%>
@@ -16,6 +16,8 @@
16
16
  :locals => @locals
17
17
  )
18
18
  ) -%>');
19
+ Alchemy.enableButton('.disabled.button');
20
+ Alchemy.overlayObserver('#<%= content_dom_id(@content) %>');
19
21
 
20
22
  <% end -%>
21
23
 
@@ -0,0 +1,4 @@
1
+ $('#<%= content_dom_id(@content_dup) %>').remove()
2
+ Alchemy.growl '<%= escape_javascript(@notice) %>'
3
+ Alchemy.reloadPreview()
4
+ Alchemy.pleaseWaitOverlay false
@@ -8,7 +8,7 @@
8
8
  <%= hidden_field_tag('options', @options) %>
9
9
  </td>
10
10
  <td class="submit">
11
- <%= f.button t('save'), :class => 'button' %>
11
+ <%= f.button t(:create), :class => 'button' %>
12
12
  </td>
13
13
  </tr>
14
14
  </table>
@@ -1,3 +1,4 @@
1
+ <% remarkable_type = element.class.name.demodulize.underscore.pluralize %>
1
2
  <div class="element_foot">
2
3
  <span class="element_tools">
3
4
  <%= link_to(
@@ -10,7 +11,7 @@
10
11
  ) -%>
11
12
  <%= link_to(
12
13
  "",
13
- alchemy.insert_admin_clipboard_path(:remarkable_type => element.class.name.demodulize.underscore, :remarkable_id => element.id, :remove => true),
14
+ alchemy.insert_admin_clipboard_path(:remarkable_type => remarkable_type, :remarkable_id => element.id, :remove => true),
14
15
  :remote => true,
15
16
  :method => :post,
16
17
  :class => "element_move_button",
@@ -18,7 +19,7 @@
18
19
  ) %>
19
20
  <%= link_to(
20
21
  "",
21
- alchemy.insert_admin_clipboard_path(:remarkable_type => element.class.name.demodulize.underscore, :remarkable_id => element.id),
22
+ alchemy.insert_admin_clipboard_path(:remarkable_type => remarkable_type, :remarkable_id => element.id),
22
23
  :remote => true,
23
24
  :method => :post,
24
25
  :class => "element_copy_button",
@@ -0,0 +1,31 @@
1
+ <% if @cutted_element_id %>
2
+ $('.element_editor[data-element-id="<%= @cutted_element_id %>"]').remove()
3
+ <% end %>
4
+
5
+ <% if @page.can_have_cells? %>
6
+ Alchemy.selectOrCreateCellTab('<%= @cell.nil? ? "for_other_elements" : @cell.name -%>', '<%= @cell.nil? ? t("other Elements") : @cell.name_for_label -%>')
7
+ <% end %>
8
+
9
+ $('#cell_<%= @cell.nil? ? "for_other_elements" : @cell.name -%>').append('<%= escape_javascript render(:partial => "element", :object => @element, :locals => {:draggable => true}) -%>')
10
+ $('#cell_<%= @cell.nil? ? "for_other_elements" : @cell.name -%>').sortable('refresh')
11
+ Alchemy.growl('<%= t("successfully_added_element") -%>')
12
+ Alchemy.closeCurrentWindow()
13
+
14
+ <% @element.rtf_contents.each do |content| %>
15
+ Alchemy.Tinymce.addEditor('<%= content.form_field_id -%>')
16
+ <% end %>
17
+
18
+ Alchemy.PreviewWindow.refresh()
19
+ Alchemy.ElementEditorSelector.init()
20
+
21
+ $el = $('#element_<%= @element.id -%>')
22
+ $el.trigger('Alchemy.SelectElementEditor')
23
+ Alchemy.ElementDirtyObserver($el)
24
+ Alchemy.SelectBox('select', $el)
25
+ Alchemy.ButtonObserver('button.button', $el)
26
+ Alchemy.Datepicker('input[type="date"]', $el)
27
+ Alchemy.overlayObserver($el)
28
+
29
+ <% if @clipboard.blank? %>
30
+ $('#clipboard_button .icon.clipboard').removeClass('full')
31
+ <% end %>
@@ -0,0 +1,37 @@
1
+ $el = $('.element_editor[data-element-id="<%= @element.id %>"]')
2
+
3
+ <% if @error %>
4
+
5
+ $("#element_<%= @element.id -%>_folder_spinner").replaceWith("<span class='error_icon' title='<%= @error -%>'>!</span>")
6
+
7
+ <% else %>
8
+
9
+ $el = $el.replaceWith('<%= escape_javascript render(:partial => "element", :object => @element) -%>')
10
+ $('#element_area .sortable_cell').sortable('refresh')
11
+ Alchemy.ElementEditorSelector.reinit('.element_editor[data-element-id="<%= @element.id %>"]')
12
+
13
+ <% if @element.folded %>
14
+
15
+ <% @element.rtf_contents.each do |content| %>
16
+ rtf_<%= content.id -%> = tinymce.get '<%= content.form_field_id -%>'
17
+ rtf_<%= content.id -%>.remove() if rtf_<%= content.id %>
18
+ `delete rtf_<%= content.id -%>`
19
+ <%- end %>
20
+
21
+ <%- else %>
22
+
23
+ $el.trigger('Alchemy.SelectElementEditor')
24
+ Alchemy.SelectBox('select', $el)
25
+
26
+ <% @element.rtf_contents.each do |content| %>
27
+ Alchemy.Tinymce.addEditor '<%= content.form_field_id -%>'
28
+ <% end %>
29
+
30
+ Alchemy.ElementDirtyObserver $el
31
+ Alchemy.Datepicker('input[type="date"]', $el)
32
+ Alchemy.ButtonObserver('button.button', $el)
33
+ Alchemy.overlayObserver "#element_<%= @element.id -%>"
34
+
35
+ <% end %>
36
+
37
+ <% end %>
@@ -0,0 +1,15 @@
1
+ $('#picture_to_assign_<%= @picture.id %> a').attr('href', '#').off 'click'
2
+ $('#<%= content_dom_id(@content) -%>').replaceWith('<%= escape_javascript(
3
+ render(
4
+ :partial => "alchemy/essences/essence_picture_editor",
5
+ :locals => {:content => @content, :options => @options}
6
+ )
7
+ ) -%>')
8
+
9
+ <% if @content.siblings.essence_pictures.count > 1 %>
10
+ Alchemy.SortableContents '#<%= @content.element.id -%>_contents', '<%= form_authenticity_token -%>'
11
+ <% end %>
12
+
13
+ Alchemy.closeCurrentWindow()
14
+ Alchemy.setElementDirty '#element_<%= @content.element.id -%>'
15
+ Alchemy.overlayObserver '#<%= content_dom_id(@content) %>'
@@ -0,0 +1,19 @@
1
+ $('#essence_picture_<%= @content_id -%>').remove()
2
+
3
+ <% if max_image_count.present? && @essence_pictures.length < max_image_count.to_i %>
4
+ $picture_editor = $('#element_<%= @element.id -%>_contents')
5
+ if $('div.add_content', $picture_editor).length == 0
6
+ $('#element_<%= @element.id -%>_contents').append('<%= escape_javascript(
7
+ render(
8
+ :partial => "alchemy/admin/elements/add_content",
9
+ :locals => {
10
+ :element => @element,
11
+ :options => @options
12
+ }
13
+ )
14
+ ) %>')
15
+ <% end %>
16
+
17
+ Alchemy.SortableContents '#element_<%= @element.id -%>_contents', '<%= form_authenticity_token -%>'
18
+ Alchemy.reloadPreview()
19
+ Alchemy.pleaseWaitOverlay(false)
@@ -47,7 +47,12 @@
47
47
  <tr>
48
48
  <td class="label"><%= f.label "css_class" %></td>
49
49
  <td class="select">
50
- <%= f.select "css_class", [[t("Layout default"), ""], [t("above"), "no_float"], [t("left"), "left"], [t("right"), "right"]], :class => 'alchemy_selectbox' %>
50
+ <%= f.select(
51
+ "css_class",
52
+ [[t("Layout default"), ""], [t("above"), "no_float"], [t("left"), "left"], [t("right"), "right"]],
53
+ {},
54
+ {:class => 'alchemy_selectbox'}
55
+ ) %>
51
56
  </td>
52
57
  </tr>
53
58
  <%# Have to use a Hash here, because Rails has a Hash.to_params bug with nested Arrays!!!! %>
@@ -55,7 +60,12 @@
55
60
  <tr>
56
61
  <td class="label"><%= f.label "css_class" %></td>
57
62
  <td class="select">
58
- <%= f.select("css_class", options_for_select([[t('None'), '']] + @options[:css_classes].sort, @essence_picture.css_class), :class => 'alchemy_selectbox') %>
63
+ <%= f.select(
64
+ "css_class",
65
+ options_for_select([[t('None'), '']] + @options[:css_classes].sort, @essence_picture.css_class),
66
+ {},
67
+ {:class => 'alchemy_selectbox'}
68
+ ) %>
59
69
  </td>
60
70
  </tr>
61
71
  <%- elsif @options[:css_classes] && !@options[:css_classes].is_a?(HashWithIndifferentAccess) -%>
@@ -22,7 +22,7 @@
22
22
  <%= link_to(
23
23
  render_icon("copy_page"),
24
24
  alchemy.insert_admin_clipboard_path(
25
- :remarkable_type => layoutpage.class.name.demodulize.underscore,
25
+ :remarkable_type => layoutpage.class.name.demodulize.underscore.pluralize,
26
26
  :remarkable_id => layoutpage.id
27
27
  ),
28
28
  :remote => true,
@@ -43,7 +43,7 @@
43
43
  <%= link_to(
44
44
  render_icon("copy_page"),
45
45
  alchemy.insert_admin_clipboard_path(
46
- :remarkable_type => page.class.name.demodulize.underscore,
46
+ :remarkable_type => page.class.name.demodulize.underscore.pluralize,
47
47
  :remarkable_id => page.id
48
48
  ),
49
49
  :remote => true,
@@ -0,0 +1,19 @@
1
+ $('#locked_page_<%= @page_id -%>').remove()
2
+
3
+ <% if @layoutpage %>
4
+
5
+ window.location.replace '<%= alchemy.admin_layoutpages_path -%>'
6
+
7
+ <% elsif @page_root %>
8
+
9
+ $('#sitemap').replaceWith '<%= escape_javascript(render(:partial => "sitemap")) -%>'
10
+ Alchemy.growl '<%= @message -%>'
11
+ Alchemy.Tooltips()^
12
+
13
+ <% else %>
14
+
15
+ window.location.replace '<%= alchemy.admin_pages_path -%>'
16
+
17
+ <% end %>
18
+
19
+ Alchemy.pleaseWaitOverlay false
@@ -112,8 +112,8 @@
112
112
  Alchemy.openWindow(
113
113
  '<%= alchemy.new_admin_element_path(:page_id => @page.id) -%>',
114
114
  '<%= t("New Element") -%>',
115
- '320',
116
- '120',
115
+ 320,
116
+ 120,
117
117
  false,
118
118
  true,
119
119
  true
@@ -129,8 +129,8 @@
129
129
  Alchemy.openWindow(
130
130
  '<%= alchemy.admin_clipboard_path(:remarkable_type => "elements") -%>',
131
131
  '<%= t("Clipboard") -%>',
132
- '380',
133
- '270',
132
+ 380,
133
+ 270,
134
134
  false,
135
135
  true,
136
136
  true
@@ -154,7 +154,7 @@
154
154
  Alchemy.Tinymce.init(function() {
155
155
  Alchemy.ElementDirtyObserver('#element_area');
156
156
  });
157
- if (Alchemy.Tinymce.customInits.length > 0) {
157
+ if (Alchemy.Tinymce.customInits) {
158
158
  for (var i = Alchemy.Tinymce.customInits.length - 1; i >= 0; i--) {
159
159
  Alchemy.Tinymce.customInits[i].call();
160
160
  }
@@ -0,0 +1,36 @@
1
+ Alchemy.closeCurrentWindow()
2
+
3
+ <% if @while_page_edit %>
4
+
5
+ Alchemy.reloadPreview()
6
+ $('#page_<%= @page.id %>_status').replaceWith('<%= escape_javascript(render(:partial => "page_status")) -%>')
7
+
8
+ <% else %>
9
+ $page = $('#page_<%= @page.id %>')
10
+ $('.sitemap_page > .sitemap_sitename .sitemap_pagename_link', $page).html('<%= @page.name -%>')
11
+
12
+ <% if @page.locked? && @page.locker == current_user %>
13
+
14
+ $('#locked_page_<%= @page.id %> > a').html('<%= @page.name -%>')
15
+
16
+ <% end %>
17
+
18
+ $('#page_<%= @page.id %>_infos').html('<%= escape_javascript(render(:partial => "page_infos", :locals => {:page => @page})) -%>')
19
+
20
+ <% if @page.restricted? %>
21
+
22
+ $('.page_status:nth-child(3)', $page).addClass('restricted', 'not_restricted').removeClass('not_restricted')
23
+
24
+ <% elsif @page.redirects_to_external? %>
25
+
26
+ $('span.redirect_url', $page).html('&raquo; <%= t("Redirects to") %>: <%= h @page.urlname %>')
27
+
28
+ <% else %>
29
+
30
+ $('.page_status:nth-child(3)', $page).addClass('not_restricted').removeClass('restricted')
31
+
32
+ <% end %>
33
+
34
+ <% end %>
35
+
36
+ Alchemy.growl("<%= @notice -%>")
@@ -13,7 +13,18 @@
13
13
  <td class="input"><%= f.send :text_area, attribute[:name] -%></td>
14
14
  <%- else -%>
15
15
  <td class="label"><%= f.send :label, attribute[:name] %></td>
16
- <td class="input"><%= f.send :text_field, attribute[:name], :class => 'thin_border' -%></td>
16
+
17
+ <% attr_array = attribute[:name].split('.') %>
18
+ <% if attr_array.length > 1 %>
19
+ <td class="select">
20
+ <%= f.send :select, "#{attr_array[0]}_id", attr_array[0].classify.constantize.all.collect {|r| [r.send(attr_array[1]), r.id] }, {:prompt => t("Please choose")}, {:class => "alchemy_selectbox"} %>
21
+ </td>
22
+ <% else %>
23
+ <td class="input">
24
+ <%= f.send :text_field, attribute[:name], :class => 'thin_border' -%>
25
+ </td>
26
+ <% end %>
27
+
17
28
  <%- end -%>
18
29
  </tr>
19
30
  <%- end -%>
@@ -2,13 +2,16 @@
2
2
  <%- resource_handler.attributes.each do |attribute| -%>
3
3
  <%- if attribute[:type] == :boolean -%>
4
4
  <td class="center">
5
- <% attr_value = resource.send(attribute[:name]) %>
5
+ <% attr_value = render_attribute(resource, attribute[:name]) %>
6
6
  <%= attr_value.blank? ? '' : render_icon(attr_value) -%>
7
7
  </td>
8
8
  <%- elsif attribute[:type] == :integer || attribute[:type] == :float || attribute[:type] == :decimal -%>
9
- <td class="right"><%= resource.send(attribute[:name]) -%></td>
9
+
10
+ <td class="right"><%= render_attribute(resource, attribute[:name]) -%></td>
10
11
  <%- else -%>
11
- <td><%= resource.send(attribute[:name]) -%></td>
12
+ <td>
13
+ <%= render_attribute(resource, attribute[:name]) %>
14
+ </td>
12
15
  <%- end -%>
13
16
  <%- end -%>
14
17
  <td class="tools">
@@ -9,7 +9,7 @@
9
9
  <%- else -%>
10
10
  <th>
11
11
  <%- end -%>
12
- <%= resource_handler.model.human_attribute_name(attribute[:name]) %>
12
+ <%= resource_handler.model.human_attribute_name(attribute[:name]) %>
13
13
  </th>
14
14
  <%- end -%>
15
15
  <th class="tools"></th>
@@ -0,0 +1,4 @@
1
+ Alchemy.growl '<%= t("Cleared trash") %>'
2
+ Alchemy.refreshTrashWindow <%= @page.id %>
3
+ jQuery('#element_trash_button .icon').removeClass 'full'
4
+ Alchemy.pleaseWaitOverlay false
@@ -11,12 +11,12 @@
11
11
  </div>
12
12
  <div id="trash_items">
13
13
  <%- @elements.each do |element| -%>
14
- <%= render :partial => 'alchemy/admin/elements/element', :object => element, :locals => {:draggable => !@allowed_elements.detect { |e| e['name'] == element.name }.nil?} %>
14
+ <%= render :partial => 'alchemy/admin/elements/element', :object => element, :locals => {:draggable => !@allowed_elements.detect { |e| e['name'] == element.name }.nil? } %>
15
15
  <%- end -%>
16
- <p>
17
- <%= link_to_confirmation_window(t('clear trash'), t('Do you really want to clear the trash?'), alchemy.clear_admin_trash_path(:page_id => @page.id), :class => 'button') %>
18
- </p>
19
16
  </div>
17
+ <p>
18
+ <%= link_to_confirmation_window(t('clear trash'), t('Do you really want to clear the trash?'), alchemy.clear_admin_trash_path(:page_id => @page.id), :class => 'button') %>
19
+ </p>
20
20
  <%- end -%>
21
21
  </div>
22
22
  <script type="text/javascript" charset="utf-8">
@@ -1,4 +1,6 @@
1
1
  <%= render_essence_editor_by_name(element, 'intro') %>
2
- <%= render_essence_editor_by_name(element, 'headline') %>
3
2
  <%= render_picture_editor(element, :maximum_amount_of_images => 1, :image_size => "450x300", :crop => true, :image_float_selector => true, :fixed_ratio => false) %>
4
- <%= render_essence_editor_by_name(element, 'text') %>
3
+ <% element.contents.where(:name => ['headline', 'text']).each do |content| %>
4
+ <%= render_essence_editor content %>
5
+ <% end %>
6
+ <%= render_new_content_link(element) %>
@@ -5,12 +5,10 @@
5
5
  <%= intro %>
6
6
  </div>
7
7
  <%- end -%>
8
- <%- headline = render_essence_view_by_name(element, 'headline') -%>
9
- <%- if !headline.blank? -%>
10
- <h1 class="headline">
11
- <%= headline %>
12
- </h1>
13
- <%- end -%>
8
+ <% element.contents.where(:name => 'headline').each do |content| %>
9
+ <% next if content.ingredient.blank? %>
10
+ <h1 class="headline"><%= render_essence content %></h1>
11
+ <% end %>
14
12
  <div class="text_bild_container">
15
13
  <%- content = element.contents.find_by_essence_type("Alchemy::EssencePicture") -%>
16
14
  <%- if content -%>
@@ -18,8 +16,10 @@
18
16
  <%= render_essence_view(content, :image_size => "450x1000", :crop => true) %>
19
17
  </div>
20
18
  <%- end -%>
19
+ <% element.contents.where(:name => 'text').each do |content| %>
21
20
  <div class="text">
22
- <%= render_essence_view_by_name(element, 'text') %>
21
+ <%= render_essence content %>
23
22
  </div>
23
+ <% end %>
24
24
  </div>
25
25
  </div>