ecm_references2 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +47 -0
- data/Rakefile +25 -0
- data/app/admin/ecm_references_categories.rb +92 -0
- data/app/admin/ecm_references_references.rb +78 -0
- data/app/assets/stylesheets/ecm_references.css.less +7 -0
- data/app/controllers/ecm/references/categories_controller.rb +11 -0
- data/app/controllers/ecm/references/references_controller.rb +11 -0
- data/app/models/ecm/references.rb +5 -0
- data/app/models/ecm/references/category.rb +102 -0
- data/app/models/ecm/references/reference.rb +83 -0
- data/app/views/ecm/references/categories/_category.html.haml +13 -0
- data/app/views/ecm/references/categories/_category_in_table.html.haml +6 -0
- data/app/views/ecm/references/categories/_table.html.haml +4 -0
- data/app/views/ecm/references/categories/index.html.haml +9 -0
- data/app/views/ecm/references/categories/show.html.haml +9 -0
- data/app/views/ecm/references/references/_reference.html.haml +7 -0
- data/app/views/ecm/references/references/_reference_in_list.html.haml +11 -0
- data/app/views/ecm/references/references/_reference_in_table.html.haml +3 -0
- data/app/views/ecm/references/references/_references_in_category.html.haml +3 -0
- data/app/views/ecm/references/references/index.html.haml +11 -0
- data/app/views/ecm/references/references/show.html.haml +6 -0
- data/config/locales/de.yml +55 -0
- data/config/locales/en.yml +54 -0
- data/db/migrate/001_create_ecm_references_categories.rb +24 -0
- data/db/migrate/002_create_ecm_references_references.rb +25 -0
- data/lib/ecm/references/configuration.rb +49 -0
- data/lib/ecm/references/engine.rb +11 -0
- data/lib/ecm/references/routing.rb +10 -0
- data/lib/ecm/references/version.rb +5 -0
- data/lib/ecm_references2.rb +22 -0
- data/lib/generators/ecm/references/install/install_generator.rb +15 -0
- data/lib/generators/ecm/references/install/templates/ecm_references.rb +56 -0
- data/lib/generators/ecm/references/locales/locales_generator.rb +16 -0
- data/lib/tasks/ecm_references_tasks.rake +4 -0
- metadata +560 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
%h1.reference-category-name= category.name
|
2
|
+
|
3
|
+
- if category.description.present?
|
4
|
+
.reference-category-description
|
5
|
+
%p= category.description
|
6
|
+
|
7
|
+
.references.item-list
|
8
|
+
- if category.references.published.any?
|
9
|
+
= render partial: 'ecm/references/references/references_in_category', locals: { references: category.references.published }
|
10
|
+
- else
|
11
|
+
%p= t('ecm.references.category.messages.no_references_available')
|
12
|
+
|
13
|
+
= render partial: 'table', locals: { categories: category.descendants }
|
@@ -0,0 +1,6 @@
|
|
1
|
+
%tr{ class: "#{category.class.name.underscore.gsub('/', ' ')}", id: "#{category.class.name.underscore.gsub('/', '-')}-#{category.to_param}" }
|
2
|
+
%td
|
3
|
+
= link_to(category.tree_name, category, class: "left-padding-#{category.depth * 3}", title: category.description)
|
4
|
+
= category.locale_label(self)
|
5
|
+
%td.text-right
|
6
|
+
= category.references_count_label(self)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
- content_for :meta_description, Ecm::References::Category.model_name.human(count: :other)
|
2
|
+
- content_for :title, Ecm::References::Category.model_name.human(count: :other)
|
3
|
+
|
4
|
+
%h1= Ecm::References::Category.model_name.human(count: :other)
|
5
|
+
|
6
|
+
= render partial: 'table', locals: { categories: @categories }
|
7
|
+
|
8
|
+
%div.well.page-actions
|
9
|
+
= link_to(t('ecm.references.actions.back'), root_path, class: 'btn btn-default')
|
@@ -0,0 +1,9 @@
|
|
1
|
+
- content_for :meta_description, @category.name
|
2
|
+
- content_for :title, @category.name
|
3
|
+
= render @category
|
4
|
+
|
5
|
+
.well.page-actions
|
6
|
+
- if @category.root?
|
7
|
+
= link_to(t('ecm.references.category.actions.back_to_index'), ecm_references_categories_path, class: 'btn btn-default') if respond_to?(:ecm_references_categories_path)
|
8
|
+
- else
|
9
|
+
= link_to(t('ecm.references.actions.back'), @category.parent, class: 'btn btn-default')
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.reference.show
|
2
|
+
%h1= reference.name
|
3
|
+
|
4
|
+
- if reference.preview_picture.present?
|
5
|
+
%img.img-responsive.bottom-margin-2{ src: reference.preview_picture.image.url, alt: reference.preview_picture.description, title: reference.preview_picture.description }
|
6
|
+
|
7
|
+
.item-body= mu(reference, :description)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%div{ class: Ecm::References::Configuration.reference_preview_div_classes, id: "#{reference.class.name.underscore.gsub('/', '-')}-#{reference.to_param}" }
|
2
|
+
.media-left
|
3
|
+
- if reference.preview_picture.present?
|
4
|
+
= link_to(reference, class: Ecm::References::Configuration.reference_preview_thumbnail_link_classes) do
|
5
|
+
%img.media-object.thumbnail.img-responsive{ src: reference.preview_picture.image.url(:default_thumb) }
|
6
|
+
- else
|
7
|
+
%div{ class: Ecm::References::Configuration.reference_preview_thumbnail_link_classes }
|
8
|
+
.media-body
|
9
|
+
%h3.media-heading= reference.name
|
10
|
+
%div{ class: "news-body truncate lines-#{Ecm::References::Configuration.reference_preview_lines} bottom-margin-1" }= mu reference, :description
|
11
|
+
.object-actions= link_to(t('ecm.references.actions.more'), reference, class: 'btn btn-primary')
|
@@ -0,0 +1,11 @@
|
|
1
|
+
- content_for :meta_description, Ecm::References::Reference.model_name.human(count: :other)
|
2
|
+
- content_for :title, Ecm::References::Reference.model_name.human(count: :other)
|
3
|
+
|
4
|
+
%h1= Ecm::References::Reference.model_name.human(count: :other)
|
5
|
+
|
6
|
+
= render(:partial => 'reference_in_list', :collection => @references, :as => :reference)
|
7
|
+
|
8
|
+
= paginate @references, :theme => 'twitter-bootstrap'
|
9
|
+
|
10
|
+
%div.well.page-actions
|
11
|
+
= link_to(t('ecm.references.actions.back'), root_path, class: 'btn btn-default')
|
@@ -0,0 +1,55 @@
|
|
1
|
+
de:
|
2
|
+
activerecord:
|
3
|
+
attributes:
|
4
|
+
ecm/references/category:
|
5
|
+
children: Unterkategorien
|
6
|
+
created_at: "Erstellt am"
|
7
|
+
depth: Baumtiefe
|
8
|
+
description: Beschreibung
|
9
|
+
details: Details
|
10
|
+
locale: Sprache
|
11
|
+
markup_language: "Markup Sprache"
|
12
|
+
name: Name
|
13
|
+
parent: "Übergeordnete Kategorie"
|
14
|
+
reference_count: Referenzen
|
15
|
+
references: Referenzen
|
16
|
+
slug: "Freundliche ID"
|
17
|
+
updated_at: "Aktualisiert am"
|
18
|
+
ecm/references/reference:
|
19
|
+
category: Kategorie
|
20
|
+
created_at: "Erstellt am"
|
21
|
+
description: Beschreibung
|
22
|
+
details: Details
|
23
|
+
markup_language: "Markup Sprache"
|
24
|
+
name: Name
|
25
|
+
preview_picture: Vorschaubild
|
26
|
+
published: Veröffentlicht
|
27
|
+
slug: "Freundliche ID"
|
28
|
+
updated_at: "Aktualisiert am"
|
29
|
+
models:
|
30
|
+
ecm/references/category:
|
31
|
+
one: Referenzkategorie
|
32
|
+
other: Referenzkategorien
|
33
|
+
ecm/references/reference:
|
34
|
+
one: Referenz
|
35
|
+
other: Referenzen
|
36
|
+
ecm:
|
37
|
+
references:
|
38
|
+
actions:
|
39
|
+
back: Zurück
|
40
|
+
back_to_category: "Zurück zu %{category}"
|
41
|
+
back_to_category_index: "Alle Referenzkategorien"
|
42
|
+
more: mehr
|
43
|
+
next_reference: "Nächste Referenz"
|
44
|
+
previous_reference: "Vorherige Referenz"
|
45
|
+
active_admin:
|
46
|
+
menu: Referenzen
|
47
|
+
category:
|
48
|
+
actions:
|
49
|
+
back_to_index: 'Zurück zu Kategorien'
|
50
|
+
messages:
|
51
|
+
no_references_available: "Keine Referenzen in dieser Kategorie vorhanden"
|
52
|
+
routes:
|
53
|
+
ecm_references_categories: referenz-kategorien
|
54
|
+
ecm_references_references: referenzen
|
55
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
en:
|
2
|
+
activerecord:
|
3
|
+
attributes:
|
4
|
+
ecm/references/category:
|
5
|
+
children: subcategories
|
6
|
+
created_at: "created at"
|
7
|
+
depth: Depth
|
8
|
+
description: Description
|
9
|
+
details: details
|
10
|
+
locale: language
|
11
|
+
markup_language: "markup language"
|
12
|
+
name: name
|
13
|
+
parent: "parent category"
|
14
|
+
reference_count: references
|
15
|
+
references: references
|
16
|
+
slug: "friendly id"
|
17
|
+
updated_at: "updated at"
|
18
|
+
ecm/references/reference:
|
19
|
+
category: category
|
20
|
+
created_at: "created at"
|
21
|
+
description: description
|
22
|
+
details: details
|
23
|
+
markup_language: "markup language"
|
24
|
+
name: name
|
25
|
+
preview_picture: preview picture
|
26
|
+
published: published
|
27
|
+
slug: "friendly id"
|
28
|
+
updated_at: "updated at"
|
29
|
+
models:
|
30
|
+
ecm/references/category:
|
31
|
+
one: "reference category"
|
32
|
+
other: "reference categories"
|
33
|
+
ecm/references/reference:
|
34
|
+
one: reference
|
35
|
+
other: references
|
36
|
+
ecm:
|
37
|
+
references:
|
38
|
+
actions:
|
39
|
+
back: back
|
40
|
+
back_to_category: "back to %{category}"
|
41
|
+
back_to_category_index: "back to all categories"
|
42
|
+
more: more
|
43
|
+
next_reference: "next reference"
|
44
|
+
previous_reference: "previous referencez"
|
45
|
+
active_admin:
|
46
|
+
menu: references
|
47
|
+
category:
|
48
|
+
actions:
|
49
|
+
back_to_index: 'Back to categories'
|
50
|
+
messages:
|
51
|
+
no_references_available: "No references avaiable"
|
52
|
+
routes:
|
53
|
+
ecm_references_categories: reference-categories
|
54
|
+
ecm_references_references: references
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateEcmReferencesCategories < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_references_categories do |t|
|
4
|
+
t.string :name
|
5
|
+
t.text :description
|
6
|
+
t.string :locale
|
7
|
+
|
8
|
+
# acts as markup
|
9
|
+
t.string :markup_language
|
10
|
+
|
11
|
+
# awesome nested set
|
12
|
+
t.integer :lft
|
13
|
+
t.integer :rgt
|
14
|
+
t.references :parent
|
15
|
+
t.integer :depth
|
16
|
+
|
17
|
+
# friendly id
|
18
|
+
t.string :slug
|
19
|
+
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
add_index :ecm_references_categories, :parent_id
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateEcmReferencesReferences < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_references_references do |t|
|
4
|
+
t.string :name
|
5
|
+
t.text :description
|
6
|
+
|
7
|
+
# acts as list
|
8
|
+
t.integer :position
|
9
|
+
|
10
|
+
# acts as markup
|
11
|
+
t.string :markup_language
|
12
|
+
|
13
|
+
# acts as published
|
14
|
+
t.timestamp :published_at
|
15
|
+
|
16
|
+
# friendly id
|
17
|
+
t.string :slug
|
18
|
+
|
19
|
+
# references
|
20
|
+
t.references :ecm_categories_category
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'active_support/core_ext/module/delegation'
|
2
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
3
|
+
require 'active_support/hash_with_indifferent_access'
|
4
|
+
|
5
|
+
module Ecm
|
6
|
+
module References
|
7
|
+
module Configuration
|
8
|
+
def configure
|
9
|
+
yield self
|
10
|
+
end
|
11
|
+
|
12
|
+
mattr_accessor :default_markup_language
|
13
|
+
@@default_markup_language = nil
|
14
|
+
|
15
|
+
mattr_accessor :markup_languages
|
16
|
+
@@markup_languages = []
|
17
|
+
|
18
|
+
mattr_accessor :new_references_published_by_default
|
19
|
+
@@new_references_published_by_default = false
|
20
|
+
|
21
|
+
mattr_accessor :reference_preview_length
|
22
|
+
@@reference_preview_length = nil
|
23
|
+
|
24
|
+
mattr_accessor :categories_table_classes do
|
25
|
+
''
|
26
|
+
end
|
27
|
+
|
28
|
+
mattr_accessor :references_table_classes do
|
29
|
+
''
|
30
|
+
end
|
31
|
+
|
32
|
+
mattr_accessor :base_controller do
|
33
|
+
'ApplicationController'
|
34
|
+
end
|
35
|
+
|
36
|
+
mattr_accessor :reference_preview_div_classes do
|
37
|
+
''
|
38
|
+
end
|
39
|
+
|
40
|
+
mattr_accessor :reference_preview_thumbnail_link_classes do
|
41
|
+
''
|
42
|
+
end
|
43
|
+
|
44
|
+
mattr_accessor :reference_preview_lines do
|
45
|
+
''
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Ecm::References
|
2
|
+
class Routing
|
3
|
+
def self.routes(router, options = {})
|
4
|
+
options.reverse_merge!({})
|
5
|
+
|
6
|
+
router.resources :ecm_references_categories, controller: 'ecm/references/categories'
|
7
|
+
router.resources :ecm_references_references, controller: 'ecm/references/references'
|
8
|
+
end # def
|
9
|
+
end # class Routing
|
10
|
+
end # module Ecm::References
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_admin-acts_as_list'
|
2
|
+
require 'active_admin-awesome_nested_set'
|
3
|
+
require 'acts_as_list'
|
4
|
+
require 'acts_as_markup'
|
5
|
+
require 'acts_as_published'
|
6
|
+
require 'awesome_nested_set'
|
7
|
+
require 'awesome_nested_set-tools'
|
8
|
+
require 'ecm_pictures2'
|
9
|
+
require 'friendly_id'
|
10
|
+
require 'haml-rails'
|
11
|
+
require 'kaminari'
|
12
|
+
require 'bootstrap-kaminari-views'
|
13
|
+
|
14
|
+
require 'ecm/references/engine'
|
15
|
+
require 'ecm/references/configuration'
|
16
|
+
require 'ecm/references/routing'
|
17
|
+
|
18
|
+
module Ecm
|
19
|
+
module References
|
20
|
+
extend Configuration
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ecm
|
2
|
+
module References
|
3
|
+
module Generators
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
desc 'Generates the intializer'
|
6
|
+
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
def generate_intializer
|
10
|
+
copy_file 'ecm_references.rb', 'config/initializers/ecm_references.rb'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Ecm::References.configure do |config|
|
2
|
+
# Accepted markup languages
|
3
|
+
#
|
4
|
+
# default: config.markup_languages = %w[ textile ]
|
5
|
+
config.markup_languages = %w( textile )
|
6
|
+
|
7
|
+
# Default markup language
|
8
|
+
#
|
9
|
+
# default: config.default_markup_language = 'textile'
|
10
|
+
config.default_markup_language = 'textile'
|
11
|
+
|
12
|
+
# Controls if new references are marked as published by default when created
|
13
|
+
#
|
14
|
+
# default: config.new_references_published_by_default = false
|
15
|
+
config.new_references_published_by_default = false
|
16
|
+
|
17
|
+
# Number of characters to render in reference preview
|
18
|
+
#
|
19
|
+
# default: config.news_preview_length = 250
|
20
|
+
config.reference_preview_length = 250
|
21
|
+
|
22
|
+
# Set the css classes for the categories table
|
23
|
+
#
|
24
|
+
# Default: config.categories_table_classes = 'table table-striped table-hover'
|
25
|
+
#
|
26
|
+
config.categories_table_classes = 'table table-striped table-hover'
|
27
|
+
|
28
|
+
# Set the css classes for the references table
|
29
|
+
#
|
30
|
+
# Default: config.references_table_classes = 'table table-striped table-hover'
|
31
|
+
#
|
32
|
+
config.references_table_classes = 'table table-striped table-hover'
|
33
|
+
|
34
|
+
# Set the base controller
|
35
|
+
#
|
36
|
+
# Default: config.base_controller = 'ApplicationController'
|
37
|
+
#
|
38
|
+
config.base_controller = 'ApplicationController'
|
39
|
+
|
40
|
+
# CSS Classes for the preview container div
|
41
|
+
#
|
42
|
+
# Default: config.reference_preview_div_classes = 'media ecm-reference bottom-margin-2'
|
43
|
+
#
|
44
|
+
config.reference_preview_div_classes = 'media ecm-reference bottom-margin-2'
|
45
|
+
|
46
|
+
# CSS Classes for the preview thumbnail link
|
47
|
+
#
|
48
|
+
# Default: config.reference_preview_thumbnail_link_classes = 'col-lg-4'
|
49
|
+
#
|
50
|
+
config.reference_preview_thumbnail_link_classes = 'col-lg-4'
|
51
|
+
|
52
|
+
# Number of lines to render in news preview
|
53
|
+
#
|
54
|
+
# default: config.news_item_preview_lines = 3
|
55
|
+
config.reference_preview_lines = 3
|
56
|
+
end
|