alchemy_cms 2.0.rc2 → 2.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/app/controllers/admin/attachments_controller.rb +47 -21
  2. data/app/controllers/admin/clipboard_controller.rb +2 -0
  3. data/app/controllers/admin/elements_controller.rb +2 -0
  4. data/app/controllers/admin/essence_files_controller.rb +7 -6
  5. data/app/controllers/admin/languages_controller.rb +1 -0
  6. data/app/controllers/admin/pictures_controller.rb +49 -34
  7. data/app/controllers/admin/users_controller.rb +2 -0
  8. data/app/controllers/admin_controller.rb +1 -0
  9. data/app/controllers/alchemy_controller.rb +9 -0
  10. data/app/helpers/alchemy_helper.rb +8 -2
  11. data/app/models/attachment.rb +5 -0
  12. data/app/models/element.rb +4 -0
  13. data/app/sweepers/pictures_sweeper.rb +2 -1
  14. data/app/views/admin/attachments/_archive_overlay.html.erb +25 -0
  15. data/app/views/admin/attachments/_file_to_assign.html.erb +2 -2
  16. data/app/views/admin/attachments/create.js.erb +4 -2
  17. data/app/views/admin/contents/create.js.erb +16 -7
  18. data/app/views/admin/elements/_add_content.html.erb +1 -3
  19. data/app/views/admin/essence_files/edit.html.erb +5 -5
  20. data/app/views/admin/essence_pictures/destroy.js.erb +6 -3
  21. data/app/views/admin/pages/edit.html.erb +1 -1
  22. data/app/views/admin/partials/_remote_search_form.html.erb +4 -3
  23. data/app/views/admin/partials/_upload_form.html.erb +1 -3
  24. data/app/views/admin/pictures/_archive_overlay.html.erb +18 -0
  25. data/app/views/admin/pictures/_filter_and_size_bar.html.erb +6 -17
  26. data/app/views/admin/pictures/_picture.html.erb +14 -16
  27. data/app/views/admin/pictures/_picture_to_assign.html.erb +27 -29
  28. data/app/views/admin/pictures/create.js.erb +10 -10
  29. data/app/views/admin/pictures/index.html.erb +35 -5
  30. data/app/views/essences/_essence_file_editor.html.erb +4 -4
  31. data/app/views/essences/_essence_picture_editor.html.erb +2 -2
  32. data/app/views/essences/_essence_picture_tools.html.erb +1 -3
  33. data/assets/javascripts/alchemy.js +2 -2
  34. data/assets/stylesheets/alchemy.css +127 -132
  35. data/assets/stylesheets/elements.css +19 -39
  36. data/config/routes.rb +6 -8
  37. data/lib/alchemy/remote_pagination_link_renderer.rb +12 -1
  38. data/lib/alchemy/version.rb +1 -1
  39. data/spec/dummy/public/stylesheets/alchemy/alchemy.css +197 -173
  40. data/spec/dummy/public/stylesheets/alchemy/elements.css +6 -6
  41. metadata +6 -8
  42. data/app/views/admin/attachments/archive_overlay.html.erb +0 -8
  43. data/app/views/admin/pictures/_archive_overlay_images.html.erb +0 -16
  44. data/app/views/admin/pictures/archive_overlay.html.erb +0 -3
  45. data/app/views/admin/pictures/update.js.erb +0 -11
@@ -1,6 +1,8 @@
1
1
  (function($) {
2
-
2
+ <%- if @while_assigning -%>
3
+ $('#alchemy_window_body').replaceWith('<%= escape_javascript(render(:partial => "archive_overlay.html.erb")) -%>');
4
+ <%- else -%>
3
5
  $('#archive_all').html('<%= escape_javascript(render(:partial => 'files_list')) %>');
4
6
  Alchemy.growl('<%= @message %>');
5
-
7
+ <%- end -%>
6
8
  })(jQuery);
