woople-theme 0.6.9 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  module ContentImage
2
- DEFAULT_IMAGE = 'woople-theme/missing.png'
3
- MISSING_WOOPLE_IMAGE = '/images/original/missing.png'
2
+ DEFAULT_IMAGE = 'woople-theme/missing.png'
3
+ MISSING_WOOPLE_IMAGE = '/assets/retina_thumb/missing.png'
4
4
 
5
5
  def image(&block)
6
6
  yield(normalized(__getobj__.image) || DEFAULT_IMAGE) if __getobj__.respond_to? :image
@@ -9,7 +9,7 @@ module ContentImage
9
9
  private
10
10
 
11
11
  def normalized(image)
12
- if image.is_a?(Paperclip::Attachment) && image.to_s == MISSING_WOOPLE_IMAGE
12
+ if image == MISSING_WOOPLE_IMAGE
13
13
  DEFAULT_IMAGE
14
14
  else
15
15
  image
@@ -14,6 +14,4 @@ class MenuSectionPresenter < SimpleDelegator
14
14
  def section
15
15
  __getobj__
16
16
  end
17
-
18
17
  end
19
-
@@ -0,0 +1,5 @@
1
+ require 'explicit_delegator'
2
+
3
+ class ProfileLinkPresenter < ExplicitDelegator
4
+ enforce_definitions :name, :url
5
+ end
@@ -1,9 +1,30 @@
1
- require 'delegate'
1
+ require 'explicit_delegator'
2
2
 
3
- class ProfilePresenter < SimpleDelegator
4
- def each(*)
5
- super do |e|
6
- yield ThemePresentation.wrap(e, ProfilePresenter)
3
+ class ProfilePresenter < ExplicitDelegator
4
+ DEFAULT_IMAGE = 'woople-theme/missing-profile.png'
5
+ MISSING_WOOPLE_IMAGE = '/assets/retina_thumb/missing.png'
6
+
7
+ enforce_definitions :image, :sections
8
+
9
+ def image
10
+ normalized(profile.image)
11
+ end
12
+
13
+ def sections
14
+ @sections ||= ThemePresentation.wrap_collection(profile.sections, ProfileSectionPresenter)
15
+ end
16
+
17
+ private
18
+
19
+ def profile
20
+ __getobj__
21
+ end
22
+
23
+ def normalized(image)
24
+ if image.nil? || image == MISSING_WOOPLE_IMAGE
25
+ DEFAULT_IMAGE
26
+ else
27
+ image
7
28
  end
8
29
  end
9
30
  end
@@ -0,0 +1,14 @@
1
+ require 'delegate'
2
+
3
+ class ProfileSectionPresenter < SimpleDelegator
4
+
5
+ def links
6
+ ThemePresentation.wrap_collection(section, ProfileLinkPresenter)
7
+ end
8
+
9
+ private
10
+
11
+ def section
12
+ __getobj__
13
+ end
14
+ end
@@ -5,16 +5,15 @@
5
5
  </form>
6
6
  <ul class="nav nav-pills profile-link">
7
7
  <li class="dropdown">
8
- <a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= image_tag('woople-theme/missing-profile.png') %></a>
9
- <ul id="menu1" class="dropdown-menu">
10
- <% profile.each do |section| %>
11
- <% section.each do |link| %>
12
- <li><a href="<%= link.url %>"><%= link.name %></a></li>
8
+ <%= link_to(image_tag(profile.image), "#", class: 'dropdown-toggle', data: { toggle: 'dropdown' }) %>
9
+ <ul id="menu1" class="dropdown-menu">
10
+ <% profile.sections.each do |section| %>
11
+ <% section.links.each do |link| %>
12
+ <li><%= link_to(link.name, link.url) %></li>
13
+ <% end %>
14
+ <li class="divider"></li>
13
15
  <% end %>
14
- <li class="divider"></li>
15
- <% end %>
16
- </ul>
16
+ </ul>
17
17
  </li>
18
18
  </ul>
19
19
  </div>
20
-
@@ -1,3 +1,3 @@
1
1
  module WoopleTheme
2
- VERSION = '0.6.9'
2
+ VERSION = '0.6.10'
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.6.9
4
+ version: 0.6.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -207,7 +207,9 @@ files:
207
207
  - app/presenters/outline_presenter.rb
208
208
  - app/presenters/outline_video_presenter.rb
209
209
  - app/presenters/page_header_presenter.rb
210
+ - app/presenters/profile_link_presenter.rb
210
211
  - app/presenters/profile_presenter.rb
212
+ - app/presenters/profile_section_presenter.rb
211
213
  - app/presenters/submitted_assessment_form_presenter.rb
212
214
  - app/presenters/theme_presentation.rb
213
215
  - app/presenters/woople_theme/answer_presenter.rb