parent
9e286ef8a5
commit
66bf50098a
@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the shield_activities controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,43 @@
|
|||||||
|
class ShieldActivitiesController < ApplicationController
|
||||||
|
def create
|
||||||
|
if params[:org_id]
|
||||||
|
if params[:project_id]
|
||||||
|
ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||||
|
elsif params[:course_id]
|
||||||
|
ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Course', :shield_id => params[:course_id].to_i)
|
||||||
|
end
|
||||||
|
elsif params[:user_id]
|
||||||
|
if params[:project_id]
|
||||||
|
ShieldActivity.create(:container_type => 'User', :container_id => params[:user_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||||
|
elsif params[:course_id]
|
||||||
|
ShieldActivity.create(:container_type => 'User', :container_id => params[:user_id].to_i, :shield_type => 'Course', :shield_id => params[:course_id].to_i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if params[:org_id]
|
||||||
|
if params[:project_id]
|
||||||
|
ShieldActivity.where("container_type='Organization' and container_id=#{params[:org_id].to_i} and shield_type='Project' and shield_id=#{params[:project_id]}").each do |act|
|
||||||
|
act.destroy
|
||||||
|
end
|
||||||
|
# ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||||
|
elsif params[:course_id]
|
||||||
|
ShieldActivity.where("container_type='Organization' and container_id=#{params[:org_id].to_i} and shield_type='Course' and shield_id=#{params[:course_id]}").each do |act|
|
||||||
|
act.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elsif params[:user_id]
|
||||||
|
if params[:project_id]
|
||||||
|
ShieldActivity.where("container_type='User' and container_id=#{params[:user_id].to_i} and shield_type='Project' and shield_id=#{params[:project_id]}").each do |act|
|
||||||
|
act.destroy
|
||||||
|
end
|
||||||
|
# ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||||
|
elsif params[:course_id]
|
||||||
|
ShieldActivity.where("container_type='User' and container_id=#{params[:user_id].to_i} and shield_type='Course' and shield_id=#{params[:course_id]}").each do |act|
|
||||||
|
act.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,2 @@
|
|||||||
|
module ShieldActivitiesHelper
|
||||||
|
end
|
@ -0,0 +1,3 @@
|
|||||||
|
class ShieldActivity < ActiveRecord::Base
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1 @@
|
|||||||
|
location.reload();
|
@ -0,0 +1 @@
|
|||||||
|
location.reload();
|
@ -1,38 +1,45 @@
|
|||||||
<div class="userCard boxShadow">
|
<div class="userCard boxShadow" style="<%= User.current == user ? 'top:-153px;':'' %>">
|
||||||
<div class="userAvatarWrap fl">
|
<div class="userAvatarWrap fl">
|
||||||
<%= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
|
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像", :target => '_blank' %>
|
||||||
|
<%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
|
||||||
<!--<img src="images/homepageImage.jpg" width="50" height="50" alt="个人头像" />-->
|
<!--<img src="images/homepageImage.jpg" width="50" height="50" alt="个人头像" />-->
|
||||||
</div>
|
</div>
|
||||||
<div class="fl ml15">
|
<div class="fl">
|
||||||
<p class="homepageImageName mb5" style="max-width:88px;"><%= user %></p><span class="fb f14"><%= user.show_name %></span>
|
<p class="homepageImageName mb5" style="max-width:88px;"><%= user %></p>
|
||||||
<span class="homepageImageSex"></span>
|
<span class="homepageImageSex"></span>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<p class="mb8 c_dark f14"><%= user.user_extensions.technical_title %></p>
|
<p class="mb8 c_dark f14">
|
||||||
|
<span class="mr15 hidden fl ml15" style="max-width:90px;"><%= user.show_name %></span>
|
||||||
|
<%= user.user_extensions.technical_title %>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="homepageImageBlock mb10">
|
<div class="homepageImageBlock mb10">
|
||||||
<div><a href="javascript:void(0);" class="homepageImageNumber"><%= User.watched_by(user.id).count %></a></div>
|
<div><%= link_to User.watched_by(user.id).count, {:controller=>"users", :action=>"user_watchlist",:id=>user.id}, :class => 'homepageImageNumber',:target => "_blank" %></div>
|
||||||
<div class="homepageImageText">关注</div>
|
<div class="homepageImageText"><%= link_to '关注',{:controller=>"users", :action=>"user_watchlist",:id=>user.id},:target => "_blank" %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepageVerDiv"></div>
|
<div class="homepageVerDiv"></div>
|
||||||
<div class="homepageImageBlock">
|
<div class="homepageImageBlock">
|
||||||
<div><a href="javascript:void(0);" class="homepageImageNumber fans_count_<%= user.id %>"><%= user.watcher_users.count %></a></div>
|
<div><%= link_to user.watcher_users.count,{:controller=>"users", :action=>"user_fanslist",:id=>user.id}, :class => 'homepageImageNumber', :id => "fans_count_#{user.id}",:target => "_blank" %></div>
|
||||||
<div class="homepageImageText">粉丝</div>
|
<div class="homepageImageText"><%= link_to '粉丝', {:controller=>"users", :action=>"user_fanslist",:id=>user.id},:target => "_blank" %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepageVerDiv"></div>
|
<div class="homepageVerDiv"></div>
|
||||||
<div class="homepageImageBlock">
|
<div class="homepageImageBlock">
|
||||||
<div><a href="javascript:void(0);" class="homepageImageNumber"><%= user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></a></div>
|
<div><%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_path(user), :class => 'homepageImageNumber',:target => "_blank" %></div>
|
||||||
<div class="homepageImageText">博客</div>
|
<div class="homepageImageText"><%= link_to '博客', user_blogs_path(user),:target => "_blank" %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="add_cancel_watch_<%= user.id %>">
|
<% if User.current != user %>
|
||||||
<%= render :partial => 'users/watch_btn_for_picture', :locals => {:user => user} %>
|
<div class="add_cancel_watch_<%= user.id %>">
|
||||||
</div>
|
<%= render :partial => 'users/watch_btn_for_picture', :locals => {:user => user} %>
|
||||||
<!--<a href="javascript:void(0);" class="userFollow mr27 fl">添加关注</a> <a href="javascript:void(0);" class="userCancel mr27 fl" style="display:none;">取消关注</a>-->
|
</div>
|
||||||
<%= link_to "留言", feedback_path(user), :class => 'greyBtn fr', :target => "_blank" %>
|
<!--<a href="javascript:void(0);" class="userFollow mr27 fl">添加关注</a> <a href="javascript:void(0);" class="userCancel mr27 fl" style="display:none;">取消关注</a>-->
|
||||||
<%= link_to "私信", feedback_path(user), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %>
|
<%= link_to "留言", feedback_path(user), :class => 'greyBtn fr', :target => "_blank" %>
|
||||||
<!--<a href="javascript:void(0);" class="greyBtn fl">私信</a><a href="javascript:void(0);" class="greyBtn fr">留言</a> -->
|
<%= link_to "私信", feedback_path(user), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %>
|
||||||
|
<!--<a href="javascript:void(0);" class="greyBtn fl">私信</a><a href="javascript:void(0);" class="greyBtn fr">留言</a> -->
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<em></em>
|
<em></em>
|
||||||
|
<font></font>
|
||||||
</div>
|
</div>
|
@ -0,0 +1,15 @@
|
|||||||
|
class CreateShieldActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :shield_activities do |t|
|
||||||
|
t.string :container_type
|
||||||
|
t.integer :container_id
|
||||||
|
t.string :shield_type
|
||||||
|
t.integer :shield_id
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :shield_activities
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ShieldActivitiesController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in new issue