alchemy_cms 2.1.rc6 → 2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/app/assets/images/alchemy/lupe.cur +0 -0
  2. data/app/assets/javascripts/alchemy/alchemy.buttons.js +1 -1
  3. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +1 -0
  4. data/app/assets/stylesheets/alchemy/alchemy.css +11 -0
  5. data/app/assets/stylesheets/alchemy/base.css.scss +447 -2446
  6. data/app/assets/stylesheets/alchemy/buttons.css.scss +354 -0
  7. data/app/assets/stylesheets/alchemy/dashboard.css.scss +76 -0
  8. data/app/assets/stylesheets/alchemy/flags.css.scss +1 -1
  9. data/app/assets/stylesheets/alchemy/flash.css.scss +54 -0
  10. data/app/assets/stylesheets/alchemy/frame.css.scss +287 -0
  11. data/app/assets/stylesheets/alchemy/icons.css.scss +300 -0
  12. data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +3 -2
  13. data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +1 -1
  14. data/app/assets/stylesheets/alchemy/login.css.scss +53 -0
  15. data/app/assets/stylesheets/alchemy/menubar.css.scss +26 -11
  16. data/app/assets/stylesheets/alchemy/modules.css.scss +31 -0
  17. data/app/assets/stylesheets/alchemy/pagination.css.scss +56 -0
  18. data/app/assets/stylesheets/alchemy/sitemap.css.scss +285 -0
  19. data/app/assets/stylesheets/alchemy/tables.css.scss +150 -0
  20. data/app/assets/stylesheets/alchemy/upload.css.scss +92 -0
  21. data/app/controllers/alchemy/admin/dashboard_controller.rb +1 -1
  22. data/app/controllers/alchemy/admin/pages_controller.rb +1 -1
  23. data/app/controllers/alchemy/admin/resources_controller.rb +35 -2
  24. data/app/controllers/alchemy/user_sessions_controller.rb +3 -0
  25. data/app/helpers/alchemy/admin/attachments_helper.rb +1 -1
  26. data/app/helpers/alchemy/admin/base_helper.rb +69 -20
  27. data/app/helpers/alchemy/pages_helper.rb +0 -55
  28. data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
  29. data/app/views/alchemy/admin/clipboard/index.html.erb +4 -1
  30. data/app/views/alchemy/admin/dashboard/index.html.erb +16 -11
  31. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +4 -1
  32. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -20
  33. data/app/views/alchemy/admin/layoutpages/index.html.erb +1 -1
  34. data/app/views/alchemy/admin/pages/index.html.erb +3 -3
  35. data/app/views/alchemy/admin/partials/_search_form.html.erb +7 -1
  36. data/app/views/alchemy/admin/resources/_form.html.erb +1 -1
  37. data/app/views/alchemy/admin/resources/_resource.html.erb +8 -5
  38. data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
  39. data/app/views/alchemy/admin/resources/index.html.erb +4 -3
  40. data/app/views/alchemy/admin/trash/index.html.erb +3 -2
  41. data/app/views/alchemy/user_sessions/login.html.erb +2 -1
  42. data/app/views/layouts/alchemy/admin.html.erb +3 -4
  43. data/app/views/layouts/alchemy/login.html.erb +9 -8
  44. data/config/authorization_rules.rb +0 -1
  45. data/config/locales/alchemy.de.yml +1 -0
  46. data/config/locales/alchemy.en.yml +1 -0
  47. data/lib/alchemy/seeder.rb +1 -1
  48. data/lib/alchemy/version.rb +1 -1
  49. data/spec/integration/admin/pages_controller_spec.rb +45 -57
  50. data/spec/integration/admin/resources_spec.rb +19 -0
  51. data/spec/models/content_spec.rb +6 -5
  52. data/spec/support/alchemy/controller_hacks.rb +41 -0
  53. data/spec/support/alchemy/specs_helpers.rb +32 -0
  54. data/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +137 -1
  55. metadata +55 -37
  56. data/app/views/alchemy/admin/languages/_language.html.erb +0 -36
  57. data/spec/support/controller_hacks.rb +0 -37
