alchemy_cms 2.3.2 → 2.4.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/.gitignore +1 -2
  2. data/.travis.yml +1 -5
  3. data/Gemfile +4 -4
  4. data/README.md +22 -15
  5. data/alchemy_cms.gemspec +38 -38
  6. data/app/assets/javascripts/alchemy/alchemy.base.js +2 -2
  7. data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +31 -0
  8. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +1 -1
  9. data/app/assets/javascripts/alchemy/alchemy.elements_window.js +24 -15
  10. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +9 -3
  11. data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +2 -2
  12. data/app/assets/javascripts/alchemy/alchemy.js +1 -0
  13. data/app/assets/javascripts/alchemy/alchemy.menubar.js +4 -12
  14. data/app/assets/javascripts/alchemy/alchemy.onload.js.coffee +32 -0
  15. data/app/assets/javascripts/alchemy/alchemy.windows.js +4 -4
  16. data/app/assets/stylesheets/alchemy/_defaults.scss +0 -1
  17. data/app/assets/stylesheets/alchemy/alchemy.css +2 -1
  18. data/app/assets/stylesheets/alchemy/base.css.scss +2 -54
  19. data/app/assets/stylesheets/alchemy/elements.css.scss +8 -5
  20. data/app/assets/stylesheets/alchemy/errors.css.scss +51 -0
  21. data/app/assets/stylesheets/alchemy/flash.css.scss +0 -2
  22. data/app/assets/stylesheets/alchemy/form_elements.css.scss +31 -75
  23. data/app/assets/stylesheets/alchemy/icons.css.scss +5 -5
  24. data/app/assets/stylesheets/alchemy/menubar.css.scss +0 -2
  25. data/app/assets/stylesheets/alchemy/sitemap.css.scss +0 -1
  26. data/app/assets/stylesheets/alchemy/tables.css.scss +3 -1
  27. data/app/controllers/alchemy/admin/base_controller.rb +19 -12
  28. data/app/controllers/alchemy/admin/elements_controller.rb +52 -24
  29. data/app/controllers/alchemy/admin/pages_controller.rb +11 -5
  30. data/app/controllers/alchemy/admin/resources_controller.rb +3 -4
  31. data/app/controllers/alchemy/admin/users_controller.rb +1 -0
  32. data/app/controllers/alchemy/base_controller.rb +34 -8
  33. data/app/controllers/alchemy/pictures_controller.rb +16 -1
  34. data/app/controllers/alchemy/user_sessions_controller.rb +6 -1
  35. data/app/helpers/alchemy/base_helper.rb +14 -0
  36. data/app/helpers/alchemy/elements_helper.rb +10 -5
  37. data/app/helpers/alchemy/pages_helper.rb +1 -2
  38. data/app/helpers/alchemy/url_helper.rb +43 -24
  39. data/app/models/alchemy/element.rb +23 -16
  40. data/app/models/alchemy/page.rb +25 -14
  41. data/app/models/alchemy/picture.rb +24 -0
  42. data/app/views/alchemy/admin/contents/create.js.erb +1 -1
  43. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -1
  44. data/app/views/alchemy/admin/elements/create.js.erb +11 -3
  45. data/app/views/alchemy/admin/elements/fold.js.erb +1 -1
  46. data/app/views/alchemy/admin/elements/new.html.erb +1 -1
  47. data/app/views/alchemy/admin/elements/update.js.erb +1 -1
  48. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -1
  49. data/app/views/alchemy/admin/languages/_form.html.erb +1 -1
  50. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
  51. data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
  52. data/app/views/alchemy/admin/pages/configure.html.erb +10 -6
  53. data/app/views/alchemy/admin/pages/configure_external.html.erb +1 -1
  54. data/app/views/alchemy/admin/pages/edit.html.erb +1 -2
  55. data/app/views/alchemy/admin/pages/new.html.erb +2 -2
  56. data/app/views/alchemy/admin/pages/update.js.erb +10 -2
  57. data/app/views/alchemy/admin/partials/_sub_navigation_tab.html.erb +5 -5
  58. data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +2 -1
  59. data/app/views/alchemy/admin/pictures/_picture.html.erb +2 -2
  60. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +2 -1
  61. data/app/views/alchemy/admin/pictures/show_in_window.html.erb +3 -2
  62. data/app/views/alchemy/admin/resources/_form.html.erb +1 -1
  63. data/app/views/alchemy/admin/users/_table.html.erb +4 -4
  64. data/app/views/alchemy/admin/users/edit.html.erb +1 -1
  65. data/app/views/alchemy/admin/users/new.html.erb +1 -1
  66. data/app/views/alchemy/base/error_notice.js.erb +1 -1
  67. data/app/views/alchemy/base/remote_errors.js.erb +2 -3
  68. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +10 -7
  69. data/app/views/alchemy/essences/_essence_picture_view.html.erb +24 -21
  70. data/app/views/layouts/alchemy/admin.html.erb +9 -31
  71. data/bin/alchemy +20 -24
  72. data/config/alchemy/config.yml +6 -0
  73. data/config/alchemy/page_layouts.yml +2 -0
  74. data/config/authorization_rules.rb +1 -1
  75. data/config/locales/alchemy.de.yml +3 -0
  76. data/config/locales/alchemy.en.yml +4 -1
  77. data/db/migrate/20121026100815_alchemy_two_point_three.rb +312 -0
  78. data/lib/alchemy/mount_point.rb +9 -3
  79. data/lib/alchemy/page_layout.rb +89 -73
  80. data/lib/alchemy/version.rb +1 -1
  81. data/lib/rails/generators/alchemy/deploy_script/deploy_script_generator.rb +45 -12
  82. data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +3 -1
  83. data/lib/rails/generators/alchemy/essence/essence_generator.rb +51 -0
  84. data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +18 -0
  85. data/lib/rails/generators/alchemy/essence/templates/view.html.erb +2 -0
  86. data/lib/rails/templates/alchemy.rb +1 -1
  87. data/lib/tasks/install.rake +57 -2
  88. data/spec/controllers/admin/elements_controller_spec.rb +170 -22
  89. data/spec/controllers/admin/trash_controller_spec.rb +1 -1
  90. data/spec/controllers/admin/users_controller_spec.rb +36 -0
  91. data/spec/controllers/base_controller_spec.rb +12 -1
  92. data/spec/controllers/elements_controller_spec.rb +17 -13
  93. data/spec/controllers/pictures_controller_spec.rb +4 -4
  94. data/spec/dummy/config/application.rb +1 -1
  95. data/spec/dummy/db/migrate/20121026100815_alchemy_two_point_three.rb +312 -0
  96. data/spec/dummy/db/migrate/20121026104128_create_events.rb +19 -0
  97. data/spec/dummy/db/schema.rb +1 -1
  98. data/spec/factories.rb +0 -1
  99. data/spec/helpers/base_helper_spec.rb +48 -0
  100. data/spec/helpers/elements_helper_spec.rb +14 -3
  101. data/spec/helpers/url_helper_spec.rb +8 -3
  102. data/spec/integration/picture_security_spec.rb +35 -0
  103. data/spec/integration/translation_integration_spec.rb +6 -5
  104. data/spec/models/element_spec.rb +5 -5
  105. data/spec/models/page_layout_spec.rb +10 -16
  106. data/spec/models/page_spec.rb +25 -2
  107. data/spec/models/picture_spec.rb +24 -2
  108. data/spec/routing_spec.rb +115 -115
  109. data/spec/support/alchemy/specs_helpers.rb +4 -4
  110. data/{app/assets/images/alchemy → vendor/assets/images}/Jcrop.gif +0 -0
  111. data/vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js +19 -243
  112. data/vendor/assets/javascripts/jquery_plugins/jquery.selectboxit.min.js +1 -0
  113. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +6 -6
  114. data/vendor/assets/stylesheets/jquery.Jcrop.min.css +28 -0
  115. metadata +48 -82
  116. data/app/assets/javascripts/alchemy/alchemy.buttons.js +0 -50
  117. data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +0 -54
  118. data/app/helpers/alchemy/pictures_helper.rb +0 -19
  119. data/db/migrate/20100607143125_create_pages.rb +0 -34
  120. data/db/migrate/20100607144254_create_elements.rb +0 -20
  121. data/db/migrate/20100607145256_create_contents.rb +0 -18
  122. data/db/migrate/20100607145719_create_users.rb +0 -32
  123. data/db/migrate/20100607150611_create_pictures.rb +0 -16
  124. data/db/migrate/20100607150812_create_attachments.rb +0 -16
  125. data/db/migrate/20100607153647_create_folded_pages.rb +0 -13
  126. data/db/migrate/20100607161345_create_essence_texts.rb +0 -19
  127. data/db/migrate/20100607162339_create_elements_pages.rb +0 -12
  128. data/db/migrate/20100607193638_create_essence_pictures.rb +0 -23
  129. data/db/migrate/20100607193646_create_essence_richtexts.rb +0 -16
  130. data/db/migrate/20100607193653_create_essence_htmls.rb +0 -13
  131. data/db/migrate/20100609111653_create_essence_dates.rb +0 -13
  132. data/db/migrate/20100609111809_create_essence_files.rb +0 -15
  133. data/db/migrate/20100609111821_create_essence_flashes.rb +0 -16
  134. data/db/migrate/20100609111837_create_essence_videos.rb +0 -18
  135. data/db/migrate/20100616150753_create_essence_audios.rb +0 -17
  136. data/db/migrate/20100812085225_add_crop_from_and_crop_size_to_essence_pictures.rb +0 -11
  137. data/db/migrate/20100909140701_change_essence_htmls_source_column_type.rb +0 -9
  138. data/db/migrate/20101109150312_alter_pages_visible_column_default.rb +0 -9
  139. data/db/migrate/20101109151812_create_languages.rb +0 -19
  140. data/db/migrate/20101216151419_add_language_id_to_pages.rb +0 -27
  141. data/db/migrate/20101216155216_add_index_to_languages.rb +0 -9
  142. data/db/migrate/20101216173323_add_default_to_languages.rb +0 -9
  143. data/db/migrate/20101218130049_add_urlname_index_to_pages.rb +0 -9
  144. data/db/migrate/20110115123343_remove_css_class_default_from_essence_pictures.rb +0 -11
  145. data/db/migrate/20110224105120_change_pages_visible_default.rb +0 -11
  146. data/db/migrate/20110228182659_remove_default_page_layout_from_pages.rb +0 -11
  147. data/db/migrate/20110414163140_remove_display_name_from_elements.rb +0 -11
  148. data/db/migrate/20110511100516_rename_essence_texts_title_to_link_title.rb +0 -9
  149. data/db/migrate/20110529130429_create_cells.rb +0 -14
  150. data/db/migrate/20110529130500_add_cell_id_to_elements.rb +0 -11
  151. data/db/migrate/20110530102804_change_pages_page_layout_column.rb +0 -11
  152. data/db/migrate/20110707190728_add_render_size_to_essence_pictures.rb +0 -9
  153. data/db/migrate/20110711142057_change_open_link_in_new_window_to_link_target.rb +0 -19
  154. data/db/migrate/20110919110451_add_default_role_to_users.rb +0 -9
  155. data/db/migrate/20111116125112_namespace_alchemy_models.rb +0 -23
  156. data/db/migrate/20120216135355_add_country_code_to_languages.rb +0 -9
  157. data/db/migrate/20120608085509_create_alchemy_essence_selects.rb +0 -11
  158. data/db/migrate/20120611221734_create_alchemy_essence_booleans.rb +0 -11
  159. data/db/migrate/20120704181529_add_upload_hash_to_alchemy_picture.rb +0 -5
  160. data/db/migrate/20120705214247_acts_as_taggable_on_migration.rb +0 -28
  161. data/db/migrate/20120728185830_add_cached_tag_list_to_alchemy_pictures.rb +0 -5
  162. data/db/migrate/20120831135441_set_alchemy_languages_country_code_default_to_empty_string.rb +0 -9
  163. data/spec/helpers/pictures_helper_spec.rb +0 -14
  164. data/vendor/assets/javascripts/jquery_plugins/jquery.selectBoxIt.js +0 -1909
