orange 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ module Orange::Middleware
12
12
  unless orange.options.has_key?('database') && orange.options['database'] == false
13
13
  db = orange.options['database'] || 'sqlite3::memory:'
14
14
  orange.load_db!(db)
15
- orange.upgrade_db! unless @options[:no_auto_upgrade]
15
+ orange.upgrade_db! unless @options[:no_auto_upgrade] || orange.options['db_no_auto_upgrade']
16
16
  end
17
17
  end
18
18
 
@@ -21,7 +21,7 @@ module Orange::Middleware
21
21
  })();
22
22
 
23
23
  </script>"
24
- packet[:content] = packet[:content].sub(/.*<\/body>$/, ga + '</body>')
24
+ packet[:content] = packet[:content].sub(/.*<\/head>$/, ga + '</head>')
25
25
  end
26
26
  packet.finish
27
27
  end
@@ -13,7 +13,7 @@ module Orange
13
13
  @gattica ||= Gattica.new(options)
14
14
  end
15
15
 
16
- def pageviews(route)
16
+ def pageviews(route, opts = {})
17
17
  return "No GA" unless gattica
18
18
  r = route.to_s
19
19
  # Strip of trailing slash if present. GA doesn't like it.
@@ -30,7 +30,7 @@ module Orange
30
30
  :dimensions => ['pagePath'],
31
31
  :metrics => ['pageviews'],
32
32
  :filters => ['pagePath == '+route.to_s[0..-1]]
33
- })
33
+ }.merge(opts))
34
34
  unless data.points.length == 0
35
35
  views = data.points[0].metrics[0][:pageviews]
36
36
  views
@@ -6,10 +6,11 @@ module Orange
6
6
  call_me :cloud
7
7
  def stack_init
8
8
  options[:ping_fm_key] = orange.options['ping_fm_key'] || false
9
+ options[:ping_fm_app_key] = orange.options['ping_fm_app_key'] || false
9
10
  end
10
11
 
11
12
  def microblog(packet, status, opts = {})
12
- params = { :api_key => ORANGE_PING_KEY,
13
+ params = { :api_key => options[:ping_fm_app_key] || ORANGE_PING_KEY,
13
14
  :user_app_key => options[:ping_fm_key],
14
15
  :post_method => "microblog",
15
16
  :body => status}.merge(opts)
@@ -52,7 +52,7 @@ module Orange
52
52
  emails = event.attendees.map{|a| a.email}
53
53
  orange[:members, true].batch_update_interest_mailchimp(packet, emails, "Eventbrite Attendee", "#{event.title} - #{event.id}")
54
54
  end
55
- packet.reroute(@my_orange_name, :orange, packet['route.resource_id']) unless no_reroute
55
+ packet.reroute(@my_orange_name, :orange, packet['route.resource_id'], 'edit') unless no_reroute
56
56
  end
57
57
 
58
58
  # Todo - eventbrite crashes when date in past
@@ -84,6 +84,7 @@ module Orange
84
84
  no_reroute = opts.delete(:no_reroute)
85
85
  if packet.request.post? || !opts.blank?
86
86
  dir = opts[:direction]
87
+ dir = {:into => opts[:parent]} if (dir == :into)
87
88
  obj ||= find_one(packet, :move, (opts[:id] || packet['route.resource_id']))
88
89
  obj.move(dir) if obj
89
90
  end
@@ -114,6 +115,12 @@ module Orange
114
115
  move(packet, false, :direction => :higher)
115
116
  end
116
117
 
118
+ def into(packet, opts = {})
119
+ opts[:parent_id] ||= packet['route.resource_path'].split('/').last
120
+ opts[:parent] = find_one(packet, :move, (opts[:parent_id])) unless opts[:parent]
121
+ move(packet, false, :direction => :into, :parent => opts[:parent])
122
+ end
123
+
117
124
  def lower(packet, opts = {})
118
125
  move(packet, false, :direction => :lower)
119
126
  end
@@ -20,6 +20,10 @@ module Orange
20
20
  end
21
21
  end
22
22
 
23
+ def afterNew(packet, obj, params = {})
24
+ obj.orange_site = packet['subsite'].blank? ? packet['site'] : packet['subsite']
25
+ end
26
+
23
27
  def for_site(packet, opts = {})
24
28
  site_filtered = model_class.all(:orange_site => packet['subsite'].blank? ? packet['site'] : packet['subsite'])
25
29
  if site_filtered.count > 0
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
- - 9
9
- version: 0.3.9
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Haslem