@@ -14,61 +14,6 @@ module Alchemy
14
14
  content.essence.caption
15
15
  end
16
16
 
17
- def alchemy_form_select(name, select_options, options={})
18
- select "mail_data", name, select_options, :selected => (session[:mail_data][name.to_sym] rescue "")
19
- end
20
-
21
- def alchemy_form_input_field(name, options = {})
22
- if options[:value].blank? && session[:mail_data].blank?
23
- value = nil
24
- elsif options[:value].blank? && !session[:mail_data].blank?
25
- value = session[:mail_data][name.to_sym]
26
- else
27
- value = options[:value]
28
- end
29
- text_field("mail_data", name, {:value => value}.merge(options))
30
- end
31
-
32
- def alchemy_form_text_area(name, options={})
33
- text_area "mail_data", name, :class => options[:class], :value => (session[:mail_data][name.to_sym] rescue "")
34
- end
35
-
36
- def alchemy_form_check_box(name, options={})
37
- box = hidden_field_tag "mail_data[#{name}]", 0, :id => nil
38
- box += check_box_tag("mail_data[#{name}]", 1, (session[:mail_data] && session[:mail_data][name.to_sym] == "1"))
39
- box
40
- end
41
-
42
- def alchemy_form_label(element, name, options={})
43
- label_tag "mail_data_#{name}", render_essence_view_by_name(element, name), options
44
- end
45
-
46
- def alchemy_form_reset_button(name, options={})
47
- button_to_function(
48
- name,
49
- remote_function(
50
- :url => {
51
- :controller => "contact_form",
52
- :action => "clear_session"
53
- },
54
- :before => %(
55
- this.form.reset();
56
- this.form.descendants().each(
57
- function(d){
58
- if ((d.type!='button') && (d.type!='submit') && (d.type!='hidden') && !d.disabled) {
59
- d.value = '';
60
- if (d.type == 'checkbox') {
61
- d.checked = false;
62
- }
63
- }
64
- }
65
- )
66
- )
67
- ),
68
- options
69
- )
70
- end
71
-
72
17
  # == Helper for rendering language switches
73
18
  #
74
19
  # Renders links to all public language root pages
@@ -17,7 +17,7 @@
17
17
  <td class="file_name"><%= attachment.filename %></td>
18
18
  <td class="file_type"><%= mime_to_human(attachment.content_type) %></td>
19
19
  <td class="file_size"><%= number_to_human_size(attachment.size) %></td>
20
- <td class="date"><%= l(attachment.created_at) %></td>
20
+ <td class="date"><%= l(attachment.created_at, :format => :short) %></td>
21
21
  <td class="tools long">
22
22
  <%- permitted_to?(:download, :attachments) do -%>
23
23
  <%= link_to(
@@ -1,6 +1,9 @@
1
1
  <div class="with_padding">
2
2
  <%- if @clipboard_items.blank? -%>
3
- <p><%= t('No items in your clipboard') %></p>
3
+ <div class="info">
4
+ <%= render_icon('info') %>
5
+ <%= t('No items in your clipboard') %>
6
+ </div>
4
7
  <%- else -%>
5
8
  <div id="clipboard_items">
6
9
  <ul>
@@ -1,11 +1,16 @@
1
1
  <div id="dashboard">
2
- <h1><%= t('Welcome back, %{name}', :name => current_user.firstname.blank? ? current_user.login : current_user.firstname) %></h1>
3
- <h2><%= t('Your last login was on %{time}', :time => l(current_user.last_login_at)) unless current_user.last_login_at.blank? %></h2>
4
-
2
+ <div class="with_padding">
3
+ <h1>
4
+ <%= t('Welcome back, %{name}', :name => current_user.firstname.blank? ? current_user.login : current_user.firstname) %>
5
+ </h1>
6
+ <p>
7
+ <small><%= t('Your last login was on %{time}', :time => l(current_user.last_login_at)) unless current_user.last_login_at.blank? %></small>
8
+ </p>
9
+ </div>
5
10
  <div class="widget">
6
11
  <h2><%= t('Your last updated pages') %>:</h2>
7
12
  <%- if @last_edited_pages.blank? -%>
8
- <p><%= t('no pages') %></p>
13
+ <ul><li class="even"><%= t('no pages') %></li></ul>
9
14
  <%- else -%>
10
15
  <ul>
11
16
  <%- @last_edited_pages.each do |page| -%>
@@ -18,17 +23,17 @@
18
23
  <div class="widget">
19
24
  <h2><%= t('Currently locked pages') %>:</h2>
20
25
  <%- if @locked_pages.blank? -%>
21
- <p><%= t('no pages') %></p>
26
+ <ul><li class="even"><%= t('no pages') %></li></ul>
22
27
  <%- else -%>
23
28
  <ul>
24
29
  <%- @locked_pages.each do |page| -%>
25
30
  <li class="<%= cycle('even', 'odd', :name => 'locked_pages') %>">
26
31
  <%- if current_user.id == page.locked_by -%>
27
32
  <%= link_to(page.name, alchemy.edit_admin_page_path(page)) %> <small>(<%= page.locker.name %>)</small>
28
- <%= form_tag(alchemy.unlock_admin_page_path(page, :redirect_to => request.path)) do %>
29
- <button class="icon_button small" title="<%= t('explain_unlocking') %>">
30
- <%= render_icon('close small') %>
31
- </button>
33
+ <%= form_tag(alchemy.unlock_admin_page_path(page, :redirect_to => alchemy.admin_dashboard_url)) do %>
34
+ <button class="icon_button small" title="<%= t('explain_unlocking') %>">
35
+ <%= render_icon('close small') %>
36
+ </button>
32
37
  <% end %>
33
38
  <%- else -%>
34
39
  <%= page.name %> <small>(<%= page.locker_name %>)</small>
@@ -42,7 +47,7 @@
42
47
  <div class="widget">
43
48
  <h2><%= t('Who else is online') %>:</h2>
44
49
  <%- if @online_users.blank? -%>
45
- <p><%= t('no users') %></p>
50
+ <ul><li class="even"><%= t('no users') %></li></ul>
46
51
  <%- else -%>
47
52
  <ul>
48
53
  <%- @online_users.each do |user| -%>
@@ -53,7 +58,7 @@
53
58
  </div>
54
59
  </div>
55
60
  <div id="sideboard">
56
- <%= image_tag("alchemy/alchemy-logo.png") %>
61
+ <%= image_tag("alchemy/alchemy-logo.png", :style => "width: 240px; height: 70px") %>
57
62
  <p><%= t("Version") %>: <%= @alchemy_version %></p>
58
63
  <div class="sideboard_body" style="display: none">
59
64
  <p><%= t('Alchemy is open software and itself uses open software and free resources:') %></p>
@@ -1,6 +1,9 @@
1
1
  <div class="new_alchemy_element">
2
2
  <%- if @elements.blank? -%>
3
- <p class="with_padding"><%= t('no_more_elements_to_add') %></p>
3
+ <div class="info with_margin">
4
+ <%= render_icon('info') %>
5
+ <%= t('no_more_elements_to_add') %>
6
+ </div>
4
7
  <%- else -%>
5
8
  <%= form_for [:admin, @element], :remote => true, :class => "add_element_content" do |form| %>
6
9
  <div id="errors" style="display: none"></div>
@@ -1,26 +1,7 @@
1
1
  <li class="page_level_<%= layoutpage.level %>" id="page_<%= layoutpage.id %>">
2
2
  <div class="sitemap_page">
3
3
  <div class="sitemap_left_images">
4
- <span class="site_status <%= layoutpage.level > 1 ? 'handle' : nil %> tooltip html_tooltip_<%= layoutpage.id %><%= layoutpage.locked ? ' locked' : '' %>" ></span>
5
- <div id="tooltip_<%= layoutpage.id %>" style="display: none;">
6
- <h1><%= t("page_type") %>: <%= layoutpage.layout_display_name %></h1>
7
- <p>
8
- <%= layoutpage.humanized_status %>
9
- </p>
10
- <p>
11
- <strong><%= t("created_at") %>:</strong>
12
- <%= l(layoutpage.created_at) %> von <%= layoutpage.creator %>
13
- </p>
14
- <p>
15
- <strong><%= t("updated_at") %>:</strong>
16
- <%= l(layoutpage.updated_at) %> durch <%= layoutpage.updater %>
17
- </p>
18
- <%- if layoutpage.locked? -%>
19
- <p>
20
- <%= t("currently_edited_by") %>: <span style="font-weight: bold;"><%= layoutpage.current_editor %></span>
21
- </p>
22
- <%- end -%>
23
- </div>
4
+ <span class="site_status <%= layoutpage.locked ? ' locked' : '' %>" ></span>
24
5
  </div>
25
6
  <div class="sitemap_right_tools">
26
7
  <%- permitted_to?(:configure, :alchemy_admin_pages) do -%>
@@ -8,7 +8,7 @@
8
8
  <%= truncate page.name, :length => 15 %>
9
9
  </span>
10
10
  <% end %>
11
- <%= form_for(alchemy.unlock_admin_page_path(page), :remote => true) do %>
11
+ <%= form_tag(alchemy.unlock_admin_page_path(page), :remote => true) do %>
12
12
  <button class="icon_button small" title="<%= t('explain_unlocking') %>">
13
13
  <%= render_icon('close small') %>
14
14
  </button>
@@ -9,9 +9,9 @@
9
9
  </span>
10
10
  <% end %>
11
11
  <%= form_tag(alchemy.unlock_admin_page_path(page), :remote => true) do %>
12
- <button class="icon_button small" title="<%= t('explain_unlocking') %>">
13
- <%= render_icon('close small') %>
14
- </button>
12
+ <button class="icon_button small" title="<%= t('explain_unlocking') %>">
13
+ <%= render_icon('close small') %>
14
+ </button>
15
15
  <% end %>
16
16
  </div>
17
17
  <%- end -%>
@@ -1,4 +1,10 @@
1
- <%- url ||= url_for(:action => 'index') -%>
1
+ <%- url_scope =
2
+ begin
3
+ resource_url_scope
4
+ rescue NameError
5
+ self
6
+ end -%>
7
+ <%- url ||= url_scope.url_for(:action => 'index') -%>
2
8
  <%= form_tag(url, :method => :get) do %>
3
9
  <div class="search_field">
4
10
  <%= render_icon('search') %>
@@ -1,4 +1,4 @@
1
- <%= form_for [:admin, resource_instance_variable], :remote => true do |f| %>
1
+ <%= form_for [resource_url_scope, :admin, resource_instance_variable], :remote => true do |f| %>
2
2
  <div id="errors" style="display: none"></div>
3
3
  <table>
4
4
  <%- resource_attributes.each do |attribute| -%>
@@ -1,7 +1,10 @@
1
1
  <tr class="<%= cycle('even', 'odd') %>">
2
2
  <%- resource_attributes.each do |attribute| -%>
3
3
  <%- if attribute[:type] == :boolean -%>
4
- <td class="center"><%= render_icon(resource.send(attribute[:name])) -%></td>
4
+ <td class="center">
5
+ <% attr_value = resource.send(attribute[:name]) %>
6
+ <%= attr_value.blank? ? '' : render_icon(attr_value) -%>
7
+ </td>
5
8
  <%- elsif attribute[:type] == :integer || attribute[:type] == :float || attribute[:type] == :decimal -%>
6
9
  <td class="right"><%= resource.send(attribute[:name]) -%></td>
7
10
  <%- else -%>
@@ -9,19 +12,19 @@
9
12
  <%- end -%>
10
13
  <%- end -%>
11
14
  <td class="tools">
12
- <%- permitted_to?(:destroy, namespaced_resources_name.to_sym) do -%>
15
+ <%- permitted_to?(:destroy, resources_permission) do -%>
13
16
  <%= link_to_confirmation_window(
14
17
  '',
15
18
  t("Are you sure?"),
16
- send("admin_#{resource_model_name}_path", resource),
19
+ resource_url_scope.send("admin_#{resource_model_name}_path", resource),
17
20
  :title => t("Delete"),
18
21
  :class => "icon destroy"
19
22
  ) -%>
20
23
  <%- end -%>
21
- <%- permitted_to?(:edit, namespaced_resources_name.to_sym) do -%>
24
+ <%- permitted_to?(:edit, resources_permission) do -%>
22
25
  <%= link_to_overlay_window(
23
26
  '',
24
- send("edit_admin_#{resource_model_name}_path", resource),
27
+ resource_url_scope.send("edit_admin_#{resource_model_name}_path", resource),
25
28
  {
26
29
  :title => t("Edit")
27
30
  },
@@ -20,4 +20,4 @@
20
20
  <p><%= t('Nothing found') %></p>
21
21
  <%- end -%>
22
22
 
23
- <%= render 'alchemy/admin/partials/pagination_links', :items => resources_instance_variable %>
23
+ <%= render 'alchemy/admin/partials/pagination_links', :items => resources_instance_variable, :scope => resource_url_scope %>
@@ -5,15 +5,16 @@
5
5
  {
6
6
  :icon => 'create',
7
7
  :label => label_title,
8
- :url => send("new_admin_#{resource_model_name}_path"),
8
+ :url => resource_url_scope.send("new_admin_#{resource_model_name}_path"),
9
9
  :title => label_title,
10
10
  :overlay_options => {
11
11
  :title => label_title
12
12
  },
13
- :if_permitted_to => [:new, namespaced_resources_name.to_sym]
13
+ :if_permitted_to => [:new, resources_permission]
14
14
  }
15
15
  ],
16
- :search => true
16
+ :search => true,
17
+ :search_url => resource_url_scope.send("admin_#{resources_name}_path")
17
18
  ) -%>
