Commit f31d0ef4c229c1371af7fc105696791de431fcc2
1 parent
29f9c094
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
dspace_plugin : updating views
Showing
6 changed files
with
57 additions
and
31 deletions
Show diff stats
plugins/dspace/controllers/dspace_plugin_myprofile_controller.rb
plugins/dspace/public/javascripts/dspace_plugin.js
... | ... | @@ -20,3 +20,13 @@ function selectCollection(element, collection_slug) { |
20 | 20 | jQuery(hidden_field).insertAfter(element); |
21 | 21 | } |
22 | 22 | |
23 | +jQuery(document).ready(function() { | |
24 | + url_base = window.location.protocol + '//' + window.location.host; | |
25 | + forms = jQuery('form'); | |
26 | + forms.each( function(f) { | |
27 | + url_action = forms[f].action; | |
28 | + if (url_action.indexOf("/cms/new") > -1) { | |
29 | + forms[f].action = url_action.replace("/cms/new", "/plugin/dspace/new").replace(url_base,''); | |
30 | + } | |
31 | + }); | |
32 | +}); | ... | ... |
plugins/dspace/views/cms/dspace_plugin/_collection.html.erb
1 | -<h1><%= _('DSpace Collection') %></h1> | |
2 | - | |
3 | -<%#= required_fields_message %> | |
4 | - | |
5 | -<%#= required f.text_field('name', :size => '64', :maxlength => 150) %> | |
1 | +<h1><%= _('DSpace Collections') %></h1> | |
6 | 2 | |
7 | 3 | <%= hidden_field_tag 'article[parent_id]', @article.parent_id %> |
8 | 4 | |
... | ... | @@ -12,27 +8,31 @@ |
12 | 8 | |
13 | 9 | <% community_id = @article.parent.dspace_community_id %> |
14 | 10 | |
15 | -<% #dspace_client = Dspace::Client.new(dspace_server_url) %> | |
16 | - | |
17 | 11 | <% collections = Dspace::Community.get_all_collections_from( dspace_server_url, community_id ).map { |collection| item = [_(collection.name), collection.id] } %> |
18 | 12 | |
19 | -<table border="0"> | |
20 | - <tr> | |
21 | - <th><%= check_box_tag "article[dspace_collection_id]", true %></th> | |
22 | - <th align="left"><%= _('DSpace Collection') %></th> | |
13 | +<table border="0" style="border-bottom: 1px solid #c0c0c0;"> | |
14 | + <tr style="background-color: #f0f0f0; border-bottom: 1px solid #c0c0c0;"> | |
15 | + <th style="border-bottom: none;"> </th> | |
16 | + <th style="border-bottom: none;" align="left"><%= _('Collection name') %></th> | |
23 | 17 | </tr> |
18 | + | |
19 | + <% dspace_collections_ids = DspacePlugin::Collection.find(:all, :conditions => { :parent_id => @article.parent_id}).map { |collection| ids = collection.dspace_collection_id.to_i } %> | |
20 | + | |
24 | 21 | <% collections.each do |collection| %> |
22 | + | |
25 | 23 | <tr> |
26 | - <td align="center"><%= check_box_tag "article[dspace_collection_id][]", collection[1] %> </td> | |
24 | + <% if dspace_collections_ids.include? collection[1] %> | |
25 | + <td align="center"><%= check_box_tag "article[dspace_collections_ids][]", collection[1], true, :disabled => 'disabled', :onclick => "selectCollection(this,'#{collection[0]}')" %> </td> | |
26 | + <% else %> | |
27 | + <td align="center"><%= check_box_tag "article[dspace_collections_ids][]", collection[1], false, :onclick => "selectCollection(this,'#{collection[0]}')" %> </td> | |
28 | + <% end %> | |
27 | 29 | <td> |
28 | - <%= hidden_field_tag "article[dspace_collection_name][]", collection[0].to_slug %> | |
29 | 30 | <%= collection[0] %> |
30 | 31 | </td> |
31 | 32 | </tr> |
33 | + | |
32 | 34 | <% end %> |
35 | + | |
33 | 36 | </table> |
34 | 37 | |
35 | -<%#= labelled_form_field(_('Collections:'), | |
36 | - select(:article, | |
37 | - :dspace_collection_id, | |
38 | - options_for_select_with_title(collections))) %> | |
38 | +<%= javascript_include_tag 'plugins/dspace/javascripts/dspace_plugin' %> | ... | ... |
plugins/dspace/views/cms/dspace_plugin/_communityy.html.erb
1 | -<h1><%= _('DSpace Community') %></h1> | |
2 | - | |
3 | -<%= required_fields_message %> | |
4 | - | |
5 | -<%= required f.text_field('name', :size => '64', :maxlength => 150) %> | |
1 | +<h1><%= _('DSpace Communities') %></h1> | |
6 | 2 | |
7 | 3 | <%= hidden_field_tag 'article[parent_id]', @article.parent_id %> |
8 | 4 | |
9 | 5 | <% dspace_server_url = @article.parent.dspace_server_url %> |
10 | 6 | |
11 | -<% dspace_client = Dspace::Client.new(dspace_server_url) %> | |
7 | +<% communities = Dspace::Community.get_all_communities_from(dspace_server_url).map { |community| item = [_(community.name), community.id] } %> | |
8 | + | |
9 | +<table border="0" style="border-bottom: 1px solid #c0c0c0;"> | |
10 | + <tr style="background-color: #f0f0f0; border-bottom: 1px solid #c0c0c0;"> | |
11 | + <th style="border-bottom: none;"> </th> | |
12 | + <th style="border-bottom: none;" align="left"><%= _('Community name') %></th> | |
13 | + </tr> | |
14 | + | |
15 | + <% dspace_communities_ids = DspacePlugin::Communityy.find(:all, :conditions => { :parent_id => @article.parent_id }).map { |community| ids = community.dspace_community_id.to_i } %> | |
16 | + | |
17 | + <% communities.each do |community| %> | |
18 | + | |
19 | + <tr> | |
20 | + <% if dspace_communities_ids.include? community[1] %> | |
21 | + <td align="center"><%= check_box_tag "article[dspace_communities_ids][]", community[1], true, :disabled => 'disabled', :onclick => "selectCommunity(this,'#{community[0]}')" %> </td> | |
22 | + <% else %> | |
23 | + <td align="center"><%= check_box_tag "article[dspace_communities_ids][]", community[1], false, :onclick => "selectCommunity(this,'#{community[0]}')" %> </td> | |
24 | + <% end %> | |
25 | + <td> | |
26 | + <%= community[0] %> | |
27 | + </td> | |
28 | + </tr> | |
29 | + | |
30 | + <% end %> | |
12 | 31 | |
13 | -<% communities = dspace_client.get_communities.map { |community| item = [_(community.name), community.id] } %> | |
32 | +</table> | |
14 | 33 | |
15 | -<%= labelled_form_field(_('Communities:'), | |
16 | - select(:article, | |
17 | - :dspace_community_id, | |
18 | - options_for_select_with_title(communities))) %> | |
34 | +<%= javascript_include_tag 'plugins/dspace/javascripts/dspace_plugin' %> | ... | ... |
plugins/dspace/views/content_viewer/community.html.erb
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | <% if dspace_community.allow_create?(user) %> |
7 | 7 | |
8 | 8 | <div id="actions"> |
9 | - <%= content_tag('a', :href => url_for({:controller => 'dspace_plugin_myprofile', :action => 'new', :type => "DspacePlugin::Collection", :parent_id => dspace_community.id}), :class => 'button with-text icon-add') do %> | |
9 | + <%= content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "DspacePlugin::Collection", :parent_id => dspace_community.id}), :class => 'button with-text icon-add') do %> | |
10 | 10 | <%= _("Add a %s") % DspacePlugin::Collection.short_description %> |
11 | 11 | <% end %> |
12 | 12 | </div> | ... | ... |
plugins/dspace/views/content_viewer/library.html.erb
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <% if dspace_library.allow_create?(user) %> |
4 | 4 | |
5 | 5 | <div id="actions"> |
6 | - <%= content_tag('a', :href => url_for({:controller => 'dspace_plugin_myprofile', :action => 'new', :type => "DspacePlugin::Communityy", :parent_id => dspace_library.id}), :class => 'button with-text icon-add') do %> | |
6 | + <%= content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "DspacePlugin::Communityy", :parent_id => dspace_library.id}), :class => 'button with-text icon-add') do %> | |
7 | 7 | <%= _("Add a %s") % DspacePlugin::Communityy.short_description %> |
8 | 8 | <% end %> |
9 | 9 | </div> | ... | ... |