添加分享按钮

This commit is contained in:
kaizheng 2013-08-03 20:09:04 +08:00
parent a29a84d8a3
commit 3d8aa620a5
7 changed files with 36 additions and 29 deletions

View File

@ -27,8 +27,8 @@ class SharesController < ApplicationController
@share = Share.new
#add by mkz 抓取参数传给share
@share[:access_token] = params[:access_token]
@share[:comment] = params[:comment]
@share[:created_on] = params[:created_on]
@share[:title] = params[:title]
@share[:url] = params[:url]
@share[:share_type] = params[:share_type]

View File

@ -1,3 +1,3 @@
class Share < ActiveRecord::Base
attr_accessible :access_token, :comment, :share_type, :title, :url
attr_accessible :created_on, :share_type, :title, :url
end

View File

@ -12,12 +12,8 @@
<% end %>
<div class="field">
<%= f.label :access_token %><br />
<%= f.text_field :access_token %>
</div>
<div class="field">
<%= f.label :comment %><br />
<%= f.text_field :comment %>
<%= f.label :created_on %><br />
<%= f.text_field :created_on %>
</div>
<div class="field">
<%= f.label :url %><br />

View File

@ -2,8 +2,7 @@
<table>
<tr>
<th>Access token</th>
<th>Comment</th>
<th>Created On</th>
<th>Url</th>
<th>Title</th>
<th>Share type</th>
@ -14,8 +13,7 @@
<% @shares.each do |share| %>
<tr>
<td><%= share.access_token %></td>
<td><%= share.comment %></td>
<td><%= share.created_on %></td>
<td><%= share.url %></td>
<td><%= share.title %></td>
<td><%= share.share_type %></td>
@ -26,6 +24,10 @@
<% end %>
</table>
<a href=javascript:window.open('http://localhost:3000/shares/new?from=3&title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','');void(0)><img src="genghuancheng" alt="QQshuqian" border="0" height="16" width="16"></a>
<br />
<%= link_to 'New Share', new_share_path %>
<a href=javascript:window.open('http://localhost:3000/shares/new?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','');void(0)><img src="genghuancheng" alt="QQshuqian" border="0" height="16" width="16"></a>

View File

@ -1,13 +1,8 @@
<p id="notice"><%= notice %></p>
<p>
<b>Access token:</b>
<%= @share.access_token %>
</p>
<p>
<b>Comment:</b>
<%= @share.comment %>
<b>Created On:</b>
<%= @share.created_on %>
</p>
<p>

View File

@ -1,8 +1,7 @@
class CreateShares < ActiveRecord::Migration
def change
create_table :shares do |t|
t.string :access_token
t.string :comment
t.date :created_on
t.string :url
t.string :title
t.integer :share_type

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130801081314) do
ActiveRecord::Schema.define(:version => 20130802011758) do
create_table "a_user_watchers", :force => true do |t|
t.string "name"
@ -516,13 +516,12 @@ ActiveRecord::Schema.define(:version => 20130801081314) do
add_index "settings", ["name"], :name => "index_settings_on_name"
create_table "shares", :force => true do |t|
t.string "access_token"
t.string "comment"
t.string "url"
t.date "created_on"
t.string "title"
t.integer "share_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "share_type"
t.string "url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "students", :force => true do |t|
@ -587,6 +586,22 @@ ActiveRecord::Schema.define(:version => 20130801081314) do
t.integer "fields_bits", :default => 0
end
create_table "user_extensions", :force => true do |t|
t.integer "user_id"
t.text "brief_introduction"
t.text "gender"
t.date "birthdate"
t.text "occupation"
t.text "location"
t.integer "zip_code"
t.float "work_experitions"
t.integer "qq"
t.integer "praise_num"
t.integer "tread_num"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "user_preferences", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.text "others"