woople-theme 0.2.49 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
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,5 +1,19 @@
1
- class AssessmentFormPresenter < SimpleDelegator
1
+ require 'explicit_delegator'
2
+
3
+ class AssessmentFormPresenter < ExplicitDelegator
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
10
+
2
11
  def render_copyright
3
12
  yield if copyright.present?
4
13
  end
14
+
15
+ def questions
16
+ ThemePresentation.wrap_collection(__getobj__.questions, QuestionPresenter)
17
+ end
18
+
5
19
  end
@@ -0,0 +1,12 @@
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
@@ -1,18 +1,24 @@
1
1
  <%= page_header title: 'Assessment', description: assessment_form.description %>
2
2
 
3
- <form id="assessment">
3
+
4
+ <%= form_tag(assessment_form.submit_path, id: "assessment") do %>
5
+
4
6
  <%= render partial: 'woople-theme/assessment_form_question', collection: assessment_form.questions %>
5
7
 
6
8
  <div class="fieldset <%= cycle 'odd', 'even' %>">
7
9
  <div class="row-fluid">
8
10
  <div class="span4"><span class="badge"><%= t 'woople_theme.assessment_form.unanswered_questions', count: assessment_form.questions.count %></span></div>
9
11
  <div class="span8">
10
- <input type="button" value="Cancel" class="btn btn-large" data-course-path="<%= assessment_form.course_path %>" />
11
- <input type="submit" value="Submit Assessment" class="btn btn-primary btn-large" disabled="disabled" />
12
+ <input type="button"
13
+ value="<%= I18n.t('woople_theme.cancel') %>"
14
+ class="btn btn-large"
15
+ data-course-path="<%= assessment_form.course_path %>" />
16
+ <%= submit_tag(I18n.t('woople_theme.assessment_form.submit_assessment'), {class: "btn btn-primary btn-large", disabled: "disabled"}) %>
12
17
  </div>
13
18
  </div>
14
19
  </div>
15
20
  <% assessment_form.render_copyright do %>
16
21
  <p class="<%= cycle 'odd', 'even' %>"><%= assessment_form.copyright %></p>
17
22
  <% end %>
18
- </form>
23
+
24
+ <% end %>
@@ -1,2 +1,9 @@
1
- <% input_id = "question_#{question_number}_answer_#{assessment_form_answer_counter + 1}" %>
2
- <label class="radio" for="<%= input_id %>"><input type="radio" id="<%= input_id %>" name="question_<%= question_number %>" /><%= assessment_form_answer %></label>
1
+ <% input_id = "response_#{response_id}_index_#{assessment_form_answer.index}" %>
2
+ <label class="radio" for="<%= input_id %>">
3
+ <input type="radio"
4
+ id="<%= input_id %>"
5
+ name="response[<%= response_id %>]"
6
+ value="<%= assessment_form_answer.index %>"/>
7
+
8
+ <%= assessment_form_answer.text %>
9
+ </label>
@@ -1,7 +1,7 @@
1
1
  <% question_number = assessment_form_question_counter + 1 %>
2
2
  <div class="fieldset <%= cycle 'odd', 'even' %>">
3
- <div class="legend"><span><%= question_number %></span> <%= assessment_form_question.name %></div>
3
+ <div class="legend"><span><%= question_number %></span> <%= assessment_form_question.question %></div>
4
4
  <div>
5
- <%= render partial: 'woople-theme/assessment_form_answer', collection: assessment_form_question.answers, locals: { question_number: question_number } %>
5
+ <%= render partial: 'woople-theme/assessment_form_answer', collection: assessment_form_question.answers, locals: { response_id: assessment_form_question.id } %>
6
6
  </div>
7
7
  </div>
@@ -39,9 +39,11 @@ en:
39
39
  unanswered_questions:
40
40
  one: 1 unanswered question
41
41
  other: '%{count} unanswered questions'
42
+ submit_assessment: Submit Assessment
42
43
  search_results_more: See All >
43
44
  logged_in_as: Logged in as
44
45
  impersonating: impersonating
