Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop

This commit is contained in:
nieguanghui 2013-08-01 20:32:50 +08:00
commit 2e139cd682
20 changed files with 334 additions and 21 deletions

25
Client.html Normal file
View File

@ -0,0 +1,25 @@
<html>
<head>
<title>
Client
</title>
</head>
<body>
<hr />
<h2>这是一张图片</h2>
<p>photo<a href="http://10.0.47.15:3000/shares/new?access_token='2d3dda45dsd'&comment='verygood'&title=davide&share_type=1&url=http://www.baidu.com"> Share A </a></p>
<hr />
<h2>这是一段视频</h2>
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=kaka&share_type=2&url=http://www.sina.com"> Share B </a></p>
<hr />
<h2>这是一篇文章</h2>
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=pepe&share_type=3&url=http://www.sina.com"> Share C </a></p>
<hr />
</body>
</html>

View File

@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@ -0,0 +1,56 @@
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}
a { color: #000; }
a:visited { color: #666; }
a:hover { color: #fff; background-color:#000; }
div.field, div.actions {
margin-bottom: 10px;
}
#notice {
color: green;
}
.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}
#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
}
#error_explanation h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
#error_explanation ul li {
font-size: 12px;
list-style: square;
}

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -0,0 +1,92 @@
class SharesController < ApplicationController
# GET /shares
# GET /shares.json
def index
@shares = Share.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @shares }
end
end
# GET /shares/1
# GET /shares/1.json
def show
@share = Share.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @share }
end
end
# GET /shares/new
# GET /shares/new.json
def new
@share = Share.new
#add by mkz 抓取参数传给share
@share[:access_token] = params[:access_token]
@share[:comment] = params[:comment]
@share[:title] = params[:title]
@share[:url] = params[:url]
@share[:share_type] = params[:share_type]
@share.save
#
respond_to do |format|
format.html # new.html.erb
format.json { render json: @share }
end
end
# GET /shares/1/edit
def edit
@share = Share.find(params[:id])
end
# POST /shares
# POST /shares.json
def create
@share = Share.new(params[:share])
respond_to do |format|
if @share.save
format.html { redirect_to @share, notice: 'Share was successfully created.' }
format.json { render json: @share, status: :created, location: @share }
else
format.html { render action: "new" }
format.json { render json: @share.errors, status: :unprocessable_entity }
end
end
end
# PUT /shares/1
# PUT /shares/1.json
def update
@share = Share.find(params[:id])
respond_to do |format|
if @share.update_attributes(params[:share])
format.html { redirect_to @share, notice: 'Share was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @share.errors, status: :unprocessable_entity }
end
end
end
# DELETE /shares/1
# DELETE /shares/1.json
def destroy
@share = Share.find(params[:id])
@share.destroy
respond_to do |format|
format.html { redirect_to shares_url }
format.json { head :no_content }
end
end
end

View File

@ -17,7 +17,7 @@
class UsersController < ApplicationController
layout 'base_users'
before_filter :require_admin, :except => [:show, :index,:tag_save]
before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments]
before_filter :find_user, :only => [:show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments]
accept_api_auth :index, :show, :create, :update, :destroy

View File

@ -0,0 +1,2 @@
module SharesHelper
end

3
app/models/share.rb Normal file
View File

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

View File

@ -0,0 +1,5 @@
<div id="footer" style="margin-left:-5px;padding-top: 10px;clear: both;">
<div class="bgl"><div class="bgr">
Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> &copy; 2006-2013 Jean-Philippe Lang
</div></div>
</div>

View File

@ -119,7 +119,9 @@
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%= render_flash_messages %>
</div>
<%=render :partial => 'layouts/base_footer'%>
</div>
<div id="ajax-indicator" style="display:none;">

View File

@ -19,15 +19,7 @@
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<div id="top-menu" style="background-color: #FFFFFF">
<div id="account">
<div id="top-menu" style="background-color: #FFFFFF">
<%= render_menu :account_menu -%>
</div>
<%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
</div>
<%=render :partial => 'layouts/base_header'%>
<div id="main" class="">
<!--user page-->
<div id="sidebar">
@ -139,7 +131,10 @@
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%= render_flash_messages %>
</div>
<%=render :partial => 'layouts/base_footer'%>
</div>
<div id="ajax-indicator" style="display:none;">
@ -150,6 +145,7 @@
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -0,0 +1,37 @@
<%= form_for(@share) do |f| %>
<% if @share.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@share.errors.count, "error") %> prohibited this share from being saved:</h2>
<ul>
<% @share.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% 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 %>
</div>
<div class="field">
<%= f.label :url %><br />
<%= f.text_field :url %>
</div>
<div class="field">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :share_type %><br />
<%= f.number_field :share_type %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

View File

@ -0,0 +1,6 @@
<h1>Editing share</h1>
<%= render 'form' %>
<%= link_to 'Show', @share %> |
<%= link_to 'Back', shares_path %>

View File

@ -0,0 +1,31 @@
<h1>Listing shares</h1>
<table>
<tr>
<th>Access token</th>
<th>Comment</th>
<th>Url</th>
<th>Title</th>
<th>Share type</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @shares.each do |share| %>
<tr>
<td><%= share.access_token %></td>
<td><%= share.comment %></td>
<td><%= share.url %></td>
<td><%= share.title %></td>
<td><%= share.share_type %></td>
<td><%= link_to 'Show', share %></td>
<td><%= link_to 'Edit', edit_share_path(share) %></td>
<td><%= link_to 'Destroy', share, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Share', new_share_path %>

View File

@ -0,0 +1,5 @@
<h1>New share</h1>
<%= render 'form' %>
<%= link_to 'Back', shares_path %>

View File

@ -0,0 +1,30 @@
<p id="notice"><%= notice %></p>
<p>
<b>Access token:</b>
<%= @share.access_token %>
</p>
<p>
<b>Comment:</b>
<%= @share.comment %>
</p>
<p>
<b>Url:</b>
<%= @share.url %>
</p>
<p>
<b>Title:</b>
<%= @share.title %>
</p>
<p>
<b>Share type:</b>
<%= @share.share_type %>
</p>
<%= link_to 'Edit', edit_share_path(@share) %> |
<%= link_to 'Back', shares_path %>

View File

@ -11,7 +11,7 @@
<td colspan="2" valign="top"><strong> <%= content_tag('span', h(e.project), :class => 'project') %></strong> <span class="font_lighter">有了最新动态</span> <%= link_to format_activity_title(e.event_title), e.event_url %></td>
</tr>
<tr>
<td colspan="2" width="580" ><p class="font_description"><%= format_activity_description(e.event_description) %></p></td>
<td colspan="2" width="580" ><p class="font_description"><%= textilizable e.event_description %></p></td>
</tr>
<tr>
<td align="left"><a class="font_lighter"></a></td>

View File

@ -16,6 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do
resources :shares
get "tags/index"
get "tags/show"

View File

@ -0,0 +1,13 @@
class CreateShares < ActiveRecord::Migration
def change
create_table :shares do |t|
t.string :access_token
t.string :comment
t.string :url
t.string :title
t.integer :share_type
t.timestamps
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130729033444) do
ActiveRecord::Schema.define(:version => 20130801081314) do
create_table "a_user_watchers", :force => true do |t|
t.string "name"
@ -516,10 +516,11 @@ ActiveRecord::Schema.define(:version => 20130729033444) do
add_index "settings", ["name"], :name => "index_settings_on_name"
create_table "shares", :force => true do |t|
t.string "title"
t.string "type"
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
end