alchemy_cms 2.4.1 → 2.5.0.b2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/.travis.yml +1 -1
  2. data/README.md +18 -17
  3. data/alchemy_cms.gemspec +5 -10
  4. data/app/assets/images/alchemy/icons.png +0 -0
  5. data/app/assets/stylesheets/alchemy/archive.scss +27 -0
  6. data/app/assets/stylesheets/alchemy/base.scss +0 -51
  7. data/app/assets/stylesheets/alchemy/elements.scss +37 -2
  8. data/app/assets/stylesheets/alchemy/icons.scss +4 -0
  9. data/app/assets/stylesheets/alchemy/modules.scss +4 -0
  10. data/app/assets/stylesheets/alchemy/sitemap.scss +1 -1
  11. data/app/assets/stylesheets/alchemy/tables.scss +1 -1
  12. data/app/assets/stylesheets/alchemy/variables.scss +1 -0
  13. data/app/controllers/alchemy/admin/pages_controller.rb +1 -0
  14. data/app/controllers/alchemy/admin/pictures_controller.rb +22 -8
  15. data/app/controllers/alchemy/admin/resources_controller.rb +1 -1
  16. data/app/controllers/alchemy/admin/sites_controller.rb +6 -0
  17. data/app/controllers/alchemy/base_controller.rb +8 -0
  18. data/app/controllers/alchemy/elements_controller.rb +33 -3
  19. data/app/controllers/alchemy/messages_controller.rb +47 -40
  20. data/app/controllers/alchemy/pages_controller.rb +8 -31
  21. data/app/controllers/alchemy/pictures_controller.rb +64 -30
  22. data/app/helpers/alchemy/admin/base_helper.rb +7 -0
  23. data/app/helpers/alchemy/admin/pages_helper.rb +12 -0
  24. data/app/helpers/alchemy/elements_helper.rb +2 -0
  25. data/app/helpers/alchemy/pages_helper.rb +30 -10
  26. data/app/helpers/alchemy/url_helper.rb +1 -0
  27. data/app/models/alchemy/content.rb +1 -2
  28. data/app/models/alchemy/element.rb +47 -2
  29. data/app/models/alchemy/language.rb +27 -14
  30. data/app/models/alchemy/page.rb +1 -1
  31. data/app/models/alchemy/picture.rb +46 -41
  32. data/app/models/alchemy/site.rb +44 -0
  33. data/app/views/alchemy/admin/elements/_element_head.html.erb +1 -0
  34. data/app/views/alchemy/admin/languages/index.html.erb +23 -0
  35. data/app/views/alchemy/admin/pages/edit.html.erb +27 -1
  36. data/app/views/alchemy/admin/pages/fold.js.erb +1 -0
  37. data/app/views/alchemy/admin/partials/_upload_form.html.erb +2 -0
  38. data/app/views/alchemy/admin/pictures/_picture.html.erb +24 -2
  39. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +5 -4
  40. data/app/views/alchemy/admin/pictures/create.js.erb +1 -9
  41. data/app/views/alchemy/admin/pictures/info.html.erb +42 -0
  42. data/app/views/alchemy/admin/resources/_form.html.erb +0 -2
  43. data/app/views/alchemy/admin/resources/_resource.html.erb +2 -1
  44. data/app/views/alchemy/admin/resources/index.html.erb +2 -1
  45. data/app/views/alchemy/elements/show.html.erb +1 -6
  46. data/app/views/alchemy/elements/show.js.erb +4 -10
  47. data/app/views/alchemy/essences/_essence_link_view.html.erb +1 -0
  48. data/app/views/alchemy/search/_form.html.erb +9 -6
  49. data/app/views/alchemy/search/_result.html.erb +1 -1
  50. data/bin/alchemy +13 -120
  51. data/config/alchemy/config.yml +7 -11
  52. data/config/alchemy/modules.yml +24 -12
  53. data/config/authorization_rules.rb +6 -2
  54. data/config/initializers/dragonfly.rb +20 -0
  55. data/config/locales/alchemy.de.yml +57 -28
  56. data/config/locales/alchemy.en.yml +18 -4
  57. data/config/routes.rb +4 -2
  58. data/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +21 -0
  59. data/db/migrate/20121205155004_create_alchemy_sites.rb +14 -0
  60. data/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +6 -0
  61. data/lib/alchemy/capistrano.rb +7 -2
  62. data/lib/alchemy/ferret_search.rb +84 -0
  63. data/lib/alchemy/picture_attributes.rb +29 -0
  64. data/lib/alchemy/seeder.rb +10 -16
  65. data/lib/alchemy/upgrader.rb +59 -8
  66. data/lib/alchemy/version.rb +1 -1
  67. data/lib/alchemy_cms.rb +7 -4
  68. data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +3 -0
  69. data/lib/rails/generators/alchemy/elements/elements_generator.rb +5 -1
  70. data/lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb +1 -0
  71. data/lib/rails/generators/alchemy/scaffold/files/{pages.html.erb → application.html.erb} +0 -0
  72. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +11 -20
  73. data/lib/rails/templates/alchemy.rb +1 -7
  74. data/lib/tasks/{database.rake → alchemy/db.rake} +1 -1
  75. data/lib/tasks/{install.rake → alchemy/install.rake} +9 -14
  76. data/lib/tasks/{upgrade.rake → alchemy/upgrade.rake} +1 -1
  77. data/spec/controllers/elements_controller_spec.rb +24 -9
  78. data/spec/controllers/pictures_controller_spec.rb +11 -8
  79. data/{app → spec/dummy/app}/views/alchemy/elements/_article_editor.html.erb +0 -0
  80. data/{app → spec/dummy/app}/views/alchemy/elements/_article_view.html.erb +0 -0
  81. data/{app → spec/dummy/app}/views/alchemy/elements/_headline_view.html.erb +0 -0
  82. data/{app → spec/dummy/app}/views/alchemy/elements/_news_view.html.erb +0 -0
  83. data/{app → spec/dummy/app}/views/alchemy/elements/_searchresult_view.html.erb +0 -0
  84. data/{app → spec/dummy/app}/views/alchemy/page_layouts/_standard.html.erb +0 -0
  85. data/spec/dummy/config/alchemy/elements.yml +86 -0
  86. data/spec/dummy/config/alchemy/page_layouts.yml +26 -0
  87. data/spec/dummy/config/application.rb +1 -1
  88. data/spec/dummy/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +21 -0
  89. data/spec/dummy/db/migrate/20121205155004_create_alchemy_sites.rb +14 -0
  90. data/spec/dummy/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +6 -0
  91. data/spec/dummy/db/schema.rb +21 -6
  92. data/spec/factories.rb +6 -2
  93. data/spec/integration/translation_integration_spec.rb +4 -18
  94. data/spec/models/element_spec.rb +4 -4
  95. data/spec/models/picture_spec.rb +37 -20
  96. data/spec/models/site_spec.rb +69 -0
  97. data/spec/routing_spec.rb +115 -115
  98. data/spec/spec_helper.rb +1 -3
  99. data/spec/support/alchemy/specs_helpers.rb +4 -4
  100. data/vendor/assets/javascripts/jquery_plugins/jquery.html5uploader.js +1 -1
  101. metadata +72 -96
  102. data/app/assets/stylesheets/alchemy/standard_set.css +0 -440
  103. data/app/views/alchemy/elements/_bild_editor.html.erb +0 -1
  104. data/app/views/alchemy/elements/_bild_text_editor.html.erb +0 -7
  105. data/app/views/alchemy/elements/_bild_text_view.html.erb +0 -9
  106. data/app/views/alchemy/elements/_bild_view.html.erb +0 -9
  107. data/app/views/alchemy/elements/_claim_editor.html.erb +0 -1
  108. data/app/views/alchemy/elements/_claim_view.html.erb +0 -1
  109. data/app/views/alchemy/elements/_contactform_editor.html.erb +0 -4
  110. data/app/views/alchemy/elements/_contactform_view.html.erb +0 -78
  111. data/app/views/alchemy/elements/_download_editor.html.erb +0 -4
  112. data/app/views/alchemy/elements/_download_view.html.erb +0 -7
  113. data/app/views/alchemy/elements/_footnote_editor.html.erb +0 -1
  114. data/app/views/alchemy/elements/_footnote_view.html.erb +0 -5
  115. data/app/views/alchemy/elements/_header_editor.html.erb +0 -1
  116. data/app/views/alchemy/elements/_header_view.html.erb +0 -1
  117. data/app/views/alchemy/elements/_headline_editor.html.erb +0 -1
  118. data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +0 -3
  119. data/app/views/alchemy/elements/_image_mosaic_view.html.erb +0 -14
  120. data/app/views/alchemy/elements/_intro_editor.html.erb +0 -1
  121. data/app/views/alchemy/elements/_intro_image_text_editor.html.erb +0 -3
  122. data/app/views/alchemy/elements/_intro_image_text_view.html.erb +0 -16
  123. data/app/views/alchemy/elements/_intro_view.html.erb +0 -3
  124. data/app/views/alchemy/elements/_news_editor.html.erb +0 -3
  125. data/app/views/alchemy/elements/_searchresult_editor.html.erb +0 -4
  126. data/app/views/alchemy/elements/_sitemap_editor.html.erb +0 -3
  127. data/app/views/alchemy/elements/_sitemap_view.html.erb +0 -38
  128. data/app/views/alchemy/elements/_sitename_editor.html.erb +0 -1
  129. data/app/views/alchemy/elements/_sitename_view.html.erb +0 -1
  130. data/app/views/alchemy/elements/_subheadline_editor.html.erb +0 -1
  131. data/app/views/alchemy/elements/_subheadline_view.html.erb +0 -5
  132. data/app/views/alchemy/elements/_text_editor.html.erb +0 -1
  133. data/app/views/alchemy/elements/_text_view.html.erb +0 -3
  134. data/app/views/alchemy/page_layouts/_contact.html.erb +0 -14
  135. data/app/views/alchemy/page_layouts/_external.html.erb +0 -0
  136. data/app/views/alchemy/page_layouts/_intro.html.erb +0 -14
  137. data/app/views/alchemy/page_layouts/_layout_footer.html.erb +0 -14
  138. data/app/views/alchemy/page_layouts/_layout_header.html.erb +0 -14
  139. data/app/views/alchemy/page_layouts/_news.html.erb +0 -14
  140. data/app/views/alchemy/page_layouts/_newsletter_layout.html.erb +0 -1
  141. data/app/views/alchemy/page_layouts/_search.html.erb +0 -14
  142. data/app/views/alchemy/pictures/show.gif.flexi +0 -19
  143. data/app/views/alchemy/pictures/show.jpg.flexi +0 -19
  144. data/app/views/alchemy/pictures/show.png.flexi +0 -19
  145. data/app/views/alchemy/pictures/thumbnail.png.flexi +0 -13
  146. data/app/views/alchemy/pictures/zoom.jpg.flexi +0 -3
  147. data/app/views/alchemy/pictures/zoom.png.flexi +0 -3
  148. data/app/views/layouts/alchemy/pages.html.erb +0 -51
  149. data/config/alchemy/elements.yml +0 -274
  150. data/config/alchemy/page_layouts.yml +0 -75
  151. data/config/asset_packages.yml +0 -30
  152. data/config/initializers/localeapp.rb +0 -9
  153. data/lib/rails/generators/alchemy/plugin/files/translation.pot +0 -3
  154. data/lib/rails/generators/alchemy/plugin/files/translation_de.po +0 -3
  155. data/lib/rails/generators/alchemy/plugin/files/translation_en.po +0 -3
  156. data/lib/rails/generators/alchemy/plugin/plugin_generator.rb +0 -37
  157. data/lib/rails/generators/alchemy/plugin/templates/authorization_rules.rb +0 -34
  158. data/lib/rails/generators/alchemy/plugin/templates/config.yml +0 -30
  159. data/lib/rails/generators/alchemy/plugin/templates/init.rb +0 -1
  160. data/lib/rails/generators/alchemy/plugin/templates/plugin.rb +0 -0
  161. data/lib/rails/generators/alchemy/plugin/templates/routes.rb +0 -10
  162. data/lib/tasks/fleximage.rake +0 -154
  163. data/spec/dummy/app/views/layouts/.gitkeep +0 -0
@@ -11,6 +11,7 @@
11
11
  <span class="preview_text_element_name"><%= element.display_name %></span>
12
12
  <span class="preview_text_quote"><%= sanitize(element.preview_text) %></span>
13
13
  </span>
14
+ <%= render_hint_for(element) %>
14
15
  <span class="ajax_folder" <%= element.trashed? ? 'style="display: none"'.html_safe : '' %>>
15
16
  <%= image_tag(
16
17
  "alchemy/ajax_loader.gif",
@@ -0,0 +1,23 @@
1
+ <%- label_title = t("Create #{resource_model_name}", :default => t('Create')) -%>
2
+
3
+ <%- toolbar(
4
+ :buttons => [
5
+ {
6
+ :icon => 'create',
7
+ :label => label_title,
8
+ :url => new_resource_path,
9
+ :title => label_title,
10
+ :overlay_options => {
11
+ :title => label_title,
12
+ :size => "430x400"
13
+ },
14
+ :if_permitted_to => [:new, resource_permission_scope]
15
+ }
16
+ ],
17
+ :search => true,
18
+ :search_url => resources_path
19
+ ) -%>
20
+
21
+ <div id="archive_all">
22
+ <%= render 'table' %>
23
+ </div>
@@ -65,6 +65,10 @@
65
65
  <% end %>
66
66
  </div>
67
67
  <% end %>
68
+ <div class="button_with_label">
69
+ <%= select_tag('preview_size', preview_sizes_for_select, :class => 'alchemy_selectbox short') %>
70
+ <label><%= t :preview_size %></label>
71
+ </div>
68
72
  </div>
69
73
  <div id="toolbar_buttons_right">
70
74
  <div class="button_with_label" id="show_preview_window">
@@ -160,10 +164,14 @@
160
164
  }
161
165
  }
162
166
  jQuery('#cells').tabs().tabs('paging', { follow: true, followOnSelect: true } );
167
+
168
+ if (window.location.hash) {
169
+ $(window.location.hash).trigger('Alchemy.SelectElementEditor');
170
+ }
163
171
  });
164
172
  }
165
173
 
166
- jQuery(document).ready(function($) {
174
+ jQuery(function($) {
167
175
  var texts = {
168
176
  title: '<%= t("Warning!") %>',
169
177
  message: '<%= t(:element_dirty_page_leave_warning) %>',
@@ -178,6 +186,24 @@
178
186
  Alchemy.PageLeaveObserver(texts);
179
187
  Alchemy.openElementsWindow();
180
188
  Alchemy.openPreviewWindow();
189
+
190
+ $('#preview_size').bind('open.selectBoxIt', function (e) {
191
+ $('#top_menu').css('z-index', 5000);
192
+ });
193
+
194
+ $('#preview_size').bind('blur.selectBoxIt', function (e) {
195
+ $('#top_menu').css('z-index', 5);
196
+ });
197
+
198
+ Alchemy.PreviewWindow.currentWidth = Alchemy.PreviewWindow.currentWindow.dialog('widget').width();
199
+
200
+ $('select#preview_size').on('change', function(e) {
201
+ var width = this.value;
202
+ if (this.value === 'auto') {
203
+ width = Alchemy.PreviewWindow.currentWidth;
204
+ }
205
+ Alchemy.PreviewWindow.currentWindow.dialog('widget').css('width', width);
206
+ });
181
207
  });
182
208
 
183
209
  </script>
@@ -1,4 +1,5 @@
1
1
  (function($) {
2
2
  $('#page_<%= @page.id -%>').replaceWith('<%= escape_javascript(render(:partial => "page", :locals => {:page => @page})) -%>');
3
3
  Alchemy.Tooltips();
4
+ Alchemy.overlayObserver('#page_<%= @page.id -%>');
4
5
  })(jQuery);
@@ -53,9 +53,11 @@
53
53
  file_upload_limit: <%= configuration(:uploader)['upload_limit'] || 50 -%>,
54
54
  locale: "<%= ::I18n.locale || 'en' %>",
55
55
  onQueueComplete: function() {
56
+ // While assigning picture in page edit mode
56
57
  <% if @while_assigning && model_name == 'picture' %>
57
58
  var url = '<%= alchemy.admin_pictures_path(:size => params[:size], :filter => :last_upload, :element_id => @element.id, :content_id => @content ? @content.id : nil, :options => @options).html_safe %>';
58
59
  $.get(url, null, null, 'script');
60
+ // While uploading picture in library
59
61
  <% elsif controller.class.name == 'Alchemy::Admin::PicturesController' %>
60
62
  var url = '<%= alchemy.admin_pictures_path(:size => params[:size], :filter => :last_upload).html_safe %>';
61
63
  Alchemy.pleaseWaitOverlay();
@@ -2,7 +2,7 @@
2
2
  <span class="picture_tool select">
3
3
  <%= check_box_tag "picture_ids[]", picture.id %>
4
4
  </span>
5
- <% permitted_to?(:destroy, :alchemy_admin_pictures) do %>
5
+ <% if permitted_to?(:destroy, :alchemy_admin_pictures) && picture.deletable? %>
6
6
  <span class="picture_tool delete">
7
7
  <%= link_to_confirmation_window(
8
8
  "",
@@ -43,6 +43,28 @@
43
43
  ) -%>
44
44
  </span>
45
45
  <% end %>
46
+ <% permitted_to?(:info, :alchemy_admin_pictures) do %>
47
+ <span class="picture_tool info">
48
+ <%= link_to_overlay_window(
49
+ "",
50
+ alchemy.info_admin_picture_path(
51
+ :id => picture,
52
+ :query => params[:query],
53
+ :page => params[:page],
54
+ :tagged_with => params[:tagged_with],
55
+ :size => params[:size],
56
+ :filter => params[:filter]
57
+ ),
58
+ {
59
+ :title => t('Picture infos'),
60
+ :size => "400x300"
61
+ },
62
+ {
63
+ :title => t('Show picture infos')
64
+ }
65
+ ) -%>
66
+ </span>
67
+ <% end %>
46
68
  <div class="image_spinner spinner">
47
69
  <%= image_tag("alchemy/image_loader.gif", :alt => '') %>
48
70
  </div>
@@ -55,7 +77,7 @@
55
77
  :style => "display: none;"
56
78
  ),
57
79
  '#',
58
- :onclick => "Alchemy.zoomImage('#{show_in_window_admin_picture_path(:id => picture.id, :sh => picture.security_token)}', '#{picture.name}', #{picture.image_width || 320}, #{picture.image_height || 240})",
80
+ :onclick => "Alchemy.zoomImage('#{show_in_window_admin_picture_path(:id => picture.id, :sh => picture.security_token)}', '#{picture.name}', #{picture.image_file_width || 320}, #{picture.image_file_height || 240})",
59
81
  :class => 'thumbnail_background',
60
82
  :id => 'show_in_window'
61
83
  ) %>
@@ -1,12 +1,13 @@
1
+ <% p = params.dup %>
1
2
  <h2><%= t("Filter by tag") %></h2>
2
3
  <ul>
3
4
  <% Alchemy::Picture.tag_counts.each do |t| %>
4
5
  <% picture_tags = pictures_filtered_by_tag?(t) ? picture_tag_filter(:remove => t) : picture_tag_filter(:add => t) %>
5
- <%= content_tag 'li', :class => params[:tagged_with].try(:split, ',').try(:include?, t.name) ? 'active' : nil do %>
6
+ <%= content_tag 'li', :class => p[:tagged_with].try(:split, ',').try(:include?, t.name) ? 'active' : nil do %>
6
7
  <%= link_to(
7
8
  "#{t.name} (#{t.count})",
8
9
  url_for(
9
- params.delete_if { |k, v| k == "page" }.merge(
10
+ p.delete_if { |k, v| k == "page" }.merge(
10
11
  :action => :index,
11
12
  :tagged_with => picture_tags
12
13
  )
@@ -17,10 +18,10 @@
17
18
  <% end %>
18
19
  <% end %>
19
20
  </ul>
20
- <% if params[:tagged_with].present? %>
21
+ <% if p[:tagged_with].present? %>
21
22
  <%= link_to(
22
23
  render_icon('delete-small') + t('Remove tag filter'),
23
- url_for(params.delete_if { |k, v| k == "tagged_with" }.merge(:action => :index)),
24
+ url_for(p.delete_if { |k, v| k == "tagged_with" }.merge(:action => :index)),
24
25
  :remote => request.xhr?,
25
26
  :class => 'button small with_icon please_wait'
26
27
  ) %>
@@ -1,11 +1,3 @@
1
1
  (function($) {
2
- <%- if @while_assigning -%>
3
- $('#alchemy_window_body').replaceWith('<%= escape_javascript(render(:partial => "archive_overlay")) -%>');
4
- <%- else -%>
5
- $('#picture_archive').html("<%= escape_javascript(render :partial => 'archive') %>");
6
- Alchemy.pictureSelector();
7
- Alchemy.overlayObserver('#picture_archive');
8
- Alchemy.SelectBox('#filter_bar');
9
- <%- end -%>
10
2
  Alchemy.growl('<%= @message -%>');
11
- })(jQuery);
3
+ })(jQuery);
@@ -0,0 +1,42 @@
1
+ <div class="with_padding">
2
+ <table>
3
+ <tr>
4
+ <td class="label"><%= Alchemy::Picture.human_attribute_name :name %></td>
5
+ <td class="value"><p><%= @picture.name %></p></td>
6
+ </tr>
7
+ <tr>
8
+ <td class="label"><%= Alchemy::Picture.human_attribute_name :image_file_name %></td>
9
+ <td class="value"><p><%= @picture.image_file_name %></p></td>
10
+ </tr>
11
+ <tr>
12
+ <td class="label"><%= Alchemy::Picture.human_attribute_name :image_file_dimensions %></td>
13
+ <td class="value"><p><%= @picture.image_file_dimensions %> px</p></td>
14
+ </tr>
15
+ <tr>
16
+ <td class="label"><%= Alchemy::Picture.human_attribute_name :image_file_size %></td>
17
+ <td class="value"><p><%= number_to_human_size @picture.image_file_size %></p></td>
18
+ </tr>
19
+ </table>
20
+ </div>
21
+ <div id="pictures_page_list">
22
+ <% if @picture.deletable? %>
23
+ <h2><%= t :this_picture_is_not_used_on_any_page %></h2>
24
+ <% else %>
25
+ <h2><%= t :this_picture_is_used_on_these_pages %>:</h2>
26
+ <ul class="list">
27
+ <% @picture.essence_pictures.group_by(&:page).each do |page, essence_pictures| %>
28
+ <li>
29
+ <h3><%= link_to page.name, edit_admin_page_path(page) %></h3>
30
+ <ul>
31
+ <% essence_pictures.group_by(&:element).each do |element, essence_pictures| %>
32
+ <li class="<%= cycle('even', 'odd') %>">
33
+ <%= link_to element.display_name_with_preview_text, edit_admin_page_path(page, :anchor => "element_#{element.id}") %> in
34
+ <%= essence_pictures.collect { |e| e.content.name_for_label }.to_sentence %>
35
+ </li>
36
+ <% end %>
37
+ </ul>
38
+ </li>
39
+ <% end %>
40
+ </ul>
41
+ <% end %>
42
+ </div>
@@ -1,5 +1,4 @@
1
1
  <%= form_for resource_instance_variable, :url => resource_path(resource_instance_variable), :remote => true do |f| %>
2
- <% if resource_instance_variable.errors.any? %>
3
2
  <div id="errors">
4
3
  <ul>
5
4
  <% resource_instance_variable.errors.full_messages.each do |error| %>
@@ -7,7 +6,6 @@
7
6
  <% end %>
8
7
  </ul>
9
8
  </div>
10
- <% end %>
11
9
  <table>
12
10
  <%- resource_handler.attributes.each do |attribute| -%>
13
11
  <tr>
@@ -30,7 +30,8 @@
30
30
  '',
31
31
  edit_resource_path(resource),
32
32
  {
33
- :title => t("Edit")
33
+ :title => t("Edit"),
34
+ :size => resource_window_size
34
35
  },
35
36
  {
36
37
  :class => "icon edit",
@@ -8,7 +8,8 @@
8
8
  :url => new_resource_path,
9
9
  :title => label_title,
10
10
  :overlay_options => {
11
- :title => label_title
11
+ :title => label_title,
12
+ :size => resource_window_size
12
13
  },
13
14
  :if_permitted_to => [:new, resource_permission_scope]
14
15
  }
@@ -1,6 +1 @@
1
- <%= render(
2
- :partial => "alchemy/elements/#{@element.name}_view.html.erb",
3
- :locals => {
4
- :element => @element
5
- }
6
- ) -%>
1
+ <%= render @element, :element => @element %>
@@ -1,11 +1,5 @@
1
1
  (function($) {
2
-
3
- $('#<%= @container_id -%>').html('<%= escape_javascript(render(
4
- :partial => "alchemy/elements/<%= @element.name -%>_view.html.erb",
5
- :locals => {
6
- :element => @element,
7
- :options => @options
8
- }
9
- )) -%>');
10
-
11
- })(jQuery);
2
+ $('#<%= @container_id -%>').html('<%= escape_javascript(
3
+ render @element, :element => @element, :options => @options
4
+ ) -%>');
5
+ })(jQuery);
@@ -1,2 +1,3 @@
1
1
  <%- options[:text] ||= content.ingredient %>
2
+ <%- html_options = { target: content.essence.link_target == "blank" ? "_blank" : nil }.merge(html_options) %>
2
3
  <%= link_to options[:text], content.ingredient, html_options %>
@@ -1,8 +1,11 @@
1
- <%= form_tag(show_alchemy_page_path(@search_result_page), :method => :get, :class => 'fulltext_search') do %>
2
- <% if options[:html5] %>
3
- <%= search_field_tag(:query, params[:query], :placeholder => t('search query')) %>
4
- <% else %>
5
- <%= text_field_tag(:query, params[:query]) %>
1
+ <% search_result_page ||= find_search_result_page %>
2
+ <% if search_result_page %>
3
+ <%= form_tag show_alchemy_page_path(search_result_page), :method => :get, :id => options[:id], :class => options[:class] do %>
4
+ <% if options[:html5] %>
5
+ <%= search_field_tag(:query, params[:query], :placeholder => t('search query')) %>
6
+ <% else %>
7
+ <%= text_field_tag(:query, params[:query]) %>
8
+ <% end %>
9
+ <%= submit_tag(t("search"), :name => nil) %>
6
10
  <% end %>
7
- <%= submit_tag(t("search"), :name => nil) %>
8
11
  <% end %>
@@ -4,6 +4,6 @@
4
4
  <%= link_to page.name, show_alchemy_page_path(page) %>
