alchemy_cms 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -6,7 +6,7 @@ rvm:
6
6
  - ree
7
7
  branches:
8
8
  only:
9
- - next_stable
9
+ - master
10
10
  before_script:
11
11
  #- "mysql -e 'create database alchemy_cms_test;'"
12
12
  - "sh -c 'cd spec/dummy && RAILS_ENV=test bundle exec rake db:schema:load'"
@@ -106,6 +106,17 @@ if (typeof(Alchemy) === 'undefined') {
106
106
  };
107
107
  },
108
108
 
109
+ removePicture : function(selector) {
110
+ var $form_field = $(selector);
111
+ var $element = $form_field.parents('.element_editor');
112
+ if ($form_field) {
113
+ $form_field.val('');
114
+ $form_field.prev().remove();
115
+ $form_field.parent().addClass('missing');
116
+ Alchemy.setElementDirty($element);
117
+ }
118
+ },
119
+
109
120
  saveElement : function(form) {
110
121
  // disabled for now. I think we don't need this.
111
122
  return true;
@@ -30,7 +30,7 @@ if (typeof(Alchemy) === 'undefined') {
30
30
  },
31
31
 
32
32
  setElementDirty : function(element) {
33
- var $element = $(element);
33
+ var $element = $(element);
34
34
  $element.addClass('dirty');
35
35
  $element.find('.element_head .icon').addClass('element_dirty');
36
36
  },
@@ -65,7 +65,6 @@ if (typeof(Alchemy) === 'undefined') {
65
65
  $(selector).sortable({
66
66
  items: 'div.dragable_picture',
67
67
  handle: 'div.picture_handle',
68
- placeholder: 'droppable_content_placeholder',
69
68
  opacity: 0.5,
70
69
  cursor: 'move',
71
70
  tolerance: 'pointer',
@@ -923,17 +923,6 @@ div#image_assign_filter_and_image_sizing {
923
923
  cursor: image-url('alchemy/lupe.cur'), zoom-in, pointer;
924
924
  }
925
925
 
926
- .essence_picture_editor .picture_thumbnail {
927
- width: 111px;
928
- height: 115px;
929
- margin: 1px;
930
- }
931
-
932
- .essence_picture_editor .picture_thumbnail .thumbnail_background {
933
- width: 111px;
934
- height: 93px;
935
- }
936
-
937
926
  div.picture_thumbnail.small {
938
927
  width: 80px;
939
928
  height: 75px;
@@ -245,7 +245,6 @@ form.add_gallery_to_index {
245
245
  }
246
246
 
247
247
  div.picture_gallery_images {
248
- margin-top: 8px;
249
248
  overflow: hidden;
250
249
  margin-bottom: 8px;
251
250
  border: 1px inset #cecece;
@@ -434,9 +433,18 @@ a.icon_button.linked {
434
433
  }
435
434
 
436
435
  div.essence_picture_editor {
437
- position: relative;
438
436
  float: left;
439
- margin: 0;
437
+ height: 126px;
438
+ margin: 1px;
439
+ position: relative;
440
+ }
441
+
442
+ div.essence_picture_editor.content_editor {
443
+ float: none;
444
+ height: auto;
445
+ display: inline;
446
+ display: inline-block;
447
+ margin: 8px 0;
440
448
  }
441
449
 
442
450
  div.essence_picture_editor .picture_tool_delete {
@@ -470,28 +478,18 @@ div.essence_picture_css_class {
470
478
  overflow: hidden;
471
479
  }
472
480
 
473
- div.essence_picture_editor:hover .picture_tool_delete {
481
+ div.essence_picture_editor .picture_thumbnail:hover .picture_tool_delete {
474
482
  display: block;
475
483
  }
476
484
 
477
- .dragable_picture {
478
- float: left;
479
- }
480
-
481
- .picture_thumbnail div.missing_image {
482
- height: 94px;
483
- text-align: center;
484
- line-height: 28px;
485
- color: #b3b3b3;
485
+ div.essence_picture_editor .thumbnail_background.missing {
486
+ background-image: image-url('alchemy/placeholder.png');
487
+ background-repeat: no-repeat;
488
+ background-position: center 12px;
486
489
  }
487
490
 
488
- .validation_failed .picture_thumbnail div.missing_image {
489
- color: #931f23;
490
- }
491
-
492
- .picture_thumbnail div.missing_image img {
493
- position: relative;
494
- top: 10px;
491
+ .dragable_picture {
492
+ float: left;
495
493
  }
496
494
 
497
495
  .picture_thumbnail .picture_handle {
@@ -510,10 +508,30 @@ div.essence_picture_editor:hover .picture_tool_delete {
510
508
  }
511
509
 
512
510
  .picture_content_spinner {
511
+ background: #666666;
512
+ height: 93px;
513
+ left: 4px;
513
514
  position: absolute;
514
- z-index: 0;
515
- top: 35px;
516
- left: 39px;
515
+ top: 4px;
516
+ width: inherit;
517
+ img {
518
+ top: 50%;
519
+ left: 50%;
520
+ position: absolute;
521
+ margin-top: -16px;
522
+ margin-left: -16px;
523
+ }
524
+ }
525
+
526
+ .essence_picture_editor .picture_thumbnail {
527
+ width: 111px;
528
+ height: 115px;
529
+ margin: 0;
530
+ }
531
+
532
+ .essence_picture_editor .picture_thumbnail .thumbnail_background {
533
+ width: 111px;
534
+ height: 93px;
517
535
  }
518
536
 
519
537
  div.file {
@@ -689,6 +707,7 @@ div.content_editor label {
689
707
  font-size: 10px;
690
708
  text-shadow: #fff5e1 1px 1px 0;
691
709
  line-height: 15px;
710
+ text-indent: 1px;
692
711
  }
693
712
 
694
713
  div.content_editor label span.warning.icon {
@@ -777,16 +796,6 @@ textarea.tinymce {
777
796
  border-width: 1px;
778
797
  }
779
798
 
780
- .droppable_content_placeholder {
781
- border: 1px dotted #bba589;
782
- background-color: #f0e8d7;
783
- float: left;
784
- width: 111px;
785
- height: 115px;
786
- padding: 4px;
787
- margin: 1px;
788
- }
789
-
790
799
  div.element_editor div.error {
791
800
  padding: 8px 4px 8px 32px;
792
801
  margin-bottom: 8px;
@@ -18,7 +18,7 @@ module Alchemy
18
18
  @options = Rack::Utils.parse_query(@options)
19
19
  end
20
20
  if @content.essence_type == "Alchemy::EssencePicture"
21
- @content.essence.picture = Picture.find(params[:picture_id])
21
+ @content.essence.picture_id = params[:picture_id]
22
22
  @content.essence.save
23
23
  @contents_of_this_type = @element.contents.find_all_by_essence_type('Alchemy::EssencePicture')
24
24
  @dragable = @contents_of_this_type.length > 1
@@ -50,7 +50,7 @@ module Alchemy
50
50
  resource_instance_variable.save
51
51
  render_errors_or_redirect(
52
52
  resource_instance_variable,
53
- url_for({:action => :index}),
53
+ resource_url_scope.url_for({:action => :index}),
54
54
  flash_notice_for_resource_action
55
55
  )
56
56
  end
@@ -59,7 +59,7 @@ module Alchemy
59
59
  resource_instance_variable.update_attributes(params[resource_model_name.to_sym])
60
60
  render_errors_or_redirect(
61
61
  resource_instance_variable,
62
- url_for({:action => :index}),
62
+ resource_url_scope.url_for({:action => :index}),
63
63
  flash_notice_for_resource_action
64
64
  )
65
65
  end
@@ -37,20 +37,22 @@ module Alchemy
37
37
  render_element(element, :editor)
38
38
  end
39
39
 
40
- # This helper renderes the picture editor for the elements on the Alchemy Desktop.
41
- # It brings full functionality for adding images to the element, deleting images from it and sorting them via drag'n'drop.
40
+ # Renders a drag'n'drop picture gallery editor for all EssencePictures.
41
+ #
42
+ # It brings full functionality for adding images, deleting images and sorting them via drag'n'drop.
42
43
  # Just place this helper inside your element editor view, pass the element as parameter and that's it.
43
44
  #
44
- # Options:
45
- # :maximum_amount_of_images (integer), default nil. This option let you handle the amount of images your customer can add to this element.
46
- def render_picture_editor(element, options={})
45
+ # === Options:
46
+ #
47
+ # :maximum_amount_of_images [Integer] # This option let you handle the amount of images your customer can add to this element.
48
+ #
49
+ def render_picture_gallery_editor(element, options={})
47
50
  default_options = {
48
- :last_image_deletable => true,
49
51
  :maximum_amount_of_images => nil,
50
- :refresh_sortable => true
52
+ :grouped => true
51
53
  }
52
54
  options = default_options.merge(options)
53
- picture_contents = element.all_contents_by_type("Alchemy::EssencePicture")
55
+ picture_contents = element.contents.where(:essence_type => "Alchemy::EssencePicture")
54
56
  render(
55
57
  :partial => "alchemy/admin/elements/picture_editor",
56
58
  :locals => {
@@ -60,6 +62,7 @@ module Alchemy
60
62
  }
61
63
  )
62
64
  end
65
+ alias_method :render_picture_editor, :render_picture_gallery_editor
63
66
 
64
67
  # Returns all elements that could be placed on that page because of the pages layout.
65
68
  # The elements are returned as an array to be used in alchemy_selectbox form builder.
@@ -442,7 +442,9 @@ module Alchemy
442
442
  def render_search_form(options={})
443
443
  default_options = {
444
444
  :page => @search_result_page,
445
- :html5 => false
445
+ :html5 => false,
446
+ :button_value => t("search"),
447
+ :button_class => nil
446
448
  }
447
449
  options = default_options.merge(options)
448
450
  if options[:page].class.name != "Alchemy::Page"
@@ -453,7 +455,7 @@ module Alchemy
453
455
  if options[:html5]
454
456
  search_field_tag(:query, params[:query])
455
457
  else
456
- text_field_tag(:query, params[:query]) + submit_tag(t("search"))
458
+ text_field_tag(:query, params[:query]) + submit_tag(options[:button_value], :class => options[:button_class], :name => nil)
457
459
  end
458
460
  end
459
461
  end
@@ -11,7 +11,7 @@ module Alchemy
11
11
  has_and_belongs_to_many :to_be_sweeped_pages, :class_name => 'Alchemy::Page', :uniq => true, :join_table => 'alchemy_elements_alchemy_pages'
12
12
 
13
13
  validates_uniqueness_of :position, :scope => [:page_id, :cell_id]
14
- validates_presence_of :name, :on => :create, :message => '^'+Alchemy::I18n.t("Please choose an element.")
14
+ validates_presence_of :name, :on => :create, :message => '^'+Alchemy::I18n.t(:choose_element)
15
15
 
16
16
  attr_accessor :create_contents_after_create
17
17
 
@@ -8,6 +8,13 @@ module Alchemy
8
8
 
9
9
  belongs_to :picture
10
10
  before_save :replace_newlines
11
+ before_save :fix_crop_from
12
+
13
+ private
14
+
15
+ def fix_crop_from
16
+ write_attribute(:crop_from, self.crop_from.to_s.split('x').map { |number| number.to_i < 0 ? "0" : number }.join('x'))
17
+ end
11
18
 
12
19
  def replace_newlines
13
20
  return nil if caption.nil?
@@ -20,7 +20,7 @@
20
20
  ) %>
21
21
  <%= link_to_function(
22
22
  "",
23
- "Alchemy.toggleElement(#{element.id}, '#{alchemy.fold_admin_element_path(element)}', '#{form_authenticity_token}', {title: '#{ t('Warning!') }', message: '#{ t('This element has unsaved changes. Do you really want to fold it?') }', okLabel: '#{ t('Yes') }', cancelLabel: '#{ t('No') }'})",
23
+ "Alchemy.toggleElement(#{element.id}, '#{alchemy.fold_admin_element_path(element)}', '#{form_authenticity_token}', {title: '#{ t('Warning!') }', message: '#{ t(:element_dirty_notice) }', okLabel: '#{ t('Yes') }', cancelLabel: '#{ t('No') }'})",
24
24
  :class => element.folded? ? 'expand_element' : 'fold_element',
25
25
  :title => element.folded? ? t('show_element_content') : t('hide_element_content'),
26
26
  :id => "element_#{element.id}_folder"
@@ -1,22 +1,25 @@
1
1
  <%- max_image_count = options[:maximum_amount_of_images] || options[:max_images] -%>
2
- <div class="picture_gallery_images" id="element_<%= element.id %>_contents">
3
- <%- for picture_content in picture_contents do -%>
4
- <%= render_essence_editor(picture_content, {
5
- :dragable => (picture_contents.size > 1)
6
- }.merge(options)) %>
7
- <%- end -%>
8
- <%- if max_image_count.blank? || picture_contents.length < max_image_count.to_i -%>
9
- <%= render(
10
- :partial => 'alchemy/admin/elements/add_content',
11
- :locals => {
12
- :element => element,
13
- :essence_type => "Alchemy::EssencePicture",
14
- :link_text => t("add_image_to_element"),
15
- :options => options,
2
+ <div class="content_editor">
3
+ <label><%= t("picture_gallery_editor.#{element.name}", :default => t('picture_gallery_editor')) %></label>
4
+ <div class="picture_gallery_images" id="element_<%= element.id %>_contents">
5
+ <%- picture_contents.each do |picture_content| -%>
6
+ <%= render_essence_editor(picture_content, {
16
7
  :dragable => (picture_contents.size > 1)
17
- }
18
- ) %>
19
- <%- end -%>
8
+ }.merge(options)) %>
9
+ <%- end -%>
10
+ <%- if max_image_count.blank? || picture_contents.length < max_image_count.to_i -%>
11
+ <%= render(
12
+ :partial => 'alchemy/admin/elements/add_content',
13
+ :locals => {
14
+ :element => element,
15
+ :essence_type => "Alchemy::EssencePicture",
16
+ :link_text => t("add_image_to_element"),
17
+ :options => options,
18
+ :dragable => (picture_contents.size > 1)
19
+ }
20
+ ) %>
21
+ <%- end -%>
22
+ </div>
20
23
  </div>
21
24
  <%- if picture_contents.size > 1 -%>
22
25
  <script type="text/javascript" charset="utf-8">
@@ -102,7 +102,7 @@
102
102
  texts: {
103
103
  title: '<%= t("Elements") -%>',
104
104
  dirtyTitle: '<%= t("Warning!") -%>',
105
- dirtyMessage: '<%= t("You have unsaved elements. Do you really want to close the elements window?") -%>',
105
+ dirtyMessage: '<%= t(:element_dirty_close_window_notice) -%>',
106
106
  okLabel: '<%= t("Yes") -%>',
107
107
  cancelLabel: '<%= t("No") -%>'
108
108
  },
@@ -165,12 +165,14 @@
165
165
  jQuery(document).ready(function($) {
166
166
  var texts = {
167
167
  title: '<%= t("Warning!") %>',
168
- message: '<%= t("You have unsaved elements on this page. Do you really want to continue?") %>',
168
+ message: '<%= t(:element_dirty_page_leave_warning) %>',
169
169
  okLabel: '<%= t("Yes") %>',
170
170
  cancelLabel: '<%= t("No") %>'
171
171
  };
172
172
  $('#unlock_page_form, #visit_page_form, #publish_page_form').on('submit', function(event) {
173
- return Alchemy.checkPageDirtyness(this, texts);
173
+ var not_dirty = Alchemy.checkPageDirtyness(this, texts);
174
+ if (!not_dirty) Alchemy.pleaseWaitOverlay(false);
175
+ return not_dirty;
174
176
  });
175
177
  Alchemy.PageLeaveObserver(texts);
176
178
  Alchemy.openElementsWindow();
@@ -1 +1 @@
1
- <p><%= t('This element displays the search and the searchresults.') %></p>
1
+ <p><%= t(:searchresults_editor_info) %></p>
@@ -1,3 +1,3 @@
1
1
  <div class="content_editor">
2
- <p><%= t('The sitemap is autogenerated.') %></p>
2
+ <p><%= t(:sitemap_editor_info) %></p>
3
3
  </div>
@@ -1,69 +1,75 @@
1
- <div id="<%= content_dom_id(content) %>" class="<%= options[:dragable] ? 'essence_picture_editor dragable_picture' : 'essence_picture_editor' %>">
2
- <div class="picture_thumbnail">
3
- <span class="picture_tool_delete">
4
- <%= link_to_confirmation_window(
5
- "",
6
- t("confirm_to_delete_image"),
7
- alchemy.admin_essence_picture_path(
8
- :id => content,
9
- :options => options
10
- ),
11
- {
12
- :title => t("delete_image"),
13
- :class => "picture_delete"
14
- }
15
- ) -%>
16
- </span>
17
- <%- if content.ingredient.nil? -%>
18
- <div class="missing_image">
19
- <p>
20
- <%= image_tag('alchemy/placeholder.png') %><br>
21
- <%= t('Image missing') %><%= '<span class="validation_indicator">*</span>'.html_safe if content.has_validations? %>
22
- </p>
23
- </div>
24
- <%- else -%>
25
- <div class="picture_handle" title="<%= t('drag_to_sort') if options[:dragable] %>"></div>
26
- <div class="picture_content_spinner">
27
- <%= image_tag("alchemy/image_loader.gif", :alt => '') %>
28
- </div>
29
- <div class="picture_image">
30
- <div class="thumbnail_background">
31
- <%= image_tag(
32
- alchemy.thumbnail_path(
33
- :id => content.ingredient.id,
34
- :size => content.ingredient.cropped_thumbnail_size(content.essence.render_size.blank? ? options[:image_size] : content.essence.render_size),
35
- :crop_from => content.essence.crop_from.blank? ? nil : content.essence.crop_from,
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,
38
- :name => content.ingredient.urlname
39
- ),
40
- :alt => content.ingredient.name,
41
- :class => 'img_paddingtop',
42
- :title => t("image_name") + ": #{content.ingredient.name}",
43
- :onload => "Alchemy.fadeImage(this, '##{content_dom_id(content)} .picture_content_spinner');",
44
- :style => "display: none;"
45
- ) %>
46
- </div>
47
- <%= hidden_field_tag content.form_field_name(:picture_id), content.ingredient.id %>
48
- </div>
49
- <%- end -%>
50
- <%- unless options[:css_class].blank? || content.essence.css_class.blank? -%>
51
- <div class="essence_picture_css_class">
52
- <%= t("alchemy.essence_pictures.css_classes.#{content.essence.css_class}", :default => content.essence.css_class.camelcase) %>
53
- </div>
54
- <%- end -%>
55
- <div class="edit_images_bottom">
56
- <%= render(
57
- :partial => 'alchemy/essences/essence_picture_tools',
58
- :locals => {
59
- :content => content,
60
- :options => options
61
- }
62
- ) %>
63
- </div>
64
- </div>
65
- <%= hidden_field_tag content.form_field_name(:link), content.essence.link %>
66
- <%= hidden_field_tag content.form_field_name(:link_title), content.essence.link_title %>
67
- <%= hidden_field_tag content.form_field_name(:link_class_name), content.essence.link_class_name %>
68
- <%= hidden_field_tag content.form_field_name(:link_target), content.essence.link_target %>
1
+ <div id="<%= content_dom_id(content) %>" class="<%= options[:dragable] ? 'essence_picture_editor dragable_picture' : "essence_picture_editor#{options[:grouped] ? nil : ' content_editor'}" %>">
2
+ <% unless options[:grouped] %>
3
+ <label><%= render_content_name(content) %></label>
4
+ <% end %>
5
+ <div class="picture_thumbnail">
6
+ <span class="picture_tool_delete">
7
+ <% if options[:grouped] %>
8
+ <%= link_to_confirmation_window(
9
+ "",
10
+ t("confirm_to_delete_image"),
11
+ alchemy.admin_essence_picture_path(
12
+ :id => content,
13
+ :options => options
14
+ ),
15
+ {
16
+ :title => t("delete_image"),
17
+ :class => "picture_delete"
18
+ }
19
+ ) -%>
20
+ <% else %>
21
+ <%= link_to(
22
+ '',
23
+ '#',
24
+ :onclick => "Alchemy.removePicture('##{content.form_field_id(:picture_id)}');"
25
+ ) %>
26
+ <% end %>
27
+ </span>
28
+ <%- if content.ingredient -%>
29
+ <div class="picture_handle" title="<%= t('drag_to_sort') if options[:dragable] %>"></div>
30
+ <div class="picture_content_spinner">
31
+ <%= image_tag("alchemy/image_loader.gif", :alt => '') %>
32
+ </div>
33
+ <%- end -%>
34
+ <div class="picture_image">
35
+ <div class="thumbnail_background<%= ' missing' if content.ingredient.nil? %>">
36
+ <%- if content.ingredient -%>
37
+ <%= image_tag(
38
+ alchemy.thumbnail_path(
39
+ :id => content.ingredient.id,
40
+ :size => content.ingredient.cropped_thumbnail_size(content.essence.render_size.blank? ? options[:image_size] : content.essence.render_size),
41
+ :crop_from => content.essence.crop_from.blank? ? nil : content.essence.crop_from,
42
+ :crop_size => content.essence.crop_size.blank? ? nil : content.essence.crop_size,
43
+ :crop => content.essence.crop_size.blank? && content.essence.crop_from.blank? ? 'crop' : nil,
44
+ :name => content.ingredient.urlname
45
+ ),
46
+ :alt => content.ingredient.name,
47
+ :class => 'img_paddingtop',
48
+ :title => t("image_name") + ": #{content.ingredient.name}",
49
+ :onload => "Alchemy.fadeImage(this, '##{content_dom_id(content)} .picture_content_spinner');",
50
+ :style => "display: none;"
51
+ ) %>
52
+ <%= hidden_field_tag content.form_field_name(:picture_id), content.ingredient.id %>
53
+ <% end %>
54
+ </div>
55
+ </div>
56
+ <%- unless options[:css_class].blank? || content.essence.css_class.blank? -%>
57
+ <div class="essence_picture_css_class">
58
+ <%= t("alchemy.essence_pictures.css_classes.#{content.essence.css_class}", :default => content.essence.css_class.camelcase) %>
59
+ </div>
60
+ <%- end -%>
61
+ <div class="edit_images_bottom">
62
+ <%= render(
63
+ :partial => 'alchemy/essences/essence_picture_tools',
64
+ :locals => {
65
+ :content => content,
66
+ :options => options
67
+ }
68
+ ) %>
69
+ </div>
70
+ </div>
71
+ <%= hidden_field_tag content.form_field_name(:link), content.essence.link %>
72
+ <%= hidden_field_tag content.form_field_name(:link_title), content.essence.link_title %>
73
+ <%= hidden_field_tag content.form_field_name(:link_class_name), content.essence.link_class_name %>
74
+ <%= hidden_field_tag content.form_field_name(:link_target), content.essence.link_target %>
69
75
  </div>
data/bin/alchemy CHANGED
@@ -29,107 +29,113 @@ class AlchemyInstaller < Thor
29
29
  method_option :database, :type => :string, :default => 'mysql', :aliases => "-d", :desc => "Type of database to use for this project. Default mysql."
30
30
  def new(project)
31
31
  @application = project.downcase.strip.gsub(/ /, '_')
32
- if yes?("Install Alchemy CMS into ./#{@application}? (y/N)")
32
+ say "Install Alchemy CMS into ./#{@application}", :yellow
33
+ say "Generating new Rails App...", :yellow
34
+
35
+ if system("rails _#{RAILS_VERSION}_ 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' : ''}")
33
36
 
34
- say "Generating new Rails App...", :yellow
37
+ create_database_yml if options[:database] == 'mysql'
35
38
 
36
- if system("rails _#{RAILS_VERSION}_ 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
-
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 }
39
+ mountpoint = ask "\nWhere do you want to mount Alchemy CMS? (/)"
40
+ mountpoint = "/" if mountpoint.empty?
41
+ sentinel = /\.routes\.draw do(?:\s*\|map\|)?\s*$/
42
+ inject_into_file "#{@application}/config/routes.rb", "\n mount Alchemy::Engine => '#{mountpoint}'\n", { :after => sentinel, :verbose => true }
43
+
44
+ with_standard_set = yes?("\nDo you want to copy the files of Alchemy´s Standardset into your App? (y/N)")
45
+
46
+ if with_standard_set
47
+ sentinel = /::Application\.configure do\s*$/
48
+ inject_into_file "#{@application}/environments/production.rb", "\n config.assets.precompile += %w( alchemy/standard_set.css )\n", { :after => sentinel, :verbose => true }
49
+ end
50
+
51
+ %x[
52
+ cd ./#{@application}
53
+ rails g alchemy:scaffold#{' --with-standard-set' if with_standard_set}
54
+ rm ./public/index.html
55
+ rm ./app/views/layouts/application.html.erb
56
+ rm ./app/assets/images/rails.png
57
+ ]
58
+
59
+ if !options[:scm].nil? && !options[:scm].empty?
44
60
 
45
- with_standard_set = yes?("\nDo you want to copy the files of Alchemy´s Standardset into your App? (y/N)")
61
+ clean_mountpoint = mountpoint.gsub('/', '')
46
62
 
47
63
  %x[
48
64
  cd ./#{@application}
49
- rails g alchemy:scaffold#{' --with-standard-set' if with_standard_set}
50
- rm ./public/index.html
51
- rm ./app/assets/images/rails.png
65
+ rm -rf ./tmp/*
66
+ rm -rf ./log/*
67
+ mkdir -p ./index
68
+ mkdir -p ./uploads
52
69
  ]
53
70
 
54
- if !options[:scm].nil? && !options[:scm].empty?
55
-
56
- clean_mountpoint = mountpoint.gsub('/', '')
57
-
58
- %x[
59
- cd ./#{@application}
60
- rm -rf ./tmp/*
61
- rm -rf ./log/*
62
- mkdir -p ./index
63
- mkdir -p ./uploads
64
- ]
65
-
66
- if yes?("\nDo you want to generate a deploy script for Capistrano? (y/N)")
67
- system "cd #{@application} && rails g alchemy:deploy_script --scm=#{options[:scm]} --db=#{options[:database]}"
68
- say "\nCapifying...", :yellow
69
- system "cd #{@application} && capify ."
70
- end
71
-
72
- case options[:scm]
73
- when 'svn'
74
- server = ask("\nURL of your svn server:")
75
- repository = ask("\nName of the repository (#{@application}):")
76
- repository = @application if repository.empty?
77
-
78
- say "\nImporting #{@application} into #{server}/#{repository} ...", :yellow
79
- output = %x[svn import ./#{@application} #{server}/#{repository} -m 'initial import by Alchemy installer']; imported = $?.success?
71
+ if yes?("\nDo you want to generate a deploy script for Capistrano? (y/N)")
72
+ system "cd #{@application} && rails g alchemy:deploy_script --scm=#{options[:scm]} --db=#{options[:database]}"
73
+ say "\nCapifying...", :yellow
74
+ system "cd #{@application} && capify ."
75
+ end
76
+
77
+ case options[:scm]
78
+ when 'svn'
79
+ server = ask("\nURL of your svn server:")
80
+ repository = ask("\nName of the repository (#{@application}):")
81
+ repository = @application if repository.empty?
82
+
83
+ say "\nImporting #{@application} into #{server}/#{repository} ...", :yellow
84
+ output = %x[svn import ./#{@application} #{server}/#{repository} -m 'initial import by Alchemy installer']; imported = $?.success?
85
+
86
+ if imported
80
87
 
81
- if imported
82
-
83
- say "Removing and checking out again...", :yellow
84
- %x[
85
- rm -rf ./#{@application}
86
- svn co #{server}/#{repository} #{@application}
87
- ]
88
-
89
- say "Committing ignores...", :yellow
90
- %x[
91
- cd ./#{@application}
92
- svn propset svn:ignore '*' tmp/ log/ index/ uploads/
93
- svn propset svn:ignore '#{clean_mountpoint.empty? ? 'pictures' : clean_mountpoint}' ./public
94
- svn propset svn:ignore 'assets' ./public
95
- svn propset svn:ignore 'database.yml' ./config
96
- svn commit -m 'set ignores'
97
- ]
98
-
99
- else
100
- say "Error while importing!", :red
101
- end
88
+ say "Removing and checking out again...", :yellow
89
+ %x[
90
+ rm -rf ./#{@application}
91
+ svn co #{server}/#{repository} #{@application}
92
+ ]
102
93
 
103
- when 'git'
104
- gitignore = <<-GIT
105
- log/*
106
- tmp/*
107
- .DS_Store
108
- upload/*
109
- index/*
110
- public/#{clean_mountpoint.empty? ? 'pictures' : clean_mountpoint}
111
- public/assets
112
- config/database.yml
113
- GIT
94
+ say "Committing ignores...", :yellow
114
95
  %x[
115
- cd #{@application}
116
- echo "#{gitignore}" > .gitignore
117
- touch ./index/.gitkeep
118
- touch ./uploads/.gitkeep
119
- git init .
120
- git add .
121
- git commit -am 'inital commit'
96
+ cd ./#{@application}
97
+ svn propset svn:ignore '*' tmp/ log/ index/ uploads/
98
+ svn propset svn:ignore '#{clean_mountpoint.empty? ? 'pictures' : clean_mountpoint}' ./public
99
+ svn propset svn:ignore 'assets' ./public
100
+ svn propset svn:ignore 'database.yml' ./config
101
+ svn commit -m 'set ignores'
122
102
  ]
123
- end
124
-
103
+
104
+ else
105
+ say "Error while importing!", :red
106
+ end
107
+
108
+ when 'git'
109
+ gitignore = <<-GIT
110
+ log/*
111
+ tmp/*
112
+ .DS_Store
113
+ upload/*
114
+ index/*
115
+ public/#{clean_mountpoint.empty? ? 'pictures' : clean_mountpoint}
116
+ public/assets
117
+ config/database.yml
118
+ GIT
119
+
120
+ %x[
121
+ cd #{@application}
122
+ echo "#{gitignore}" > .gitignore
123
+ touch ./index/.gitkeep
124
+ touch ./uploads/.gitkeep
125
+ git init .
126
+ git add .
127
+ git commit -am 'inital commit'
128
+ ]
125
129
  end
126
130
 
127
- %x[
128
- cd ./#{@application}
129
- rake db:create alchemy:install:migrations db:migrate alchemy:db:seed
130
- ]
131
-
132
- readme = <<-EOF
131
+ end
132
+
133
+ %x[
134
+ cd ./#{@application}
135
+ rake db:create alchemy:install:migrations db:migrate alchemy:db:seed
136
+ ]
137
+
138
+ readme = <<-EOF
133
139
 
134
140
  Successfully installed Alchemy CMS into ./#{@application}
135
141
 
@@ -137,15 +143,15 @@ Next steps:
137
143
 
138
144
  1. Go into your projects folder:
139
145
 
140
- cd ./#{@application}
146
+ cd ./#{@application}
141
147
 
142
148
  2. Start your local Rails server:
143
149
 
144
- rails server
150
+ rails server
145
151
 
146
152
  3. Open a browser and enter the following URL:
147
153
 
148
- http://localhost:3000
154
+ http://localhost:3000
149
155
 
150
156
  4. Follow the instructions to complete the installation!
151
157
 
@@ -153,13 +159,9 @@ Thank you for using Alchemy CMS!
153
159
  http://alchemy-cms.com
154
160
 
155
161
  EOF
156
- say readme, :green
157
- else
158
- say "\nError while installation!\n", :red
159
- end
160
-
162
+ say readme, :green
161
163
  else
162
- return
164
+ say "\nError while installation!\n", :red
163
165
  end
164
166
  end
165
167
 
@@ -250,7 +250,7 @@ de:
250
250
  "Please check contents below.": "Bitte überprüfen Sie die markierten Felder."
251
251
  "Please choose": "Bitte wählen"
252
252
  "Please choose a page layout.": "Bitte wählen Sie einen Seitentyp."
253
- "Please choose an element.": "Bitte wählen Sie ein Element."
253
+ choose_element: "Bitte wählen Sie ein Element."
254
254
  "Please log in": "Bitte melden Sie sich an."
255
255
  use_alternative_uploader_instead: "Benutzen Sie bitte diesen alternativen Uploader."
256
256
  "Publish page": "veröffentlichen"
@@ -274,9 +274,9 @@ de:
274
274
  "Successfully deleted content": "%{content} wurde gelöscht"
275
275
  "Successfully saved content position": "Die Position wurde gespeichert."
276
276
  "Switch to Flash® Uploader": "Auf den Flash® Uploader wechseln"
277
- "The sitemap is autogenerated.": "Die Sitemap wird automatisch generiert"
278
- "This element displays the search and the searchresults.": "Dieses Element stellt die Suchergebnisse dar. Es Bedarf keinerlei Anpassung."
279
- "This element has unsaved changes. Do you really want to fold it?": "Dieses Element hat nicht gespeicherte Änderungen. Möchten Sie es wirklich einklappen?"
277
+ sitemap_editor_info: "Die Sitemap wird automatisch generiert"
278
+ searchresults_editor_info: "Dieses Element stellt die Suchergebnisse dar. Es Bedarf keinerlei Anpassung."
279
+ element_dirty_notice: "Dieses Element hat nicht gespeicherte Änderungen. Möchten Sie es wirklich einklappen?"
280
280
  "This page is locked by %{name}": "Diese Seite wird gerade von %{name} blockiert"
281
281
  "Title": "Titel"
282
282
  "To manage your website open a browser and go to": "Um die Inhalte Ihrer Webseite zu bearbeiten klicken Sie bitte auf folgenden Link"
@@ -299,9 +299,7 @@ de:
299
299
  "Who else is online": "Wer ist noch online"
300
300
  "Yes": "Ja"
301
301
  "You are not authorized": "Sie sind dazu nicht authorisiert."
302
- "You have unsaved elements on this page. Do you really want to clear the page cache?": "Sie haben ungesicherte Elemente auf der Seite. Möchten Sie den Cache wirklich löschen?"
303
- "You have unsaved elements on this page. Do you really want to leave this page?": "Sie haben ungesicherte Elemente auf der Seite. Möchten Sie die Seite wirklich verlassen?"
304
- "You have unsaved elements. Do you really want to close the elements window?": "Sie haben ungesicherte Elemente. Möchten Sie das Elemente Fenster wirklich schließen?"
302
+ element_dirty_close_window_notice: "Sie haben ungesicherte Elemente. Möchten Sie das Elemente Fenster wirklich schließen?"
305
303
  "You may upload files with following extensions": "Sie können %{file_types_description} mit folgenden Endungen hochladen: %{file_types}"
306
304
  "You may upload any file": "Sie können jede Art von Datei hochladen."
307
305
  "Your last login was on %{time}": "Sie waren zuletzt angemeldet am %{time}."
@@ -364,6 +362,7 @@ de:
364
362
  edit_page: "Seite bearbeiten"
365
363
  edit_page_properties: "Seiteneigenschaften bearbeiten"
366
364
  edit_user: "Benutzer bearbeiten"
365
+ element_dirty_page_leave_warning: "Sie haben ungesicherte Elemente auf der Seite. Möchten Sie wirklich fortfahren?"
367
366
  element_editor_not_found: "Bei diesem Element ist ein Fehler aufgetreten"
368
367
  element_of_type: "Element"
369
368
  element_saved: "Element wurde gespeichert."
@@ -466,6 +465,7 @@ de:
466
465
  previous_page: "vorherige Seite"
467
466
  password: "Passwort"
468
467
  paste: "einfügen"
468
+ picture_gallery_editor: 'Bilder'
469
469
  place_link: "Text verlinken"
470
470
  player_version: "Flashplayer Version"
471
471
  "please enter a name": "Bitte geben Sie einen Namen ein."
@@ -186,6 +186,7 @@ en:
186
186
  big_thumbnails: "Big thumbnails"
187
187
  choose_element_as_target: "Please choose an element as target"
188
188
  choose_element_to_link: "Please choose an element"
189
+ choose_element: "Please choose an element."
189
190
  choose_file_to_link: "Please choose a file to link"
190
191
  click_to_show_all: "Click to show all again."
191
192
  confirm_to_delete_file: "Do you really want to delete this file from the server?"
@@ -219,6 +220,9 @@ en:
219
220
  edit_page: "Edit this page"
220
221
  edit_page_properties: "Edit the page´s properties."
221
222
  edit_user: "Edit the user´s properties."
223
+ element_dirty_notice: "This element has unsaved changes. Do you really want to fold it?"
224
+ element_dirty_close_window_notice: "You have unsaved elements. Do you really want to close the elements window?"
225
+ element_dirty_page_leave_warning: "You have unsaved elements on this page. Do you really want to continue?"
222
226
  element_editor_not_found: "Error within this Element"
223
227
  element_of_type: "Element"
224
228
  element_saved: "Saved element."
@@ -307,6 +311,7 @@ en:
307
311
  next_page: "next page"
308
312
  previous_page: "previous page"
309
313
  password: "Password"
314
+ picture_gallery_editor: 'Pictures'
310
315
  "Picture uploaded succesfully": "Picture %{name} uploaded succesfully"
311
316
  "Picture renamed successfully": "Picture renamed successfully from %{from} to %{to}"
312
317
  "Picture deleted successfully": "Picture %{name} deleted"
@@ -327,6 +332,8 @@ en:
327
332
  show_eq: "Show EQ"
328
333
  show_navigation: "Show in navigation"
329
334
  show_page_in_sitemap: "Show page in sitemap."
335
+ sitemap_editor_notice: "The sitemap is autogenerated."
336
+ searchresults_editor_info: "This element displays the search and the searchresults."
330
337
  small_thumbnails: "Small thumbnails"
331
338
  successfully_added_element: "Succesfully added new element."
332
339
  successfully_saved_element_position: "Element position updated succesfully."
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
 
3
- VERSION = "2.1.1"
3
+ VERSION = "2.1.2"
4
4
 
5
5
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alchemy::EssencePicture do
4
+
5
+ it "should not store negative values for crop_from" do
6
+ essence = Alchemy::EssencePicture.new(:crop_from => '-1x100')
7
+ essence.save!
8
+ essence.crop_from.should == "0x100"
9
+ end
10
+
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-01-29 00:00:00.000000000 Z
14
+ date: 2012-02-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
18
- requirement: &70362121763680 !ruby/object:Gem::Requirement
18
+ requirement: &70295293852440 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 3.1.3
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70362121763680
26
+ version_requirements: *70295293852440
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: authlogic
29
- requirement: &70362121763060 !ruby/object:Gem::Requirement
29
+ requirement: &70295293851260 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70362121763060
37
+ version_requirements: *70295293851260
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: awesome_nested_set
40
- requirement: &70362121762500 !ruby/object:Gem::Requirement
40
+ requirement: &70295293848080 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '2.0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70362121762500
48
+ version_requirements: *70295293848080
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: declarative_authorization
51
- requirement: &70362121761980 !ruby/object:Gem::Requirement
51
+ requirement: &70295293862020 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ~>
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 0.5.4
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *70362121761980
59
+ version_requirements: *70295293862020
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: tvdeyen-fleximage
62
- requirement: &70362121761320 !ruby/object:Gem::Requirement
62
+ requirement: &70295293859620 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ~>
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: 1.0.9
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *70362121761320
70
+ version_requirements: *70295293859620
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: will_paginate
73
- requirement: &70362121760820 !ruby/object:Gem::Requirement
73
+ requirement: &70295293856680 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ~>
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '3.0'
79
79
  type: :runtime
80
80
  prerelease: false
81
- version_requirements: *70362121760820
81
+ version_requirements: *70295293856680
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: acts_as_ferret
84
- requirement: &70362121760340 !ruby/object:Gem::Requirement
84
+ requirement: &70295293869400 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ~>
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: '0.5'
90
90
  type: :runtime
91
91
  prerelease: false
92
- version_requirements: *70362121760340
92
+ version_requirements: *70295293869400
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: acts_as_list
95
- requirement: &70362121683540 !ruby/object:Gem::Requirement
95
+ requirement: &70295293867480 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ~>
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: '0.1'
101
101
  type: :runtime
102
102
  prerelease: false
103
- version_requirements: *70362121683540
103
+ version_requirements: *70295293867480
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: magiclabs-userstamp
106
- requirement: &70362121682980 !ruby/object:Gem::Requirement
106
+ requirement: &70295293865640 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ~>
@@ -111,10 +111,10 @@ dependencies:
111
111
  version: 2.0.2
112
112
  type: :runtime
113
113
  prerelease: false
114
- version_requirements: *70362121682980
114
+ version_requirements: *70295293865640
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: dynamic_form
117
- requirement: &70362121682480 !ruby/object:Gem::Requirement
117
+ requirement: &70295293864160 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ~>
@@ -122,10 +122,10 @@ dependencies:
122
122
  version: '1.1'
123
123
  type: :runtime
124
124
  prerelease: false
125
- version_requirements: *70362121682480
125
+ version_requirements: *70295293864160
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: jquery-rails
128
- requirement: &70362121681960 !ruby/object:Gem::Requirement
128
+ requirement: &70295293863160 !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ~>
@@ -133,10 +133,10 @@ dependencies:
133
133
  version: 1.0.16
134
134
  type: :runtime
135
135
  prerelease: false
136
- version_requirements: *70362121681960
136
+ version_requirements: *70295293863160
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: attachment_magic
139
- requirement: &70362121681440 !ruby/object:Gem::Requirement
139
+ requirement: &70295293876280 !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
142
142
  - - ~>
@@ -144,10 +144,10 @@ dependencies:
144
144
  version: 0.2.1
145
145
  type: :runtime
146
146
  prerelease: false
147
- version_requirements: *70362121681440
147
+ version_requirements: *70295293876280
148
148
  - !ruby/object:Gem::Dependency
149
149
  name: rspec-rails
150
- requirement: &70362121680920 !ruby/object:Gem::Requirement
150
+ requirement: &70295293872400 !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
153
153
  - - ~>
@@ -155,10 +155,10 @@ dependencies:
155
155
  version: '2.8'
156
156
  type: :development
157
157
  prerelease: false
158
- version_requirements: *70362121680920
158
+ version_requirements: *70295293872400
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: sqlite3
161
- requirement: &70362121680540 !ruby/object:Gem::Requirement
161
+ requirement: &70295293884580 !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
164
  - - ! '>='
@@ -166,7 +166,7 @@ dependencies:
166
166
  version: '0'
167
167
  type: :development
168
168
  prerelease: false
169
- version_requirements: *70362121680540
169
+ version_requirements: *70295293884580
170
170
  description: Alchemy is a Rails 3 CMS with a flexible content storing architecture.
171
171
  email:
172
172
  - alchemy@magiclabs.de
@@ -674,6 +674,7 @@ files:
674
674
  - spec/integration/security_spec.rb
675
675
  - spec/models/content_spec.rb
676
676
  - spec/models/element_spec.rb
677
+ - spec/models/essence_picture_spec.rb
677
678
  - spec/models/essence_richtext_spec.rb
678
679
  - spec/models/language_spec.rb
679
680
  - spec/models/page_spec.rb
@@ -807,7 +808,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
807
808
  version: '0'
808
809
  segments:
809
810
  - 0
810
- hash: 395153038709539496
811
+ hash: -3492770316894394278
811
812
  required_rubygems_version: !ruby/object:Gem::Requirement
812
813
  none: false
813
814
  requirements:
@@ -816,7 +817,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
816
817
  version: '0'
817
818
  segments:
818
819
  - 0
819
- hash: 395153038709539496
820
+ hash: -3492770316894394278
820
821
  requirements:
821
822
  - ImageMagick (libmagick), v6.6 or greater.
822
823
  rubyforge_project:
@@ -882,6 +883,7 @@ test_files:
882
883
  - spec/integration/security_spec.rb
883
884
  - spec/models/content_spec.rb
884
885
  - spec/models/element_spec.rb
886
+ - spec/models/essence_picture_spec.rb
885
887
  - spec/models/essence_richtext_spec.rb
886
888
  - spec/models/language_spec.rb
887
889
  - spec/models/page_spec.rb