woople-theme 0.3.0 → 0.3.01

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,18 +2,18 @@ require 'explicit_delegator'
2
2
 
3
3
  class AssessmentFormPresenter < ExplicitDelegator
4
4
 
5
- delegate_methods :description, # Short description of assessment
6
- :course_path, # url to go to when assessment cancelled
7
- :copyright, # copyright notice for assessment
8
- :submit_path, # path for assessment form to submit to
9
- :questions # set of questions in the assessment
5
+ enforce_definitions :description, # Short description of assessment
6
+ :course_path, # url to go to when assessment cancelled
7
+ :copyright, # copyright notice for assessment
8
+ :submit_path, # path for assessment form to submit to
9
+ :questions # set of questions in the assessment
10
10
 
11
11
  def render_copyright
12
12
  yield if copyright.present?
13
13
  end
14
14
 
15
15
  def questions
16
- ThemePresentation.wrap_collection(__getobj__.questions, QuestionPresenter)
16
+ ThemePresentation.wrap_collection(__getobj__.questions, WoopleTheme::QuestionPresenter)
17
17
  end
18
18
 
19
- end
19
+ end
@@ -0,0 +1,9 @@
1
+ require 'explicit_delegator'
2
+
3
+ module WoopleTheme
4
+ class AnswerPresenter < ExplicitDelegator
5
+ enforce_definitions :index, # ID of the option to be used in the form
6
+ :text # Text of the option/answer
7
+ end
8
+ end
9
+
@@ -0,0 +1,14 @@
1
+ require 'explicit_delegator'
2
+
3
+ module WoopleTheme
4
+ class QuestionPresenter < ExplicitDelegator
5
+ enforce_definitions :id, # Response id used in the form
6
+ :question, # Text of the question
7
+ :answers # Set of options/answers for the question
8
+
9
+ def answers
10
+ ThemePresentation.wrap_collection(__getobj__.answers, WoopleTheme::AnswerPresenter)
11
+ end
12
+
13
+ end
14
+ end
@@ -1,18 +1,25 @@
1
- class ExplicitDelegator
1
+ class ExplicitDelegator < SimpleDelegator
2
2
 
3
3
  def initialize(obj)
4
- @obj = obj
4
+ super(obj)
5
+ ensure_defined
5
6
  end
6
7
 
7
- def __getobj__
8
- @obj
8
+ def enforced_methods
9
+ []
9
10
  end
10
11
 
11
- def self.delegate_methods(*methods)
12
- methods.each do |method|
13
- define_method(method) do
14
- __getobj__.send(method)
15
- end
12
+ def ensure_defined
13
+ missing_methods = []
14
+ enforced_methods.each do |method|
15
+ missing_methods << method unless __getobj__.methods.include?(method)
16
+ end
17
+ raise "Methods required to use #{self.class}: #{missing_methods}" unless missing_methods.empty?
18
+ end
19
+
20
+ def self.enforce_definitions(*methods)
21
+ define_method(:enforced_methods) do
22
+ return methods
16
23
  end
17
24
  end
18
25
 
@@ -1,3 +1,3 @@
1
1
  module WoopleTheme
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.01"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woople-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.01
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70177854241140 !ruby/object:Gem::Requirement
16
+ requirement: &70189845747500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70177854241140
24
+ version_requirements: *70189845747500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: less-rails-bootstrap
27
- requirement: &70177854240400 !ruby/object:Gem::Requirement
27
+ requirement: &70189845746940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.0.13
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70177854240400
35
+ version_requirements: *70189845746940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: therubyracer
38
- requirement: &70177854239960 !ruby/object:Gem::Requirement
38
+ requirement: &70189845746560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70177854239960
46
+ version_requirements: *70189845746560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70177854239200 !ruby/object:Gem::Requirement
49
+ requirement: &70189845745780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70177854239200
57
+ version_requirements: *70189845745780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sqlite3
60
- requirement: &70177854233240 !ruby/object:Gem::Requirement
60
+ requirement: &70189845744880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70177854233240
68
+ version_requirements: *70189845744880
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec-rails
71
- requirement: &70177854232480 !ruby/object:Gem::Requirement
71
+ requirement: &70189845743780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 2.9.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70177854232480
79
+ version_requirements: *70189845743780
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: capybara
82
- requirement: &70177854231880 !ruby/object:Gem::Requirement
82
+ requirement: &70189845743160 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70177854231880
90
+ version_requirements: *70189845743160
91
91
  description: All Front-End all the Time
92
92
  email:
93
93
  - developers@bigbangtechnology.com
@@ -154,7 +154,6 @@ files:
154
154
  - app/assets/stylesheets/woople-theme/variables.css.less
155
155
  - app/helpers/javascript_helper.rb
156
156
  - app/helpers/theme_helper.rb
157
- - app/presenters/answer_presenter.rb
158
157
  - app/presenters/assessment_form_presenter.rb
159
158
  - app/presenters/content_image.rb
160
159
  - app/presenters/content_item_presenter.rb
@@ -167,8 +166,9 @@ files:
167
166
  - app/presenters/outline_video_presenter.rb
168
167
  - app/presenters/page_header_presenter.rb
169
168
  - app/presenters/profile_presenter.rb
170
- - app/presenters/question_presenter.rb
171
169
  - app/presenters/theme_presentation.rb
170
+ - app/presenters/woople_theme/answer_presenter.rb
171
+ - app/presenters/woople_theme/question_presenter.rb
172
172
  - app/views/layouts/theme.html.erb
173
173
  - app/views/woople-theme/_assessment_form.html.erb
174
174
  - app/views/woople-theme/_assessment_form_answer.html.erb
@@ -1,6 +0,0 @@
1
- require 'explicit_delegator'
2
-
3
- class AnswerPresenter < ExplicitDelegator
4
- delegate_methods :index, # ID of the option to be used in the form
5
- :text # Text of the option/answer
6
- end
@@ -1,12 +0,0 @@
1
- require 'explicit_delegator'
2
-
3
- class QuestionPresenter < ExplicitDelegator
4
- delegate_methods :id, # Response id used in the form
5
- :question, # Text of the question
6
- :answers # Set of options/answers for the question
7
-
8
- def answers
9
- ThemePresentation.wrap_collection(__getobj__.answers, AnswerPresenter)
10
- end
11
-
12
- end