alchemy_cms 2.1.beta6 → 2.1.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/.gitignore +3 -1
  2. data/Gemfile +10 -2
  3. data/Guardfile +16 -0
  4. data/README.md +3 -3
  5. data/Rakefile +0 -5
  6. data/alchemy_cms.gemspec +1 -9
  7. data/app/assets/javascripts/alchemy/alchemy.base.js +5 -4
  8. data/app/assets/javascripts/alchemy/{alchemy.dragndrop.js.erb → alchemy.dragndrop.js} +0 -0
  9. data/app/assets/javascripts/alchemy/alchemy.elements_window.js +96 -0
  10. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +48 -50
  11. data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +41 -0
  12. data/app/assets/javascripts/alchemy/alchemy.js +2 -0
  13. data/app/assets/javascripts/alchemy/alchemy.menubar.js +55 -0
  14. data/app/assets/javascripts/alchemy/alchemy.preview.js +94 -139
  15. data/app/assets/javascripts/alchemy/alchemy.preview_window.js +98 -0
  16. data/app/assets/javascripts/alchemy/alchemy.windows.js +1 -174
  17. data/app/assets/javascripts/alchemy/menubar.js +2 -0
  18. data/app/assets/javascripts/alchemy/preview.js +2 -1
  19. data/app/assets/stylesheets/alchemy/_defaults.scss +7 -8
  20. data/app/assets/stylesheets/alchemy/base.css.scss +29 -33
  21. data/app/assets/stylesheets/alchemy/elements.css.scss +4 -4
  22. data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +1 -1
  23. data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
  24. data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +19 -4
  25. data/app/assets/stylesheets/alchemy/menubar.css.scss +85 -0
  26. data/app/assets/stylesheets/alchemy/standard_set.css +3 -5
  27. data/app/assets/stylesheets/alchemy/tinymce_content.css.scss +1 -1
  28. data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +1 -1
  29. data/app/controllers/alchemy/admin/attachments_controller.rb +2 -18
  30. data/app/controllers/alchemy/admin/base_controller.rb +1 -1
  31. data/app/controllers/alchemy/admin/elements_controller.rb +2 -2
  32. data/app/controllers/alchemy/admin/essence_files_controller.rb +4 -2
  33. data/app/controllers/alchemy/admin/pictures_controller.rb +6 -20
  34. data/app/controllers/alchemy/admin/resources_controller.rb +7 -5
  35. data/app/controllers/alchemy/base_controller.rb +14 -4
  36. data/app/controllers/alchemy/messages_controller.rb +4 -4
  37. data/app/controllers/alchemy/pages_controller.rb +51 -32
  38. data/app/controllers/alchemy/pictures_controller.rb +0 -3
  39. data/app/controllers/alchemy/user_sessions_controller.rb +1 -1
  40. data/app/helpers/alchemy/admin/base_helper.rb +6 -4
  41. data/app/helpers/alchemy/base_helper.rb +26 -0
  42. data/app/helpers/alchemy/pages_helper.rb +42 -22
  43. data/app/models/alchemy/attachment.rb +10 -2
  44. data/app/models/alchemy/cell.rb +1 -0
  45. data/app/models/alchemy/content.rb +8 -6
  46. data/app/models/alchemy/element.rb +1 -1
  47. data/app/models/alchemy/essence_audio.rb +1 -8
  48. data/app/models/alchemy/essence_date.rb +2 -9
  49. data/app/models/alchemy/essence_file.rb +1 -8
  50. data/app/models/alchemy/essence_flash.rb +0 -7
  51. data/app/models/alchemy/essence_html.rb +1 -8
  52. data/app/models/alchemy/essence_picture.rb +0 -11
  53. data/app/models/alchemy/essence_richtext.rb +4 -12
  54. data/app/models/alchemy/essence_text.rb +1 -13
  55. data/app/models/alchemy/essence_video.rb +1 -8
  56. data/app/models/alchemy/page.rb +28 -22
  57. data/app/models/alchemy/picture.rb +19 -0
  58. data/app/sweepers/alchemy/pages_sweeper.rb +17 -6
  59. data/app/sweepers/alchemy/pictures_sweeper.rb +1 -3
  60. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +2 -2
  61. data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
  62. data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +2 -2
  63. data/app/views/alchemy/admin/attachments/_files_list.html.erb +13 -11
  64. data/app/views/alchemy/admin/attachments/create.js.erb +1 -1
  65. data/app/views/alchemy/admin/attachments/edit.html.erb +2 -2
  66. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -2
  67. data/app/views/alchemy/admin/elements/new.html.erb +1 -1
  68. data/app/views/alchemy/admin/essence_files/edit.html.erb +32 -32
  69. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +29 -29
  70. data/app/views/alchemy/admin/essence_pictures/update.js.erb +13 -12
  71. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +4 -1
  72. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
  73. data/app/views/alchemy/admin/pages/edit.html.erb +8 -8
  74. data/app/views/alchemy/admin/pages/index.html.erb +1 -1
  75. data/app/views/alchemy/admin/pages/new.html.erb +1 -1
  76. data/app/views/alchemy/admin/pages/update.js.erb +19 -12
  77. data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -1
  78. data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +8 -6
  79. data/app/views/alchemy/admin/pictures/show_in_window.html.erb +6 -1
  80. data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
  81. data/app/views/alchemy/admin/users/_table.html.erb +13 -13
  82. data/app/views/alchemy/admin/users/_user.html.erb +1 -1
  83. data/app/views/alchemy/admin/users/index.html.erb +2 -2
  84. data/app/views/alchemy/elements/_contactform_view.html.erb +78 -78
  85. data/app/views/alchemy/elements/_download_editor.html.erb +1 -0
  86. data/app/views/alchemy/elements/_download_view.html.erb +3 -0
  87. data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
  88. data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
  89. data/app/views/alchemy/essences/_essence_file_view.html.erb +6 -2
  90. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -2
  91. data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -1
  92. data/app/views/alchemy/navigation/_link.html.erb +1 -2
  93. data/app/views/alchemy/notifications/admin_user_created.text.erb +7 -7
  94. data/app/views/alchemy/notifications/registered_user_created.text.erb +5 -5
  95. data/app/views/alchemy/user_sessions/login.html.erb +34 -35
  96. data/app/views/layouts/alchemy/login.html.erb +3 -8
  97. data/app/views/layouts/alchemy/pages.html.erb +1 -0
  98. data/bin/alchemy +43 -75
  99. data/config/alchemy/config.yml +10 -0
  100. data/config/alchemy/elements.yml +5 -0
  101. data/config/alchemy/page_layouts.yml +1 -1
  102. data/config/locales/alchemy.de.yml +21 -8
  103. data/config/locales/alchemy.en.yml +20 -4
  104. data/config/routes.rb +25 -20
  105. data/db/migrate/{20111116125112_namespace_models.rb → 20111116125112_namespace_alchemy_models.rb} +1 -1
  106. data/lib/alchemy/capistrano.rb +4 -17
  107. data/lib/alchemy/engine.rb +2 -0
  108. data/lib/alchemy/essence.rb +29 -41
  109. data/lib/alchemy/i18n.rb +1 -1
  110. data/lib/alchemy/mount_point.rb +10 -0
  111. data/lib/alchemy/page_layout.rb +7 -7
  112. data/lib/alchemy/seeder.rb +85 -47
  113. data/lib/alchemy/upgrader.rb +115 -0
  114. data/lib/alchemy/version.rb +1 -1
  115. data/lib/alchemy_cms.rb +4 -3
  116. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +6 -2
  117. data/lib/tasks/ferret.rake +12 -0
  118. data/lib/tasks/install.rake +16 -105
  119. data/lib/tasks/routes.rake +29 -0
  120. data/lib/tasks/upgrade.rake +5 -67
  121. data/spec/controllers/admin/pages_controller_spec.rb +1 -1
  122. data/spec/controllers/pages_controller_spec.rb +31 -0
  123. data/spec/factories.rb +24 -15
  124. data/spec/helpers/admin/base_helper_spec.rb +0 -7
  125. data/spec/helpers/pages_helper_spec.rb +54 -29
  126. data/spec/helpers/url_helpers_spec.rb +40 -0
  127. data/spec/integration/admin/pages_controller_spec.rb +3 -3
  128. data/spec/integration/pages_controller_spec.rb +80 -6
  129. data/spec/integration/security_spec.rb +2 -2
  130. data/spec/models/content_spec.rb +24 -0
  131. data/spec/models/page_spec.rb +174 -47
  132. data/spec/models/picture_spec.rb +54 -0
  133. data/spec/page_layout_spec.rb +2 -2
  134. data/spec/routing_spec.rb +205 -1
  135. data/spec/spec_helper.rb +53 -32
  136. metadata +51 -46
  137. data/lib/alchemy/file_utilz.rb +0 -73