@@ -1,5 +1,5 @@
1
1
  <%= form_for([:admin, @page], :remote => true) do |f| %>
2
- <div id="errors" style="display:none"></div>
2
+ <div id="errors"></div>
3
3
  <table id="page_names">
4
4
  <tr>
5
5
  <td class="label"><%= t("page_type") %>: </td>
@@ -159,8 +159,7 @@
159
159
  Alchemy.Tinymce.customInits[i].call();
160
160
  }
161
161
  }
162
- jQuery('#cells').tabs();
163
- jQuery('#cells').tabs('paging', { follow: true, followOnSelect: true } );
162
+ jQuery('#cells').tabs().tabs('paging', { follow: true, followOnSelect: true } );
164
163
  });
165
164
  }
166
165
 
@@ -6,14 +6,14 @@
6
6
  <li><a href="#create_page_tab"><%= t('New page') %></a></li>
7
7
  <li><a href="#paste_page_tab"><%= t('Paste from clipboard') %></a></li>
8
8
  </ul>
9
- <div id="errors" style="display:none"></div>
9
+ <div id="errors"></div>
10
10
  <div id="create_page_tab">
11
11
  <%= render :partial => 'new_page_form' %>
12
12
  </div>
13
13
  <div id="paste_page_tab">
14
14
  <%= form_for([:admin, @page], :remote => true, :html => {:id => 'paste_page_form'}) do |f| %>
