Commit cddbff5b32ea1f7f204f93169fce897030a7760f
1 parent
4c5a5681
Exists in
master
and in
29 other branches
New logic for setting :port in development mode
Now developers running on ports other than 3000 must inform their URL options in config/url_options.yml
Showing
2 changed files
with
10 additions
and
10 deletions
Show diff stats
app/helpers/tags_helper.rb
@@ -51,7 +51,7 @@ module TagsHelper | @@ -51,7 +51,7 @@ module TagsHelper | ||
51 | style = ""+ | 51 | style = ""+ |
52 | "font-size: #{ (v * delta).round + min_size }px;"+ | 52 | "font-size: #{ (v * delta).round + min_size }px;"+ |
53 | "top: #{ -(delta/2) - (v * (delta/2)).round }px;" | 53 | "top: #{ -(delta/2) - (v * (delta/2)).round }px;" |
54 | - destination = url.kind_of?(Hash) ? url_for(url.merge(tagname_option => tag)) : (url.to_s + tag) | 54 | + destination = url.merge(tagname_option => tag) |
55 | 55 | ||
56 | if options[:show_count] | 56 | if options[:show_count] |
57 | display_count = options[:show_count] ? "<small><sup>(#{count})</sup></small>" : "" | 57 | display_count = options[:show_count] ? "<small><sup>(#{count})</sup></small>" : "" |
lib/noosfero.rb
@@ -60,16 +60,16 @@ module Noosfero | @@ -60,16 +60,16 @@ module Noosfero | ||
60 | end | 60 | end |
61 | end | 61 | end |
62 | 62 | ||
63 | - # FIXME couldn't think of a way to test this. | ||
64 | - # | ||
65 | - # Works (tested by hand) on Rails 2.0.2, with mongrel. Should work with | ||
66 | - # webrick too. | ||
67 | def self.development_url_options | 63 | def self.development_url_options |
68 | - if Object.const_defined?('OPTIONS') | ||
69 | - { :port => OPTIONS[:port ]} | ||
70 | - else | ||
71 | - {} | ||
72 | - end | 64 | + @development_url_options ||= |
65 | + begin | ||
66 | + options = { :port => 3000 } | ||
67 | + config = File.join(Rails.root, 'config', 'url_options.yml') | ||
68 | + if File.exists?(config) | ||
69 | + options.merge!(YAML.load_file(config).symbolize_keys) | ||
70 | + end | ||
71 | + options | ||
72 | + end | ||
73 | end | 73 | end |
74 | 74 | ||
75 | 75 |