18
19
 
19
20
  <%= render 'table' %>
@@ -1,8 +1,9 @@
1
1
  <div class="with_padding">
2
2
  <%- if @elements.blank? -%>
3
- <p id="trash_empty_notice" <%= @elements.blank? ? '' : 'style="display: none"' %>>
3
+ <div id="trash_empty_notice" <%= @elements.blank? ? '' : 'style="display: none"' %> class="info">
4
+ <%= render_icon('info') %>
4
5
  <%= t('Your trash is empty') %>
5
- </p>
6
+ </div>
6
7
  <%- else -%>
7
8
  <div class="info">
8
9
  <%= render_icon('info') %>
@@ -1,6 +1,6 @@
1
1
  <div id="login_box">
2
2
  <div id="alchemy_greeting">
3
- <%= image_tag("alchemy/alchemy-logo.png") %>
3
+ <%= image_tag("alchemy/alchemy-logo.png", :style => "width: 240px; height: 70px") %>
4
4
  <h1><%= flash[:info] %></h1>
5
5
  </div>
6
6
  <div class="login_signup_box">
@@ -41,6 +41,7 @@
41
41
  $('#user_screensize').val(function() {
42
42
  return screen.width+'x'+screen.height;
43
43
  });
44
+ Alchemy.ButtonObserver('#login .button');
44
45
  });
