muck-services 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,11 +18,11 @@ Add routes
18
18
  Depending on which features you use from muck raker you may need to add additional routes to your application. For example,
19
19
  a user with include MuckServices::Models::MuckFeedParent and include MuckServices::Models::MuckFeedOwner the following routes would be required:
20
20
 
21
- map.resources :users, :controller => 'muck/users' do |users|
21
+ resources :users, :controller => 'muck/users' do
22
22
  # have to map into the muck/identity_feeds controller or rails can't find the identity_feeds
23
- users.resources :identity_feeds, :controller => 'muck/identity_feeds'
24
- users.resources :feeds, :controller => 'muck/feeds'
25
- users.resources :aggregations, :controller => 'muck/aggregations'
23
+ resources :identity_feeds, :controller => 'muck/identity_feeds'
24
+ resources :feeds, :controller => 'muck/feeds'
25
+ resources :aggregations, :controller => 'muck/aggregations'
26
26
  end
27
27
 
28
28
  == Usage
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0
1
+ 3.1.1
@@ -61,25 +61,6 @@ module MuckServicesHelper
61
61
  end
62
62
  end
63
63
 
64
- def round(flt)
65
- return (((flt.to_f*100).to_i.round).to_f)/100.0
66
- end
67
-
68
- def truncate_on_word(text, length = 270, end_string = ' ...')
69
- if text.length > length
70
- stop_index = text.rindex(' ', length)
71
- stop_index = length - 10 if stop_index < length-10
72
- text[0,stop_index] + (text.length > 260 ? end_string : '')
73
- else
74
- text
75
- end
76
- end
77
-
78
- def truncate_words(text, length = 40, end_string = ' ...')
79
- words = text.split()
80
- words[0..(length-1)].join(' ') + (words.length > length ? end_string : '')
81
- end
82
-
83
64
  def feed_query_uri(feed)
84
65
  "/search/results?terms=feed_id:" + feed.id.to_s + "&locale=en"
85
66
  end
@@ -3,12 +3,12 @@ module MuckServicesServiceHelper
3
3
  # Render a summary of all services for the given parent. The parent should 'include MuckServices::Models::MuckFeedOwner'
4
4
  def services_summary(parent)
5
5
  identity_feeds = parent.identity_feeds.find(:all, :include => [{:feed => :service}])
6
- render :partial => 'services/summary', :locals => { :identity_feeds => identity_feeds }
6
+ render(:partial => 'services/summary', :locals => { :identity_feeds => identity_feeds }).html_safe
7
7
  end
8
8
 
9
9
  # Render personal recommendations
10
10
  def personal_recommendations(user, limit = 5)
11
- render :partial => 'services/personal_recommendations', :locals => { :recommendations => user.personal_recommendations.limit(5) }
11
+ render(:partial => 'services/personal_recommendations', :locals => { :recommendations => user.personal_recommendations.limit(5) }).html_safe
12
12
  end
13
13
 
14
14
  # Render a view with all services in categories.
@@ -17,7 +17,7 @@ module MuckServicesServiceHelper
17
17
  # title: Optional title. Default is 'Available Services' - from I18n.t('muck.services.available_services')
18
18
  # css: Optional css to be added to the div that surrounds the categories
19
19
  def available_service_categories(service_categories, title = nil, css = '')
20
- render :partial => 'identity_feeds/available_service_categories', :locals => { :service_categories => service_categories, :css => css, :title => title }
20
+ render(:partial => 'identity_feeds/available_service_categories', :locals => { :service_categories => service_categories, :css => css, :title => title }).html_safe
21
21
  end
22
22
 
23
23
  # Render a view with the user's registered services.
@@ -26,7 +26,7 @@ module MuckServicesServiceHelper
26
26
  # title: Optional title. Default is 'My Services' - from I18n.t('muck.services.my_services')
27
27
  # css: Optional css to be added to the div that surrounds the categories
28
28
  def services_for_user(identity_feeds, title = nil, css = '')
29
- render :partial => 'identity_feeds/services_for_user', :locals => { :identity_feeds => identity_feeds, :css => css, :title => title, :edit => false }
29
+ render(:partial => 'identity_feeds/services_for_user', :locals => { :identity_feeds => identity_feeds, :css => css, :title => title, :edit => false }).html_safe
30
30
  end
31
31
 
32
32
  # Render an edit view with the user's registered services.
@@ -35,12 +35,12 @@ module MuckServicesServiceHelper
35
35
  # title: Optional title. Default is 'My Services' - from I18n.t('muck.services.my_services')
36
36
  # css: Optional css to be added to the div that surrounds the categories
37
37
  def services_for_user_edit(identity_feeds, title = nil, css = '')
38
- render :partial => 'identity_feeds/services_for_user', :locals => { :identity_feeds => identity_feeds, :css => css, :title => title, :edit => true }
38
+ render(:partial => 'identity_feeds/services_for_user', :locals => { :identity_feeds => identity_feeds, :css => css, :title => title, :edit => true }).html_safe
39
39
  end
40
40
 
41
41
  # Renders name and icon for the service
