瀏覽代碼

Generate unique layer names for Layar

master
Adrian Short 11 年之前
父節點
當前提交
12eb811cd3
共有 3 個檔案被更改,包括 10 行新增2 行删除
  1. +2
    -1
      app/controllers/posts_controller.rb
  2. +5
    -0
      app/models/layer.rb
  3. +3
    -1
      app/views/layers/show.html.haml

+ 2
- 1
app/controllers/posts_controller.rb 查看文件

@@ -9,9 +9,10 @@ class PostsController < ApplicationController
# :params => params,
# :pois_returned => @posts.size
# )
@layer = Layer.find(params[:layer_id])

layar_response = {
:layer => 'hyparlocal',
:layer => @layer.layar_name,
:hotspots => @posts.collect { |p| post_to_poi(p) },
:errorCode => 0, # OK
:errorString => "OK",


+ 5
- 0
app/models/layer.rb 查看文件

@@ -1,4 +1,9 @@
class Layer < ActiveRecord::Base
attr_accessible :name
has_and_belongs_to_many :feeds

# Unique name for Layar layer
def layar_name
"apollo" + self.name.strip.downcase.gsub(/[^a-z0-9]/, '')
end
end

+ 3
- 1
app/views/layers/show.html.haml 查看文件

@@ -5,7 +5,9 @@
%p
API URL:
= "#{request.protocol}#{request.host_with_port}/posts/near.layar?layer_id=#{@layer.id}"
%br
Layar layer name:
= @layer.layar_name

%h2 Feeds



Loading…
取消
儲存