_communityy.html.erb
1.38 KB
<h1><%= _('DSpace Communities') %></h1>
<%= hidden_field_tag 'article[parent_id]', @article.parent_id %>
<% dspace_server_url = @article.parent.dspace_server_url %>
<% communities = Dspace::Community.get_all_communities_from(dspace_server_url).map { |community| item = [_(community.name), community.id] } %>
<table border="0" style="border-bottom: 1px solid #c0c0c0;">
<tr style="background-color: #f0f0f0; border-bottom: 1px solid #c0c0c0;">
<th style="border-bottom: none;"> </th>
<th style="border-bottom: none;" align="left"><%= _('Community name') %></th>
</tr>
<% dspace_communities_ids = DspacePlugin::Communityy.find(:all, :conditions => { :parent_id => @article.parent_id }).map { |community| ids = community.dspace_community_id.to_i } %>
<% communities.each do |community| %>
<tr>
<% if dspace_communities_ids.include? community[1] %>
<td align="center"><%= check_box_tag "article[dspace_communities_ids][]", community[1], true, :disabled => 'disabled', :onclick => "selectCommunity(this,'#{community[0]}')" %> </td>
<% else %>
<td align="center"><%= check_box_tag "article[dspace_communities_ids][]", community[1], false, :onclick => "selectCommunity(this,'#{community[0]}')" %> </td>
<% end %>
<td>
<%= community[0] %>
</td>
</tr>
<% end %>
</table>
<%= javascript_include_tag 'plugins/dspace/javascripts/dspace_plugin' %>