@@ -1,8 +1,6 @@
1
1
  (function($) {
2
2
 
3
- <%- case @content.essence_type -%>
4
-
5
- <%- when "EssencePicture" -%>
3
+ <%- if @content.essence_type == "EssencePicture" -%>
6
4
 
7
5
  $('#add_content_<%= @element.id -%>').before('<%= escape_javascript(
8
6
  render(
@@ -19,27 +17,31 @@
19
17
  $('#element_<%= @element.id -%>_contents .essence_picture_editor').addClass('dragable_picture');
20
18
  <%- end -%>
21
19
 
22
- <%- if !@options[:maximum_amount_of_images].blank? && (@contents_of_this_type.length >= @options[:maximum_amount_of_images].to_i) -%>
20
+ <%- if !max_image_count.blank? && (@contents_of_this_type.length >= max_image_count) -%>
23
21
  $("#add_content_<%= @element.id -%>").remove();
24
22
  <%- end -%>
25
23
 
26
24
  Alchemy.reloadPreview();
27
25
  Alchemy.closeCurrentWindow();
28
26
 
29
- <%- when "EssenceText" -%>
27
+ <%- elsif @content.essence_type == "EssenceText" -%>
30
28
 
31
29
  <%- locals = {
32
30
  :content => @content,
33
31
  :options => {:as => 'text_field'}.merge(@options.nil? ? {} : @options)
34
32
  } -%>
33
+
35
34
  <%- if params[:was_missing] -%>
35
+
36
36
  $("#element_<%= @element.id -%>_content_missing").replaceWith('<%= escape_javascript(
37
37
  render(
38
38
  :partial => "essences/essence_text_editor",
39
39
  :locals => locals
40
40
  )
41
41
  ) -%>');
42
+
42
43
  <%- else -%>
44
+
43
45
  $("#add_content_for_element_<%= @element.id -%>").before('<%= escape_javascript(
44
46
  render(
45
47
  :partial => "essences/essence_text_editor",
@@ -48,22 +50,27 @@
48
50
  ) -%>');
49
51
  Alchemy.reloadPreview();
50
52
  Alchemy.closeCurrentWindow();
53
+
51
54
  <%- end -%>
52
55
 
53
- <%- when "EssenceRichtext" -%>
56
+ <%- elsif @content.essence_type == "EssenceRichtext" -%>
54
57
 
55
58
  <%- locals = {
56
59
  :content => @content,
57
60
  :options => (@options.nil? ? {} : @options)
58
61
  } -%>
62
+
59
63
  <%- if params[:was_missing] -%>
64
+
60
65
  $("#element_<%= @element.id -%>_content_missing").replaceWith('<%= escape_javascript(
61
66
  render(
62
67
  :partial => "essences/essence_richtext_editor",
63
68
  :locals => locals
64
69
  )
65
- ) -%>')
70
+ ) -%>');
71
+
66
72
  <%- else -%>
73
+
67
74
  $("#add_content_for_element_<%= @element.id -%>").before('<%= escape_javascript(
68
75
  render(
69
76
  :partial => "essences/essence_richtext_editor",
@@ -71,7 +78,9 @@
71
78
  )
72
79
  ) -%>');
73
80
  Alchemy.closeCurrentWindow();
81
+
74
82
  <%- end -%>
83
+
75
84
  TinymceHammer.addEditor('contents_content_<%= @content.id -%>_body');
76
85
 
77
86
  <%- else -%>
@@ -1,9 +1,7 @@
1
1
  <div class="add_content" id="add_content_<%= element.id %>">
2
2
  <%= link_to_overlay_window(
3
3
  render_icon('assign'),
4
- url_for(
5
- :controller => 'pictures',
6
- :action => 'archive_overlay',
4
+ admin_pictures_path(
7
5
  :element_id => element,
8
6
  :options => options
9
7
  ),
@@ -2,12 +2,12 @@
2
2
  <%- if @content.essence_type == "EssenceFile" -%>
3
3
  <table>
4
4
  <tr>
5
- <td><%= f.label "title", _("title") %></td>
5
+ <td class="label long"><%= f.label "title", _("title") %></td>
6
6
  <td><%= f.text_field "title", :class => 'thin_border long' %></td>
7
7
  </tr>
8
8
  <tr>
9
9
  <td><%= f.label "css_class", _("align_in_text") %></td>
10
- <td><%= f.select "css_class", [[_("left"), "left"], [_("right"), "right"], [_("above"), "no_float"]] %></td>
10
+ <td><%= f.select "css_class", [[_("Layout default"), ""], [_("above"), "no_float"], [_("left"), "left"], [_("right"), "right"]] %></td>
11
11
  </tr>
12
12
  <tr>
13
13
  <td colspan="2" style="text-align:right">
@@ -18,7 +18,7 @@
18
18
  <%- elsif @content.essence_type == "EssenceFlash" -%>
19
19
  <table>
20
20
  <tr>
21
- <td><%= f.label "width", _("width") %></td>
21
+ <td class="label long"><%= f.label "width", _("width") %></td>
22
22
  <td><%= f.text_field "width", :class => 'thin_border long' %></td>
23
23
  </tr>
24
24
  <tr>
@@ -38,7 +38,7 @@
38
38
  <%- elsif @content.essence_type == "EssenceVideo" -%>
39
39
  <table>
40
40
  <tr>
41
- <td><%= f.label "width", _("width") %></td>
41
+ <td class="label long"><%= f.label "width", _("width") %></td>
42
42
  <td><%= f.text_field "width", :class => 'thin_border long' %></td>
43
43
  </tr>
44
44
  <tr>
@@ -66,7 +66,7 @@
66
66
  <%- elsif @content.essence_type == "EssenceAudio" -%>
67
67
  <table>
68
68
  <tr>
69
- <td><%= f.label "width", _("width") %></td>
69
+ <td class="label long"><%= f.label "width", _("width") %></td>
70
70
  <td><%= f.text_field "width", :class => 'thin_border long' %></td>
71
71
  </tr>
72
72
  <tr>
@@ -1,8 +1,9 @@
1
1
  (function($) {
2
-
2
+
3
3
  $('#essence_picture_<%= @content_id -%>').remove();
4
4
  Alchemy.SortableContents('#element_<%= @element.id -%>_contents', '<%= form_authenticity_token -%>');
5
- <%- if !@options[:maximum_amount_of_images].blank? && (@essence_pictures.length == @options[:maximum_amount_of_images].to_i) -%>
5
+
6
+ <%- if !max_image_count.blank? && (@essence_pictures.length == max_image_count) -%>
6
7
  $('#element_<%= @element.id -%>_contents').append('<%= escape_javascript(
7
8
  render(
8
9
  :partial => "admin/elements/add_content",
@@ -12,6 +13,8 @@
12
13
  }
13
14
  )
14
15
  ) -%>');
16
+ <%- end -%>
17
+
15
18
  Alchemy.reloadPreview();
16
-
19
+
17
20
  })(jQuery);
@@ -14,7 +14,7 @@
14
14
  <%= truncate page.name, :length => 15 %>
15
15
  </span>
16
16
  <% end %>
17
- <%= form_for(unlock_admin_page_path(page), :remote => true) do %>
17
+ <%= form_tag(unlock_admin_page_path(page), :remote => true) do %>
18
18
  <button class="icon_button small" title="<%= _('explain_unlocking') %>">
19
19
  <%= render_icon('close small') %>
20
20
  </button>
@@ -1,6 +1,6 @@
1
1
  <%= form_tag(
2
2
  url_for({
3
- :action => (action || 'index'),
3
+ :action => 'index',
4
4
  :options => @options,
5
5
  :size => @size
6
6
  }),
@@ -20,11 +20,12 @@
20
20
  <%= link_to(
21
21
  "",
22
22
  url_for({
23
- :action => action,
23
+ :action => 'index',
24
24
  :element_id => @element.blank? ? "" : @element.id,
25
25
  :content_id => @content.blank? ? "" : @content.id,
26
26
  :options => @options,
27
- :size => @size
27
+ :size => @size,
28
+ :overlay => true
28
29
  }),
29
30
  :remote => true,
30
31
  :class => "search_field_clear",
@@ -56,8 +56,6 @@
56
56
  <div id="divStatus" style="display: none"></div>
57
57
  <div id="uploadProgressContainer"></div>
58
58
 
59
- <%- session_key = ActionController::Base.session[:key] -%>
60
-
61
59
  <%- post_params = {
62
60
  :query => params[:query] || '',
63
61
  :page => 1,
@@ -67,7 +65,7 @@
67
65
  :element_id => @element.blank? ? nil : @element.id,
68
66
  :size => @size,
69
67
  :options => @options.to_param
70
- }.delete_if{|k,v|v.nil?}.to_json -%>
68
+ }.delete_if { |k,v| v.nil? }.to_json -%>
71
69
 
72
70
  <script type='text/javascript'>
73
71
  try {
@@ -0,0 +1,18 @@
1
+ <div id="alchemy_window_body">
2
+ <div id="overlay_toolbar">
3
+ <%= render :partial => 'filter_and_size_bar' %>
4
+ </div>
5
+ <div id="assign_image_list" class="with_padding">
6
+ <%- if @pictures.empty? -%>
7
+ <p><%= _("no_images_in_archive") %></p>
8
+ <%- else -%>
9
+ <%= render(
10
+ :partial => 'admin/partials/remote_pagination_links',
11
+ :locals => {
12
+ :items => @pictures
13
+ }
14
+ ) %>
15
+ <%= render :partial => "picture_to_assign", :collection => @pictures, :locals => {:options => @options, :size => @size} %>
16
+ <%- end -%>
17
+ </div>
18
+ </div>
@@ -2,8 +2,7 @@
2
2
  <div class="button_with_label">
3
3
  <%= link_to(
4
4
  render_icon('zoom-out'),
5
- url_for({
6
- :action => "archive_overlay",
5
+ admin_pictures_path({
7
6
  :size => "small",
8
7
  :content_id => @content,
9
8
  :element_id => @element,
@@ -17,8 +16,7 @@
17
16
  ) %>
18
17
  <%= link_to(
19
18
  render_icon('zoom-equal'),
20
- url_for({
21
- :action => "archive_overlay",
19
+ admin_pictures_path({
22
20
  :size => "medium",
23
21
  :content_id => @content,
24
22
  :element_id => @element,
@@ -32,8 +30,7 @@
32
30
  ) %>
33
31
  <%= link_to(
34
32
  render_icon('zoom-in'),
35
- url_for({
36
- :action => "archive_overlay",
33
+ admin_pictures_path({
37
34
  :size => "large",
38
35
  :content_id => @content,
39
36
  :element_id => @element,
@@ -52,10 +49,7 @@
52
49
  <div class="button_with_label">
53
50
  <%= link_to_overlay_window(
54
51
  render_icon('upload'),
55
- url_for(
56
- :controller => 'admin/pictures',
57
- :action => 'new',
58
- :while_assigning => true,
52
+ new_admin_picture_path(
59
53
  :element_id => @element.blank? ? nil : @element.id,
60
54
  :content_id => @content.blank? ? nil : @content.id,
61
55
  :swap => @swap,
@@ -65,7 +59,7 @@
65
59
  :options => @options
66
60
  ),
67
61
  {
68
- :size => "355x320",
62
+ :size => "540x480",
69
63
  :title => _('upload_image')
70
64
  },
71
65
  {
@@ -75,10 +69,5 @@
75
69
  ) %><br />
76
70
  <label><%= _('upload_image') %></label>
77
71
  </div>
78
- <%= render(
79
- :partial => 'admin/partials/remote_search_form',
80
- :locals => {
81
- :action => 'archive_overlay'
82
- }
83
- ) %>
72
+ <%= render(:partial => 'admin/partials/remote_search_form') %>
84
73
  </div>
@@ -1,4 +1,4 @@
1
- <div class="picture_detail" id="picture_<%= picture.id %>" name="<%= picture.name %>">
1
+ <div class="picture_thumbnail <%= @size %>" id="picture_<%= picture.id %>" name="<%= picture.name %>">
2
2
  <%- permitted_to?(:destroy, :admin_pictures) do -%>
3
3
  <span class="picture_tool_delete">
4
4
  <%= link_to_confirmation_window(
@@ -16,21 +16,19 @@
16
16
  ) -%>
17
17
  </span>
18
18
  <%- end -%>
19
- <div class="picture_image">
20
- <div class="image_spinner spinner">
21
- <%= image_tag("alchemy/image_loader.gif", :alt => '') %>
22
- </div>
23
- <%= link_to_function(
24
- image_tag(
25
- thumbnail_path(:id => picture, :size => "111x93"),
26
- :alt => picture.name,
27
- :title => _('zoom_image'),
28
- :onload => "Alchemy.fadeImage(this, '#picture_#{picture.id} .image_spinner');",
29
- :style => "display: none;"
30
- ),
31
- "Alchemy.zoomImage('/admin/pictures/#{picture.id}/show_in_window', '#{picture.name}', #{picture.image_width || 320}, #{picture.image_height || 240})",
32
- :class => 'thumbnail_background'
33
- ) %>
19
+ <div class="image_spinner spinner">
20
+ <%= image_tag("alchemy/image_loader.gif", :alt => '') %>
34
21
  </div>
22
+ <%= link_to_function(
23
+ image_tag(
24
+ thumbnail_path(:id => picture, :size => @size),
25
+ :alt => picture.name,
26
+ :title => _('zoom_image'),
27
+ :onload => "Alchemy.fadeImage(this, '#picture_#{picture.id} .image_spinner');",
28
+ :style => "display: none;"
29
+ ),
30
+ "Alchemy.zoomImage('/admin/pictures/#{picture.id}/show_in_window', '#{picture.name}', #{picture.image_width || 320}, #{picture.image_height || 240})",
31
+ :class => 'thumbnail_background'
32
+ ) %>
35
33
  <span class="picture_name<%= ' rename' if permitted_to?(:edit, :admin_pictures) -%>" title="<%= permitted_to?(:edit, :admin_pictures) ? picture.name + ' (' + _('Click to rename') + ')' : picture.name %>" id="image_<%= dom_id(picture) %>_name"><%= picture.name %></span>
36
34
  </div>
@@ -1,33 +1,31 @@
1
- <div class="assign_image_list_detail <%= size.blank? ? 'small' : size %>" name="<%= picture_to_assign.name %>" id="picture_to_assign_<%= picture_to_assign.id %>">
2
- <div class="assign_image_list_image">
3
- <%- unless params[:image_assign_url].blank? -%>
4
- <%- action_url = params[:image_assign_url] + "?picture_id=#{picture_to_assign.id}" -%>
5
- <%- action_method = params[:image_assign_method] -%>
6
- <%- else -%>
7
- <%- action_url = create_or_assign_url(picture_to_assign, @options) -%>
8
- <%- action_method = @content.blank? ? 'post' : 'put' -%>
9
- <%- end -%>
10
- <div class="image_spinner spinner">
11
- <%= image_tag("alchemy/image_loader.gif", :alt => '') %>
12
- </div>
13
- <%= link_to(
14
- image_tag(
15
- thumbnail_path(
16
- :id => picture_to_assign,
17
- :size => size
18
- ),
19
- :alt => picture_to_assign.name,
20
- :onload => "Alchemy.fadeImage(this, '#picture_to_assign_#{picture_to_assign.id} .image_spinner');",
21
- :style => "display: none;"
22
- ),
23
- action_url,
24
- :remote => true,
25
- :method => action_method,
26
- :title => _("assign_image"),
27
- :class => 'thumbnail_background'
28
- ) %>
1
+ <div class="picture_thumbnail assign_image_list_detail <%= size.blank? ? 'medium' : size %>" name="<%= picture_to_assign.name %>" id="picture_to_assign_<%= picture_to_assign.id %>">
2
+ <%- unless params[:image_assign_url].blank? -%>
3
+ <%- action_url = params[:image_assign_url] + "?picture_id=#{picture_to_assign.id}" -%>
4
+ <%- action_method = params[:image_assign_method] -%>
5
+ <%- else -%>
6
+ <%- action_url = create_or_assign_url(picture_to_assign, @options) -%>
7
+ <%- action_method = @content.blank? ? 'post' : 'put' -%>
8
+ <%- end -%>
9
+ <div class="image_spinner spinner">
10
+ <%= image_tag("alchemy/image_loader.gif", :alt => '') %>
29
11
  </div>
30
- <div class="picture_to_assign_name" title="<%= picture_to_assign.name %>">
12
+ <%= link_to(
13
+ image_tag(
14
+ thumbnail_path(
15
+ :id => picture_to_assign,
16
+ :size => size
17
+ ),
18
+ :alt => picture_to_assign.name,
19
+ :onload => "Alchemy.fadeImage(this, '#picture_to_assign_#{picture_to_assign.id} .image_spinner');",
20
+ :style => "display: none;"
21
+ ),
22
+ action_url,
23
+ :remote => true,
24
+ :method => action_method,
25
+ :title => _("assign_image"),
26
+ :class => 'thumbnail_background'
27
+ ) %>
28
+ <div class="picture_name" title="<%= picture_to_assign.name %>">
31
29
  <%= picture_to_assign.name.empty? ? "&nbsp;" : picture_to_assign.name %>
32
30
  </div>
33
31
  </div>
@@ -1,12 +1,12 @@
1
1
  (function($) {
2
- <%- if @while_assigning -%>
3
- $('#alchemy_window_body').html('<%= escape_javascript(render(:partial => "archive_overlay_images")) -%>');
4
- <%- else -%>
5
- $('#archive_all').html('<%= escape_javascript(render(:partial => "pictures_list")) -%>');
6
- Alchemy.inPlaceEditor({
7
- save_label: "<%= _('save') -%>",
8
- cancel_label: "<%= _('cancel') -%>"
9
- });
10
- <%- end -%>
11
- Alchemy.growl('<%= @message -%>');
2
+ <%- if @while_assigning -%>
3
+ $('#alchemy_window_body').replaceWith('<%= escape_javascript(render(:partial => "archive_overlay")) -%>');
4
+ <%- else -%>
5
+ $('#archive_all').html('<%= escape_javascript(render(:partial => "pictures_list")) -%>');
6
+ Alchemy.inPlaceEditor({
7
+ save_label: "<%= _('save') -%>",
8
+ cancel_label: "<%= _('cancel') -%>"
9
+ });
10
+ <%- end -%>
11
+ Alchemy.growl('<%= @message -%>');
12
12
  })(jQuery);
@@ -6,7 +6,7 @@
6
6
  <div class="button_with_label">
7
7
  <%= link_to_overlay_window(
8
8
  content_tag('span', '', :class => 'icon upload'),
9
- new_admin_picture_path,
9
+ new_admin_picture_path(:size => @size),
10
10
  {
11
11
  :title => _('upload_image'),
12
12
  :size => '540x480'
@@ -17,7 +17,41 @@
17
17
  <label><%= _('upload_image') %></label>
18
18
  </div>
19
19
  <%- end -%>
20
+ <div class="toolbar_spacer"></div>
21
+ <div class="button_with_label">
22
+ <%= link_to(
23
+ render_icon('zoom-out'),
24
+ admin_pictures_path({
25
+ :size => "small",
26
+ :query => params[:query]
27
+ }),
28
+ :title => _("small_thumbnails"),
29
+ :class => "icon_button"
30
+ ) %>
31
+ <%= link_to(
32
+ render_icon('zoom-equal'),
33
+ admin_pictures_path({
34
+ :size => "medium",
35
+ :query => params[:query]
36
+ }),
37
+ :title => _("medium_thumbnails"),
38
+ :class => "icon_button"
39
+ ) %>
40
+ <%= link_to(
41
+ render_icon('zoom-in'),
42
+ admin_pictures_path({
43
+ :size => "large",
44
+ :query => params[:query]
45
+ }),
46
+ :title => _("big_thumbnails"),
47
+ :class => "icon_button"
48
+ ) %><br />
49
+ <label class="sup"><%= _('Image size') %></label>
50
+ <%= hidden_field_tag('size', @size, :id => 'overlay_thumbnails_size') %>
51
+ </div>
52
+
20
53
  <%- permitted_to?(:flush, :admin_pictures) do -%>
54
+ <div class="toolbar_spacer"></div>
21
55
  <div class="button_with_label">
22
56
  <%= link_to(
23
57
  content_tag('span', '', :class => 'icon flush'),
@@ -32,10 +66,6 @@
32
66
  </div>
33
67
  <%- end -%>
34
68
  </div>
35
- <div class="toolbar_spacer"></div>
36
- <div id="toolbar_links">
37
- <%= render :partial => 'admin/partials/per_page_links', :locals => {:label => _('images'), :values => ['32', '64', 'all']} %>
38
- </div>
39
69
  <%= render :partial => 'admin/partials/search_form' %>
40
70
  </div>
41
71
  <%- end -%>