ecm_pictures 0.0.21 → 1.0.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +20 -4
 - data/app/helpers/ecm/pictures_helper.rb +41 -38
 - data/app/helpers/markup_helper.rb +7 -0
 - data/app/models/ecm/pictures/picture.rb +22 -1
 - data/app/models/ecm/pictures/picture_gallery.rb +12 -1
 - data/app/views/ecm/pictures/picture_galleries/_picture_gallery.html.erb +12 -0
 - data/app/views/ecm/pictures/picture_galleries/_picture_gallery_for_index.html.erb +12 -0
 - data/app/views/ecm/pictures/pictures/_picture.html.erb +7 -0
 - data/app/views/ecm/pictures/pictures/_picture_for_gallery.html.erb +9 -0
 - data/config/locales/ecm.pictures.de.yml +11 -3
 - data/config/locales/ecm.pictures.en.yml +15 -0
 - data/config/locales/ecm.pictures.picture.de.yml +3 -1
 - data/config/locales/ecm.pictures.picture.en.yml +23 -0
 - data/config/locales/ecm.pictures.picture_gallery.de.yml +3 -2
 - data/config/locales/ecm.pictures.picture_gallery.en.yml +19 -0
 - data/db/migrate/001_create_ecm_pictures_picture_galleries.rb +6 -1
 - data/db/migrate/002_create_ecm_pictures_pictures.rb +6 -3
 - data/lib/ecm/pictures/active_admin/ecm_pictures_picture_galleries.rb +11 -3
 - data/lib/ecm/pictures/active_admin/ecm_pictures_pictures.rb +12 -2
 - data/lib/ecm/pictures/configuration.rb +11 -0
 - data/lib/ecm/pictures/engine.rb +1 -15
 - data/lib/ecm/pictures/version.rb +1 -1
 - data/lib/ecm_pictures.rb +1 -7
 - data/lib/generators/ecm/pictures/install/templates/ecm_pictures.rb +16 -1
 - data/lib/generators/ecm/pictures/locales/locales_generator.rb +3 -3
 - data/lib/tasks/ecm_pictures_tasks.rake +2 -0
 - metadata +84 -52
 - data/app/assets/images/orangebox/buttons.png +0 -0
 - data/app/assets/images/orangebox/loading.gif +0 -0
 - data/app/assets/javascripts/ecm_pictures.js +0 -1
 - data/app/assets/javascripts/orangebox/orangebox.js +0 -719
 - data/app/assets/javascripts/orangebox/orangebox.min.js +0 -8
 - data/app/assets/stylesheets/ecm_pictures.css.scss +0 -1
 - data/app/assets/stylesheets/orangebox/orangebox.css.erb +0 -160
 
    
        data/README.rdoc
    CHANGED
    
    | 
         @@ -12,21 +12,37 @@ in your ruby on rails applictation. Orangebox is used for lightbox support. 
     | 
|
| 
       12 
12 
     | 
    
         
             
              * Lightbox support.
         
     | 
| 
       13 
13 
     | 
    
         
             
              * Picture and Gallery sorting.
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       15 
16 
     | 
    
         
             
            = Installation
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       17 
19 
     | 
    
         
             
            Add it to your gemfile:
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
              # Gemfile
         
     | 
| 
       19 
22 
     | 
    
         
             
              gem 'ecm_pictures'
         
     | 
| 
       20 
23 
     | 
    
         | 
| 
       21 
24 
     | 
    
         
             
            Install your bundle:
         
     | 
| 
       22 
25 
     | 
    
         | 
| 
       23 
26 
     | 
    
         
             
              > bundle install
         
     | 
| 
       24 
27 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
            Generate initializer:
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              > rails generate ecm:pictures:install 
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            Generatre the migrations:
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              > rake ecm_pictures_engine:install:migrations
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            Migrate:
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              > rake db:migrate
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              
         
     | 
| 
      
 41 
     | 
    
         
            +
            == Optional: Generate locale files
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            You may want to copy the locales to your app:
         
     | 
| 
       26 
44 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
              <%= javascript_include_tag "ecm_pictures" %>
         
     | 
| 
       29 
     | 
    
         
            -
              <%= stylesheet_link_tag "ecm_pictures" %>
         
     | 
| 
      
 45 
     | 
    
         
            +
              > rails generate ecm:pictures:locales
         
     | 
| 
       30 
46 
     | 
    
         | 
| 
       31 
47 
     | 
    
         
             
            = Usage
         
     | 
| 
       32 
48 
     | 
    
         | 
| 
         @@ -3,65 +3,68 @@ module Ecm::PicturesHelper 
     | 
|
| 
       3 
3 
     | 
    
         
             
              #
         
     | 
| 
       4 
4 
     | 
    
         
             
              # = Usage
         
     | 
| 
       5 
5 
     | 
    
         
             
              #
         
     | 
| 
       6 
     | 
    
         
            -
              # Assume you have created a picture gallery named "Holidays 2012". You can 
     | 
| 
      
 6 
     | 
    
         
            +
              # Assume you have created a picture gallery named "Holidays 2012". You can
         
     | 
| 
       7 
7 
     | 
    
         
             
              # render it in your view as follows:
         
     | 
| 
       8 
     | 
    
         
            -
              # 
     | 
| 
      
 8 
     | 
    
         
            +
              #
         
     | 
| 
       9 
9 
     | 
    
         
             
              #  <%= render_picture_gallery 'Holidays 2012' %>
         
     | 
| 
       10 
10 
     | 
    
         
             
              def render_picture_gallery(name, options = {})
         
     | 
| 
       11 
     | 
    
         
            -
                begin 
     | 
| 
      
 11 
     | 
    
         
            +
                begin
         
     | 
| 
       12 
12 
     | 
    
         
             
                  options = {:preview_style => :thumb}.merge(options)
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       14 
14 
     | 
    
         
             
                  gallery = Ecm::Pictures::PictureGallery.where(:name => name.to_s).first
         
     | 
| 
       15 
15 
     | 
    
         
             
                  gallery_identifier = gallery.to_param rescue 'missing'
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                   
     | 
| 
       18 
     | 
    
         
            -
                     
     | 
| 
       19 
     | 
    
         
            -
                      content_tag(: 
     | 
| 
       20 
     | 
    
         
            -
                        I18n.t('ecm.pictures.warnings.missing_gallery', :name => name.to_s)
         
     | 
| 
       21 
     | 
    
         
            -
                      end      
         
     | 
| 
       22 
     | 
    
         
            -
                    else
         
     | 
| 
       23 
     | 
    
         
            -
                      content_tag(:h1, gallery.name) +
         
     | 
| 
       24 
     | 
    
         
            -
                      content_tag(:p, gallery.description, {:class => 'picture-gallery-description'}) +
         
     | 
| 
       25 
     | 
    
         
            -
                      content_tag(:ul, {:class => 'pictures'}) do
         
     | 
| 
       26 
     | 
    
         
            -
                        gallery.pictures.collect do |picture|
         
     | 
| 
       27 
     | 
    
         
            -
                         content_tag(:li, {:class => 'picture', :id => "picture-#{picture.to_param}"}) do
         
     | 
| 
       28 
     | 
    
         
            -
                            concat(content_tag(:h2, picture.name, :class => 'picture-name')) unless picture.name.blank?
         
     | 
| 
       29 
     | 
    
         
            -
                            
         
     | 
| 
       30 
     | 
    
         
            -
                            # Check if we should link images or not.
         
     | 
| 
       31 
     | 
    
         
            -
                            if gallery.link_images
         
     | 
| 
       32 
     | 
    
         
            -
                              link_options = build_link_options_for_picture_in_gallery(gallery_identifier, picture)
         
     | 
| 
       33 
     | 
    
         
            -
                              concat(link_to(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description), "#{picture.image.url}#{File.extname(picture.image_file_name)}", link_options))
         
     | 
| 
       34 
     | 
    
         
            -
                            else 
         
     | 
| 
       35 
     | 
    
         
            -
                              concat(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description))
         
     | 
| 
       36 
     | 
    
         
            -
                            end
         
     | 
| 
       37 
     | 
    
         
            -
                            concat(content_tag(:div, picture.description, :class => 'picture-description'))
         
     | 
| 
       38 
     | 
    
         
            -
                          end
         
     | 
| 
       39 
     | 
    
         
            -
                        end.join.html_safe
         
     | 
| 
       40 
     | 
    
         
            -
                      end.html_safe
         
     | 
| 
      
 17 
     | 
    
         
            +
                  if gallery.nil?
         
     | 
| 
      
 18 
     | 
    
         
            +
                    content_tag(:div, :class => 'warning missing picture-gallery') do
         
     | 
| 
      
 19 
     | 
    
         
            +
                      content_tag(:p, I18n.t('ecm.pictures.picture_gallery.warnings.missing', :name => name.to_s))
         
     | 
| 
       41 
20 
     | 
    
         
             
                    end
         
     | 
| 
       42 
     | 
    
         
            -
                   
     | 
| 
      
 21 
     | 
    
         
            +
                  else
         
     | 
| 
      
 22 
     | 
    
         
            +
                    render gallery
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       43 
25 
     | 
    
         
             
                rescue Exception => e
         
     | 
| 
       44 
26 
     | 
    
         
             
                  return e.message
         
     | 
| 
       45 
     | 
    
         
            -
                end 
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
       46 
28 
     | 
    
         
             
              end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       48 
30 
     | 
    
         
             
              # helper method to build link options for images inside a gallery.
         
     | 
| 
       49 
31 
     | 
    
         
             
              def build_link_options_for_picture_in_gallery(gallery_identifier, picture)
         
     | 
| 
       50 
32 
     | 
    
         
             
                link_options = {}
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       52 
34 
     | 
    
         
             
                # Add gallery identifier for orange box
         
     | 
| 
       53 
     | 
    
         
            -
                link_options 
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
                link_options[:rel] = "lightbox[#{gallery_identifier}]"
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                # Add thumbnail class for twitter bootstrap
         
     | 
| 
      
 38 
     | 
    
         
            +
                link_options[:class] = "thumbnail"
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
       55 
40 
     | 
    
         
             
                # build the caption
         
     | 
| 
       56 
41 
     | 
    
         
             
                caption = ""
         
     | 
| 
       57 
     | 
    
         
            -
                caption << "< 
     | 
| 
       58 
     | 
    
         
            -
                caption << "< 
     | 
| 
      
 42 
     | 
    
         
            +
                caption << "<div class=\"caption-name\">#{picture.name}</div>" unless picture.name.blank?
         
     | 
| 
      
 43 
     | 
    
         
            +
                caption << "<div class=\"caption-description\">#{picture.description}</div>" unless picture.description.blank?
         
     | 
| 
       59 
44 
     | 
    
         
             
                link_options[:"data-ob_caption"] = caption if caption.size > 0
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       61 
46 
     | 
    
         
             
                return link_options
         
     | 
| 
       62 
47 
     | 
    
         
             
              end
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
       64 
49 
     | 
    
         
             
              # TODO: Implement this.
         
     | 
| 
       65 
50 
     | 
    
         
             
              def render_picture(name, options = {})
         
     | 
| 
      
 51 
     | 
    
         
            +
                begin
         
     | 
| 
      
 52 
     | 
    
         
            +
                  options = {:preview_style => :thumb}.merge(options)
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  picture = Ecm::Pictures::Picture.where(:name => name.to_s).first
         
     | 
| 
      
 55 
     | 
    
         
            +
                  # gallery_identifier = gallery.to_param rescue 'missing'
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  if picture.nil?
         
     | 
| 
      
 58 
     | 
    
         
            +
                    content_tag(:div, :class => 'warning missing picture') do
         
     | 
| 
      
 59 
     | 
    
         
            +
                      content_tag(:p, I18n.t('ecm.pictures.picture.warnings.missing', :name => name.to_s))
         
     | 
| 
      
 60 
     | 
    
         
            +
                    end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  else
         
     | 
| 
      
 62 
     | 
    
         
            +
                    render picture
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                rescue Exception => e
         
     | 
| 
      
 66 
     | 
    
         
            +
                  return e.message
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
       66 
