Diff
Modified: trunk/app/views/packs/show.rhtml (2596 => 2597)
--- trunk/app/views/packs/show.rhtml 2011-05-31 15:50:43 UTC (rev 2596)
+++ trunk/app/views/packs/show.rhtml 2011-06-01 16:02:46 UTC (rev 2597)
@@ -88,7 +88,7 @@
Relationships <span class="count_text">(<%= @pack.relationships.length -%>)</span>
</h4>
- <%= render :partial => "relationships/relationships", :locals => { :relationships => @pack.relationships } -%>
+ <%= render :partial => "relationships/relationships", :locals => { :relationships => @pack.relationships, :show_delete => true } -%>
<% if @authorised_to_edit %>
<br />
Modified: trunk/app/views/relationships/_breadcrumbs.rhtml (2596 => 2597)
--- trunk/app/views/relationships/_breadcrumbs.rhtml 2011-05-31 15:50:43 UTC (rev 2596)
+++ trunk/app/views/relationships/_breadcrumbs.rhtml 2011-06-01 16:02:46 UTC (rev 2597)
@@ -0,0 +1,14 @@
+<li><%= link_to 'Packs', packs_path %></li>
+
+<% if ["edit_relationships"].include? controller.action_name.to_s %>
+ <li><b>»</b></li>
+
+ <% case controller.action_name.to_s; when "edit_relationships" %>
+ <li><%= link_to "#{h(@context.title)}", pack_path(@context) %></li>
+ <li><b>»</b></li>
+ <li>Edit Relationships</li>
+ <% else %>
+ <!-- no breadcrumb -->
+ <% end %>
+<% end %>
+
Modified: trunk/app/views/relationships/_relationships.rhtml (2596 => 2597)
--- trunk/app/views/relationships/_relationships.rhtml 2011-05-31 15:50:43 UTC (rev 2596)
+++ trunk/app/views/relationships/_relationships.rhtml 2011-06-01 16:02:46 UTC (rev 2597)
@@ -1,3 +1,5 @@
+<% can_edit = Authorization.check(:action ="" 'edit', :object => @pack, :user => current_user) %>
+
<% if relationships.empty? %>
<p><i>There are no relationships in this pack.</i></p>
@@ -4,20 +6,27 @@
<% else %>
- <ol>
+ <ol class="relationship_sentences">
<% relationships.each do |relationship| %>
<li>
<%= pack_entry_link(relationship.subject) -%>
- <%=h relationship.concept.preferred_label.text.underscore.humanize.downcase -%>
- <%= pack_entry_link(relationship.objekt) -%>
- <%= link_to_remote( "delete_relationship",
- :update => "relationshipsElement",
- :url ="" pack_relationship_path(relationship.pack, relationship.id),
- :method => :delete,
- :complete => "new Effect.Highlight('relationshipsElement', { duration: 1.5 });",
- :confirm => "Are you sure you want to delete this relationship?" ) %>
+ <% if relationship.concept.phrase %>
+ <%=h relationship.concept.phrase -%>
+ <% else %>
+ <%=h relationship.concept.preferred_label.text.underscore.humanize.downcase -%>
+ <% end %>
+ <%= pack_entry_link(relationship.objekt) -%>.
+
+ <% if can_edit && defined?(show_delete) && show_delete %>
+ <%= link_to_remote("<img src='' />",
+ :update => "relationshipsElement",
+ :url ="" pack_relationship_path(relationship.pack, relationship.id),
+ :method => :delete,
+ :complete => "new Effect.Highlight('relationshipsElement', { duration: 1.5 });",
+ :confirm => "Are you sure you want to delete this relationship?" ) %>
+ <% end %>
</li>
<% end %>
</ol>
Modified: trunk/app/views/relationships/edit_relationships.rhtml (2596 => 2597)
--- trunk/app/views/relationships/edit_relationships.rhtml 2011-05-31 15:50:43 UTC (rev 2596)
+++ trunk/app/views/relationships/edit_relationships.rhtml 2011-06-01 16:02:46 UTC (rev 2597)
@@ -14,27 +14,32 @@
<% else %>
- <div>
+ <% form_tag("#{rest_resource_uri(@context)}/relationships") do -%>
- <% form_tag("#{rest_resource_uri(@context)}/relationships") do -%>
-
+ <div class="edit_relationships">
<%= select_tag("subject", options_for_select(@pack_entry_select_options)) -%>
- <%= select_tag("predicate", options_for_select(@concepts.map do |c| "#{c.vocabulary.prefix}:#{c.preferred_labels.first.text}" end)) -%>
+ <%= select_tag("predicate", options_for_select(@concepts.map do |c| [c.phrase, "#{c.vocabulary.prefix}:#{c.preferred_labels.first.text}"] end)) -%>
<%= select_tag("objekt", options_for_select(@pack_entry_select_options)) -%>
<input type="submit" value="Add relationship"/>
- <% end %>
+ </div>
- </div>
+ <% end %>
<% end %>
<h2>Relationships</h2>
<div id="relationshipsElement">
- <%= render(:partial => "relationships", :locals => { :relationships => @relationships }) -%>
+ <%= render(:partial => "relationships", :locals => { :relationships => @relationships, :show_delete => true }) -%>
</div>
+<p style="text-align: center">
+ <form action="" pack_path(@context) -%>" method="get">
+ <input type="submit" value="Back to pack" />
+ </form>
+</p>
+
Modified: trunk/config/schema.d/skos.xml (2596 => 2597)
--- trunk/config/schema.d/skos.xml 2011-05-31 15:50:43 UTC (rev 2596)
+++ trunk/config/schema.d/skos.xml 2011-06-01 16:02:46 UTC (rev 2597)
@@ -19,7 +19,7 @@
<table name="concepts">
<column type="integer" name="vocabulary_id"/>
- <column type="string" name="title"/>
+ <column type="string" name="phrase"/>
<column type="text" name="description"/>
<column type="text" name="description_html"/>
<column type="datetime" name="created_at"/>
Modified: trunk/lib/load_vocabulary.rb (2596 => 2597)
--- trunk/lib/load_vocabulary.rb 2011-05-31 15:50:43 UTC (rev 2596)
+++ trunk/lib/load_vocabulary.rb 2011-06-01 16:02:46 UTC (rev 2597)
@@ -28,7 +28,7 @@
data["concepts"].each do |concept|
c = Concept.create(
- :title => concept["title"],
+ :phrase => concept["phrase"],
:description => concept["description"])
c.labels << Label.create(
Modified: trunk/public/stylesheets/styles.css (2596 => 2597)
--- trunk/public/stylesheets/styles.css 2011-05-31 15:50:43 UTC (rev 2596)
+++ trunk/public/stylesheets/styles.css 2011-06-01 16:02:46 UTC (rev 2597)
@@ -2220,3 +2220,16 @@
width: 450px;
}
+.edit_relationships {
+ margin: 20px;
+}
+
+.edit_relationships > * {
+ display: block;
+ margin-bottom: 10px;
+}
+
+.relationship_sentences * {
+ vertical-align: middle;
+}
+