15
15
  <%= f.hidden_field(:parent_id) %>
16
- <table id="new_page_form">
16
+ <table id="paste_page_form">
17
17
  <tr>
18
18
  <td class="label">
19
19
  <label for="paste_from_clipboard"><%= t("Page") %></label>
@@ -1,4 +1,12 @@
1
1
  (function() {
2
+
3
+ Alchemy.growl("<%= @notice -%>");
4
+
5
+ <% if @old_page_layout != @page.page_layout %>
6
+ Alchemy.ElementsWindow.reload();
7
+ Alchemy.growl('<%= t(:page_layout_changed_notice) %>');
8
+ <% end %>
9
+
2
10
  <% if @while_page_edit %>
3
11
 
4
12
  Alchemy.reloadPreview();
@@ -25,6 +33,6 @@
25
33
 
26
34
  <% end %>
27
35
 
28
- Alchemy.closeCurrentWindow();
29
- Alchemy.growl("<%= @notice -%>");
36
+ Alchemy.closeCurrentWindow();
37
+
30
38
  })()
@@ -1,8 +1,8 @@
1
- <%- entries.each do |entry| -%>
2
- <%- entry.stringify_keys! -%>
3
- <%- permitted_to?(*navigate_module(entry)) do -%>
1
+ <% entries.each do |entry| %>
2
+ <% entry.stringify_keys! %>
3
+ <% permitted_to?(*navigate_module(entry)) do %>
4
4
  <div class="subnavi_tab<%= admin_sub_navigation_entry_active?(entry) ? ' active' : nil %>">
5
5
  <%= link_to t(entry["name"]), url_for_module_sub_navigation(entry) %>
6
- <%- end -%>
7
6
  </div>
8
- <%- end -%>
7
+ <% end %>
8
+ <% end %>
@@ -9,7 +9,8 @@
9
9
  [t("last_upload_only"), 'last_upload'],
10
10
  [t("recently_uploaded_only"), 'recent']
11
11
  ], params[:filter]),
12
- :data => { :remote => !!request.xhr? }
12
+ :data => { :remote => !!request.xhr? },
13
+ :class => 'alchemy_selectbox'
13
14
  ) %>
14
15
  </div>
15
16
 
@@ -48,14 +48,14 @@
48
48
  </div>
49
49
  <%= link_to(
50
50
  image_tag(
51
- alchemy.thumbnail_path(:id => picture, :size => @size),
51
+ alchemy.thumbnail_path(:id => picture, :size => @size, :sh => picture.security_token(:size => @size)),
52
52
  :alt => picture.name,
53
53
  :title => t('zoom_image'),
54
54
  :onload => "Alchemy.fadeImage(this, '#picture_#{picture.id} .image_spinner');",
55
55
  :style => "display: none;"
56
56
  ),
57
57
  '#',
58
- :onclick => "Alchemy.zoomImage('#{show_in_window_admin_picture_path(picture.id)}', '#{picture.name}', #{picture.image_width || 320}, #{picture.image_height || 240})",
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})",
59
59
  :class => 'thumbnail_background',