5
5
  </h3>
6
6
  <%- result.each do |highlight| -%>
7
- <p><%= sanitize highlight %></p>
7
+ <p><%= sanitize highlight.force_encoding('UTF-8') %></p>
8
8
  <%- end -%>
9
9
  </li>
@@ -13,147 +13,40 @@ begin
13
13
  end
14
14
 
15
15
  class AlchemyInstaller < Thor
16
-
17
16
  include Thor::Actions
18
17
 
19
18
  map "-v" => :version
20
19
  map "--version" => :version
21
-
22
20
  desc "version", "Prints current Alchemy CMS version", :hide => true
23
21
  def version
24
22
  puts Alchemy::VERSION
25
23
  end
26
24
 
27
25
  desc "new PROJECT", "Creates a new Alchemy CMS project."
28
- method_option :scm, :type => :string, :aliases => "-s", :desc => "Type of scm (git or svn) to use for this project. Leave blank for none."
29
26
  method_option :database, :type => :string, :default => 'mysql', :aliases => "-d", :desc => "Type of database to use for this project. Default mysql."
30
27
  def new(project)
31
- results = []
32
28
  @application = project.downcase.strip.gsub(/ /, '_')
33
- say "Install Alchemy CMS into ./#{@application}", :yellow
34
- say "Generating new Rails App...", :yellow
35
-
36
- if system("rails new #{@application} -m #{File.join(File.dirname(__FILE__), '..', 'lib', 'rails', 'templates', 'alchemy.rb')} -d #{options[:database]} -JT --old-style-hash #{options[:scm].nil? || options[:scm].empty? || options[:scm] == 'svn' ? '--skip-git' : ''}")
37
-
29
+ if system("rails new #{@application} -m #{File.join(File.dirname(__FILE__), '..', 'lib', 'rails', 'templates', 'alchemy.rb')} -d #{options[:database]} -JT")
38
30
  create_database_yml if options[:database] == 'mysql'
