ecm_courses2 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +17 -0
  5. data/app/assets/javascripts/ecm/courses/application.js +13 -0
  6. data/app/assets/stylesheets/ecm/courses/application.css +14 -0
  7. data/app/controllers/ecm/courses/application_controller.rb +6 -0
  8. data/app/controllers/ecm/courses/course_categories_controller.rb +36 -0
  9. data/app/controllers/ecm/courses/course_dates_controller.rb +11 -0
  10. data/app/controllers/ecm/courses/courses_controller.rb +43 -0
  11. data/app/helpers/ecm/courses/application_helper.rb +6 -0
  12. data/app/models/ecm/courses/application_record.rb +5 -0
  13. data/app/models/ecm/courses/course.rb +36 -0
  14. data/app/models/ecm/courses/course_category.rb +56 -0
  15. data/app/models/ecm/courses/course_date.rb +44 -0
  16. data/app/views/ecm/courses/course_categories/_course_category.haml +18 -0
  17. data/app/views/ecm/courses/course_categories/index.haml +4 -0
  18. data/app/views/ecm/courses/course_categories/show.haml +12 -0
  19. data/app/views/ecm/courses/course_dates/_course_date.haml +4 -0
  20. data/app/views/ecm/courses/course_dates/index.haml +3 -0
  21. data/app/views/ecm/courses/course_dates/show.haml +6 -0
  22. data/app/views/ecm/courses/courses/_course.haml +8 -0
  23. data/app/views/ecm/courses/courses/calendar.haml +5 -0
  24. data/app/views/ecm/courses/courses/index.haml +2 -0
  25. data/app/views/ecm/courses/courses/show.haml +7 -0
  26. data/app/views/layouts/ecm/courses/application.html.erb +14 -0
  27. data/config/locales/de.yml +49 -0
  28. data/config/locales/locales/ecm.courses.course.de.yml +25 -0
  29. data/config/locales/locales/ecm.courses.course.en.yml +25 -0
  30. data/config/locales/locales/ecm.courses.course_category.de.yml +25 -0
  31. data/config/locales/locales/ecm.courses.course_category.en.yml +25 -0
  32. data/config/locales/locales/ecm.courses.course_date.de.yml +20 -0
  33. data/config/locales/locales/ecm.courses.course_date.en.yml +20 -0
  34. data/config/locales/locales/ecm.courses.de.yml +18 -0
  35. data/config/locales/locales/ecm.courses.en.yml +18 -0
  36. data/config/locales/locales/ecm.courses.routes.de.yml +6 -0
  37. data/config/locales/locales/ecm.courses.routes.en.yml +6 -0
  38. data/config/routes.rb +22 -0
  39. data/db/migrate/001_create_ecm_courses_course_categories.rb +22 -0
  40. data/db/migrate/002_create_ecm_courses_courses.rb +22 -0
  41. data/db/migrate/003_create_ecm_courses_course_dates.rb +17 -0
  42. data/db/migrate/20160927141932_remove_ecm_courses_courses_count_from_ecm_courses_course_categories.rb +5 -0
  43. data/db/migrate/20160927142037_remove_ecm_courses_course_dates_count_from_ecm_courses_courses.rb +5 -0
  44. data/db/migrate/20160927142238_change_ecm_courses_course_category_id_to_course_category_id_on_ecm_courses_courses.rb +5 -0
  45. data/db/migrate/20160927142425_change_ecm_courses_course_id_to_course_id_on_ecm_courses_course_date.rb +5 -0
  46. data/lib/ecm/courses/configuration.rb +11 -0
  47. data/lib/ecm/courses/engine.rb +7 -0
  48. data/lib/ecm/courses/version.rb +5 -0
  49. data/lib/ecm/courses.rb +7 -0
  50. data/lib/ecm_courses2.rb +6 -0
  51. data/lib/tasks/ecm/courses_tasks.rake +4 -0
  52. data/spec/factories/ecm/courses/course_category_factories.rb +11 -0
  53. data/spec/factories/ecm/courses/course_date_factories.rb +7 -0
  54. data/spec/factories/ecm/courses/course_factories.rb +6 -0
  55. metadata +154 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a340e85583a43092c1c2694a7e8c221df2e28771