46
+ cancel: Cancel
45
47
  date:
46
48
  formats:
47
49
  default: ! '%b %d %Y'
@@ -0,0 +1,19 @@
1
+ class ExplicitDelegator
2
+
3
+ def initialize(obj)
4
+ @obj = obj
5
+ end
6
+
7
+ def __getobj__
8
+ @obj
9
+ end
10
+
11
+ def self.delegate_methods(*methods)
12
+ methods.each do |method|
13
+ define_method(method) do
14
+ __getobj__.send(method)
15
+ end
16
+ end
17
+ end
18
+
19
+ end
@@ -1,3 +1,3 @@
1
1
  module WoopleTheme
2
- VERSION = "0.2.49"
2
+ VERSION = "0.3.0"
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.2.49
4
+ version: 0.3.0
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-05 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70177854241140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,31 +21,21 @@ dependencies:
21
21
  version: 3.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 3.2.5
24
+ version_requirements: *70177854241140
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: less-rails-bootstrap
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70177854240400 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
- - - '='
30
+ - - =
36
31
  - !ruby/object:Gem::Version
37
32
  version: 2.0.13
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - '='
44
- - !ruby/object:Gem::Version
45
- version: 2.0.13
35
+ version_requirements: *70177854240400
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: therubyracer
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70177854239960 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,15 +43,10 @@ dependencies:
53
43
  version: '0'
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *70177854239960
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: bundler
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &70177854239200 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
52
  - - ! '>='
@@ -69,15 +54,10 @@ dependencies:
69
54
  version: '0'
70
55
  type: :development
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
57
+ version_requirements: *70177854239200
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: sqlite3
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &70177854233240 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ! '>='
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '0'
86
66
  type: :development
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
68
+ version_requirements: *70177854233240
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: rspec-rails
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &70177854232480 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ~>
@@ -101,15 +76,10 @@ dependencies:
101
76
  version: 2.9.0
102
77
  type: :development
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- version: 2.9.0
79
+ version_requirements: *70177854232480
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: capybara
112
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &70177854231880 !ruby/object:Gem::Requirement
113
83
  none: false
114
84
  requirements:
115
85
  - - ! '>='
@@ -117,12 +87,7 @@ dependencies:
117
87
  version: '0'
118
88
  type: :development
119
89
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
90
+ version_requirements: *70177854231880
126
91
  description: All Front-End all the Time
127
92
  email:
128
93
  - developers@bigbangtechnology.com
@@ -189,6 +154,7 @@ files:
189
154
  - app/assets/stylesheets/woople-theme/variables.css.less
190
155
  - app/helpers/javascript_helper.rb
191
156
  - app/helpers/theme_helper.rb
157
+ - app/presenters/answer_presenter.rb
192
158
  - app/presenters/assessment_form_presenter.rb
193
159
  - app/presenters/content_image.rb
194
160
  - app/presenters/content_item_presenter.rb
@@ -201,6 +167,7 @@ files:
201
167
  - app/presenters/outline_video_presenter.rb
202
168
  - app/presenters/page_header_presenter.rb
203
169
  - app/presenters/profile_presenter.rb
170
+ - app/presenters/question_presenter.rb
204
171
  - app/presenters/theme_presentation.rb
205
172
  - app/views/layouts/theme.html.erb
206
173
  - app/views/woople-theme/_assessment_form.html.erb
@@ -222,6 +189,7 @@ files:
222
189
  - app/views/woople-theme/_video_modal.html.erb
223
190
  - config/locales/en.yml
224
191
  - config/routes.rb
192
+ - lib/explicit_delegator.rb
225
193
  - lib/tasks/woople-theme_tasks.rake
226
194
  - lib/woople-theme/configuration.rb
227
195
  - lib/woople-theme/engine.rb
@@ -257,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
225
  version: '0'
258
226
  requirements: []
259
227
  rubyforge_project:
260
- rubygems_version: 1.8.24
228
+ rubygems_version: 1.8.10
261
229
  signing_key:
262
230
  specification_version: 3
263
231
  summary: Our Front-End CSS Framework/Theme