68 
     | 
    
         
             
              end
         
     | 
| 
       67 
69 
     | 
    
         
             
            end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
         @@ -7,14 +7,19 @@ class Ecm::Pictures::Picture < ActiveRecord::Base 
     | 
|
| 
       7 
7 
     | 
    
         
             
              # attributes
         
     | 
| 
       8 
8 
     | 
    
         
             
              attr_accessible :description,
         
     | 
| 
       9 
9 
     | 
    
         
             
                              :image,
         
     | 
| 
      
 10 
     | 
    
         
            +
                              :markup_language,
         
     | 
| 
       10 
11 
     | 
    
         
             
                              :name,
         
     | 
| 
       11 
12 
     | 
    
         
             
                              :picture_gallery_id,
         
     | 
| 
       12 
13 
     | 
    
         
             
                              :position
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
              # acts as list
         
     | 
| 
       15 
16 
     | 
    
         
             
              acts_as_list :scope => :picture_gallery
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              # acts as markup
         
     | 
| 
      
 19 
     | 
    
         
            +
              acts_as_markup :language => :variable, :columns => [ :description, :description ]
         
     | 
| 
       16 
20 
     | 
    
         | 
| 
       17 
21 
     | 
    
         
             
              # callbacks
         
     | 
| 
      
 22 
     | 
    
         
            +
              after_initialize :set_defaults
         
     | 
| 
       18 
23 
     | 
    
         
             
              before_validation :set_name_from_image_file_name, :if => Proc.new { |p| ( p.name.nil? || p.name.empty? ) }
         
     | 
| 
       19 
24 
     | 
    
         | 
| 
       20 
25 
     | 
    
         
             
              # default scope
         
     | 
| 
         @@ -26,14 +31,30 @@ class Ecm::Pictures::Picture < ActiveRecord::Base 
     | 
|
| 
       26 
31 
     | 
    
         | 
| 
       27 
32 
     | 
    
         
             
              # paperclip
         
     | 
| 
       28 
33 
     | 
    
         
             
              has_attached_file :image,
         
     | 
| 
       29 
     | 
    
         
            -
                                :styles =>  
     | 
| 
      
 34 
     | 
    
         
            +
                                :styles => Ecm::Pictures::Configuration.picture_image_styles
         
     | 
| 
       30 
35 
     | 
    
         | 
| 
       31 
36 
     | 
    
         
             
              # validations
         
     | 
| 
       32 
37 
     | 
    
         
             
              # validates :image, :attachment_presence => true
         
     | 
| 
       33 
38 
     | 
    
         
             
              validates_attachment_presence :image
         
     | 
| 
      
 39 
     | 
    
         
            +
              validates :markup_language, :presence  => true,
         
     | 
| 
      
 40 
     | 
    
         
            +
                                          :inclusion => Ecm::Pictures::Configuration.markup_languages
         
     | 
| 
       34 
41 
     | 
    
         
             
              validates :name, :presence => true
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              def display_code
         
     | 
| 
      
 44 
     | 
    
         
            +
                "<%= render_picture '#{self.name}' %>"
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              def to_s
         
     | 
| 
      
 48 
     | 
    
         
            +
                name
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
       35 
50 
     | 
    
         | 
| 
       36 
51 
     | 
    
         
             
              private
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              def set_defaults
         
     | 
| 
      
 54 
     | 
    
         
            +
                if self.new_record?
         
     | 
| 
      
 55 
     | 
    
         
            +
                  self.markup_language ||= Ecm::Pictures::Configuration.default_markup_language
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
       37 
58 
     | 
    
         | 
| 
       38 
59 
     | 
    
         
             
              def set_name_from_image_file_name
         
     | 
| 
       39 
60 
     | 
    
         
             
                self.name = File.basename(image_file_name, File.extname(image_file_name)) unless image_file_name.nil?
         
     | 
| 
         @@ -9,6 +9,7 @@ class Ecm::Pictures::PictureGallery < ActiveRecord::Base 
     | 
|
| 
       9 
9 
     | 
    
         
             
              # attributes
         
     | 
| 
       10 
10 
     | 
    
         
             
              attr_accessible :description,
         
     | 
| 
       11 
11 
     | 
    
         
             
                              :link_images,
         
     | 
| 
      
 12 
     | 
    
         
            +
                              :markup_language,
         
     | 
| 
       12 
13 
     | 
    
         
             
                              :name,
         
     | 
| 
       13 
14 
     | 
    
         
             
                              :pictures_attributes,
         
     | 
| 
       14 
15 
     | 
    
         
             
                              :position
         
     | 
| 
         @@ -18,6 +19,9 @@ class Ecm::Pictures::PictureGallery < ActiveRecord::Base 
     | 
|
| 
       18 
19 
     | 
    
         
             
              acts_as_list
         
     | 
| 
       19 
20 
     | 
    
         
             
              default_scope :order => 'position ASC'
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
      
 22 
     | 
    
         
            +
              # acts as markup
         
     | 
| 
      
 23 
     | 
    
         
            +
              acts_as_markup :language => :variable, :columns => [ :description ]
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       21 
25 
     | 
    
         
             
              # callbacks
         
     | 
| 
       22 
26 
     | 
    
         
             
              after_initialize :set_defaults
         
     | 
| 
       23 
27 
     | 
    
         | 
| 
         @@ -26,6 +30,8 @@ class Ecm::Pictures::PictureGallery < ActiveRecord::Base 
     | 
|
| 
       26 
30 
     | 
    
         
             
              friendly_id :name, :use => :slugged
         
     | 
| 
       27 
31 
     | 
    
         | 
| 
       28 
32 
     | 
    
         
             
              # validations
         
     | 
| 
      
 33 
     | 
    
         
            +
              validates :markup_language, :presence  => true,
         
     | 
| 
      
 34 
     | 
    
         
            +
                                          :inclusion => Ecm::Pictures::Configuration.markup_languages
         
     | 
| 
       29 
35 
     | 
    
         
             
              validates :name, :presence => true,
         
     | 
| 
       30 
36 
     | 
    
         
             
                               :uniqueness => true
         
     | 
| 
       31 
37 
     | 
    
         | 
| 
         @@ -33,11 +39,16 @@ class Ecm::Pictures::PictureGallery < ActiveRecord::Base 
     | 
|
| 
       33 
39 
     | 
    
         
             
                "<%= render_picture_gallery '#{self.name}' %>"
         
     | 
| 
       34 
40 
     | 
    
         
             
              end
         
     | 
| 
       35 
41 
     | 
    
         | 
| 
      
 42 
     | 
    
         
            +
              def to_s
         
     | 
| 
      
 43 
     | 
    
         
            +
                name
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       36 
46 
     | 
    
         
             
              private
         
     | 
| 
       37 
47 
     | 
    
         | 
| 
       38 
48 
     | 
    
         
             
              def set_defaults
         
     | 
| 
       39 
     | 
    
         
            -
                if new_record?
         
     | 
| 
      
 49 
     | 
    
         
            +
                if self.new_record?
         
     | 
| 
       40 
50 
     | 
    
         
             
                  self.link_images = true if self.link_images.nil?
         
     | 
| 
      
 51 
     | 
    
         
            +
                  self.markup_language ||= Ecm::Pictures::Configuration.default_markup_language
         
     | 
| 
       41 
52 
     | 
    
         
             
                end
         
     | 
| 
       42 
53 
     | 
    
         
             
              end
         
     | 
| 
       43 
54 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <div class="picture-gallery" id="picture-gallery-<%= picture_gallery.id %>">
         
     | 
| 
      
 2 
     | 
    
         
            +
              <div class="picture-gallery-description">
         
     | 
| 
      
 3 
     | 
    
         
            +
                <%= mu picture_gallery, :description %>
         
     | 
| 
      
 4 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <div class="picture-gallery_pictures row-fluid">
         
     | 
| 
      
 6 
     | 
    
         
            +
                <ul class="thumbnails">
         
     | 
| 
      
 7 
     | 
    
         
            +
                  <% picture_gallery.pictures.each do |picture| %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                    <%= render :partial => 'ecm/pictures/pictures/picture_for_gallery', :locals => { :picture => picture } %>
         
     | 
| 
      
 9 
     | 
    
         
            +
                  <% end %>
         
     | 
| 
      
 10 
     | 
    
         
            +
                </ul>
         
     | 
| 
      
 11 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 12 
     | 
    
         
            +
            </div>
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <div class="thumbnail picture_gallery-preview span3" id="picture-gallery-<%= picture_gallery.id %>">
         
     | 
| 
      
 2 
     | 
    
         
            +
              <div class="picture-image">
         
     | 
| 
      
 3 
     | 
    
         
            +
                <%= image_tag picture_gallery.pictures.first.image.url(:default_thumb) %>  
         
     | 
| 
      
 4 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <div class="caption"> 
         
     | 
| 
      
 6 
     | 
    
         
            +
                <h3><%= picture_gallery.name %></h3>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <div class="description"><%= mu(picture_gallery, :description) %></div>
         
     | 
| 
      
 8 
     | 
    
         
            +
                <%= link_to t('ecm.pictures.actions.view'), picture_gallery, :class => 'btn btn-primary' %>
         
     | 
| 
      
 9 
     | 
    
         
            +
                <span class="pull-right small picture-count"><%= Ecm::Pictures::PictureGallery.human_attribute_name(:pictures) %>: <%= picture_gallery.pictures_count %></span> 
         
     | 
| 
      
 10 
     | 
    
         
            +
              </div> 
         
     | 
| 
      
 11 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <div class="row">
         
     | 
| 
      
 2 
     | 
    
         
            +
              <div class="picture span3" id="picture-<%= picture.to_param %>">
         
     | 
| 
      
 3 
     | 
    
         
            +
                <%= link_to("#{picture.image.url}#{File.extname(picture.image_file_name)}", :class => 'thumbnail') do %>
         
     | 
| 
      
 4 
     | 
    
         
            +
                  <%= image_tag(picture.image.url(:default_thumb)) %>
         
     | 
| 
      
 5 
     | 
    
         
            +
                <% end %>
         
     | 
| 
      
 6 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 7 
     | 
    
         
            +
            </div>
         
     | 
| 
         @@ -0,0 +1,9 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <li class="span4 picture" id="picture-<%= picture.to_param %>">
         
     | 
| 
      
 2 
     | 
    
         
            +
              <% if picture.picture_gallery.link_images %>
         
     | 
| 
      
 3 
     | 
    
         
            +
                <%= link_to("#{picture.image.url}#{File.extname(picture.image_file_name)}", :class => 'thumbnail') do %>
         
     | 
| 
      
 4 
     | 
    
         
            +
                  <%= image_tag(picture.image.url(:default_thumb)) %>
         
     | 
| 
      
 5 
     | 
    
         
            +
                <% end %>
         
     | 
| 
      
 6 
     | 
    
         
            +
              <% else %>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <%= image_tag(picture.image.url(:default_thumb), :class => 'thumbnail') %>
         
     | 
| 
      
 8 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 9 
     | 
    
         
            +
            </li>
         
     | 
| 
         @@ -1,7 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            de:
         
     | 
| 
      
 2 
     | 
    
         
            +
              back: Zurück
         
     | 
| 
       2 
3 
     | 
    
         
             
              ecm:
         
     | 
| 
       3 
4 
     | 
    
         
             
                pictures:
         
     | 
| 
      
 5 
     | 
    
         
            +
                  actions:
         
     | 
| 
      
 6 
     | 
    
         
            +
                    view: Anzeigen
         
     | 
| 
       4 
7 
     | 
    
         
             
                  active_admin:
         
     | 
| 
       5 
     | 
    
         
            -
                    menu: "Bilder" 
     | 
| 
       6 
     | 
    
         
            -
                   
     | 
| 
       7 
     | 
    
         
            -
                     
     | 
| 
      
 8 
     | 
    
         
            +
                    menu: "Bilder"
         
     | 
| 
      
 9 
     | 
    
         
            +
                  picture:
         
     | 
| 
      
 10 
     | 
    
         
            +
                    warnings:
         
     | 