4
+ data.tar.gz: a03e1d28576f97e7cf85c7b1c41dfe7aed829341
5
+ SHA512:
6
+ metadata.gz: 20e1c3e0b78a9f5b47909f114b654ad87bc309583ed132677055f8a9601290285f0cf04ced8de46cd88144c03f95f60bfe4cd6f33fbe18c0283284fafb31403a
7
+ data.tar.gz: 4f9a24245264f1d079cbb1c27585bb81dce2d88e8cc68ddb8a18d46279133a109e91ec78df3419ef36d6eb8019e0ac9a49d446631855aff34276a1c686f34a79
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Roberto Vasquez Angel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Ecm::Courses
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Ecm::Courses'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,14 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. It is generally better to create a new file per style scope.
11
+ *
12
+ *= require_tree .
13
+ *= require_self
14
+ */
@@ -0,0 +1,6 @@
1
+ module Ecm
2
+ module Courses
3
+ class ApplicationController < Configuration.base_controller.constantize
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,36 @@
1
+ module Ecm::Courses
2
+ class CourseCategoriesController < ApplicationController
3
+ def self.resource_class
4
+ CourseCategory
5
+ end
6
+
7
+ def index
8
+ @course_categories = CourseCategory.all
9
+ end
10
+
11
+ def show
12
+ @year = params[:year] ||= Time.zone.now.year
13
+ @month = params[:month] ||= Time.zone.now.month
14
+
15
+ @date = Date.strptime("#{@month}-#{@year}", "%m-%Y")
16
+
17
+ @course_category = load_resource
18
+ @courses = @course_category.courses.all
19
+ @course_dates = @courses.reduce([]) { |cd, c| cd << c.course_dates.for_month(@date).all }.flatten
20
+ end
21
+
22
+ private
23
+
24
+ def resource_class
25
+ self.class.resource_class
26
+ end
27
+
28
+ def load_scope
29
+ resource_class.includes(courses: [ :course_dates ]).friendly
30
+ end
31
+
32
+ def load_resource
33
+ load_scope.find(params[:id])
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,11 @@
1
+ module Ecm::Courses
2
+ class CourseDatesController < ApplicationController
3
+ def index
4
+ @course_dates = CourseDate.includes(course: [ :course_category ]).all
5
+ end
6
+
7
+ def show
8
+ @course_date = CourseDate.includes(course: [ :course_category ]).find(params[:id])
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,43 @@
1
+ module Ecm::Courses
2
+ class CoursesController < ApplicationController
3
+ def self.resource_class
4
+ Course
5
+ end
6
+
7
+ def calendar
8
+ @year = params[:year] ||= Time.zone.now.year
9
+ @month = params[:month] ||= Time.zone.now.month
10
+
11
+ @date = Date.strptime("#{@month}-#{@year}", "%m-%Y")
12
+
13
+ @course = load_resource
14
+ @course_dates = @course.course_dates.for_month(@date).all
15
+ end
16
+
17
+ def index
18
+ @courses = load_collection
19
+ end
20
+
21
+ def show
22
+ @course = load_resource
23
+ end
24
+
25
+ private
26
+
27
+ def load_collection
28
+ load_scope.all
29
+ end
30
+
31
+ def resource_class
32
+ self.class.resource_class
33
+ end
34
+
35
+ def load_scope
36
+ resource_class.includes(:course_category, :course_dates)
37
+ end
38
+
39
+ def load_resource
40
+ load_scope.friendly.find(params[:id])
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,6 @@
1
+ module Ecm
2
+ module Courses
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm::Courses
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ module Ecm::Courses
2
+ class Course < ApplicationRecord
3
+ # acts as list
4
+ acts_as_list scope: :category
5
+
6
+ # associations
7
+ belongs_to :course_category
8
+
9
+ has_many :course_dates, ->() { order(:start_at) },
10
+ dependent: :destroy
11
+
12
+ # # attibutes
13
+ # attr_accessible :description,
14
+ # :ecm_courses_course_category_id,
15
+ # :locale,
16
+ # :name
17
+
18
+ # friendly id
19
+ extend FriendlyId
20
+ friendly_id :name, use: [:slugged]
21
+
22
+ # validations
23
+ validates :course_category, presence: true
24
+ validates :locale, inclusion: { in: I18n.available_locales.map(&:to_s) }, allow_blank: true
25
+ validates :name, presence: true
26
+
27
+ def heading_name
28
+ locale_prefix = locale.blank? ? '' : "[#{locale}] "
29
+ "#{locale_prefix}#{name}"
30
+ end
31
+
32
+ def to_s
33
+ "#{course_category.name} - #{name}"
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,56 @@
1
+ module Ecm::Courses
2
+ class CourseCategory < ApplicationRecord
3
+ # associations
4
+ has_many :courses, ->() { order(:position) },
5
+ dependent: :destroy
6
+
7
+ # # attributes
8
+ # attr_accessible :description,
9
+ # :ecm_courses_courses_count,
10
+ # :locale,
11
+ # :name,
12
+ # :parent_id,
13
+ # :position,
14
+ # :slug
15
+
16
+ # awesome nested set
17
+ acts_as_nested_set
18
+ # default_scope order: 'lft ASC'
19
+
20
+ # friendly id
21
+ extend FriendlyId
22
+ friendly_id :name, use: [:slugged]
23
+
24
+ # validations
25
+ validates :name, presence: true, uniqueness: { scope: [:parent_id] }
26
+ validates :locale, presence: true, if: :root?
27
+ validates :locale, inclusion: { in: I18n.available_locales.map(&:to_s) }, allow_blank: true
28
+ validates :locale, absence: true, unless: :root?
29
+
30
+ def index_name
31
+ if root?
32
+ "[#{locale}] #{name}"
33
+ else
34
+ "#{'&#160;&#160;&#160;&#160;' * level} |--&#160;#{name}".html_safe
35
+ end
36
+ end
37
+
38
+ def to_s
39
+ name
40
+ end
41
+
42
+ def courses_count
43
+ courses.count
44
+ end
45
+
46
+ def tree_name
47
+ root_prefix = root? ? "[#{locale}] " : ''
48
+
49
+ if courses_count < 1
50
+ "#{root_prefix}#{self}"
51
+ else
52
+ "#{root_prefix}#{self} (#{courses_count})"
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,44 @@
1
+ module Ecm::Courses
2
+ class CourseDate < ApplicationRecord
3
+ # associations
4
+ belongs_to :course
5
+
6
+ has_one :course_category,
7
+ through: :course
8
+
9
+ # # attributes
10
+ # attr_accessible :description,
11
+ # :ecm_courses_course_id,
12
+ # :end_at,
13
+ # # :slug,
14
+ # :start_at
15
+
16
+ # callbacks
17
+ after_initialize :set_defaults, if: :new_record?
18
+
19
+ # validations
20
+ validates :ecm_courses_course, presence: true
21
+ validates :end_at, presence: true
22
+ validates :start_at, presence: true
23
+
24
+ def self.for_month(date)
25
+ date ||= Time.zone.now.to_date
26
+ where(start_at: (date.beginning_of_month..(date.end_of_month + 1.day)))
27
+ end
28
+
29
+ def duration_in_minutes
30
+ (end_at - start_at).to_i / 60
31
+ end
32
+
33
+ def to_s
34
+ "#{I18n.l(start_at)} - #{I18n.l(end_at)}"
35
+ end
36
+
37
+ protected
38
+
39
+ def set_defaults
40
+ self.start_at ||= 6.hours.from_now.change(min: 0)
41
+ self.end_at ||= self.start_at + 1.hours
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,18 @@
1
+ .course_category{:id => "course_category-#{course_category.id}"}
2
+ - if action_name == 'show'
3
+ %h1.courses_category-name= course_category.name
4
+ - else
5
+ %h2.courses_category-name= course_category.name
6
+ .course_categories-tree
7
+ = nested_li(course_category.descendants, {}) do |course_category, level|
8
+ = link_to course_category.tree_name, course_category
9
+ - unless course_category.description.blank?
10
+ .course_categories-description
11
+ %p= course_category.description
12
+ .course_category-courses
13
+ %h2= Ecm::Courses::CourseCategory.human_attribute_name(:courses)
14
+ - if course_category.courses_count == 0
15
+ = t('ecm.courses.course_category.messages.no_courses_available')
16
+ %hr/
17
+ - else
18
+ = render course_category.courses
@@ -0,0 +1,4 @@
1
+ %h1= Ecm::Courses::CourseCategory.model_name.human(count: :other)
2
+ .course_categories-tree
3
+ = nested_li(@course_categories, {}) do |course_category, level|
4
+ = link_to course_category.tree_name, course_category
@@ -0,0 +1,12 @@
1
+ = render @course_category
2
+ %p
3
+ - if @course_category.root?
4
+ = link_to(t('ecm.courses.course_category.actions.back_to_index'), course_categories_path) if respond_to?(:course_categories_path)
5
+ - else
6
+ = link_to(Ecm::Courses::CourseCategory.human_attribute_name(:parent), @course_category.parent)
7
+ .course_category-calendar{ id: "course_category-#{@course_category.to_param}" }
8
+ - if @course_category.courses.any?
9
+ %h2
10
+ = t('.calendar_heading', month: l(@date, format: :month_with_year))
11
+ = month_calendar_pagination(@date)
12
+ = month_calendar @date, @course_dates, display_method: :course, start_day: :monday
@@ -0,0 +1,4 @@
1
+ .course_date{:id => "course_date-#{course_date.to_param}"}
2
+ %h4= link_to course_date.to_s, course_date
3
+ .course_date-description
4
+ = course_date.description
@@ -0,0 +1,3 @@
1
+ %h1= Ecm::Courses::CourseDate.model_name.human(count: :other)
2
+ .course-dates
3
+ = render @course_dates
@@ -0,0 +1,6 @@
1
+ .course-date{:id => "course-date_#{@course_date.to_param}"}
2
+ %h1= link_to @course_date.ecm_courses_course_category.to_s, @course_date.ecm_courses_course_category
3
+ %h2= link_to @course_date.ecm_courses_course.to_s, @course_date.ecm_courses_course
4
+ %h3= @course_date
5
+ .course_date-description
6
+ = @course_date.description
@@ -0,0 +1,8 @@
1
+ .course{:id => "course-#{course.to_param}"}
2
+ %h2= course.heading_name
3
+ - unless course.description.blank?
4
+ .course-description
5
+ %p= course.description
6
+ .course-dates
7
+ = render course.course_dates
8
+ %hr/
@@ -0,0 +1,5 @@
1
+ %h1
2
+ Kurskalender für #{I18n.l(@date, :format => :month_with_year)}
3
+ = link_to "Zurück zu #{@course.ecm_courses_course_category}", @course.ecm_courses_course_category
4
+ = month_calendar_pagination(@date)
5
+ = month_calendar(@
@@ -0,0 +1,2 @@
1
+ %h1= Ecm::Courses::Course.model_name.human(:count => :other)
2
+ = render @courses
@@ -0,0 +1,7 @@
1
+ .course{ id: "course_#{@course.to_param}" }
2
+ %h1= link_to @course.course_category, @course.course_category
3
+ %h2= @course
4
+ .course-description
5
+ = @course.description
6
+ .course-dates
7
+ = render @course.course_dates
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Courses</title>
5
+ <%= stylesheet_link_tag "ecm/courses/application", media: "all" %>
6
+ <%= javascript_include_tag "ecm/courses/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,49 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ ecm/courses/course_category:
5
+ one: Kurskategorie
6
+ other: Kurskategorien
7
+ ecm/courses/course_date:
8
+ one: Termin
9
+ other: Termine
10
+ ecm/courses/course:
11
+ one: Kurs
12
+ other: Kurse
13
+ attributes:
14
+ ecm/courses/course_category:
15
+ description: Beschreibung
16
+ courses_count: Kurse
17
+ courses: Kurse
18
+ locale: Sprache
19
+ name: Name
20
+ parent_id: Überliegende Kategorie
21
+ created_at: Erstellt am
22
+ updated_at: Aktualisiert am
23
+ ecm/courses/course_date:
24
+ description: Beschreibung
25
+ course_id: Kurs
26
+ end_at: Endet am
27
+ start_at: Beginnt am
28
+ created_at: Erstellt am
29
+ updated_at: Aktualisiert am
30
+ ecm/courses/course:
31
+ description: Beschreibung
32
+ course_category_id: Kategorie
33
+ course_dates_count: Termine
34
+ locale: Sprache
35
+ name: Name
36
+ created_at: Erstellt am
37
+ updated_at: Aktualisiert am
38
+ date:
39
+ formats:
40
+ month_with_year: '%B %Y'
41
+ ecm:
42
+ courses:
43
+ course_categories:
44
+ show:
45
+ calendar_heading: 'Kurskalender für %{month}'
46
+ routes:
47
+ courses: 'kurse'
48
+ course_categories: 'kurs-kategorien'
49
+ course_dates: 'kurs-termine'
@@ -0,0 +1,25 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ attributes:
5
+ ecm/courses/course:
6
+ created_at: Erstellt am
7
+ description: Beschreibung
8
+ ecm_courses_course_category_id: Kurs Kategorie
9
+ ecm_courses_course_category: Kurs Kategorie
10
+ ecm_courses_course_dates_count: Kurs Termine
11
+ ecm_courses_course_dates: Kurs Termine
12
+ locale: Sprache
13
+ name: Name
14
+ position: Position
15
+ slug: Freundliche ID
16
+ updated_at: Aktualisiert am
17
+ models:
18
+ ecm/courses/course:
19
+ one: Kurs
20
+ other: Kurse
21
+ formtastic:
22
+ hints:
23
+ ecm/courses/course:
24
+ name: "z.B. Kochen für Anfänger"
25
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ en:
3
+ activerecord:
4
+ attributes:
5
+ ecm/courses/course:
6
+ created_at: created at
7
+ description: description
8
+ ecm_courses_course_category: course category
9
+ ecm_courses_course_category_id: course category
10
+ ecm_courses_course_dates_count: course dates
11
+ ecm_courses_course_dates: course dates
12
+ locale: language
13
+ name: name
14
+ position: position
15
+ slug: friendly id
16
+ updated_at: updated at
17
+ models:
18
+ ecm/courses/course:
19
+ one: "Course"
20
+ other: "Courses"
21
+ formtastic:
22
+ hints:
23
+ ecm/courses/course:
24
+ name: "i.e. Cooking for beginners"
25
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ attributes:
5
+ ecm/courses/course_category:
6
+ children: "Unter Kategorien"
7
+ created_at: Erstellt am
8
+ depth: Tiefe
9
+ description: Beschreibung
10
+ ecm_courses_courses_count: Kurse
11
+ ecm_courses_courses: Kurse
12
+ lft: Links
13
+ locale: Sprache
14
+ name: Name
15
+ parent_id: Über Kategorie
16
+ parent: Über Kategorie
17
+ position: Position
18
+ rgt: Rechts
19
+ slug: Freundliche ID
20
+ updated_at: Aktualsiert am
21
+ models:
22
+ ecm/courses/course_category:
23
+ one: "Kurs Kategorie"
24
+ other: "Kurs Kategorien"
25
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ en:
3
+ activerecord:
4
+ attributes:
5
+ ecm/courses/course_category:
6
+ children: "sub categories"
7
+ created_at: created at
8
+ depth: depth
9
+ description: description
10
+ ecm_courses_courses_count: courses
11
+ ecm_courses_courses: courses
12
+ lft: left
13
+ locale: language
14
+ name: name
15
+ parent_id: parent cateogory
16
+ parent: parent category
17
+ position: position
18
+ rgt: right
19
+ slug: friendly id
20
+ updated_at: updated at
21
+ models:
22
+ ecm/courses/course_category:
23
+ one: "course category"
24
+ other: "course_categories"
25
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ attributes:
5
+ ecm/courses/course_date:
6
+ created_at: Erstellt am
7
+ description: Beschreibung
8
+ duration_in_minutes: Dauer
9
+ ecm_courses_course_category: Kurs Kategorie
10
+ ecm_courses_course_id: Kurs
11
+ ecm_courses_course: Kurs
12
+ end_at: Endet um
13
+ name: Name
14
+ start_at: Beginnt um
15
+ updated_at: Aktualisiert am
16
+ models:
17
+ ecm/courses/course_date:
18
+ one: "Kurs Termin"
19
+ other: "Kurs Termine"
20
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ en:
3
+ activerecord:
4
+ attributes:
5
+ ecm/courses/course_date:
6
+ created_at: created at
7
+ description: description
8
+ duration_in_minutes: duration
9
+ ecm_courses_course_category: course category
10
+ ecm_courses_course: course
11
+ ecm_courses_course_id: course
12
+ end_at: end at
13
+ name: name
14
+ start_at: begin at
15
+ updated_at: updated at
16
+ models:
17
+ ecm/courses/course_date:
18
+ one: "course date"
19
+ other: "course dates"
20
+
@@ -0,0 +1,18 @@
1
+ de:
2
+ date:
3
+ formats:
4
+ month_with_year: %B %Y
5
+ ecm:
6
+ courses:
7
+ active_admin:
8
+ menu: "Kurse"
9
+ course:
10
+ messages:
11
+ not_found: "Download \"%{name}\" nicht gefunden."
12
+ course_category:
13
+ actions:
14
+ back_to_index: "Zurück zur Übersicht"
15
+ messages:
16
+ not_found: "Kurs Kategorie \"%{name}\" nicht gefunden."
17
+ no_courses_available: "Keine Kurse in dieser Kategorie vorhanden."
18
+
@@ -0,0 +1,18 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ month_with_year: %B %Y
5
+ ecm:
6
+ courses:
7
+ active_admin:
8
+ menu: "courses"
9
+ course:
10
+ messages:
11
+ not_found: "Course \"%{name}\" not found."
12
+ course_category:
13
+ actions:
14
+ back_to_index: "Back to the index"
15
+ messages:
16
+ not_found: "Course category \"%{name}\" not found."
17
+ no_courses_available: "There are now courses in this category."
18
+
@@ -0,0 +1,6 @@
1
+ de:
2
+ resources:
3
+ ecm_courses_courses: "kurse"
4
+ ecm_courses_course_categories: "kurs-kategorien"
5
+ ecm_courses_course_dates: "kurs-termine"
6
+
@@ -0,0 +1,6 @@
1
+ en:
2
+ resources:
3
+ ecm_courses_courses: "courses"
4
+ ecm_courses_course_categories: "course-categories"
5
+ ecm_courses_course_dates: "course-dates"
6
+
data/config/routes.rb ADDED
@@ -0,0 +1,22 @@
1
+ Ecm::Courses::Engine.routes.draw do
2
+ # options.reverse_merge!(
3
+ # {
4
+ # :course_category_actions => [:index, :show],
5
+ # :course_date_actions => [:index, :show],
6
+ # :course_actions => [:calendar, :index, :show]
7
+ # }
8
+ # )
9
+ localized do
10
+ resources :course_categories # , :only => options[:course_category_actions], :controller => 'ecm/courses/course_categories'
11
+ resources :courses do # , :only => options[:course_actions], :controller => 'ecm/courses/courses' do
12
+ member do
13
+ # if options[:course_actions].include?(:calendar)
14
+ get "calendar", action: :calendar
15
+ get "calendar/:year/:month", action: :calendar
16
+ # end
17
+ end
18
+ end
19
+
20
+ resources :course_dates # , only: options[:course_date_actions] #, controller: 'ecm/courses/course_dates'
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ class CreateEcmCoursesCourseCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_courses_course_categories do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.string :locale
7
+ t.integer :position
8
+ t.integer :ecm_courses_courses_count, default: 0, null: false
9
+
10
+ # awesome nested set
11
+ t.integer :parent_id
12
+ t.integer :lft
13
+ t.integer :rgt
14
+ t.integer :depth
15
+
16
+ # friendly id
17
+ t.string :slug
18
+
19
+ t.timestamps
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ class CreateEcmCoursesCourses < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_courses_courses do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.string :locale
7
+
8
+ # references
9
+ t.integer :ecm_courses_course_dates_count, default: 0, null: false
10
+ t.references :ecm_courses_course_category
11
+
12
+ # acts as list
13
+ t.integer :position
14
+
15
+ # friendly id
16
+ t.string :slug
17
+
18
+ t.timestamps
19
+ end
20
+ add_index :ecm_courses_courses, :ecm_courses_course_category_id
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ class CreateEcmCoursesCourseDates < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_courses_course_dates do |t|
4
+ t.timestamp :start_at
5
+ t.timestamp :end_at
6
+ t.text :description
7
+
8
+ # references
9
+ t.integer :ecm_courses_course_id
10
+
11
+ # # friendly id
12
+ # t.string :slug
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ class RemoveEcmCoursesCoursesCountFromEcmCoursesCourseCategories < ActiveRecord::Migration
2
+ def change
3
+ remove_column :ecm_courses_course_categories, :ecm_courses_courses_count, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RemoveEcmCoursesCourseDatesCountFromEcmCoursesCourses < ActiveRecord::Migration
2
+ def change
3
+ remove_column :ecm_courses_courses, :ecm_courses_course_dates_count, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeEcmCoursesCourseCategoryIdToCourseCategoryIdOnEcmCoursesCourses < ActiveRecord::Migration
2
+ def change
3
+ rename_column :ecm_courses_courses, :ecm_courses_course_category_id, :course_category_id
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeEcmCoursesCourseIdToCourseIdOnEcmCoursesCourseDate < ActiveRecord::Migration
2
+ def change
3
+ rename_column :ecm_courses_course_dates, :ecm_courses_course_id, :course_id
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module Ecm
2
+ module Courses
3
+ module Configuration
4
+ def configure
5
+ yield self
6
+ end
7
+
8
+ mattr_accessor(:base_controller) { '::ApplicationController' }
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Ecm
2
+ module Courses
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Ecm::Courses
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm
2
+ module Courses
3
+ VERSION = '0.0.1'.freeze
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'ecm/courses/configuration'
2
+
3
+ module Ecm
4
+ module Courses
5
+ extend Configuration
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ require 'friendly_id'
2
+ require 'awesome_nested_set'
3
+ require 'route_translator'
4
+
5
+ require 'ecm/courses'
6
+ require 'ecm/courses/engine'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :courses do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,11 @@
1
+ FactoryGirl.define do
2
+ factory :ecm_courses_course_category, class: Ecm::Courses::CourseCategory do
3
+ sequence(:name) { |i| "Course category ##{i}" }
4
+ locale I18n.locale.to_s
5
+
6
+ factory :ecm_courses_course_category_with_parent do
7
+ locale nil
8
+ association :parent, factory: :ecm_courses_course_category
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :ecm_courses_course_date, class: Ecm::Courses::CourseDate do
3
+ ecm_courses_course
4
+ end_at 6.days.from_now
5
+ start_at 5.days.from_now
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ FactoryGirl.define do
2
+ factory :ecm_courses_course, class: Ecm::Courses::Course do
3
+ sequence(:name) { |i| "Course ##{i}" }
4
+ ecm_courses_course_category
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ecm_courses2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Roberto Vasquez Angel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: friendly_id
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: awesome_nested_set
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: route_translator
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Ecm::Courses Module.
70
+ email:
71
+ - roberto@vasquez-angel.de
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - MIT-LICENSE
77
+ - README.rdoc
78
+ - Rakefile
79
+ - app/assets/javascripts/ecm/courses/application.js
80
+ - app/assets/stylesheets/ecm/courses/application.css
81
+ - app/controllers/ecm/courses/application_controller.rb
82
+ - app/controllers/ecm/courses/course_categories_controller.rb
83
+ - app/controllers/ecm/courses/course_dates_controller.rb
84
+ - app/controllers/ecm/courses/courses_controller.rb
85
+ - app/helpers/ecm/courses/application_helper.rb
86
+ - app/models/ecm/courses/application_record.rb
87
+ - app/models/ecm/courses/course.rb
88
+ - app/models/ecm/courses/course_category.rb
89
+ - app/models/ecm/courses/course_date.rb
90
+ - app/views/ecm/courses/course_categories/_course_category.haml
91
+ - app/views/ecm/courses/course_categories/index.haml
92
+ - app/views/ecm/courses/course_categories/show.haml
93
+ - app/views/ecm/courses/course_dates/_course_date.haml
94
+ - app/views/ecm/courses/course_dates/index.haml
95
+ - app/views/ecm/courses/course_dates/show.haml
96
+ - app/views/ecm/courses/courses/_course.haml
97
+ - app/views/ecm/courses/courses/calendar.haml
98
+ - app/views/ecm/courses/courses/index.haml
99
+ - app/views/ecm/courses/courses/show.haml
100
+ - app/views/layouts/ecm/courses/application.html.erb
101
+ - config/locales/de.yml
102
+ - config/locales/locales/ecm.courses.course.de.yml
103
+ - config/locales/locales/ecm.courses.course.en.yml
104
+ - config/locales/locales/ecm.courses.course_category.de.yml
105
+ - config/locales/locales/ecm.courses.course_category.en.yml
106
+ - config/locales/locales/ecm.courses.course_date.de.yml
107
+ - config/locales/locales/ecm.courses.course_date.en.yml
108
+ - config/locales/locales/ecm.courses.de.yml
109
+ - config/locales/locales/ecm.courses.en.yml
110
+ - config/locales/locales/ecm.courses.routes.de.yml
111
+ - config/locales/locales/ecm.courses.routes.en.yml
112
+ - config/routes.rb
113
+ - db/migrate/001_create_ecm_courses_course_categories.rb
114
+ - db/migrate/002_create_ecm_courses_courses.rb
115
+ - db/migrate/003_create_ecm_courses_course_dates.rb
116
+ - db/migrate/20160927141932_remove_ecm_courses_courses_count_from_ecm_courses_course_categories.rb
117
+ - db/migrate/20160927142037_remove_ecm_courses_course_dates_count_from_ecm_courses_courses.rb
118
+ - db/migrate/20160927142238_change_ecm_courses_course_category_id_to_course_category_id_on_ecm_courses_courses.rb
119
+ - db/migrate/20160927142425_change_ecm_courses_course_id_to_course_id_on_ecm_courses_course_date.rb
120
+ - lib/ecm/courses.rb
121
+ - lib/ecm/courses/configuration.rb
122
+ - lib/ecm/courses/engine.rb
123
+ - lib/ecm/courses/version.rb
124
+ - lib/ecm_courses2.rb
125
+ - lib/tasks/ecm/courses_tasks.rake
126
+ - spec/factories/ecm/courses/course_category_factories.rb
127
+ - spec/factories/ecm/courses/course_date_factories.rb
128
+ - spec/factories/ecm/courses/course_factories.rb
129
+ homepage: https://github.com/robotex82/ecm_courses2
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.4.8
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Ecm::Courses.
153
+ test_files: []
154
+ has_rdoc: