parent
dde65a5895
commit
5d0b5812b3
@ -1,2 +1,16 @@
|
||||
module SharesHelper
|
||||
def options_from_select_project(user)
|
||||
@membership = user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@option = []
|
||||
@membership.each do |membership|
|
||||
unless(membership.project.project_type==1)
|
||||
membership.member_roles.each{|role|
|
||||
if(role.role_id == 3)
|
||||
@option << membership.project
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
options_for_select(@option)
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,18 @@
|
||||
class Share < ActiveRecord::Base
|
||||
attr_accessible :created_on, :share_type, :title, :url
|
||||
include Redmine::SafeAttributes
|
||||
attr_accessible :created_on, :share_type, :title, :url,:project_id,:user_id, :description
|
||||
|
||||
validates_presence_of :project_id
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
|
||||
safe_attributes 'project_id',
|
||||
'user_id',
|
||||
'url',
|
||||
'title',
|
||||
'share_type',
|
||||
'crated_on',
|
||||
'description'
|
||||
|
||||
end
|
||||
|
@ -0,0 +1,40 @@
|
||||
<!-- <h3>测试结果</h3> -->
|
||||
|
||||
<p id="stcloud">
|
||||
<a href="http://www.trustie.net/webdts/" style="float:right" target="_blank">进入测试平台</a>
|
||||
</p>
|
||||
|
||||
<% @shares.each do |share| %>
|
||||
<div class="issue-note">
|
||||
<table width="660px" border="0" align="center" style="font-size: 14px;">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(share.user), :class => "avatar")%></td>
|
||||
<td>
|
||||
<table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong> <%= h(share.project) if @project.nil? || @project.id != share.project.id %></strong>
|
||||
<span class="font_lighter">
|
||||
<%= link_to_user(share.user) %> <%= l(:label_new_activity) %>
|
||||
</span> <%= share.title%>
|
||||
<br/> <br/>
|
||||
<%= share.description %><%= link_to "查看详情", share.url, {:target=>"_blank"} %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px" >
|
||||
<p class="font_description">
|
||||
<!-- modify by nyan -->
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><a class="font_lighter"> <%= h(share.created_on)%></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
@ -1,33 +1,23 @@
|
||||
<div id="share_new" style = "width: 431px; center" >
|
||||
<%= 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>
|
||||
分享到项目:
|
||||
<%= f.select 'project_id', options_from_collection_for_select(@ps, "id", "name") %></div>
|
||||
<div class="field">
|
||||
<%= f.label :created_on %><br />
|
||||
<%= f.text_field :created_on %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :url %><br />
|
||||
<%= f.text_field :url %>
|
||||
<%= f.text_field :title, :style => 'width: 399px;display: none;' %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :title %><br />
|
||||
<%= f.text_field :title %>
|
||||
<%= f.text_area :description, :rows => 4, :style => 'width: 100%;resize: none;', :class => 'create-share' %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :share_type %><br />
|
||||
<%= f.number_field :share_type %>
|
||||
<%= f.label "Website:" %><br/>
|
||||
<%= f.text_field :url, :style => 'width: 100%;', :class => 'create-share' %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
|
||||
<div class="actions" style=" padding-top: 10px; float:right">
|
||||
<%= f.submit :value=>"分享"%>
|
||||
</div>
|
||||
<% end %>
|
||||
<br/>
|
||||
</div>
|
||||
|
@ -0,0 +1,6 @@
|
||||
<p>
|
||||
分享成功!
|
||||
</p>
|
||||
<p>
|
||||
<%= link_to "查看分享", share_show_path(Project.find_by_id(@share.project_id)) %>
|
||||
</p>
|
Loading…
Reference in new issue