@@ -25,7 +25,7 @@
25
25
  alchemy.edit_admin_user_path(user),
26
26
  {
27
27
  :title => t('edit_user'),
28
- :size => '384x400',
28
+ :size => '384x450',
29
29
  :overflow => true
30
30
  },
31
31
  {
@@ -7,7 +7,7 @@
7
7
  :title => t('create_user'),
8
8
  :overlay_options => {
9
9
  :title => t('create_user'),
10
- :size => "384x400"
10
+ :size => "384x450"
11
11
  },
12
12
  :if_permitted_to => [:new, :alchemy_admin_users]
13
13
  }
@@ -35,7 +35,7 @@
35
35
 
36
36
  <div class="info">
37
37
  <%= render_icon('info') %>
38
- <%= t('No users found.') %>
38
+ <%= t('No users found') %>
39
39
  </div>
40
40
 
41
41
  <%- end -%>
@@ -1,79 +1,79 @@
1
- <%= form_for(@message ||= Message.new, :html => {:id => "contact", "data-alchemy-element" => (@preview_mode ? element.id : nil)}) do |f| %>
2
- <%= f.error_messages %>
3
- <%= f.hidden_field "contact_form_id", :value => element.id %>
4
- <%= hidden_field_tag "mail_to", params[:mail_to] %>
5
- <table class="contactform">
6
- <tr>
7
- <td class="label">
8
- <%= f.label :salutation, t('alchemy.contactform.labels.salutation') %>
9
- </td>
10
- <td class="field">
11
- <%= f.select(
12
- :salutation,
13
- [
14
- [t('alchemy.contactform.labels.mr')],
15
- [t('alchemy.contactform.labels.mrs')]
16
- ],
17
- :prompt => t('alchemy.contactform.labels.choose'),
18
- :class => "select"
19
- ) %>
20
- </td>
21
- </tr>
22
- <tr>
23
- <td class="label">
24
- <%= f.label :firstname, t('alchemy.contactform.labels.firstname') %>
25
- </td>
26
- <td class="field">
27
- <%= f.text_field(:firstname, :class => "field") %>
28
- </td>
29
- </tr>
30
- <tr>
31
- <td class="label">
32
- <%= f.label :lastname, (t('alchemy.contactform.labels.lastname') + '<small>*</small>').html_safe %>
33
- </td>
34
- <td class="field">
35
- <%= f.text_field(:lastname, :class => "field") %>
36
- </td>
37
- </tr>
38
- <tr>
39
- <td class="label">
40
- <%= f.label :address, t('alchemy.contactform.labels.address') %>
41
- </td>
42
- <td class="field">
43
- <%= f.text_field :address, :class => 'field' %>
44
- </td>
45
- </tr>
46
- <tr>
47
- <td class="label">
48
- <%= f.label :zip, t('alchemy.contactform.labels.zip') %>
49
- </td>
50
- <td class="field">
51
- <%= f.text_field :zip, :class => 'field short' %>
52
- <%= f.text_field :city, :class => 'field medium' %>
53
- </td>
54
- </tr>
55
- <tr>
56
- <td class="label">
57
- <%= f.label :phone, t('alchemy.contactform.labels.phone') %>
58
- </td>
59
- <td class="field">
60
- <%= f.text_field :phone, :class => 'field' %>
61
- </td>
62
- </tr>
63
- <tr>
64
- <td class="label">
65
- <%= f.label :email, (t('alchemy.contactform.labels.email') + '<small>*</small>').html_safe %>
66
- </td>
67
- <td class="field">
68
- <%= f.text_field :email, :class => 'field' %>
69
- </td>
70
- </tr>
71
- </table>
72
- <div id="message">
73
- <%= f.text_area :message %>
74
- </div>
75
- <p class="foot_notice">*) <%= t('alchemy.contactform.labels.mandatory_fields') %></p>
76
- <p class="right">
77
- <%= f.button t('alchemy.contactform.labels.send'), :name => nil, :class => 'button' %>
78
- </p>
1
+ <%= form_for(@message ||= Alchemy::Message.new, :html => {:id => "contact", "data-alchemy-element" => (@preview_mode ? element.id : nil)}) do |f| %>
2
+ <%= f.error_messages %>
3
+ <%= f.hidden_field "contact_form_id", :value => element.id %>
4
+ <%= hidden_field_tag "mail_to", params[:mail_to] %>
5
+ <table class="contactform">
6
+ <tr>
7
+ <td class="label">
8
+ <%= f.label :salutation, t('contactform.labels.salutation') %>
9
+ </td>
10
+ <td class="field">
11
+ <%= f.select(
12
+ :salutation,
13
+ [
14
+ [t('contactform.labels.mr')],
15
+ [t('contactform.labels.mrs')]
16
+ ],
17
+ :prompt => t('contactform.labels.choose'),
18
+ :class => "select"
19
+ ) %>
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+ <td class="label">
24
+ <%= f.label :firstname, t('contactform.labels.firstname') %>
25
+ </td>
26
+ <td class="field">
27
+ <%= f.text_field(:firstname, :class => "field") %>
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <td class="label">
32
+ <%= f.label :lastname, (t('contactform.labels.lastname') + '<small>*</small>').html_safe %>
33
+ </td>
34
+ <td class="field">
35
+ <%= f.text_field(:lastname, :class => "field") %>
36
+ </td>
37
+ </tr>
38
+ <tr>
39
+ <td class="label">
40
+ <%= f.label :address, t('contactform.labels.address') %>
41
+ </td>
42
+ <td class="field">
43
+ <%= f.text_field :address, :class => 'field' %>
44
+ </td>
45
+ </tr>
46
+ <tr>
47
+ <td class="label">
48
+ <%= f.label :zip, t('contactform.labels.zip') %>
49
+ </td>
50
+ <td class="field">
51
+ <%= f.text_field :zip, :class => 'field short' %>
52
+ <%= f.text_field :city, :class => 'field medium' %>
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <td class="label">
57
+ <%= f.label :phone, t('contactform.labels.phone') %>
58
+ </td>
59
+ <td class="field">
60
+ <%= f.text_field :phone, :class => 'field' %>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td class="label">
65
+ <%= f.label :email, (t('contactform.labels.email') + '<small>*</small>').html_safe %>
66
+ </td>
67
+ <td class="field">
68
+ <%= f.text_field :email, :class => 'field' %>
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ <div id="message">
73
+ <%= f.text_area :message %>
74
+ </div>
75
+ <p class="foot_notice">*) <%= t('contactform.labels.mandatory_fields') %></p>
76
+ <p class="right">
77
+ <%= f.button t('contactform.labels.send'), :name => nil, :class => 'button' %>
78
+ </p>
79
79
  <% end %>