39
-
40
- system "rake alchemy:mount"
41
-
42
- with_standard_set = yes?("\nDo you want to copy the files of Alchemy´s Standardset into your App? (y/N)")
43
-
44
- if with_standard_set
45
- sentinel = /::Application\.configure do\s*$/
46
- inject_into_file "#{@application}/config/environments/production.rb", "\n config.assets.precompile += %w( alchemy/standard_set.css )\n", { :after => sentinel, :verbose => true }
47
- end
48
-
49
- results << system("cd ./#{@application} && rake db:create alchemy:install:migrations db:migrate alchemy:db:seed")
50
- results << system("cd ./#{@application} && rails g alchemy:scaffold#{' --with-standard-set' if with_standard_set}")
51
-
52
- %x[
53
- cd ./#{@application}
54
- rm ./public/index.html
55
- rm ./app/assets/images/rails.png
56
- ]
57
-
58
- if !options[:scm].nil? && !options[:scm].empty?
59
-
60
- clean_mountpoint = mountpoint.gsub('/', '')
61
-
62
- %x[
63
- cd ./#{@application}
64
- rm -rf ./tmp/*
65
- rm -rf ./log/*
66
- mkdir -p ./index
67
- mkdir -p ./uploads
68
- ]
69
-
70
- if yes?("\nDo you want to generate a deploy script for Capistrano? (y/N)")
71
- system "cd #{@application} && rails g alchemy:deploy_script --scm=#{options[:scm]} --db=#{options[:database]}"
72
- say "\nCapifying...", :yellow
73
- system "cd #{@application} && capify ."
74
- end
75
-
76
- case options[:scm]
77
- when 'svn'
78
- server = ask("\nURL of your svn server:")
79
- repository = ask("\nName of the repository (#{@application}):")
80
- repository = @application if repository.empty?
81
-
82
- say "\nImporting #{@application} into #{server}/#{repository} ...", :yellow
83
- output = %x[svn import ./#{@application} #{server}/#{repository} -m 'initial import by Alchemy installer']; imported = $?.success?
84
-
85
- if imported
86
-
87
- say "Removing and checking out again...", :yellow
88
- %x[
89
- rm -rf ./#{@application}
90
- svn co #{server}/#{repository} #{@application}
91
- ]
92
-
93
- say "Committing ignores...", :yellow
94
- %x[
95
- cd ./#{@application}
96
- svn propset svn:ignore '*' tmp/ log/ index/ uploads/
97
- svn propset svn:ignore '#{clean_mountpoint.empty? ? 'pictures' : clean_mountpoint}' ./public
98
- svn propset svn:ignore 'assets' ./public
99
- svn propset svn:ignore 'database.yml' ./config
100
- svn commit -m 'set ignores'
101
- ]
102
-
103
- else
104
- say "Error while importing!", :red
105
- end
106
-
107
- when 'git'
108
- gitignore = <<-GIT
31
+ system("cd ./#{@application} && rake alchemy:install")
32
+ gitignore = <<-GIT
109
33
  log/*
110
34
  tmp/*
111
35
  .DS_Store
112
36
  upload/*
113
37
  index/*
114
- public/#{clean_mountpoint.empty? ? 'pictures' : clean_mountpoint}
115
- public/assets
116
38
  config/database.yml
117
39
  GIT
118
-
119
- %x[
120
- cd #{@application}
121
- echo "#{gitignore}" > .gitignore
122
- touch ./index/.gitkeep
123
- touch ./uploads/.gitkeep
124
- git init .
125
- git add .
126
- git commit -am 'inital commit'
127
- ]
128
- end
129
-
130
- end
131
-
132
- readme = <<-EOF
133
-
134
- Successfully installed Alchemy CMS into ./#{@application}
135
-
136
- Next steps:
137
-
138
- 1. Go into your projects folder:
139
-
140
- cd ./#{@application}
141
-
142
- 2. Start your local Rails server:
143
-
144
- rails server
145
-
146
- 3. Open a browser and enter the following URL:
147
-
148
- http://localhost:3000
149
-
150
- 4. Follow the instructions to complete the installation!
151
-
152
- Thank you for using Alchemy CMS!
153
- http://alchemy-cms.com
154
-
155
- EOF
156
- say readme, :green if results.detect { |r| r == false }.nil?
40
+ %x[
41
+ cd ./#{@application}
42
+ rm ./public/index.html
43
+ rm ./app/assets/images/rails.png
44
+ mkdir -p ./index
45
+ mkdir -p ./uploads
46
+ touch ./index/.gitkeep
47
+ touch ./uploads/.gitkeep
48
+ echo "#{gitignore}" > .gitignore
49
+ ]
157
50
  else
158
51
  say "\nError while installation!\n", :red
159
52
  end