60
60
  :id => 'show_in_window'
61
61
  ) %>
@@ -13,7 +13,8 @@
13
13
  image_tag(
14
14
  alchemy.thumbnail_path(
15
15
  :id => picture_to_assign,
16
- :size => size
16
+ :size => size,
17
+ :sh => picture_to_assign.security_token(:size => size)
17
18
  ),
18
19
  :alt => picture_to_assign.name,
19
20
  :onload => "Alchemy.fadeImage(this, '#picture_to_assign_#{picture_to_assign.id} .image_spinner');",
@@ -2,6 +2,7 @@
2
2
  alchemy.zoom_picture_path(
3
3
  :id => @picture.id,
4
4
  :name => @picture.urlname,
5
- :format => :png
5
+ :format => :png,
6
+ :sh => @picture.security_token
6
7
  )
7
- ) %>
8
+ ) %>
@@ -1,5 +1,5 @@
1
1
  <%= form_for resource_instance_variable, :url => resource_path(resource_instance_variable), :remote => true do |f| %>
2
- <div id="errors" style="display: none"></div>
2
+ <div id="errors"></div>
3
3
  <table>
4
4
  <%- resource_handler.attributes.each do |attribute| -%>
5
5
  <tr>
@@ -31,14 +31,14 @@
31
31
  <td class="label mandatory"><%= f.label 'password_confirmation' %></td>
32
32
  <td class="input"><%= f.password_field 'password_confirmation', :class => 'thin_border', :autocomplete => "off", :required => action_name == 'signup' %></td>
33
33
  </tr>
34
- <%- unless action_name == 'signup' -%>
34
+ <% if action_name == 'signup' %>
35
+ <%= f.hidden_field :role %>
36
+ <% elsif permitted_to? :update_role %>
35
37
  <tr>
36
38
  <td class="label"><%= f.label 'role' %></td>
37
39
  <td class="select"><%= f.select :role, options_for_select(@user_roles, @user.role), {}, {:class => 'alchemy_selectbox'} %></td>
38
40
  </tr>
39
- <%- else -%>
40
- <%= f.hidden_field :role %>
41
- <%- end -%>
41
+ <% end %>
42
42
  <tr>
43
43
  <td>&nbsp;</td>
44
44
  <td class="checkbox">
@@ -1,6 +1,6 @@
1
1
  <div id="user_edit">
2
2
  <%= form_for [:admin, @user], :remote => true do |f| %>
3
- <div id="errors" style="display: none"></div>
3
+ <div id="errors"></div>
4
4
  <%= render :partial => 'table', :locals => {:f => f} %>
5
5
  <% end %>
6
6
  </div>
@@ -1,6 +1,6 @@
1
1
  <div id="user_edit">
2
2
  <%= form_for [:admin, @user], :remote => true do |f| %>
3
- <div id="errors" style="display: none"></div>
3
+ <div id="errors"></div>
4
4
  <%= render :partial => 'table', :locals => {:f => f} %>
5
5
  <% end %>
6
6
  </div>
@@ -1,2 +1,2 @@
1
1
  Alchemy.growl('<%= escape_javascript(@notice) %>', 'error');
2
- Alchemy.enableButton('button.button, a.button, input.button');
2
+ Alchemy.Buttons.enable();
@@ -1,3 +1,2 @@
1
- jQuery('#errors').html('<%= escape_javascript(@errors) %>');
2
- jQuery('#errors').show();
3
- Alchemy.enableButton('<%= @button || "form button.button" %>');
1
+ jQuery('<%= @error_div_id %>').html('<%= escape_javascript(@errors) %>').show();
2
+ Alchemy.Buttons.enable();
@@ -33,15 +33,18 @@
33
33
  <div class="picture_image">
34
34
  <div class="thumbnail_background<%= ' missing' if content.ingredient.nil? %>">
35
35
  <%- if content.ingredient -%>