45
46
  </script>
46
47
  <%- end -%>
@@ -23,14 +23,13 @@
23
23
  <span id="overlay_text"><%= t("please_wait") %></span>
24
24
  </div>
25
25
  </div>
26
- <div id="main_menu">
26
+ <div id="left_menu">
27
27
  <div id="main_navi">
28
28
  <%= admin_main_navigation %>
29
29
  <%= yield(:alchemy_main_navigation) %>
30
30
  </div>
31
- <div id="main_menu_background"></div>
32
31
  <div id="logout">
33
- <%= link_to_overlay_window("<span class='module icon exit'></span><label>#{t('leave')}</label>".html_safe, alchemy.leave_admin_path, {:size => "300x140", :title => t("Leave Alchemy")}) %>
32
+ <%= link_to_overlay_window("<span class='module icon exit'></span><label>#{t('leave')}</label>".html_safe, alchemy.leave_admin_path, {:size => "300x105", :title => t("Leave Alchemy")}) %>
34
33
  </div>
35
34
  </div>
36
35
  <div id="top_menu">
@@ -66,7 +65,7 @@
66
65
  if ($('#flash_notices').length > 0) {
67
66
  Alchemy.Growler.fade();
68
67
  }
69
- $('#toolbar a.please_wait, #toolbar form .button, #main_navi a.main_navi_entry, #sub_navigation .subnavi_tab a').click(function() {
68
+ $('#toolbar a.please_wait, #toolbar form .button, #toolbar form .icon_button, #main_navi a.main_navi_entry, #sub_navigation .subnavi_tab a, .pagination a').click(function() {
70
69
  Alchemy.pleaseWaitOverlay();
71
70
  });
72
71
  });