42
42
  def service_title(service)
43
- %Q{<div class="identity-service-title" #{service_icon_background(service)}>#{service_prompt(service)}</div>}
43
+ %Q{<div class="identity-service-title" #{service_icon_background(service)}>#{service_prompt(service)}</div>}.html_safe
44
44
  end
45
45
 
46
46
  # By default renders Service username e.g. Flickr username
@@ -52,9 +52,9 @@ module MuckServicesServiceHelper
52
52
  # muck.services.facebook_prompt: "%{service} Feeds"
53
53
  def service_prompt(service)
54
54
  if @service.prompt.blank?
55
- I18n.t('muck.services.service_username', :service => @service.name)
55
+ I18n.t('muck.services.service_username', :service => @service.name).html_safe
56
56
  else
57
- I18n.t("muck.services.#{@service.prompt}", :service => @service.name)
57
+ I18n.t("muck.services.#{@service.prompt}", :service => @service.name).html_safe
58
58
  end
59
59
  end
60
60
 
@@ -79,18 +79,18 @@ module MuckServicesServiceHelper
79
79
 
80
80
  # Renders a delete button for an identity_feed
81
81
  def service_delete(identity_feed, button_type = :button, button_text = t("muck.general.delete"))
82
- render :partial => 'shared/delete', :locals => { :delete_object => identity_feed,
82
+ render(:partial => 'shared/delete', :locals => { :delete_object => identity_feed,
83
83
  :button_type => button_type,
84
84
  :button_text => button_text,
85
85
  :form_class => 'identity-feed-delete',
86
- :delete_path => identity_feed_path(identity_feed, :format => 'js') }
86
+ :delete_path => identity_feed_path(identity_feed, :format => 'js') }).html_safe
87
87
  end
88
88
 
89
89
  # Renders a service link optionally wrapping it in the specified element
90
90
  def service_link(path, service, link_css, wrapper, link_text = nil, target = nil, id = nil)
91
- link = %Q{<a #{'id=' + id if id} href="#{path}" #{service_icon_background(service)} #{'target=' + target if target} class="service-link #{link_css}">#{link_text || service.name}</a>}
91
+ link = %Q{<a #{'id=' + id if id} href="#{path}" #{service_icon_background(service)} #{'target=' + target if target} class="service-link #{link_css}">#{link_text || service.name}</a>}.html_safe
92
92
  if wrapper
93
- content_tag wrapper, link, :class => 'identity-service'
93
+ content_tag(wrapper, link, :class => 'identity-service').html_safe
94
94
  else
95
95
  link
96
96
  end
@@ -98,9 +98,9 @@ module MuckServicesServiceHelper
98
98
 
99
99
  def url_by_identity_feed(owner, identity_feed, service)
100
100
  if identity_feed
101
- polymorphic_url([owner, identity_feed], :service_id => service.to_param)
101
+ polymorphic_url([owner, identity_feed], :service_id => service.to_param).html_safe
102
102
  else
103
- polymorphic_url([owner, :identity_feeds], :service_id => service.to_param)
103
+ polymorphic_url([owner, :identity_feeds], :service_id => service.to_param).html_safe
104
104
  end
105
105
  end
106
106
 
@@ -5,7 +5,7 @@
5
5
  <div id="<%= service_category.dom_id %>" class="service-category">
6
6
  <h3><%= service_category.name %></h3>
7
7
  <ul id="services-list" class="services-list">
8
- <%= render :partial => 'services/new_service', :collection => service_category.identity_services %>
8
+ <%= render(:partial => 'services/new_service', :collection => service_category.identity_services).html_safe %>
9
9
  </ul>
10
10
  </div>
11
11
  <% end -%>
@@ -2,9 +2,9 @@
2
2
  <h2><%= title || I18n.t('muck.services.my_services') %></h2>
3
3
  <ul id="my-services-list" class="services-list">
4
4
  <% if edit -%>
5
- <%= render :partial => 'services/edit_service', :collection => identity_feeds %>
5
+ <%= render(:partial => 'services/edit_service', :collection => identity_feeds) %>
6
6
  <% else -%>
7
- <%= render :partial => 'services/view_service', :collection => identity_feeds %>
7
+ <%= render(:partial => 'services/view_service', :collection => identity_feeds) %>
8
8
  <% end -%>
9
9
  </ul>
10
10
  </div>
@@ -1 +1 @@
1
- <%= service_lightbox(@parent, new_service) %>
1
+ <%= service_lightbox(@parent, new_service).html_safe %>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-services}
8
- s.version = "3.1.0"
8
+ s.version = "3.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joel Duffin", "Justin Ball"]
12
- s.date = %q{2010-11-18}
12
+ s.date = %q{2011-01-28}
13
13
  s.description = %q{This gem contains the rails specific code for dealing with feeds, aggregations and recommendations. It is meant to work with the muck-raker gem.}
14
14
  s.email = %q{justin@tatemae.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-services
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 0
10
- version: 3.1.0
9
+ - 1
10
+ version: 3.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joel Duffin
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-18 00:00:00 -07:00
19
+ date: 2011-01-28 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency