From 980b852c17437704d3492f91c5d4c0e260e2b889 Mon Sep 17 00:00:00 2001 From: zhangyang Date: Thu, 1 Aug 2013 19:38:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E7=9A=84=E5=BA=95=E9=83=A8=EF=BC=9B=E4=BF=AE=E6=94=B9=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E4=B8=AD=E5=9B=9E=E5=A4=8D=E6=96=87=E5=AD=97=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=95=88=E6=9E=9C=EF=BC=9B=E4=BF=AE=E6=94=B9=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=AD=89=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/views/layouts/_base_footer.html.erb | 5 +++++ app/views/users/show.html.erb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 app/views/layouts/_base_footer.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 31960871..18d3e9ab 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb new file mode 100644 index 00000000..e90580d9 --- /dev/null +++ b/app/views/layouts/_base_footer.html.erb @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 8c58dd7f..772c673d 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -11,7 +11,7 @@ <%= content_tag('span', h(e.project), :class => 'project') %> 有了最新动态 <%= link_to format_activity_title(e.event_title), e.event_url %> -

<%= format_activity_description(e.event_description) %>

+

<%= textilizable e.event_description %>

From 18b1d22502b045188b5bc4737654bb4f6127d16f Mon Sep 17 00:00:00 2001 From: zhangyang Date: Thu, 1 Aug 2013 20:10:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?merge=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_projects.html.erb | 4 +++- app/views/layouts/base_users.html.erb | 20 ++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index ca7c2ddf..2c05abc9 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -119,9 +119,11 @@ <%= call_hook :view_layouts_base_content %>
<%= render_flash_messages %> + + <%=render :partial => 'layouts/base_footer'%> - + diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 5621f8d3..46f549a3 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -18,16 +18,8 @@
-
-
-
-
- <%= render_menu :account_menu -%> -
- <%= 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? -%> -
- +
+ <%=render :partial => 'layouts/base_header'%>
+ +
+ <%=render :partial => 'layouts/base_footer'%> +
- + @@ -150,6 +145,7 @@
+ <%= call_hook :view_layouts_base_body_bottom %> From e635237acd4b5336bc67bf8dd72ed3be4a343fd2 Mon Sep 17 00:00:00 2001 From: kaizheng <18763216000@163.com> Date: Thu, 1 Aug 2013 20:26:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0app\controllers\shares=5F?= =?UTF-8?q?controller.rb=E5=8F=8A=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=94=A8=E6=9D=A5=E4=BD=9C=E4=B8=BAapi=E6=BC=94=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E5=B0=8F=E4=BE=8B=E5=AD=90=EF=BC=8CClient.html?= =?UTF-8?q?=E6=94=BE=E5=9C=A8=E6=A0=B9=E7=9B=AE=E5=BD=95=E4=B8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E6=BC=94=E7=A4=BA=E5=AE=A2=E6=88=B7=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Client.html | 25 ++++++ app/assets/javascripts/shares.js | 2 + app/assets/stylesheets/scaffold.css | 56 +++++++++++++ app/assets/stylesheets/shares.css | 4 + app/controllers/shares_controller.rb | 92 ++++++++++++++++++++++ app/helpers/shares_helper.rb | 2 + app/models/share.rb | 3 + app/views/shares/_form.html.erb | 37 +++++++++ app/views/shares/edit.html.erb | 6 ++ app/views/shares/index.html.erb | 31 ++++++++ app/views/shares/new.html.erb | 5 ++ app/views/shares/show.html.erb | 30 +++++++ config/routes.rb | 3 + db/migrate/20130801081314_create_shares.rb | 13 +++ db/schema.rb | 13 +-- 15 files changed, 316 insertions(+), 6 deletions(-) create mode 100644 Client.html create mode 100644 app/assets/javascripts/shares.js create mode 100644 app/assets/stylesheets/scaffold.css create mode 100644 app/assets/stylesheets/shares.css create mode 100644 app/controllers/shares_controller.rb create mode 100644 app/helpers/shares_helper.rb create mode 100644 app/models/share.rb create mode 100644 app/views/shares/_form.html.erb create mode 100644 app/views/shares/edit.html.erb create mode 100644 app/views/shares/index.html.erb create mode 100644 app/views/shares/new.html.erb create mode 100644 app/views/shares/show.html.erb create mode 100644 db/migrate/20130801081314_create_shares.rb diff --git a/Client.html b/Client.html new file mode 100644 index 00000000..5ba9775f --- /dev/null +++ b/Client.html @@ -0,0 +1,25 @@ + + + + +Client + + + + +
+

һͼƬ

+

photo Share A

+
+ +

һƵ

+

Text Share B

+
+ +

һƪ

+

Text Share C

+
+ + + + \ No newline at end of file diff --git a/app/assets/javascripts/shares.js b/app/assets/javascripts/shares.js new file mode 100644 index 00000000..dee720fa --- /dev/null +++ b/app/assets/javascripts/shares.js @@ -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. diff --git a/app/assets/stylesheets/scaffold.css b/app/assets/stylesheets/scaffold.css new file mode 100644 index 00000000..1ae70002 --- /dev/null +++ b/app/assets/stylesheets/scaffold.css @@ -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; +} diff --git a/app/assets/stylesheets/shares.css b/app/assets/stylesheets/shares.css new file mode 100644 index 00000000..afad32db --- /dev/null +++ b/app/assets/stylesheets/shares.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rb new file mode 100644 index 00000000..9a76d26b --- /dev/null +++ b/app/controllers/shares_controller.rb @@ -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 diff --git a/app/helpers/shares_helper.rb b/app/helpers/shares_helper.rb new file mode 100644 index 00000000..e51aa8b8 --- /dev/null +++ b/app/helpers/shares_helper.rb @@ -0,0 +1,2 @@ +module SharesHelper +end diff --git a/app/models/share.rb b/app/models/share.rb new file mode 100644 index 00000000..f597ae79 --- /dev/null +++ b/app/models/share.rb @@ -0,0 +1,3 @@ +class Share < ActiveRecord::Base + attr_accessible :access_token, :comment, :share_type, :title, :url +end diff --git a/app/views/shares/_form.html.erb b/app/views/shares/_form.html.erb new file mode 100644 index 00000000..3cf30386 --- /dev/null +++ b/app/views/shares/_form.html.erb @@ -0,0 +1,37 @@ +<%= form_for(@share) do |f| %> + <% if @share.errors.any? %> +
+

<%= pluralize(@share.errors.count, "error") %> prohibited this share from being saved:

+ +
    + <% @share.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :access_token %>
+ <%= f.text_field :access_token %> +
+
+ <%= f.label :comment %>
+ <%= f.text_field :comment %> +
+
+ <%= f.label :url %>
+ <%= f.text_field :url %> +
+
+ <%= f.label :title %>
+ <%= f.text_field :title %> +
+
+ <%= f.label :share_type %>
+ <%= f.number_field :share_type %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/shares/edit.html.erb b/app/views/shares/edit.html.erb new file mode 100644 index 00000000..b54061dd --- /dev/null +++ b/app/views/shares/edit.html.erb @@ -0,0 +1,6 @@ +

Editing share

+ +<%= render 'form' %> + +<%= link_to 'Show', @share %> | +<%= link_to 'Back', shares_path %> diff --git a/app/views/shares/index.html.erb b/app/views/shares/index.html.erb new file mode 100644 index 00000000..fe06463b --- /dev/null +++ b/app/views/shares/index.html.erb @@ -0,0 +1,31 @@ +

Listing shares

+ + + + + + + + + + + + + +<% @shares.each do |share| %> + + + + + + + + + + +<% end %> +
Access tokenCommentUrlTitleShare type
<%= share.access_token %><%= share.comment %><%= share.url %><%= share.title %><%= share.share_type %><%= link_to 'Show', share %><%= link_to 'Edit', edit_share_path(share) %><%= link_to 'Destroy', share, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Share', new_share_path %> diff --git a/app/views/shares/new.html.erb b/app/views/shares/new.html.erb new file mode 100644 index 00000000..919a9f4b --- /dev/null +++ b/app/views/shares/new.html.erb @@ -0,0 +1,5 @@ +

New share

+ +<%= render 'form' %> + +<%= link_to 'Back', shares_path %> diff --git a/app/views/shares/show.html.erb b/app/views/shares/show.html.erb new file mode 100644 index 00000000..7744914e --- /dev/null +++ b/app/views/shares/show.html.erb @@ -0,0 +1,30 @@ +

<%= notice %>

+ +

+ Access token: + <%= @share.access_token %> +

+ +

+ Comment: + <%= @share.comment %> +

+ +

+ Url: + <%= @share.url %> +

+ +

+ Title: + <%= @share.title %> +

+ +

+ Share type: + <%= @share.share_type %> +

+ + +<%= link_to 'Edit', edit_share_path(@share) %> | +<%= link_to 'Back', shares_path %> diff --git a/config/routes.rb b/config/routes.rb index 51daeb28..481fd057 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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" diff --git a/db/migrate/20130801081314_create_shares.rb b/db/migrate/20130801081314_create_shares.rb new file mode 100644 index 00000000..755de055 --- /dev/null +++ b/db/migrate/20130801081314_create_shares.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index a6de651e..4bae3d3b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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,12 +516,13 @@ 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.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.string "title" + t.integer "share_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "students", :force => true do |t|