| 
      
 11 
     | 
    
         
            +
                      missing: "Das Bild %{name} wurde nicht gefunden."
         
     | 
| 
      
 12 
     | 
    
         
            +
                  picture_gallery:
         
     | 
| 
      
 13 
     | 
    
         
            +
                    warnings:
         
     | 
| 
      
 14 
     | 
    
         
            +
                      missing: "Die Galerie %{name} wurde nicht gefunden."
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            en:
         
     | 
| 
      
 2 
     | 
    
         
            +
              back: back
         
     | 
| 
      
 3 
     | 
    
         
            +
              ecm:
         
     | 
| 
      
 4 
     | 
    
         
            +
                pictures:
         
     | 
| 
      
 5 
     | 
    
         
            +
                  actions:
         
     | 
| 
      
 6 
     | 
    
         
            +
                    view: view
         
     | 
| 
      
 7 
     | 
    
         
            +
                  active_admin:
         
     | 
| 
      
 8 
     | 
    
         
            +
                    menu: pictures
         
     | 
| 
      
 9 
     | 
    
         
            +
                  picture:
         
     | 
| 
      
 10 
     | 
    
         
            +
                    warnings:
         
     | 
| 
      
 11 
     | 
    
         
            +
                      missing_gallery: "Could not find picture %{name}"
         
     | 
| 
      
 12 
     | 
    
         
            +
                  picture_gallery:
         
     | 
| 
      
 13 
     | 
    
         
            +
                    warnings:
         
     | 
| 
      
 14 
     | 
    
         
            +
                      missing_gallery: "Could not find picture gallery %{name}"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
         @@ -8,13 +8,15 @@ de: 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  ecm/pictures/picture:
         
     | 
| 
       9 
9 
     | 
    
         
             
                    created_at: Erstellt am
         
     | 
| 
       10 
10 
     | 
    
         
             
                    description: Beschreibung
         
     | 
| 
      
 11 
     | 
    
         
            +
                    display_code: Anzeigecode
         
     | 
| 
       11 
12 
     | 
    
         
             
                    image: Datei
         
     | 
| 
       12 
13 
     | 
    
         
             
                    image_file: Datei
         
     | 
| 
       13 
14 
     | 
    
         
             
                    image_file_name: Dateiname
         
     | 
| 
       14 
15 
     | 
    
         
             
                    image_file_size: Größe
         
     | 
| 
       15 
16 
     | 
    
         
             
                    image_fingerprint: Fingerabdruck
         
     | 
| 
      
 17 
     | 
    
         
            +
                    markup_language: Markup Sprache
         
     | 
| 
       16 
18 
     | 
    
         
             
                    name: Name
         
     | 
| 
       17 
     | 
    
         
            -
                    picture_gallery:  
     | 
| 
      
 19 
     | 
    
         
            +
                    picture_gallery: Galerie
         
     | 
| 
       18 
20 
     | 
    
         
             
                    position: Position
         
     | 
| 
       19 
21 
     | 
    
         
             
                    thumbnail: Vorschau
         
     | 
| 
       20 
22 
     | 
    
         
             
                    updated_at: Aktualisiert am
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            en:
         
     | 
| 
      
 2 
     | 
    
         
            +
              activerecord:
         
     | 
| 
      
 3 
     | 
    
         
            +
                models:
         
     | 
| 
      
 4 
     | 
    
         
            +
                  ecm/pictures/picture:
         
     | 
| 
      
 5 
     | 
    
         
            +
                    one: picture
         
     | 
| 
      
 6 
     | 
    
         
            +
                    other: pictures
         
     | 
| 
      
 7 
     | 
    
         
            +
                attributes:
         
     | 
| 
      
 8 
     | 
    
         
            +
                  ecm/pictures/picture:
         
     | 
| 
      
 9 
     | 
    
         
            +
                    created_at: created at
         
     | 
| 
      
 10 
     | 
    
         
            +
                    description: description
         
     | 
| 
      
 11 
     | 
    
         
            +
                    display_code: display code
         
     | 
| 
      
 12 
     | 
    
         
            +
                    image: image
         
     | 
| 
      
 13 
     | 
    
         
            +
                    image_file: image
         
     | 
| 
      
 14 
     | 
    
         
            +
                    image_file_name: image filename
         
     | 
| 
      
 15 
     | 
    
         
            +
                    image_file_size: image size
         
     | 
| 
      
 16 
     | 
    
         
            +
                    image_fingerprint: image fingerprint
         
     | 
| 
      
 17 
     | 
    
         
            +
                    markup_language: markup language
         
     | 
| 
      
 18 
     | 
    
         
            +
                    name: name
         
     | 
| 
      
 19 
     | 
    
         
            +
                    picture_gallery: picture gallery
         
     | 
| 
      
 20 
     | 
    
         
            +
                    position: position
         
     | 
| 
      
 21 
     | 
    
         
            +
                    thumbnail: thumbnail
         
     | 
| 
      
 22 
     | 
    
         
            +
                    updated_at: updated at
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
         @@ -2,14 +2,15 @@ de: 
     | 
|
| 
       2 
2 
     | 
    
         
             
              activerecord:
         
     | 
| 
       3 
3 
     | 
    
         
             
                models:
         
     | 
| 
       4 
4 
     | 
    
         
             
                  ecm/pictures/picture_gallery:
         
     | 
| 
       5 
     | 
    
         
            -
                    one:  
     | 
| 
       6 
     | 
    
         
            -
                    other:  
     | 
| 
      
 5 
     | 
    
         
            +
                    one: Bildgalerie
         
     | 
| 
      
 6 
     | 
    
         
            +
                    other: Bildgalerien
         
     | 
| 
       7 
7 
     | 
    
         
             
                attributes:
         
     | 
| 
       8 
8 
     | 
    
         
             
                  ecm/pictures/picture_gallery:
         
     | 
| 
       9 
9 
     | 
    
         
             
                    created_at: Erstellt am
         
     | 
| 
       10 
10 
     | 
    
         
             
                    description: Beschreibung
         
     | 
| 
       11 
11 
     | 
    
         
             
                    display_code: Anzeigecode
         
     | 
| 
       12 
12 
     | 
    
         
             
                    link_images: Bilder verlinken
         
     | 
| 
      
 13 
     | 
    
         
            +
                    markup_language: Markup Sprache
         
     | 
| 
       13 
14 
     | 
    
         
             
                    name: Name
         
     | 
| 
       14 
15 
     | 
    
         
             
                    pictures: Bilder
         
     | 
| 
       15 
16 
     | 
    
         
             
                    pictures_count: Bilder
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            en:
         
     | 
| 
      
 2 
     | 
    
         
            +
              activerecord:
         
     | 
| 
      
 3 
     | 
    
         
            +
                models:
         
     | 
| 
      
 4 
     | 
    
         
            +
                  ecm/pictures/picture_gallery:
         
     | 
| 
      
 5 
     | 
    
         
            +
                    one: picture gallery
         
     | 
| 
      
 6 
     | 
    
         
            +
                    other: picture galleries
         
     | 
| 
      
 7 
     | 
    
         
            +
                attributes:
         
     | 
| 
      
 8 
     | 
    
         
            +
                  ecm/pictures/picture_gallery:
         
     | 
| 
      
 9 
     | 
    
         
            +
                    created_at: created at
         
     | 
| 
      
 10 
     | 
    
         
            +
                    description: description
         
     | 
| 
      
 11 
     | 
    
         
            +
                    display_code: display code
         
     | 
| 
      
 12 
     | 
    
         
            +
                    link_images: link images
         
     | 
| 
      
 13 
     | 
    
         
            +
                    markup_language: markup language
         
     | 
| 
      
 14 
     | 
    
         
            +
                    name: name
         
     | 
| 
      
 15 
     | 
    
         
            +
                    pictures: pictures
         
     | 
| 
      
 16 
     | 
    
         
            +
                    pictures_count: pictures
         
     | 
| 
      
 17 
     | 
    
         
            +
                    position: position
         
     | 
| 
      
 18 
     | 
    
         
            +
                    updated_at: updated at
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
         @@ -4,10 +4,15 @@ class CreateEcmPicturesPictureGalleries < ActiveRecord::Migration 
     | 
|
| 
       4 
4 
     | 
    
         
             
                  t.string :name
         
     | 
| 
       5 
5 
     | 
    
         
             
                  t.text :description
         
     | 
| 
       6 
6 
     | 
    
         
             
                  t.boolean :link_images
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  # associations
         
     | 
| 
      
 9 
     | 
    
         
            +
                  t.integer :pictures_count, :default => 0, :null => false
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
       9 
11 
     | 
    
         
             
                  # acts as list
         
     | 
| 
       10 
12 
     | 
    
         
             
                  t.integer :position
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  # acts as markup
         
     | 
| 
      
 15 
     | 
    
         
            +
                  t.string :markup_language
         
     | 
| 
       11 
16 
     | 
    
         | 
| 
       12 
17 
     | 
    
         
             
                  # friendly id
         
     | 
| 
       13 
18 
     | 
    
         
             
                  t.string :slug
         
     | 
| 
         @@ -3,9 +3,15 @@ class CreateEcmPicturesPictures < ActiveRecord::Migration 
     | 
|
| 
       3 
3 
     | 
    
         
             
                create_table :ecm_pictures_pictures do |t|
         
     | 
| 
       4 
4 
     | 
    
         
             
                  t.string :name
         
     | 
| 
       5 
5 
     | 
    
         
             
                  t.text :description
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  # associations
         
     | 
| 
      
 8 
     | 
    
         
            +
                  t.references :picture_gallery
         
     | 
| 
       6 
9 
     | 
    
         | 
| 
       7 
10 
     | 
    
         
             
                  # acts as list
         
     | 
| 
       8 
11 
     | 
    
         
             
                  t.integer :position
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  # acts as markup
         
     | 
| 
      
 14 
     | 
    
         
            +
                  t.string :markup_language
         
     | 
| 
       9 
15 
     | 
    
         | 
| 
       10 
16 
     | 
    
         
             
                  # friendly id
         
     | 
| 
       11 
17 
     | 
    
         
             
                  t.string :slug
         
     | 
| 
         @@ -17,9 +23,6 @@ class CreateEcmPicturesPictures < ActiveRecord::Migration 
     | 
|
| 
       17 
23 
     | 
    
         
             
                  t.string :image_content_type
         
     | 
| 
       18 
24 
     | 
    
         
             
                  t.timestamp :image_updated_at
         
     | 
| 
       19 
25 
     | 
    
         
             
                  t.string :image_fingerprint
         
     | 
| 
       20 
     | 
    
         
            -
                  
         
     | 
| 
       21 
     | 
    
         
            -
                  # references
         
     | 
| 
       22 
     | 
    
         
            -
                  t.references :picture_gallery
         
     | 
| 
       23 
26 
     | 
    
         | 
| 
       24 
27 
     | 
    
         
             
                  t.timestamps
         
     | 
| 
       25 
28 
     | 
    
         
             
                end
         
     | 
| 
         @@ -13,14 +13,22 @@ ActiveAdmin.register Ecm::Pictures::PictureGallery do 
     | 
|
| 
       13 
13 
     | 
    
         
             
                  f.input :link_images
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
                f.inputs do
         
     | 
| 
      
 17 
     | 
    
         
            +
                  f.input :markup_language, :as => :select, :collection => Ecm::Pictures::Configuration.markup_languages
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       16 
20 
     | 
    
         
             
               f.inputs do
         
     | 
| 
       17 
21 
     | 
    
         
             
                f.has_many :pictures do |p|
         
     | 
| 
       18 
22 
     | 
    
         
             
                  p.input :name
         
     | 
| 
       19 
23 
     | 
    
         
             
                  if p.object.persisted?
         
     | 
| 
       20 
24 
     | 
    
         
             
                    p.input :_destroy, :as => :boolean, :label => I18n.t('active_admin.delete')
         
     | 
| 
       21 
25 
     | 
    
         
             
                  end
         
     | 
| 
       22 
     | 
    
         
            -
                  p.input :image, :as => :file, :hint => p.template.image_tag(p.object.image.url(: 
     | 
| 
      
 26 
     | 
    
         
            +
                  p.input :image, :as => :file, :hint => p.template.image_tag(p.object.image.url(:default_thumb))
         
     | 
| 
       23 
27 
     | 
    
         
             
                  p.input :description
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  p.inputs do
         
     | 
| 
      
 30 
     | 
    
         
            +
                    p.input :markup_language, :as => :select, :collection => Ecm::Pictures::Configuration.markup_languages
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
       24 
32 
     | 
    
         
             
                end
         
     | 
| 
       25 
33 
     | 
    
         
             
              end
         
     | 
| 
       26 
34 
     | 
    
         | 
| 
         @@ -42,7 +50,7 @@ ActiveAdmin.register Ecm::Pictures::PictureGallery do 
     | 
|
| 
       42 
50 
     | 
    
         
             
              show do
         
     | 
| 
       43 
51 
     | 
    
         
             
                panel Ecm::Pictures::PictureGallery.human_attribute_name(:description) do
         
     | 
| 
       44 
52 
     | 
    
         
             
                  div do
         
     | 
| 
       45 
     | 
    
         
            -
                    ecm_pictures_picture_gallery 
     | 
| 
      
 53 
     | 
    
         
            +
                    mu ecm_pictures_picture_gallery, :description
         
     | 
| 
       46 
54 
     | 
    
         
             
                  end
         
     | 
| 
       47 
55 
     | 
    
         
             
                end
         
     | 
| 
       48 
56 
     | 
    
         | 
| 
         @@ -56,7 +64,7 @@ ActiveAdmin.register Ecm::Pictures::PictureGallery do 
     | 
|
| 
       56 
64 
     | 
    
         
             
                  table_for ecm_pictures_picture_gallery.pictures, :i18n => Ecm::Pictures::Picture do
         
     | 
| 
       57 
65 
     | 
    
         
             
                    sortable_columns
         
     | 
| 
       58 
66 
     | 
    
         
             
                    column :thumbnail do |picture|
         
     | 
| 
       59 
     | 
    
         
            -
                      link_to(image_tag(picture.image.url(: 
     | 
| 
      
 67 
     | 
    
         
            +
                      link_to(image_tag(picture.image.url(:default_thumb)), [:admin, picture])
         
     | 
| 
       60 
68 
     | 
    
         
             
                    end
         
     | 
| 
       61 
69 
     | 
    
         
             
                    column :name
         
     | 
| 
       62 
70 
     | 
    
         
             
                    column :image_file_size, :sortable => :image_file_size do |picture|
         
     | 
| 
         @@ -15,13 +15,17 @@ ActiveAdmin.register Ecm::Pictures::Picture do 
     | 
|
| 
       15 
15 
     | 
    
         
             
                  f.input :description
         
     | 
| 
       16 
16 
     | 
    
         
             
                end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
                f.inputs do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  f.input :markup_language, :as => :select, :collection => Ecm::Pictures::Configuration.markup_languages
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       18 
22 
     | 
    
         
             
                f.buttons
         
     | 
| 
       19 
23 
     | 
    
         
             
              end
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
       21 
25 
     | 
    
         
             
              index do
         
     | 
| 
       22 
26 
     | 
    
         
             
                selectable_column
         
     | 
| 
       23 
27 
     | 
    
         
             
                column :thumbnail do |picture|
         
     | 
| 
       24 
     | 
    
         
            -
                  link_to(image_tag(picture.image.url(: 
     | 
| 
      
 28 
     | 
    
         
            +
                  link_to(image_tag(picture.image.url(:default_thumb)), admin_ecm_pictures_picture_path(picture))
         
     | 
| 
       25 
29 
     | 
    
         
             
                end
         
     | 
| 
       26 
30 
     | 
    
         
             
                column :picture_gallery
         
     | 
| 
       27 
31 
     | 
    
         
             
                column :name
         
     | 
| 
         @@ -39,7 +43,13 @@ ActiveAdmin.register Ecm::Pictures::Picture do 
     | 
|
| 
       39 
43 
     | 
    
         | 
| 
       40 
44 
     | 
    
         
             
                panel Ecm::Pictures::Picture.human_attribute_name(:description) do
         
     | 
| 
       41 
45 
     | 
    
         
             
                  div do
         
     | 
| 
       42 
     | 
    
         
            -
                    ecm_pictures_picture 
     | 
| 
      
 46 
     | 
    
         
            +
                    mu ecm_pictures_picture, :description
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                panel Ecm::Pictures::Picture.human_attribute_name(:display_code) do
         
     | 
| 
      
 51 
     | 
    
         
            +
                  div do
         
     | 
| 
      
 52 
     | 
    
         
            +
                    ecm_pictures_picture.display_code
         
     | 
| 
       43 
53 
     | 
    
         
             
                  end
         
     | 
| 
       44 
54 
     | 
    
         
             
                end
         
     | 
| 
       45 
55 
     | 
    
         
             
              end
         
     | 
| 
         @@ -9,6 +9,17 @@ module Ecm 
     | 
|
| 
       9 
9 
     | 
    
         
             
                    yield self
         
     | 
| 
       10 
10 
     | 
    
         
             
                  end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
                  mattr_accessor :markup_languages
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @@markup_languages = []
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  mattr_accessor :default_markup_language
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @@default_markup_language = nil
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  mattr_accessor :picture_image_styles
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @@picture_image_styles = {}
         
     | 
| 
      
 20 
     | 
    
         
            +
                  def picture_image_styles=(picture_image_styles)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @@picture_image_styles = HashWithIndifferentAccess.new(picture_image_styles)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
       12 
23 
     | 
    
         
             
                end
         
     | 
| 
       13 
24 
     | 
    
         
             
              end
         
     | 
| 
       14 
25 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ecm/pictures/engine.rb
    CHANGED
    
    | 
         @@ -1,24 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ecm
         
     | 
| 
       2 
2 
     | 
    
         
             
              module Pictures
         
     | 
| 
       3 
3 
     | 
    
         
             
                class Engine < Rails::Engine
         
     | 
| 
       4 
     | 
    
         
            -
                  paths["config/locales"] << File.dirname(__FILE__) + '/../../../config/locales'
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
                  # Enabling assets precompiling under rails 3.1 or greater
         
     | 
| 
       7 
     | 
    
         
            -
                  if Rails.version >= '3.1'
         
     | 
| 
       8 
     | 
    
         
            -
                    initializer "ecm_pictures.asset_pipeline" do |app|
         
     | 
| 
       9 
     | 
    
         
            -
                      app.config.assets.precompile << 'ecm_pictures.js'
         
     | 
| 
       10 
     | 
    
         
            -
                      app.config.assets.precompile << 'ecm_pictures.css'
         
     | 
| 
       11 
     | 
    
         
            -
                    end
         
     | 
| 
       12 
     | 
    
         
            -
                  end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  config.to_prepare do
         
     | 
| 
       15 
     | 
    
         
            -
                    ApplicationController.helper(Ecm::PicturesHelper)
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
4 
     | 
    
         
             
                  initializer :ecm_pictures_engine do
         
     | 
| 
       19 
5 
     | 
    
         
             
                    ActiveAdmin.setup do |active_admin_config|
         
     | 
| 
       20 
6 
     | 
    
         
             
                      active_admin_config.load_paths += Dir[File.dirname(__FILE__) + '/active_admin']
         
     | 
| 
       21 
     | 
    
         
            -
                    end
         
     | 
| 
      
 7 
     | 
    
         
            +
                    end if defined?(ActiveAdmin)
         
     | 
| 
       22 
8 
     | 
    
         
             
                  end
         
     | 
| 
       23 
9 
     | 
    
         
             
                end
         
     | 
| 
       24 
10 
     | 
    
         
             
              end
         
     | 
    
        data/lib/ecm/pictures/version.rb
    CHANGED
    
    
    
        data/lib/ecm_pictures.rb
    CHANGED
    
    | 
         @@ -1,15 +1,9 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            require 'acts_as_list'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'acts_as_markup'
         
     | 
| 
       4 
3 
     | 
    
         
             
            require 'active_admin-acts_as_list'
         
     | 
| 
       5 
4 
     | 
    
         
             
            require 'friendly_id'
         
     | 
| 
       6 
5 
     | 
    
         
             
            require 'paperclip'
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            # Ecm::Admin should do this!
         
     | 
| 
       9 
     | 
    
         
            -
            require 'activeadmin'
         
     | 
| 
       10 
     | 
    
         
            -
            require 'sass-rails'
         
     | 
| 
       11 
     | 
    
         
            -
            require 'meta_search'
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
7 
     | 
    
         
             
            require 'ecm/pictures/engine'
         
     | 
| 
       14 
8 
     | 
    
         
             
            require 'ecm/pictures/configuration'
         
     | 
| 
       15 
9 
     | 
    
         
             
            require 'ecm/pictures/version'
         
     | 
| 
         @@ -1,3 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Ecm::Pictures.configure do |config|
         
     | 
| 
       2 
     | 
    
         
            -
              #  
     | 
| 
      
 2 
     | 
    
         
            +
              # markup options
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              # Accepted markup languages
         
     | 
| 
      
 5 
     | 
    
         
            +
              config.markup_languages = %w[ markdown rdoc textile ]
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              # Default markup language
         
     | 
| 
      
 8 
     | 
    
         
            +
              config.default_markup_language = 'textile'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              # picture options
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              # image sizes for slider items
         
     | 
| 
      
 13 
     | 
    
         
            +
              config.picture_image_styles = {
         
     | 
| 
      
 14 
     | 
    
         
            +
                :small_thumb   => "80x60",
         
     | 
| 
      
 15 
     | 
    
         
            +
                :medium_thumb  => "160x120",
         
     | 
| 
      
 16 
     | 
    
         
            +
                :default_thumb => "260x180"
         
     | 
| 
      
 17 
     | 
    
         
            +
              }
         
     | 
| 
       3 
18 
     | 
    
         
             
            end
         
     | 
| 
         @@ -7,13 +7,13 @@ module Ecm 
     | 
|
| 
       7 
7 
     | 
    
         
             
                    source_root File.expand_path('../../../../../../config/locales', __FILE__)
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    def generate_locales
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                      copy_file "ecm.pictures.en.yml", "config/locales/ecm.pictures.en.yml"
         
     | 
| 
       11 
11 
     | 
    
         
             
                      copy_file "ecm.pictures.de.yml", "config/locales/ecm.pictures.de.yml"
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
                      copy_file "ecm.pictures.picture.en.yml", "config/locales/ecm.pictures.picture.en.yml"
         
     | 
| 
       14 
14 
     | 
    
         
             
                      copy_file "ecm.pictures.picture.de.yml", "config/locales/ecm.pictures.picture.de.yml"
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
                      copy_file "ecm.pictures.picture_gallery.en.yml", "config/locales/ecm.pictures.picture_gallery.en.yml"
         
     | 
| 
       17 
17 
     | 
    
         
             
                      copy_file "ecm.pictures.picture_gallery.de.yml", "config/locales/ecm.pictures.picture_gallery.de.yml"
         
     | 
| 
       18 
18 
     | 
    
         
             
                    end
         
     | 
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -31,9 +31,11 @@ namespace :ecm do 
     | 
|
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                  desc "Creates example data for galleries"
         
     | 
| 
       33 
33 
     | 
    
         
             
                  task :populate_galleries, [] => [:environment] do |t, args|
         
     | 
| 
      
 34 
     | 
    
         
            +
                    require "ffaker"
         
     | 
| 
       34 
35 
     | 
    
         
             
                    5.times do |i|
         
     | 
| 
       35 
36 
     | 
    
         
             
                      Ecm::Pictures::PictureGallery.create! do |pg|
         
     | 
| 
       36 
37 
     | 
    
         
             
                        pg.name = "Picture Gallery #{i}"
         
     | 
| 
      
 38 
     | 
    
         
            +
                        pg.description = Faker::Lorem.paragraph(rand(3))
         
     | 
| 
       37 
39 
     | 
    
         
             
                      end
         
     | 
| 
       38 
40 
     | 
    
         
             
                    end
         
     | 
| 
       39 
41 
     | 
    
         
             
                  end
         
     |