@@ -0,0 +1 @@
1
+ <%= render_essence_editor_by_name(element, 'file') %>
@@ -0,0 +1,3 @@
1
+ <div class="download" <%= element_preview_code(element) -%>>
2
+ <%= render_essence_view_by_name(element, 'file') %>
3
+ </div>
@@ -1,7 +1,7 @@
1
1
  <div class="content_editor" id="<%= content_dom_id(content) %>">
2
2
  <label><%= render_content_name(content) %></label>
3
3
  <%= datetime_select(
4
- content.form_field_name,
4
+ "contents[content_#{content.id}]",
5
5
  :date,
6
6
  :default => content.ingredient || Date.today,
7
7
  :start_year => options[:start_year],
@@ -28,6 +28,7 @@
28
28
  <%= content.ingredient.name rescue ("&#x2190;" + t('assign_file_from_archive')).html_safe %>
29
29
  </div>
30
30
  <%- unless content.ingredient.nil? -%>
31
+ <%= hidden_field_tag content.form_field_name(:attachment_id), content.ingredient.id %>
31
32
  <div class="essence_file_tools">
32
33
  <%= link_to_overlay_window("",
33
34
  alchemy.admin_attachments_path(
@@ -1,6 +1,10 @@
1
1
  <%= link_to(
2
2
  h(content.essence.attachment.name),
3
- alchemy.download_attachment_path(:id => content.essence.attachment.id, :name => content.essence.attachment.filename),
3
+ alchemy.download_attachment_path(
4
+ :id => content.essence.attachment.id,
5
+ :name => content.essence.attachment.urlname,
6
+ :format => content.essence.attachment.suffix
7
+ ),
4
8
  :class => "file_link #{content.essence.css_class.blank? ? "" : content.essence.css_class}",
5
9
  :title => "#{content.essence.title.blank? ? content.essence.attachment.filename : content.essence.title}"
6
- ) if content.essence.attachment %>
10
+ ) if content.essence.attachment %>
@@ -30,11 +30,12 @@
30
30
  <div class="thumbnail_background">
31
31
  <%= image_tag(
32
32
  alchemy.thumbnail_path(
33
- :id => content.ingredient,
33
+ :id => content.ingredient.id,
34
34
  :size => content.ingredient.cropped_thumbnail_size(content.essence.render_size.blank? ? options[:image_size] : content.essence.render_size),
35
35
  :crop_from => content.essence.crop_from.blank? ? nil : content.essence.crop_from,
36
36
  :crop_size => content.essence.crop_size.blank? ? nil : content.essence.crop_size,
37
- :crop => content.essence.crop_size.blank? && content.essence.crop_from.blank? ? 'crop' : nil
37
+ :crop => content.essence.crop_size.blank? && content.essence.crop_from.blank? ? 'crop' : nil,
38
+ :name => content.ingredient.urlname
38
39
  ),
39
40
  :alt => content.ingredient.name,
40
41
  :class => 'img_paddingtop',
@@ -10,7 +10,7 @@
10
10
  :crop_size => options[:crop] && !content.essence.crop_size.blank? ? content.essence.crop_size : nil,
11
11
  :upsample => options[:upsample],
12
12
  :padding => options[:padding],
13
- :format => (options[:format].blank? ? configuration(:image_output_format) : options[:format]),
13
+ :format => options[:format],
14
14
  :effects => options[:effects].blank? ? nil : options[:effects]
15
15
  ),
16
16
  {
@@ -6,10 +6,9 @@
6
6
  :target => '_blank'
7
7
  ) -%>
8
8
  <%- else -%>
9
- <%- link_path = @preview_mode ? 'javascript:void(0)' : alchemy.show_page_path(:urlname => page.urlname, :lang => multi_language? ? page.language.code : nil) -%>
10
9
  <%= link_to(
11
10
  h(page.name),
12
- link_path,
11
+ @preview_mode ? 'javascript:void(0)' : show_alchemy_page_path(page),
13
12
  {
14
13
  :class => (page_active?(page) ? 'active' : nil),
15
14
  :title => (options[:show_title] ? page.title : nil),
@@ -1,13 +1,13 @@
1
- <%= t('Welcome to Alchemy') %>
1
+ <%= Alchemy::I18n.t('Welcome to Alchemy') %>
2
2
 
3
- <%= t('To manage your website open a browser and go to') %>:
3
+ <%= Alchemy::I18n.t('To manage your website open a browser and go to') %>:
4
4
 
5
5
  <%= @url %>
6
6
 
7
- <%= t('Your credentials are') %>:
8
- ----------------------
9
- <%= t('Username') %>: <%= @user.login %>
10
- <%= t('Password') %>: <%= @user.password %>
7
+ <%= Alchemy::I18n.t('Your credentials are') %>:
11
8
 
9
+ <%= Alchemy::I18n.t('Username') %>: <%= @user.login %>
10
+ <%= Alchemy::I18n.t('Password') %>: <%= @user.password %>
12
11
 
13
- <%= t('Have much fun with Alchemy!') %>
12
+
13
+ <%= Alchemy::I18n.t('Have much fun with Alchemy!') %>
@@ -1,10 +1,10 @@
1
- <%= Alchemy::I18n.t('alchemy.mailer.new_user_mail.welcome') %>!
1
+ <%= Alchemy::I18n.t('mailer.new_user_mail.welcome') %>!
2
2
 
3
- <%= Alchemy::I18n.t('alchemy.mailer.new_user_mail.login_url_explanation') %>:
3
+ <%= Alchemy::I18n.t('mailer.new_user_mail.login_url_explanation') %>:
4
4
 
5
5
  <%= @url %>
6
6
 
7
- <%= Alchemy::I18n.t('alchemy.mailer.new_user_mail.username') %>: <%= @user.login %>
8
- <%= Alchemy::I18n.t('alchemy.mailer.new_user_mail.password') %>: <%= @user.password %>
7
+ <%= Alchemy::I18n.t('mailer.new_user_mail.username') %>: <%= @user.login %>
8
+ <%= Alchemy::I18n.t('mailer.new_user_mail.password') %>: <%= @user.password %>
9
9
 
10
- <%= Alchemy::I18n.t('alchemy.mailer.new_user_mail.greeting') %>
10
+ <%= Alchemy::I18n.t('mailer.new_user_mail.greeting') %>
@@ -1,38 +1,37 @@
1
- <div id="alchemy_greeting">
2
- <%= image_tag("alchemy/alchemy-logo.png") %>
3
- <h1>
4
- <%= flash[:info] %>
5
- </h1>
6
- </div>
7
-
8
- <div class="login_signup_box">
9
- <%= form_for @user_session, :url => {:action => 'login'}, :html => { :id => "login" } do |f| %>
10
- <%= f.error_messages %>
11
- <table>
12
- <tr>
13
- <td class="label">
14
- <%= f.label :login %>
15
- </td>
16
- <td class="input">
17
- <%= f.text_field :login, :class => 'thin_border' %>
18
- </td>
19
- </tr>
20
- <tr>
21
- <td class="label">
22
- <%= f.label :password %>
23
- </td>
24
- <td class="input">
25
- <%= f.password_field :password, :class => 'thin_border' %>
26
- </td>
27
- </tr>
28
- <tr>
29
- <td colspan="2" class="submit">
30
- <%= hidden_field_tag 'user_screensize' %>
31
- <%= f.button t('login'), :class => 'button', :name => nil %>
32
- </td>
33
- </tr>
34
- </table>
35
- <% end %>
1
+ <div id="login_box">
2
+ <div id="alchemy_greeting">
3
+ <%= image_tag("alchemy/alchemy-logo.png") %>
4
+ <h1><%= flash[:info] %></h1>
5
+ </div>
6
+ <div class="login_signup_box">
7
+ <%= form_for @user_session, :url => {:action => 'login'}, :html => { :id => "login" } do |f| %>
8
+ <%= f.error_messages %>
9
+ <table>
10
+ <tr>
11
+ <td class="label">
12
+ <%= f.label :login %>
13
+ </td>
14
+ <td class="input">
15
+ <%= f.text_field :login, :class => 'thin_border' %>
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <td class="label">
20
+ <%= f.label :password %>
21
+ </td>
22
+ <td class="input">
23
+ <%= f.password_field :password, :class => 'thin_border' %>
24
+ </td>
25
+ </tr>
26
+ <tr>
27
+ <td colspan="2" class="submit">
28
+ <%= hidden_field_tag 'user_screensize' %>
29
+ <%= f.button t('login'), :class => 'button', :name => nil %>
30
+ </td>
31
+ </tr>
32
+ </table>
33
+ <% end %>
34
+ </div>
36
35
  </div>
37
36
 
38
37
  <%- content_for :javascripts do -%>
@@ -8,12 +8,9 @@
8
8
  <%= stylesheet_link_tag('alchemy/print', :media => 'print') %>
9
9
  <%= javascript_include_tag('alchemy/alchemy') %>
10
10
  </head>
11
- <body id="alchemy">
11
+ <body id="alchemy" class="login">
12
12
  <div id="main_menu">
13
- <div id="main_navi">
14
- <%= yield(:navigation) %>
15
- <%= admin_main_navigation %>
16
- </div>
13
+ <div id="main_navi"></div>
17
14
  <div id="main_menu_background"></div>
18
15
  <div id="logout">
19
16
  <%= link_to(alchemy.root_path) do %>
@@ -28,9 +25,7 @@
28
25
  <%= yield(:javascripts) %>
29
26
  <script type="text/javascript" charset="utf-8">
30
27
  jQuery(document).ready(function($) {
31
- if (typeof($().sb) === 'function') {
32
- Alchemy.SelectBox('body#alchemy select');
33
- }
28
+ Alchemy.SelectBox('body#alchemy select');
34
29
  });
35
30
  </script>
36
31
  </body>
@@ -25,5 +25,6 @@
25
25
  </div>
26
26
  </div>
27
27
  <%= alchemy_preview_mode_code %>
28
+ <%= alchemy_menu_bar %>
28
29
  </body>
29
30
  </html>
@@ -1,12 +1,15 @@
1
+ # encoding: UTF-8
2
+
1
3
  #!/usr/bin/env ruby
2
4
  begin
3
5
  require "rubygems"
4
- require "thor"
5
- require 'alchemy/version'
6
- require 'rails'
7
- if Rails.version >= "3.1" || Rails.version < "3.0"
8
- raise LoadError, "Wrong rails version installed. Please run gem install rails -v'~>3.0.10'"
6
+ require 'rails/version'
7
+ RAILS_VERSION = Rails::VERSION::STRING
8
+ if RAILS_VERSION < "3.1"
9
+ raise LoadError, "Wrong rails version installed. Please run gem install rails -v'~>3.1'"
9
10
  end
11
+ require "thor"
12
+ require File.join(File.dirname(__FILE__), '..', 'lib/alchemy/version')
10
13
  end
11
14
 
12
15
  class AlchemyInstaller < Thor
@@ -16,39 +19,42 @@ class AlchemyInstaller < Thor
16
19
  map "-v" => :version
17
20
  map "--version" => :version
18
21
 
19
- desc "version", "Prints current Alchemy version", :hide => true
22
+ desc "version", "Prints current Alchemy CMS version", :hide => true
20
23
  def version
21
24
  puts Alchemy::VERSION
22
25
  end
23
26
 
24
- desc "new PROJECT", "Creates a new Alchemy project."
27
+ desc "new PROJECT", "Creates a new Alchemy CMS project."
25
28
  method_option :scm, :type => :string, :aliases => "-s", :desc => "Type of scm to use for this project. Leave blank for none."
26
29
  method_option :database, :type => :string, :default => 'mysql', :aliases => "-d", :desc => "Type of database to use for this project. Default mysql."
27
30
  def new(project)
28
- project = project.downcase.strip.gsub(/ /, '_')
29
- if yes?("Install Alchemy into ./#{project}? (y/N)")
31
+ @application = project.downcase.strip.gsub(/ /, '_')
32
+ if yes?("Install Alchemy CMS into ./#{@application}? (y/N)")
30
33
 
31
34
  say "Generating new Rails App...", :yellow
32
35
 
33
- if system("rails _#{Rails.version}_ new #{project} -m #{File.join(File.dirname(__FILE__), '..', 'lib', 'rails', 'templates', 'alchemy.rb')} -d #{options[:database]} -JT")
34
-
35
- @application = project
36
+ if system("rails _#{RAILS_VERSION}_ new #{@application} -m #{File.join(File.dirname(__FILE__), '..', 'lib', 'rails', 'templates', 'alchemy.rb')} -d #{options[:database]} -JT")
36
37
 
37
38
  create_database_yml if options[:database] == 'mysql'
38
39
 
39
- with_standard_set = yes?("\nDo you want to install Alchemys Standardset files into your App? (y/N)")
40
+ with_standard_set = yes?("\nDo you want to copy the files of Alchemy´s Standardset into your App? (y/N)")
40
41
 
41
42
  %x[
42
- cd ./#{project}
43
+ cd ./#{@application}
43
44
  rails g alchemy:scaffold#{' --with-standard-set' if with_standard_set}
44
45
  rm ./public/index.html
45
- rm ./public/images/rails.png
46
+ rm ./app/assets/images/rails.png
46
47
  ]
48
+
49
+ mountpoint = ask "\nWhere do you want to mount Alchemy CMS? (/)"
50
+ mountpoint = "/" if mountpoint.empty?
51
+ sentinel = /\.routes\.draw do(?:\s*\|map\|)?\s*$/
52
+ inject_into_file "#{@application}/config/routes.rb", "\n mount Alchemy::Engine => '#{mountpoint}'\n", { :after => sentinel, :verbose => true }
47
53
 
48
54
  if options[:scm]
49
55
 
50
56
  %x[
51
- cd ./#{project}
57
+ cd ./#{@application}
52
58
  rm -rf ./tmp/*
53
59
  rm -rf ./log/*
54
60
  mkdir -p ./index
@@ -59,26 +65,27 @@ class AlchemyInstaller < Thor
59
65
  when 'svn'
60
66
  server = ask("\nURL of your svn server? (http://svn.magiclabs.de/customers)")
61
67
  server = "http://svn.magiclabs.de/customers" if server.empty?
62
- repository = ask("\nName of the repository? (#{project})")
63
- repository = project if repository.empty?
68
+ repository = ask("\nName of the repository? (#{@application})")
69
+ repository = @application if repository.empty?
64
70
 
65
- say "\nImporting #{project} into #{server}/#{repository} ...", :yellow
66
- output = %x[svn import ./#{project} #{server}/#{repository} -m 'initial import by Alchemy installer']; imported = $?.success?
71
+ say "\nImporting #{@application} into #{server}/#{repository} ...", :yellow
72
+ output = %x[svn import ./#{@application} #{server}/#{repository} -m 'initial import by Alchemy installer']; imported = $?.success?
67
73
 
68
74
  if imported
69
75
 
70
76
  say "Removing and checking out again...", :yellow
71
77
  %x[
72
- rm -rf ./#{project}
78
+ rm -rf ./#{@application}
73
79
  svn co #{server}/#{repository}
74
80
  ]
75
81
 
76
82
  say "Committing ignores...", :yellow
77
83
  %x[
78
- cd ./#{project}
84
+ cd ./#{@application}
79
85
  svn propset svn:ignore '*' tmp/ log/ index/ uploads/
80
86
  svn propset svn:ignore 'alchemy' ./public/images ./public/stylesheets ./public/javascripts
81
87
  svn propset svn:ignore 'pictures' ./public
88
+ svn propset svn:ignore 'assets' ./public
82
89
  svn propset svn:ignore 'database.yml' ./config
83
90
  svn commit -m 'set ignores'
84
91
  ]
@@ -125,7 +132,7 @@ class AlchemyInstaller < Thor
125
132
  say "\nCapifying...", :yellow
126
133
 
127
134
  %x[
128
- cd #{project}
135
+ cd #{@application}
129
136
  capify .
130
137
  svn add ./config/deploy.rb ./Capfile
131
138
  svn commit -m 'capified'
@@ -146,11 +153,12 @@ class AlchemyInstaller < Thor
146
153
  index/*
147
154
  public/**/alchemy
148
155
  public/pictures
156
+ public/assets
149
157
  config/database.yml
150
158
  GIT
151
159
  %x[
152
- cd #{project}
153
- echo #{gitignore} > #{project}/.gitignore
160
+ cd #{@application}
161
+ echo #{gitignore} > #{@application}/.gitignore
154
162
  touch ./index/.gitkeep
155
163
  touch ./uploads/.gitkeep
156
164
  git init .
@@ -161,18 +169,18 @@ class AlchemyInstaller < Thor
161
169
  end
162
170
 
163
171
  %x[
164
- cd ./#{project}
165
- rake alchemy:prepare db:create db:migrate db:seed
172
+ cd ./#{@application}
173
+ rake db:create alchemy:install:migrations db:migrate alchemy:db:seed
166
174
  ]
167
175
 
168
176
  readme = <<-EOF
169
- \nSuccessfully installed Alchemy into ./#{project}
177
+ \nSuccessfully installed Alchemy CMS into ./#{@application}
170
178
 
171
179
  Next steps:
172
180
 
173
181
  1. Go into your projects folder:
174
182
 
175
- cd ./#{project}
183
+ cd ./#{@application}
176
184
 
177
185
  2. Start your local Rails server:
178
186
 
@@ -184,7 +192,8 @@ Next steps:
184
192
 
185
193
  4. Follow the instructions to complete the installation!
186
194
 
187
- Thank you for using Alchemy!
195
+ Thank you for using Alchemy CMS!
196
+ http://alchemy-cms.com
188
197
 
189
198
  EOF
190
199
  say readme, :green
@@ -258,13 +267,6 @@ set :password, "#{@ssh_password}"
258
267
  set :port, #{@ssh_port}
259
268
  set :use_sudo, false
260
269
 
261
- # database
262
- set :database_user, "#{@db_user}"
263
- set :database_password, "#{@db_password}"
264
- set :database_name, "#{@db_name}"
265
- set :database_host, "#{@db_host}"
266
- set :database_socket, "#{@db_socket}"
267
-
268
270
  # domain names
269
271
  role :app, "#{@server}"
270
272
  role :web, "#{@server}"
@@ -279,17 +281,13 @@ set :scm_password, "#{@scm_password}"
279
281
 
280
282
  set :repository, Proc.new{ "--username \#{scm_user} --password \#{scm_password} \#{repository_url}" }
281
283
 
282
- after "deploy:setup", "alchemy:shared_folders:create"
283
284
  after "deploy:setup", "alchemy:database_yml:create"
284
285
 
285
- after "deploy:symlink", "alchemy:shared_folders:symlink"
286
+ before "deploy:start", "deploy:seed"
287
+
286
288
  after "deploy:symlink", "alchemy:database_yml:symlink"
287
289
 
288
290
  before "deploy:restart", "deploy:migrate"
289
- before "deploy:restart", "alchemy:db:migrate"
290
-
291
- before "deploy:restart", "deploy:seed"
292
- before "deploy:restart", "alchemy:assets:copy"
293
291
 
294
292
  after "deploy", "deploy:cleanup"
295
293
 
@@ -305,39 +303,9 @@ namespace :logs do
305
303
  end
306
304
  end
307
305
 
308
- namespace :alchemy do
309
-
310
- namespace :database_yml do
311
-
312
- desc "Creates the database.yml file for server database"
313
- task :create, :roles => :app do
314
- db_config = ERB.new <<-EOF
315
- production:
316
- adapter: mysql2
317
- encoding: utf8
318
- database: \#{database_name}
319
- username: \#{database_user}
320
- password: \#{database_password}
321
- host: \#{database_host}
322
- socket: \#{database_socket}
323
- EOF
324
- run "mkdir -p \#{shared_path}/config"
325
- put db_config.result, "\#{shared_path}/config/database.yml"
326
- end
327
-
328
- desc ""
329
- task :symlink do
330
- run "ln -nfs \#{shared_path}/config/database.yml \#{current_path}/config/"
331
- end
332
-
333
- end
334
-
335
- end
336
-
337
306
  namespace :deploy do
338
307
  desc "Overwrite for the internal Capistrano deploy:start task."
339
308
  task :start, :roles => :app do
340
- run "echo 'Nothing to start'"
341
309
  end
342
310
 
343
311
  desc "Restart the server"
@@ -346,8 +314,8 @@ namespace :deploy do
346
314
  end
347
315
 
348
316
  desc 'Seeds the database'
349
- task :seed, :roles => :app, :except => { :no_release => true } do
350
- run "cd \#{current_path} && RAILS_ENV=production rake db:seed"
317
+ task :seed, :roles => :app, :except => { :no_release => true } do
318
+ run "cd \#{current_path} && RAILS_ENV=production rake db:seed"
351
319
  end
352
320
  end
353
321
  DEPLOY