36
+ <% image_options = {
37
+ :size => content.ingredient.cropped_thumbnail_size(content.essence.render_size.blank? ? options[:image_size] : content.essence.render_size),
38
+ :crop_from => content.essence.crop_from.blank? ? nil : content.essence.crop_from,
39
+ :crop_size => content.essence.crop_size.blank? ? nil : content.essence.crop_size,
40
+ :crop => content.essence.crop_size.blank? && content.essence.crop_from.blank? ? 'crop' : nil
41
+ } %>
36
42
  <%= image_tag(
37
- alchemy.thumbnail_path(
43
+ alchemy.thumbnail_path({
38
44
  :id => content.ingredient.id,
39
- :size => content.ingredient.cropped_thumbnail_size(content.essence.render_size.blank? ? options[:image_size] : content.essence.render_size),
40
- :crop_from => content.essence.crop_from.blank? ? nil : content.essence.crop_from,
41
- :crop_size => content.essence.crop_size.blank? ? nil : content.essence.crop_size,
42
- :crop => content.essence.crop_size.blank? && content.essence.crop_from.blank? ? 'crop' : nil,
43
- :name => content.ingredient.urlname
44
- ),
45
+ :name => content.ingredient.urlname,
46
+ :sh => content.ingredient.security_token(image_options)
47
+ }.merge(image_options)),
45
48
  :alt => content.ingredient.name,
46
49
  :class => 'img_paddingtop',
47
50
  :title => t("image_name") + ": #{content.ingredient.name}",
@@ -1,32 +1,34 @@
1
- <%- unless content.essence.picture.nil? -%>
2
- <%- img_tag = image_tag(
3
- alchemy.show_picture_url(
4
- :id => content.essence.picture.id,
5
- :name => content.essence.picture.urlname,
6
- :size => options[:image_size],
7
- :crop => options[:crop] ? 'crop' : nil,
8
- :crop_from => options[:crop] && !content.essence.crop_from.blank? ? content.essence.crop_from : nil,
9
- :crop_size => options[:crop] && !content.essence.crop_size.blank? ? content.essence.crop_size : nil,
10
- :upsample => options[:upsample],
11
- :padding => options[:padding],
12
- :format => (options[:format] or 'png'),
13
- :effects => options[:effects].blank? ? nil : options[:effects]
1
+ <% if content.essence.picture.present? %>
2
+
3
+ <% img_tag = image_tag(
4
+ show_alchemy_picture_url(content.essence.picture,
5
+ options.merge(
6
+ :size => options.delete(:image_size),
7
+ :crop_from => options[:crop] && !content.essence.crop_from.blank? ? content.essence.crop_from : nil,
8
+ :crop_size => options[:crop] && !content.essence.crop_size.blank? ? content.essence.crop_size : nil
9
+ ).delete_if { |k,v| v.blank? || k.to_sym == :show_caption || k.to_sym == :disable_link }
14
10
  ),
15
11
  {
16
12
  :alt => (content.essence.alt_tag.blank? ? nil : content.essence.alt_tag),
17
13
  :title => (content.essence.title.blank? ? nil : content.essence.title),
18
14
  :class => (content.essence.css_class.blank? ? nil : content.essence.css_class)
19
15
  }.merge(html_options)
20
- ) -%>
16
+ ) %>
17
+
18
+ <% caption = content_tag("div", content.essence.caption, :id => "#{dom_id(content.essence.picture)}_caption", :class => "image_caption") %>
21
19
 
22
- <%- caption = (content_tag("div", content.essence.caption, :id => "#{dom_id(content.essence.picture)}_caption", :class => "image_caption") unless (options[:show_caption] == false)) -%>
20
+ <% if content.essence.link.blank? || options[:disable_link] %>
23
21
 
24
- <%- if content.essence.link.blank? || options[:disable_link] -%>
25
22
  <%= img_tag %>
26
- <%- unless content.essence.caption.blank? -%>
23
+
24
+ <% if options[:show_caption] && content.essence.caption.present? %>
25
+
27
26
  <%= caption %>
28
- <%- end -%>
29
- <%- else -%>
27
+
28
+ <% end %>
29
+
30
+ <% else %>
31
+
30
32
  <%= link_to(
31
33
  content.essence.caption.blank? || options[:show_caption] == false ? img_tag : img_tag + caption,
32
34
  url_for(content.essence.link),
@@ -34,6 +36,7 @@
34
36
  :target => (content.essence.link_target == "blank" ? "_blank" : nil),
35
37
  'data-link-target' => content.essence.link_target
36
38
  ) %>
37
- <%- end -%>
38
39
 
39
- <%- end -%>
40
+ <% end %>
41
+
42
+ <% end %>
@@ -8,10 +8,18 @@
8
8
  <%= stylesheet_link_tag('alchemy/print', :media => 'print') %>
9
9
  <%= yield :stylesheets %>
10
10
  <script type="text/javascript" charset="utf-8">
11
+
12
+ // Setting TinyMCE path.
11
13
  var tinyMCEPreInit = {
12
14
  base: '<%= Rails.application.config.assets.prefix %>/tiny_mce',
13
15
  suffix: ''
14
16
  };
17
+
18
+ // Initialize Alchemys JavaScript framework.
19
+ var Alchemy = {};
20
+ Alchemy.locale = '<%= ::I18n.locale %>';
21
+ Alchemy.current_url = '<%= url_for.html_safe %>';
22
+
15
23
  </script>
16
24
  <%= javascript_include_tag('alchemy/alchemy') %>
17
25
  <%= yield :javascript_includes %>
@@ -60,7 +68,7 @@
60
68
  <%= yield(:toolbar) %>
61
69
  </div>
62
70
  <div id="user_info">
63
- <%= select_tag 'change_locale', options_for_select(::I18n.available_locales.map { |l| [l.to_s.upcase, l] }, ::I18n.locale), :class => 'alchemy_select tiny' %>
71
+ <%= select_tag 'change_locale', options_for_select(::I18n.available_locales.map { |l| [l.to_s.upcase, l] }, ::I18n.locale), :class => 'alchemy_selectbox tiny' %>
64
72
  <%= t('Logged in as') %> <%= current_user.name %>
65
73
  </div>
66
74
  </div>
@@ -70,35 +78,5 @@
70
78
  <%= yield %>
71
79
  </div>
72
80
  <%= yield(:javascripts) %>
73
- <script type="text/javascript" charset="utf-8">
74
- jQuery(function($) {
75
- // Preloading all background images from CSS files.
76
- $.preloadCssImages();
77
- $('html').removeClass('no-js');
78
- Alchemy.locale = '<%= ::I18n.locale %>';
79
- Alchemy.resizeFrame();
80
- Alchemy.Tooltips();
81
- Alchemy.SelectBox();
82
- Alchemy.Datepicker();
83
- if ($('#flash_notices').length > 0) {
84
- Alchemy.Growler.fade();
85
- }
86
- $('a.please_wait, form button.button, form .icon_button, #main_navi a.main_navi_entry, #sub_navigation .subnavi_tab a, .pagination a').not('*[data-alchemy-confirm], #subnav_additions .subnavi_tab button').click(function() {
87
- Alchemy.pleaseWaitOverlay();
88
- });
89
- // Hack for enabling tab focus for a's styled as button
90
- $('a.button').attr({tabindex: 0});
91
-
92
- // Locale select handler
93
- $('select#change_locale').on('change', function(e) {
94
- var url = '<%= url_for.html_safe %>';
95
- delimiter = url.match(/\?/) ? '&' : '?';
96
- window.location = url + delimiter + 'locale=' + $(this).val();
97
- });
98
- });
99
- jQuery(window).resize(function() {
100
- Alchemy.resizeFrame();
101
- });
102
- </script>
103
81
  </body>
104
82
  </html>
@@ -32,37 +32,33 @@ class AlchemyInstaller < Thor
32
32
  @application = project.downcase.strip.gsub(/ /, '_')
33
33
  say "Install Alchemy CMS into ./#{@application}", :yellow
34
34
  say "Generating new Rails App...", :yellow
35
-
35
+
36
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
-
37
+
38
38
  create_database_yml if options[:database] == 'mysql'
39
-
40
- mountpoint = ask "\nWhere do you want to mount Alchemy CMS? (/)"
41
- mountpoint = "/" if mountpoint.empty?
42
- sentinel = /\.routes\.draw do(?:\s*\|map\|)?\s*$/
43
- inject_into_file "#{@application}/config/routes.rb", "\n mount Alchemy::Engine => '#{mountpoint}'\n", { :after => sentinel, :verbose => true }
44
-
39
+
40
+ system "rake alchemy:mount"
41
+
45
42
  with_standard_set = yes?("\nDo you want to copy the files of Alchemy´s Standardset into your App? (y/N)")
46
-
43
+
47
44
  if with_standard_set
48
45
  sentinel = /::Application\.configure do\s*$/
49
46
  inject_into_file "#{@application}/config/environments/production.rb", "\n config.assets.precompile += %w( alchemy/standard_set.css )\n", { :after => sentinel, :verbose => true }
50
47
  end
51
-
48
+
52
49
  results << system("cd ./#{@application} && rake db:create alchemy:install:migrations db:migrate alchemy:db:seed")
53
50
  results << system("cd ./#{@application} && rails g alchemy:scaffold#{' --with-standard-set' if with_standard_set}")
54
51
 
55
52
  %x[
56
53
  cd ./#{@application}
57
54
  rm ./public/index.html
58
- rm ./app/views/layouts/application.html.erb
59
55
  rm ./app/assets/images/rails.png
60
56
  ]
61
57
 
62
58
  if !options[:scm].nil? && !options[:scm].empty?
63
-
59
+
64
60
  clean_mountpoint = mountpoint.gsub('/', '')
65
-
61
+
66
62
  %x[
67
63
  cd ./#{@application}
68
64
  rm -rf ./tmp/*
@@ -70,30 +66,30 @@ class AlchemyInstaller < Thor
70
66
  mkdir -p ./index
71
67
  mkdir -p ./uploads
72
68
  ]
73
-
69
+
74
70
  if yes?("\nDo you want to generate a deploy script for Capistrano? (y/N)")
75
71
  system "cd #{@application} && rails g alchemy:deploy_script --scm=#{options[:scm]} --db=#{options[:database]}"
76
72
  say "\nCapifying...", :yellow
77
73
  system "cd #{@application} && capify ."
78
74
  end
79
-
75
+
80
76
  case options[:scm]
81
77
  when 'svn'
82
78
  server = ask("\nURL of your svn server:")
83
79
  repository = ask("\nName of the repository (#{@application}):")
84
80
  repository = @application if repository.empty?
85
-
81
+
86
82
  say "\nImporting #{@application} into #{server}/#{repository} ...", :yellow
87
83
  output = %x[svn import ./#{@application} #{server}/#{repository} -m 'initial import by Alchemy installer']; imported = $?.success?
88
-
84
+
89
85
  if imported
90
-
86
+
91
87
  say "Removing and checking out again...", :yellow
92
88
  %x[
93
89
  rm -rf ./#{@application}
94
90
  svn co #{server}/#{repository} #{@application}
95
91
  ]
96
-
92
+
97
93
  say "Committing ignores...", :yellow
98
94
  %x[
99
95
  cd ./#{@application}
@@ -103,11 +99,11 @@ class AlchemyInstaller < Thor
103
99
  svn propset svn:ignore 'database.yml' ./config
104
100
  svn commit -m 'set ignores'
105
101
  ]
106
-
102
+
107
103
  else
108
104
  say "Error while importing!", :red
109
105
  end
110
-
106
+
111
107
  when 'git'
112
108
  gitignore = <<-GIT
113
109
  log/*
@@ -119,7 +115,7 @@ public/#{clean_mountpoint.empty? ? 'pictures' : clean_mountpoint}
119
115
  public/assets
120
116
  config/database.yml
121
117
  GIT
122
-
118
+
123
119
  %x[
124
120
  cd #{@application}
125
121
  echo "#{gitignore}" > .gitignore
@@ -130,9 +126,9 @@ GIT
130
126
  git commit -am 'inital commit'
131
127
  ]
132
128
  end
133
-
129
+
134
130
  end
135
-
131
+
136
132
  readme = <<-EOF
137
133
 
138
134
  Successfully installed Alchemy CMS into ./#{@application}