@@ -9,15 +9,16 @@
9
9
  <%= javascript_include_tag('alchemy/alchemy') %>
10
10
  </head>
11
11
  <body id="alchemy" class="login">
12
- <div id="main_menu">
13
- <div id="main_navi"></div>
14
- <div id="main_menu_background"></div>
15
- <div id="logout">
16
- <%= link_to(alchemy.root_path) do %>
17
- <span class="module icon exit"></span>
18
- <label><%= t('leave') %></label>
19
- <% end %>
12
+ <div id="left_menu">
13
+ <div id="main_navi">
14
+ <div id="logout">
15
+ <%= link_to(alchemy.root_path) do %>
16
+ <span class="module icon exit"></span>
17
+ <label><%= t('leave') %></label>
18
+ <% end %>
19
+ </div>
20
20
  </div>
21
+ <div id="left_menu_background"></div>
21
22
  </div>
22
23
  <div id="main_content">
23
24
  <%= yield %>
@@ -49,7 +49,6 @@ authorization do
49
49
  includes :editor
50
50
  has_permission_on :alchemy_admin_users, :to => [:manage]
51
51
  has_permission_on :alchemy_admin_languages, :to => [:manage]
52
- has_permission_on :alchemy_languages, :to => [:manage]
53
52
  has_permission_on :authorization_rules, :to => :read
54
53
  end
55
54
 
@@ -415,6 +415,7 @@ de:
415
415
  meta_keywords: "Meta Schlagwörter"
416
416
  missing_image: "Bild wird vermisst."
417
417
  modules:
418
+ user_sessions: "Anmeldung"
418
419
  attachments: "Dateien"
419
420
  dashboard: "Dashboard"
420
421
  pictures: "Bilder"
@@ -265,6 +265,7 @@ en:
265
265
  meta_keywords: "Meta-Keywords"
266
266
  missing_image: "Missing image"
267
267
  modules:
268
+ user_sessions: "Login"
268
269
  attachments: "Files"
269
270
  dashboard: "Dashboard"
270
271
  pictures: "Images"
@@ -47,7 +47,7 @@ module Alchemy
47
47
  end
48
48
 
49
49
  if errors.blank?
50
- log "Successfully seeded your database!" if notices.blank?
50
+ log "Successfully seeded your database!\n" if notices.blank?
51
51
  notices.each do |note|
52
52
  log(note, :skip)
53
53
  end
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
 
3
- VERSION = "2.1.rc6"
3
+ VERSION = "2.1"
4
4
 
5
5
  end
@@ -1,85 +1,73 @@
1
1
  # Skipping on Travis-CI, because capybara-webkit does not install on travis.
2
2
  unless ENV["CI"]
3
3
 
4
- require 'spec_helper'
4
+ require 'spec_helper'
5
5
 
6
- describe Alchemy::Admin::PagesController, :js => true do
6
+ describe Alchemy::Admin::PagesController, :js => true do
7
7
 
8
- describe "language tree switching" do
8
+ describe "language tree switching" do
9
9
 
10
- context "in a multilangual environment" do
10
+ context "in a multilangual environment" do
11
11
 
12
- before(:all) do
13
- Factory.build(:admin_user).save_without_session_maintenance
14
- @language = Factory(:language)
15
- @german_root = Factory(:language_root_page, :language => Alchemy::Language.get_default, :name => 'Deutsch')
16
- @klingonian_root = Factory(:language_root_page, :name => 'Klingonian')
17
- end
12
+ before(:all) do
13
+ Factory.build(:admin_user).save_without_session_maintenance
14
+ @language = Factory(:language)
15
+ @german_root = Factory(:language_root_page, :language => Alchemy::Language.get_default, :name => 'Deutsch')
16
+ @klingonian_root = Factory(:language_root_page, :name => 'Klingonian')
17
+ end
18
18
 
19
- it "one should be able to switch the language tree" do
20
- login_to_alchemy
21
- visit('/alchemy/admin/pages')
22
- page.select 'Klingonian', :from => 'language'
23
- within('#sitemap') { page.should have_content('Klingonian') }
24
- end
19
+ it "one should be able to switch the language tree" do
20
+ login_into_alchemy
21
+ visit('/alchemy/admin/pages')
22
+ page.select 'Klingonian', :from => 'language'
23
+ page.should have_selector('#sitemap .sitemap_pagename_link', :text => 'Klingonian')
24
+ end
25
25
 
26
- after(:all) {
27
- @language.destroy
28
- @klingonian_root.destroy
29
- @german_root.destroy
30
- }
26
+ after(:all) {
27
+ @language.destroy
28
+ @klingonian_root.delete
29
+ @german_root.delete
30
+ }
31
31
 
32
- end
32
+ end
33
33
 
34
- context "with no language root page" do
34
+ context "with no language root page" do
35
35
 
36
- before(:all) do
37
- Factory.build(:admin_user).save_without_session_maintenance
38
- @language = Factory(:language)
39
- end
36
+ before(:all) do
37
+ Factory.build(:admin_user).save_without_session_maintenance
38
+ @language = Factory(:language)
39
+ end
40
40
 
41
- it "it should display the form for creating language root" do
42
- login_to_alchemy
43
- visit('/alchemy/admin/pages')
44
- page.select 'Klingonian', :from => 'language'
45
- within('#archive_all') do
41
+ it "it should display the form for creating language root" do
42
+ login_into_alchemy
43
+ visit('/alchemy/admin/pages')
44
+ page.select 'Klingonian', :from => 'language'
46
45
  page.should have_content('This language tree does not exist')
47
46
  end
48
- end
49
47
 
50
- after(:all) {
51
- @language.destroy
52
- }
48
+ after(:all) {
49
+ @language.destroy
50
+ }
53
51
 
54
- end
52
+ end
55
53
 
56
- end
54
+ end
57
55
 
58
- describe "flush complete page cache" do
56
+ describe "flush complete page cache" do
59
57
 
60
- before(:all) do
61
- Factory.build(:admin_user).save_without_session_maintenance
62
- end
58
+ before(:all) do
59
+ Factory.build(:admin_user).save_without_session_maintenance
60
+ end
63
61
 
64
- it "should remove the cache of all pages" do
65
- login_to_alchemy
66
- visit '/alchemy/admin/pages'
67
- click_link 'Flush page cache'
68
- within('#flash_notices') do
62
+ it "should remove the cache of all pages" do
63
+ login_into_alchemy
64
+ visit '/alchemy/admin/pages'
65
+ click_link 'Flush page cache'
69
66
  page.should have_content('Page cache flushed')
70
67
  end
68
+
71
69
  end
72
70
 
73
71
  end
74
72
 
75
73
  end
76
-
77
- # We need this, because the before blocks losing its session under webkit-capybara (https://github.com/thoughtbot/capybara-webkit/issues/222)
78
- def login_to_alchemy
79
- visit '/alchemy/admin/login'
80
- fill_in('Username', :with => 'jdoe')
81
- fill_in('Password', :with => 's3cr3t')
82
- click_on('login')
83
- end
84
-
85
- end